module Dogecoin::DSL

Public Instance Methods

account(dogecoinaddress)
Alias for: getaccount
account=(dogecoinaddress, account)
Alias for: setaccount
account_address(account)
Alias for: getaccountaddress
accounts(minconf = 1)
Alias for: listaccounts
addresses_by_account(account)
backupwallet(destination) click to toggle source

Safely copies wallet.dat to destination, which can be a directory or a path with filename.

# File lib/dogecoin/dsl.rb, line 56
def backupwallet(destination)
  dogecoin.backupwallet destination
end
balance(account = nil, minconf = 1)
Alias for: getbalance
block_by_count(height)
Alias for: getblockbycount
block_count()
Alias for: getblockcount
block_number()
Alias for: getblocknumber
connection_count()
Alias for: getconnectioncount
difficulty()
Alias for: getdifficulty
dogecoin() click to toggle source
# File lib/dogecoin/dsl.rb, line 2
def dogecoin
  if self.class.respond_to?(:dogecoin)
    @client ||= Dogecoin::Client.new(self.class.dogecoin.user, self.class.dogecoin.pass, self.class.dogecoin.options)
  else
    @client ||= Dogecoin::Client.new(nil, nil)
  end
end
generate=(generate, genproclimit = -1)
Alias for: setgenerate
generate?()
Alias for: getgenerate
get_work(data = nil)
Alias for: getwork
getaccount(dogecoinaddress) click to toggle source

Returns the account associated with the given address.

# File lib/dogecoin/dsl.rb, line 61
def getaccount(dogecoinaddress)
  dogecoin.getaccount dogecoinaddress
end
Also aliased as: account
getaccountaddress(account) click to toggle source

Returns the current dogecoin address for receiving payments to this account.

# File lib/dogecoin/dsl.rb, line 66
def getaccountaddress(account)
  dogecoin.getaccountaddress account
end
Also aliased as: account_address
getaddressesbyaccount(account) click to toggle source

Returns the list of addresses for the given account.

# File lib/dogecoin/dsl.rb, line 71
def getaddressesbyaccount(account)
  dogecoin.getaddressesbyaccount account
end
Also aliased as: addresses_by_account
getbalance(account = nil, minconf = 1) click to toggle source

If account is not specified, returns the server’s total available balance. If account is specified, returns the balance in the account.

# File lib/dogecoin/dsl.rb, line 77
def getbalance(account = nil, minconf = 1)
  dogecoin.getbalance account, minconf
end
Also aliased as: balance
getblock(hash) click to toggle source

Dumps the block existing with specified hash.

# File lib/dogecoin/dsl.rb, line 88
def getblock(hash)
  dogecoin.getblock hash
end
getblockbycount(height) click to toggle source

Dumps the block existing at specified height. Note: this is not available in the official release

# File lib/dogecoin/dsl.rb, line 83
def getblockbycount(height)
  dogecoin.getblockbycount height
end
Also aliased as: block_by_count
getblockcount() click to toggle source

Returns the number of blocks in the longest block chain.

# File lib/dogecoin/dsl.rb, line 93
def getblockcount
  dogecoin.getblockcount
end
Also aliased as: block_count
getblocknumber() click to toggle source

Returns the block number of the latest block in the longest block chain.

# File lib/dogecoin/dsl.rb, line 98
def getblocknumber
  dogecoin.getblocknumber
end
Also aliased as: block_number
getconnectioncount() click to toggle source

Returns the number of connections to other nodes.

# File lib/dogecoin/dsl.rb, line 103
def getconnectioncount
  dogecoin.getconnectioncount
end
Also aliased as: connection_count
getdifficulty() click to toggle source

Returns the proof-of-work difficulty as a multiple of the minimum difficulty.

# File lib/dogecoin/dsl.rb, line 108
def getdifficulty
  dogecoin.getdifficulty
end
Also aliased as: difficulty
getgenerate() click to toggle source

Returns true or false whether dogecoind is currently generating hashes

# File lib/dogecoin/dsl.rb, line 113
def getgenerate
  dogecoin.getgenerate
end
Also aliased as: generate?
gethashespersec() click to toggle source

Returns a recent hashes per second performance measurement while generating.

# File lib/dogecoin/dsl.rb, line 118
def gethashespersec
  dogecoin.gethashespersec
end
Also aliased as: hashes_per_sec
getinfo() click to toggle source

Returns an object containing various state info.

# File lib/dogecoin/dsl.rb, line 123
def getinfo
  dogecoin.getinfo
end
Also aliased as: info
getmininginfo() click to toggle source

