class

Garlicoin::Client

Inherits JsonRpc::HttpClient < JsonRpc::Client < Reference < Object

Constructors

new(host : String, port : Int32, user : String, password : String)

Create a new Client using connection information for the garlicoind rpc server.

Source
new(config : Config)

Create a new Client by utilizing a Config object. This config object can be created manually or by loading an existing config file.

Source

Instance methods

abandon_transaction(txid : String)

Mark in-wallet transaction <txid> as abandoned This will mark this transaction and all its in-wallet descendants as abandoned which will allow for their inputs to be respent. It can be used to replace "stuck" or evicted transactions. It only works on transactions which are not included in a block and are not currently in the mempool. It has no effect on transactions which are already conflicted or abandoned.

Source
abort_rescan

Stops current wallet rescan triggered e.g. by an import_prov_key call.

Source
add_multi_sig_address(nrequired : String, keys : Array(String), account : String | Nil = nil)

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.

Source
add_witness_address(address : String)

Add a witness address for a script (with pubkey or redeemscript known). It returns the witness script.

Source
backup_wallet(destination : String)

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

Source
bump_fee(txid : String, options = nil)

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.

Source
dump_private_key(address : String)

Reveals the private key corresponding to 'address'. Then the importprivkey can be used with this output

Source
dump_wallet(filename : String)

Dumps all wallet keys in a human-readable format.

Source
encrypt_wallet(passphrase : String)

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.

Source
get_account(address : String)

DEPRECATED. Returns the account associated with the given address.

Source
get_account_address(account : String)

DEPRECATED. Returns the current Garlicoin address for receiving payments to this account.

Source
get_addresses_by_account(account : String)

DEPRECATED. Returns the list of addresses for the given account.

Source
get_balance(account = nil, minconf = 1, include_watch_only = false)

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.

Source
get_best_block_hash

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

Source
get_block(hash : String)

Returns an Object with information about block <hash> and information about each transaction.

Source
get_block_count

Returns the number of blocks in the longest blockchain.

Source
get_block_hash(index : Int32)

Returns hash of block in best-block-chain at height provided.

Source
get_block_header(hash : String)

If verbose is true, returns an Object with information about blockheader <hash>.

Source
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'. 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

Source
get_blockchain_info

Returns an object containing various state info regarding blockchain processing.

Source
get_chain_tips

Return information about all known tips in the block tree, including the main chain as well as orphaned branches.

Source
get_connection_count

Returns the number of connections to other nodes.

Source
get_difficulty

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

Source
get_mining_info(extended = true)

Returns a json object containing mining-related information.

Source
get_new_address(account = nil)

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'.

Source
get_raw_mem_pool

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.

Source
get_raw_transaction(txid : String)

NOTE: By default this function only works for mempool transactions. If the -txindex option is enabled, it also works for blockchain transactions.

Source
get_received_by_account(account : String, minconf = 1)

DEPRECATED. Returns the total amount received by addresses with <account> in transactions with at least [minconf] confirmations.

Source
get_received_by_address(address : String, minconf = 1)

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

Source
get_transaction(txid : String)

Get detailed information about in-wallet transaction <txid>

Source
get_unconfirmed_balance

Returns the server's total unconfirmed balance

Source
get_wallet_info

Returns an object containing various wallet state info.

Source
help(command = "")

List all json-rpc commands, or get help for a specified command.

Source
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.

Source
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).

Source
import_private_key(key : String, label = nil, rescan = true)

Adds a private key (as returned by dumpprivkey) to your wallet.

Source
import_pruned_funds

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.

Source
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.

Source
import_wallet(filename : String)

Imports keys from a wallet dump file (see dump_wallet).

Source
key_pool_refill(newsize : Int32)

Fills the keypool.

Source
list_accounts(minconf = 1, include_watch_only = false)

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

Source
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

Source
list_lock_unspent

Returns list of temporarily unspendable outputs. See the lockunspent call to lock and unlock transactions for spending.

Source
list_received_by_account(minconf = 1, empty = true, include_watch_only = false)

DEPRECATED. List balances by account.

Source
list_received_by_address(minconf = 1, empty = true, include_watch_only = false)

List balances by receiving address.

Source
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. 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.

Source
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'.

Source
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. Optionally filter to only include txouts paid to specified addresses.

Source
list_wallets

Returns a list of currently loaded wallets. For full information on the wallet, use get_wallet_info

Source
lock_unspent(transactions = "")

Temporarily lock specified transaction outputs.

Source
move(from_account, to_account, amount, minconf = 1, comment = "")

DEPRECATED. Move a specified amount from one account in your wallet to another.

Source
remove_pruned_funds(txid : String)

Deletes the specified transaction from the wallet. Meant for use with pruned wallets and as a companion to importprunedfunds. This will affect wallet balances.

Source
send_from(from_account, to_address, amount, minconf = 1, comment = "", comment_to = "")

DEPRECATED (use send_to_address). Sent an amount from an account to a garlicoin address.

Source
send_many(from_account, addresses : Hash(String, String), minconf = 1, comment = "", comment_to = "")

Send multiple times. Amounts are double-precision floating point numbers.

Source
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.

Source
set_account(address, account)

DEPRECATED. Sets the account associated with the given address.

Source
set_transaction_fee(amount)

Set the transaction fee per kB. Overwrites the paytxfee parameter.

Source
sign_message(address, message)

Sign a message with the private key of an address.

Source
unlock_unspent(transactions = "")

Unlock specified transaction outputs. If no transaction outputs are specified when unlocking then all current locked transaction outputs are unlocked.

Source