class Dogecoin::Client

Attributes

api[R]

Public Class Methods

new(user, pass, options = {}) click to toggle source
# File lib/dogecoin/client.rb, line 19
def initialize(user, pass, options = {})
  @api = Dogecoin::API.new({ :user => user, :pass => pass }.merge(options))
end

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/client.rb, line 24
def backupwallet(destination)
  @api.request '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
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/client.rb, line 29
def getaccount(dogecoinaddress)
  @api.request '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/client.rb, line 34
def getaccountaddress(account)
  @api.request '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/client.rb, line 39
def getaddressesbyaccount(account)
  @api.request '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/client.rb, line 45
def getbalance(account = nil, minconf = 1)
  @api.request 'getbalance', account, minconf
end
Also aliased as: balance
getbestblockhash() click to toggle source

Returns the hash of the best (tip) block in the longest block chain.

# File lib/dogecoin/client.rb, line 103
def getbestblockhash
  @api.request 'getbestblockhash'
end
getblock(hash) click to toggle source

Dumps the block existing with specified hash.

# File lib/dogecoin/client.rb, line 56
def getblock(hash)
  block = @api.request 'getblock', hash
  block["time"] = Time.at(block["time"]).utc
  block
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/client.rb, line 51
def getblockbycount(height)
  @api.request '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/client.rb, line 63
def getblockcount
  @api.request 'getblockcount'
end
Also aliased as: block_count
getblockhash(idx) click to toggle source

Returns the hash given a block id

# File lib/dogecoin/client.rb, line 98
def getblockhash(idx)
  @api.request 'getblockhash', idx
end
getblocknumber() click to toggle source

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

# File lib/dogecoin/client.rb, line 73
def getblocknumber
  @api.request 'getblocknumber'
end
Also aliased as: block_number
getconnectioncount() click to toggle source

Returns the number of connections to other nodes.

# File lib/dogecoin/client.rb, line 78
def getconnectioncount
  @api.request '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/client.rb, line 83
def getdifficulty
  @api.request 'getdifficulty'
end
Also aliased as: difficulty
getgenerate() click to toggle source

Returns true or false whether dogecoind is currently generating hashes

# File lib/dogecoin/client.rb, line 88
def getgenerate
  @api.request 'getgenerate'
end
Also aliased as: generate?
gethashespersec() click to toggle source

Returns a recent hashes per second performance measurement while generating.

# File lib/dogecoin/client.rb, line 93
def gethashespersec
  @api.request 'gethashespersec'
end
Also aliased as: hashes_per_sec
getinfo() click to toggle source

Returns an object containing various state info.

# File lib/dogecoin/client.rb, line 108
def getinfo
  @api.request 'getinfo'
end
Also aliased as: info
getmininginfo() click to toggle source

Returns an object containing mining info.

# File lib/dogecoin/client.rb, line 113
def getmininginfo
  @api.request 'getmininginfo'
end
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/client.rb, line 119
def getnewaddress(account = nil)
  @api.request '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/client.rb, line 125
def getreceivedbyaccount(account, minconf = 1)
  @api.request '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/client.rb, line 130
def getreceivedbyaddress(dogecoinaddress, minconf = 1)
  @api.request 'getreceivedbyaddress', dogecoinaddress, minconf
end
Also aliased as: received_by_address
gettransaction(txid) click to toggle source

Get detailed information about txid

# File lib/dogecoin/client.rb, line 135
def gettransaction(txid)
  @api.request '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/client.rb, line 147
def getwork(data = nil)
  @api.request '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/client.rb, line 152
def help(command = nil)
  @api.request 'help', command
end
host() click to toggle source
# File lib/dogecoin/client.rb, line 5
def host; api.host; end
host=(a) click to toggle source
# File lib/dogecoin/client.rb, line 11
def host=(a); api.host = a; 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/client.rb, line 157
def listaccounts(minconf = 1)
  @api.request '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/client.rb, line 167
def listreceivedbyaccount(minconf = 1, includeempty = false)
  @api.request '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/client.rb, line 179
def listreceivedbyaddress(minconf = 1, includeempty = false)
  @api.request '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/client.rb, line 184
def listtransactions(account, count = 10)
  @api.request 'listtransactions', account, count
end
Also aliased as: transactions, list_transactions
move(fromaccount, toaccount, amount, minconf = 1, comment = nil) click to toggle source

Move from one account in your wallet to another.

# File lib/dogecoin/client.rb, line 189
def move(fromaccount, toaccount, amount, minconf = 1, comment = nil)
  @api.request 'move', fromaccount, toaccount, amount, minconf, comment