Returns an object containing various mining info.

# File lib/dogecoin/dsl.rb, line 128
def getmininginfo
  dogecoin.getmininginfo
end
Also aliased as: mininginfo
getnewaddress(account = nil) click to toggle source

Returns a new dogecoin address for receiving payments. If account is specified (recommended), it is added to the address book so payments received with the address will be credited to account.

# File lib/dogecoin/dsl.rb, line 134
def getnewaddress(account = nil)
  dogecoin.getnewaddress account
end
Also aliased as: new_address
getreceivedbyaccount(account, minconf = 1) click to toggle source

Returns the total amount received by addresses with account in transactions with at least minconf confirmations.

# File lib/dogecoin/dsl.rb, line 140
def getreceivedbyaccount(account, minconf = 1)
  dogecoin.getreceivedbyaccount account, minconf
end
Also aliased as: received_by_account
getreceivedbyaddress(dogecoinaddress, minconf = 1) click to toggle source

Returns the total amount received by dogecoinaddress in transactions with at least minconf confirmations.

# File lib/dogecoin/dsl.rb, line 145
def getreceivedbyaddress(dogecoinaddress, minconf = 1)
  dogecoin.getreceivedbyaddress dogecoinaddress, minconf
end
Also aliased as: received_by_address
gettransaction(txid) click to toggle source

Get detailed information about txid

# File lib/dogecoin/dsl.rb, line 150
def gettransaction(txid)
  dogecoin.gettransaction txid
end
Also aliased as: transaction
getwork(data = nil) click to toggle source

If data is not specified, returns formatted hash data to work on:

:midstate => precomputed hash state after hashing the first half of the data
:data     => block data
:hash1    => formatted hash buffer for second hash
:target   => little endian hash target

If data is specified, tries to solve the block and returns true if it was successful.

# File lib/dogecoin/dsl.rb, line 162
def getwork(data = nil)
  dogecoin.getwork data
end
Also aliased as: work, get_work
hashes_per_sec()
Alias for: gethashespersec
help(command = nil) click to toggle source

List commands, or get help for a command.

# File lib/dogecoin/dsl.rb, line 167
def help(command = nil)
  dogecoin.help command
end
host(value = nil) click to toggle source
# File lib/dogecoin/dsl.rb, line 38
def host(value = nil)
  value ? dogecoin.host = value : dogecoin.host
end
host=(value) click to toggle source
# File lib/dogecoin/dsl.rb, line 18
def host=(value)
  dogecoin.host = value
end
info()
Alias for: getinfo
list_received_by_account(minconf = 1, includeempty = false)
list_received_by_address(minconf = 1, includeempty = false)
list_transactions(account, count = 10)
Alias for: listtransactions
listaccounts(minconf = 1) click to toggle source

Returns Object that has account names as keys, account balances as values.

# File lib/dogecoin/dsl.rb, line 172
def listaccounts(minconf = 1)
  dogecoin.listaccounts minconf
end
Also aliased as: accounts
listreceivedbyaccount(minconf = 1, includeempty = false) click to toggle source

Returns an array of objects containing:

:account       => the account of the receiving addresses
:amount        => total amount received by addresses with this account
:confirmations => number of confirmations of the most recent transaction included
# File lib/dogecoin/dsl.rb, line 182
def listreceivedbyaccount(minconf = 1, includeempty = false)
  dogecoin.listreceivedbyaccount minconf, includeempty
end
Also aliased as: list_received_by_account
listreceivedbyaddress(minconf = 1, includeempty = false) click to toggle source

Returns an array of objects containing:

:address       => receiving address
:account       => the account of the receiving address
:amount        => total amount received by the address
:confirmations => number of confirmations of the most recent transaction included

To get a list of accounts on the system, execute dogecoind listreceivedbyaddress 0 true

# File lib/dogecoin/dsl.rb, line 194
def listreceivedbyaddress(minconf = 1, includeempty = false)
  dogecoin.listreceivedbyaddress minconf, includeempty
end
Also aliased as: list_received_by_address
listtransactions(account, count = 10) click to toggle source

Returns up to count most recent transactions for account account.

# File lib/dogecoin/dsl.rb, line 199
def listtransactions(account, count = 10)
  dogecoin.listtransactions account, count
end
Also aliased as: transactions, list_transactions
mininginfo()
Alias for: getmininginfo
move(fromaccount, toaccount, amount, minconf = 1, comment = nil) click to toggle source

Move from one account in your wallet to another.

