class Garlicoin::Client
- Garlicoin::Client
- JsonRpc::HttpClient
- JsonRpc::Client
- Reference
- Object
Defined in:
garlicoin/client.crConstructors
-
.new(host : String, port : Int32, user : String, password : String)
Create a new
Client
using connection information for thegarlicoind
rpc server. - .new(config : Config)
Instance Method Summary
-
#abandon_transaction(txid : String)
Mark in-wallet transaction
as abandoned This will mark this transaction and all its in-wallet descendants as abandoned which will allow for their inputs to be respent. -
#abort_rescan
Stops current wallet rescan triggered e.g.
-
#add_multi_sig_address(nrequired : String, keys : Array(String), account : String | Nil = nil)
Add a nrequired-to-sign multisignature address to the wallet.
-
#add_witness_address(address : String)
Add a witness address for a script (with pubkey or redeemscript known).
-
#backup_wallet(destination : String)
Safely copies current wallet file to destination, which can be a directory or a path with filename.
-
#bump_fee(txid : String, options = nil)
Bumps the fee of an opt-in-RBF transaction T, replacing it with a new transaction B.
-
#dump_private_key(address : String)
Reveals the private key corresponding to 'address'.
-
#dump_wallet(filename : String)
Dumps all wallet keys in a human-readable format.
-
#encrypt_wallet(passphrase : String)
Encrypts the wallet with 'passphrase'.
-
#get_account(address : String)
DEPRECATED .
-
#get_account_address(account : String)
DEPRECATED .
-
#get_addresses_by_account(account : String)
DEPRECATED .
-
#get_balance(account = nil, minconf = 1, include_watch_only = false)
If account is not specified, returns the server's total available balance.
-
#get_best_block_hash
Returns the hash of the best (tip) block in the longest blockchain.
-
#get_block(hash : String)
Returns an Object with information about block
and information about each transaction. -
#get_block_count
Returns the number of blocks in the longest blockchain.
-
#get_block_hash(index : Int32)
Returns hash of block in best-block-chain at height provided.
-
#get_block_header(hash : String)
If verbose is true, returns an Object with information about blockheader
. -
#get_block_template(params = {} of String => JSON::Any)
If the request parameters include a 'mode' key, that is used to explicitly select between the default 'template' request or a 'proposal'.
-
#get_blockchain_info
Returns an object containing various state info regarding blockchain processing.
-
#get_chain_tips
Return information about all known tips in the block tree, including the main chain as well as orphaned branches.
-
#get_connection_count
Returns the number of connections to other nodes.
-
#get_difficulty
Returns the proof-of-work difficulty as a multiple of the minimum difficulty.
-
#get_mining_info(extended = true)
Returns a json object containing mining-related information.
-
#get_new_address(account = nil)
Returns a new Garlicoin address for receiving payments.
-
#get_raw_mem_pool
Returns all transaction ids in memory pool as a json array of string transaction ids.
-
#get_raw_transaction(txid : String)
NOTE By default this function only works for mempool transactions.
-
#get_received_by_account(account : String, minconf = 1)
DEPRECATED .
-
#get_received_by_address(address : String, minconf = 1)
Returns the total amount received by the given address in transactions with at least minconf confirmations.
-
#get_transaction(txid : String)
Get detailed information about in-wallet transaction
-
#get_unconfirmed_balance
Returns the server's total unconfirmed balance
-
#get_wallet_info
Returns an object containing various wallet state info.
-
#help(command = "")
List all json-rpc commands, or get help for a specified command.
-
#import_address(address : String, label = nil, rescan = true, p2sh = true)
Adds a script (in hex) or address that can be watched as if it were in your wallet but cannot be used to spend.
-
#import_multi(requests : String, options = nil)
Import addresses/scripts (with private or public keys, redeem script (P2SH)), rescanning all addresses in one-shot-only (rescan can be disabled via options).
-
#import_private_key(key : String, label = nil, rescan = true)
Adds a private key (as returned by dumpprivkey) to your wallet.
-
#import_pruned_funds
Imports funds without rescan.
-
#import_public_key(key : String, label = nil, rescan = true)
Adds a public key (in hex) that can be watched as if it were in your wallet but cannot be used to spend.
-
#import_wallet(filename : String)
Imports keys from a wallet dump file (see dump_wallet).
-
#key_pool_refill(newsize : Int32)
Fills the keypool.
-
#list_accounts(minconf = 1, include_watch_only = false)
DEPRECATED .
-
#list_address_groupings
Lists groups of addresses which have had their common ownership made public by common use as inputs or as the resulting change in past transactions
-
#list_lock_unspent
Returns list of temporarily unspendable outputs.
-
#list_received_by_account(minconf = 1, empty = true, include_watch_only = false)
DEPRECATED .
-
#list_received_by_address(minconf = 1, empty = true, include_watch_only = false)
List balances by receiving address.
-
#list_since_block(blockhash : String, confirmations = 1, include_watch_only = false, include_removed = true)
Get all transactions in blocks since block [blockhash], or all transactions if omitted.
-
#list_transactions(account : String, count = 10, skip = 0, include_watch_only = false)
Returns up to 'count' most recent transactions skipping the first 'from' transactions for account 'account'.
-
#list_unspent(addresses : Array(String), minconf = 1, maxconf = 9999999, include_unsafe = true, query_options = nil)
Returns array of unspent transaction outputs with between minconf and maxconf (inclusive) confirmations.
-
#list_wallets
Returns a list of currently loaded wallets.
-
#lock_unspent(transactions = "")
Temporarily lock specified transaction outputs.
-
#move(from_account, to_account, amount, minconf = 1, comment = "")
DEPRECATED .
-
#remove_pruned_funds(txid : String)
Deletes the specified transaction from the wallet.
-
#send_from(from_account, to_address, amount, minconf = 1, comment = "", comment_to = "")
DEPRECATED (use send_to_address).
-
#send_many(from_account, addresses : Hash(String, String), minconf = 1, comment = "", comment_to = "")
Send multiple times.
-
#send_to_address(address, amount, comment = "", comment_to = "", subtract_fee_from_amount = false, replacable = false, conf_target = 1, estimate_mode = "")
Send an amount to a given address.
-
#set_account(address, account)
DEPRECATED .
-
#set_transaction_fee(amount)
Set the transaction fee per kB.
-
#sign_message(address, message)
Sign a message with the private key of an address.
-
#unlock_unspent(transactions = "")
Unlock specified transaction outputs.
Constructor Detail
Create a new Client
using connection information for the garlicoind
rpc server.
Create a new Client
by utilizing a Config
object. This config object can be
created manually or by loading an existing config file.
Instance Method Detail
Mark in-wallet transaction
Add a nrequired-to-sign multisignature address to the wallet. Each key is a Garlicoin address or hex-encoded public key. If 'account' is specified (DEPRECATED), assign address to that account.
Add a witness address for a script (with pubkey or redeemscript known). It returns the witness script.
Safely copies current wallet file to destination, which can be a directory or a path with filename.
Bumps the fee of an opt-in-RBF transaction T, replacing it with a new transaction B. An opt-in RBF transaction with the given txid must be in the wallet. The command will pay the additional fee by decreasing (or perhaps removing) its change output. If the change output is not big enough to cover the increased fee, the command will currently fail instead of adding new inputs to compensate. (A future implementation could improve this.) The command will fail if the wallet or mempool contains a transaction that spends one of T's outputs. By default, the new fee will be calculated automatically using estimatefee. The user can specify a confirmation target for estimatefee. Alternatively, the user can specify totalFee, or use RPC settxfee to set a higher fee rate. At a minimum, the new fee rate must be high enough to pay an additional new relay fee (incrementalfee returned by getnetworkinfo) to enter the node's mempool.
Reveals the private key corresponding to 'address'. Then the importprivkey can be used with this output
Encrypts the wallet with 'passphrase'. This is for first time encryption. After this, any calls that interact with private keys such as sending or signing will require the passphrase to be set prior the making these calls. Use the walletpassphrase call for this, and then walletlock call. If the wallet is already encrypted, use the walletpassphrasechange call. Note that this will shutdown the server.
DEPRECATED . Returns the account associated with the given address.
DEPRECATED . Returns the current Garlicoin address for receiving payments to this account.
DEPRECATED . Returns the list of addresses for the given account.
If account is not specified, returns the server's total available balance. If account is specified (DEPRECATED), returns the balance in the account. Note that the account "" is not the same as leaving the parameter out. The server total may be different to the balance in the default "" account.
Returns an Object with information about block
If verbose is true, returns an Object with information about blockheader
If the request parameters include a 'mode' key, that is used to explicitly select between the default 'template' request or a 'proposal'. It returns data needed to construct a block to work on. For full specification, see BIPs 22, 23, 9, and 145: https://github.com/bitcoin/bips/blob/master/bip-0022.mediawiki https://github.com/bitcoin/bips/blob/master/bip-0023.mediawiki https://github.com/bitcoin/bips/blob/master/bip-0009.mediawiki#getblocktemplate_changes https://github.com/bitcoin/bips/blob/master/bip-0145.mediawiki
Returns an object containing various state info regarding blockchain processing.
Return information about all known tips in the block tree, including the main chain as well as orphaned branches.
Returns a new Garlicoin address for receiving payments. If 'account' is specified (DEPRECATED), it is added to the address book so payments received with the address will be credited to 'account'.
Returns all transaction ids in memory pool as a json array of string transaction ids. Hint: use get_mempool_entry to fetch a specific transaction from the mempool.
NOTE By default this function only works for mempool transactions. If the -txindex option is enabled, it also works for blockchain transactions.
DEPRECATED . Returns the total amount received by addresses with
Returns the total amount received by the given address in transactions with at least minconf confirmations.
Adds a script (in hex) or address that can be watched as if it were in your wallet but cannot be used to spend.
Import addresses/scripts (with private or public keys, redeem script (P2SH)), rescanning all addresses in one-shot-only (rescan can be disabled via options).
Adds a private key (as returned by dumpprivkey) to your wallet.
Imports funds without rescan. Corresponding address or script must previously be included in wallet. Aimed towards pruned wallets. The end-user is responsible to import additional transactions that subsequently spend the imported outputs or rescan after the point in the blockchain the transaction is included.
Adds a public key (in hex) that can be watched as if it were in your wallet but cannot be used to spend.
DEPRECATED . Returns Object that has account names as keys, account balances as values.
Lists groups of addresses which have had their common ownership made public by common use as inputs or as the resulting change in past transactions
Returns list of temporarily unspendable outputs. See the lockunspent call to lock and unlock transactions for spending.
DEPRECATED . List balances by account.
List balances by receiving address.
Get all transactions in blocks since block [blockhash], or all transactions if omitted. If "blockhash" is no longer a part of the main chain, transactions from the fork point onward are included. Additionally, if include_removed is set, transactions affecting the wallet which were removed are returned in the "removed" array.
Returns up to 'count' most recent transactions skipping the first 'from' transactions for account 'account'.
Returns array of unspent transaction outputs with between minconf and maxconf (inclusive) confirmations. Optionally filter to only include txouts paid to specified addresses.
Returns a list of currently loaded wallets.
For full information on the wallet, use #get_wallet_info
DEPRECATED . Move a specified amount from one account in your wallet to another.
Deletes the specified transaction from the wallet. Meant for use with pruned wallets and as a companion to importprunedfunds. This will affect wallet balances.
DEPRECATED (use send_to_address). Sent an amount from an account to a garlicoin address.
Send multiple times. Amounts are double-precision floating point numbers.
Send an amount to a given address.
DEPRECATED . Sets the account associated with the given address.
Set the transaction fee per kB. Overwrites the paytxfee parameter.
Unlock specified transaction outputs. If no transaction outputs are specified when unlocking then all current locked transaction outputs are unlocked.