end
new_address(account = nil)
Alias for: getnewaddress
options() click to toggle source
# File lib/dogecoin/client.rb, line 15
def options
  api.options
end
pass() click to toggle source
# File lib/dogecoin/client.rb, line 4
def pass; api.pass; end
pass=(a) click to toggle source
# File lib/dogecoin/client.rb, line 10
def pass=(a); api.pass = a; end
port() click to toggle source
# File lib/dogecoin/client.rb, line 6
def port; api.port; end
port=(a) click to toggle source
# File lib/dogecoin/client.rb, line 12
def port=(a); api.port = a; 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_many(fromaccount, addresses_amounts, minconf = 1, comment = nil)
Alias for: sendmany
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/client.rb, line 194
def sendfrom(fromaccount, todogecoinaddress, amount, minconf = 1, comment = nil, comment_to = nil)
  @api.request 'sendfrom', fromaccount, todogecoinaddress, amount, minconf, comment, comment_to
end
Also aliased as: send_from
sendmany(fromaccount, addresses_amounts, minconf = 1, comment = nil) click to toggle source
# File lib/dogecoin/client.rb, line 203
def sendmany(fromaccount, addresses_amounts, minconf = 1, comment = nil)
  @api.request 'sendmany', fromaccount, addresses_amounts, minconf, comment
end
Also aliased as: send_many
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/client.rb, line 199
def sendtoaddress(dogecoinaddress, amount, comment = nil, comment_to = nil)
  @api.request '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/client.rb, line 208
def setaccount(dogecoinaddress, account)
  @api.request '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/client.rb, line 214
def setgenerate(generate, genproclimit = -1)
  @api.request 'setgenerate', generate, genproclimit
end
Also aliased as: generate=, set_generate
settxfee(amount) click to toggle source

Sets the default transaction fee

# File lib/dogecoin/client.rb, line 68
def settxfee(amount)
  @api.request 'settxfee', amount
end
sign_message(dogecoinaddress, message)
Alias for: signmessage
signmessage(dogecoinaddress, message) click to toggle source

Sign a message using dogecoinaddress.

# File lib/dogecoin/client.rb, line 229
def signmessage(dogecoinaddress, message)
  @api.request 'signmessage', dogecoinaddress, message
end
Also aliased as: sign_message
ssl() click to toggle source
# File lib/dogecoin/client.rb, line 7
def ssl;  api.ssl;  end
ssl=(a) click to toggle source
# File lib/dogecoin/client.rb, line 13
def ssl=(a);  api.ssl  = a; end
ssl?() click to toggle source
# File lib/dogecoin/client.rb, line 8
def ssl?; api.ssl?; end
stop() click to toggle source

Stop dogecoin server.

# File lib/dogecoin/client.rb, line 219
def stop
  @api.request 'stop'
end
transaction(txid)
Alias for: gettransaction
transactions(account, count = 10)
Alias for: listtransactions
user() click to toggle source
# File lib/dogecoin/client.rb, line 3
def user; api.user; end
user=(a) click to toggle source
# File lib/dogecoin/client.rb, line 9
def user=(a); api.user = a; end
validate_address(dogecoinaddress)
Alias for: validateaddress
validateaddress(dogecoinaddress) click to toggle source

Return information about dogecoinaddress.

# File lib/dogecoin/client.rb, line 224
def validateaddress(dogecoinaddress)
  @api.request 'validateaddress', dogecoinaddress
end
Also aliased as: validate_address
verify_message(dogecoinaddress, signature, message)
Alias for: verifymessage
verifymessage(dogecoinaddress, signature, message) click to toggle source

Verify signature made by dogecoinaddress.

# File lib/dogecoin/client.rb, line 234
def verifymessage(dogecoinaddress, signature, message)
  @api.request 'verifymessage', dogecoinaddress, signature, message
end
Also aliased as: verify_message
walletlock() click to toggle source

Removes the wallet encryption key from memory, locking the wallet. After calling this method, you will need to call walletpassphrase again before being able to call any methods which require the wallet to be unlocked.

# File lib/dogecoin/client.rb, line 247
def walletlock
  @api.request 'walletlock'
end
walletpassphrase(passphrase, timeout) click to toggle source

Stores the wallet decryption key in memory for timeout seconds.

# File lib/dogecoin/client.rb, line 239
def walletpassphrase(passphrase, timeout)
  @api.request 'walletpassphrase', passphrase, timeout
end
work(data = nil)
Alias for: getwork