# File lib/dogecoin/dsl.rb, line 204
def move(fromaccount, toaccount, amount, minconf = 1, comment = nil)
  dogecoin.move fromaccount, toaccount, amount, minconf, comment
end
new_address(account = nil)
Alias for: getnewaddress
password(value = nil) click to toggle source
# File lib/dogecoin/dsl.rb, line 34
def password(value = nil)
  value ? dogecoin.pass = value : dogecoin.pass
end
password=(value) click to toggle source
# File lib/dogecoin/dsl.rb, line 14
def password=(value)
  dogecoin.pass = value
end
port(value = nil) click to toggle source
# File lib/dogecoin/dsl.rb, line 42
def port(value = nil)
  value ? dogecoin.port = value : dogecoin.port
end
port=(value) click to toggle source
# File lib/dogecoin/dsl.rb, line 22
def port=(value)
  dogecoin.port = value
end
received_by_account(account, minconf = 1)
received_by_address(dogecoinaddress, minconf = 1)
send_from(fromaccount, todogecoinaddress, amount, minconf = 1, comment = nil, comment_to = nil)
Alias for: sendfrom
send_to_address(dogecoinaddress, amount, comment = nil, comment_to = nil)
Alias for: sendtoaddress
sendfrom(fromaccount, todogecoinaddress, amount, minconf = 1, comment = nil, comment_to = nil) click to toggle source

amount is a real and is rounded to 8 decimal places. Returns the transaction ID if successful.

# File lib/dogecoin/dsl.rb, line 209
def sendfrom(fromaccount, todogecoinaddress, amount, minconf = 1, comment = nil, comment_to = nil)
  dogecoin.sendfrom fromaccount, todogecoinaddress, amount, minconf, comment, comment_to
end
Also aliased as: send_from
sendtoaddress(dogecoinaddress, amount, comment = nil, comment_to = nil) click to toggle source

amount is a real and is rounded to 8 decimal places

# File lib/dogecoin/dsl.rb, line 214
def sendtoaddress(dogecoinaddress, amount, comment = nil, comment_to = nil)
  dogecoin.sendtoaddress dogecoinaddress, amount, comment, comment_to
end
Also aliased as: send_to_address
set_account(dogecoinaddress, account)
Alias for: setaccount
set_generate(generate, genproclimit = -1)
Alias for: setgenerate
setaccount(dogecoinaddress, account) click to toggle source

Sets the account associated with the given address.

# File lib/dogecoin/dsl.rb, line 224
def setaccount(dogecoinaddress, account)
  dogecoin.setaccount dogecoinaddress, account
end
Also aliased as: account=, set_account
setgenerate(generate, genproclimit = -1) click to toggle source

generate is true or false to turn generation on or off. Generation is limited to genproclimit processors, -1 is unlimited.

# File lib/dogecoin/dsl.rb, line 230
def setgenerate(generate, genproclimit = -1)
  dogecoin.setgenerate generate, genproclimit
end
Also aliased as: generate=, set_generate
settxfee(amount = 0.0001) click to toggle source
# File lib/dogecoin/dsl.rb, line 219
def settxfee(amount = 0.0001)
  dogecoin.settxfee(amount)
end
ssl(value = nil) click to toggle source
# File lib/dogecoin/dsl.rb, line 46
def ssl(value = nil)
  value.nil? ? dogecoin.ssl : dogecoin.ssl = value
end
ssl=(value) click to toggle source
# File lib/dogecoin/dsl.rb, line 26
def ssl=(value)
  dogecoin.ssl = value
end
ssl?() click to toggle source
# File lib/dogecoin/dsl.rb, line 50
def ssl?
  dogecoin.ssl?
end
stop() click to toggle source

Stop dogecoin server.

# File lib/dogecoin/dsl.rb, line 235
def stop
  dogecoin.stop
end
transaction(txid)
Alias for: gettransaction
transactions(account, count = 10)
Alias for: listtransactions
username(value = nil) click to toggle source
# File lib/dogecoin/dsl.rb, line 30
def username(value = nil)
  value ? dogecoin.user = value : dogecoin.user
end
username=(value) click to toggle source
# File lib/dogecoin/dsl.rb, line 10
def username=(value)
  dogecoin.user = value
end
validate_address(dogecoinaddress)
Alias for: validateaddress
validateaddress(dogecoinaddress) click to toggle source

Return information about dogecoinaddress.

# File lib/dogecoin/dsl.rb, line 240
def validateaddress(dogecoinaddress)
  dogecoin.validateaddress
end
Also aliased as: validate_address
work(data = nil)
Alias for: getwork