Struct core_rpc::Client [−][src]
pub struct Client { /* fields omitted */ }
Expand description
Client implements a JSON-RPC client for the Bitcoin Core daemon or compatible APIs.
Implementations
Creates a client to a bitcoind JSON-RPC server.
Can only return Err when using cookie authentication.
Create a new Client using the given jsonrpc::Client.
Get the underlying JSONRPC client.
Trait Implementations
Call an cmd
rpc with given args
list
Query an object implementing Querable
type
fn add_multisig_address(
&self,
nrequired: usize,
keys: &[PubKeyOrAddress<'_>],
label: Option<&str>,
address_type: Option<AddressType>
) -> Result<AddMultiSigAddressResult>
fn create_wallet(
&self,
wallet: &str,
disable_private_keys: Option<bool>,
blank: Option<bool>,
passphrase: Option<&str>,
avoid_reuse: Option<bool>,
descriptors: Option<bool>
) -> Result<LoadWalletResult>
fn import_descriptors(
&self,
descriptors: Vec<ImportDescriptorRequest>
) -> Result<Vec<ImportDescriptorResult>>
fn get_block_template(
&self,
mode: GetBlockTemplateModes,
rules: &[GetBlockTemplateRules],
capabilities: &[GetBlockTemplateCapabilities]
) -> Result<GetBlockTemplateResult>
Returns a data structure containing various state info regarding blockchain processing. Read more
Returns the numbers of block in the longest chain.
Returns the hash of the best (tip) block in the longest blockchain.
Get block hash at a given height
fn get_raw_transaction(
&self,
txid: &Txid,
block_hash: Option<&BlockHash>
) -> Result<Transaction>
fn get_raw_transaction_hex(
&self,
txid: &Txid,
block_hash: Option<&BlockHash>
) -> Result<String>
fn get_raw_transaction_info(
&self,
txid: &Txid,
block_hash: Option<&BlockHash>
) -> Result<GetRawTransactionResult>
fn get_transaction(
&self,
txid: &Txid,
include_watchonly: Option<bool>
) -> Result<GetTransactionResult>
fn list_transactions(
&self,
label: Option<&str>,
count: Option<usize>,
skip: Option<usize>,
include_watchonly: Option<bool>
) -> Result<Vec<ListTransactionResult>>
fn list_since_block(
&self,
blockhash: Option<&BlockHash>,
target_confirmations: Option<usize>,
include_watchonly: Option<bool>,
include_removed: Option<bool>
) -> Result<ListSinceBlockResult>
fn get_tx_out(
&self,
txid: &Txid,
vout: u32,
include_mempool: Option<bool>
) -> Result<Option<GetTxOutResult>>
fn import_public_key(
&self,
pubkey: &PublicKey,
label: Option<&str>,
rescan: Option<bool>
) -> Result<()>
fn import_private_key(
&self,
privkey: &PrivateKey,
label: Option<&str>,
rescan: Option<bool>
) -> Result<()>
fn import_address(
&self,
address: &Address,
label: Option<&str>,
rescan: Option<bool>
) -> Result<()>
fn import_address_script(
&self,
script: &Script,
label: Option<&str>,
rescan: Option<bool>,
p2sh: Option<bool>
) -> Result<()>
fn import_multi(
&self,
requests: &[ImportMultiRequest<'_>],
options: Option<&ImportMultiOptions>
) -> Result<Vec<ImportMultiResult>>
fn list_unspent(
&self,
minconf: Option<usize>,
maxconf: Option<usize>,
addresses: Option<&[&Address]>,
include_unsafe: Option<bool>,
query_options: Option<ListUnspentQueryOptions>
) -> Result<Vec<ListUnspentResultEntry>>
Unlock all unspent UTXOs.
fn list_received_by_address(
&self,
address_filter: Option<&Address>,
minconf: Option<u32>,
include_empty: Option<bool>,
include_watchonly: Option<bool>
) -> Result<Vec<ListReceivedByAddressResult>>
fn create_raw_transaction_hex(
&self,
utxos: &[CreateRawTransactionInput],
outs: &HashMap<String, Amount>,
locktime: Option<i64>,
replaceable: Option<bool>
) -> Result<String>
fn create_raw_transaction(
&self,
utxos: &[CreateRawTransactionInput],
outs: &HashMap<String, Amount>,
locktime: Option<i64>,
replaceable: Option<bool>
) -> Result<Transaction>
fn fund_raw_transaction<R: RawTx>(
&self,
tx: R,
options: Option<&FundRawTransactionOptions>,
is_witness: Option<bool>
) -> Result<FundRawTransactionResult>
fn sign_raw_transaction<R: RawTx>(
&self,
tx: R,
utxos: Option<&[SignRawTransactionInput]>,
private_keys: Option<&[PrivateKey]>,
sighash_type: Option<SigHashType>
) -> Result<SignRawTransactionResult>
fn sign_raw_transaction<R: RawTx>(
&self,
tx: R,
utxos: Option<&[SignRawTransactionInput]>,
private_keys: Option<&[PrivateKey]>,
sighash_type: Option<SigHashType>
) -> Result<SignRawTransactionResult>
fn sign_raw_transaction_with_wallet<R: RawTx>(
&self,
tx: R,
utxos: Option<&[SignRawTransactionInput]>,
sighash_type: Option<SigHashType>
) -> Result<SignRawTransactionResult>
fn sign_raw_transaction_with_key<R: RawTx>(
&self,
tx: R,
privkeys: &[PrivateKey],
prevtxs: Option<&[SignRawTransactionInput]>,
sighash_type: Option<SigHashType>
) -> Result<SignRawTransactionResult>
fn verify_message(
&self,
address: &Address,
signature: &Signature,
message: &str
) -> Result<bool>
fn get_new_address(
&self,
label: Option<&str>,
address_type: Option<AddressType>
) -> Result<Address>
fn get_new_address(
&self,
label: Option<&str>,
address_type: Option<AddressType>
) -> Result<Address>
Generate new address under own control
Mine block_num
blocks and pay coinbase to address
Read more
Mine up to block_num blocks immediately (before the RPC call returns) to an address in the wallet. Read more
Mark a block as invalid by block_hash
Mark a block as valid by block_hash
Get txids of all transactions in a memory pool
Get mempool data for given transaction
Get information about all known tips in the block tree, including the main chain as well as stale branches. Read more
fn send_to_address(
&self,
address: &Address,
amount: Amount,
comment: Option<&str>,
comment_to: Option<&str>,
subtract_fee: Option<bool>,
replaceable: Option<bool>,
confirmation_target: Option<u32>,
estimate_mode: Option<EstimateMode>
) -> Result<Txid>
Requests that a ping be sent to all other nodes, to measure ping time. Read more
fn estimate_smart_fee(
&self,
conf_target: u16,
estimate_mode: Option<EstimateMode>
) -> Result<EstimateSmartFeeResult>
Waits for a specific new block and returns useful info about it. Returns the current block on timeout or exit. Read more
Waits for a specific new block and returns useful info about it. Returns the current block on timeout or exit. Read more
fn wallet_create_funded_psbt(
&self,
inputs: &[CreateRawTransactionInput],
outputs: &HashMap<String, Amount>,
locktime: Option<i64>,
options: Option<WalletCreateFundedPsbtOptions>,
bip32derivs: Option<bool>
) -> Result<WalletCreateFundedPsbtResult>
fn wallet_process_psbt(
&self,
psbt: &str,
sign: Option<bool>,
sighash_type: Option<SigHashType>,
bip32derivs: Option<bool>
) -> Result<WalletProcessPsbtResult>
fn rescan_blockchain(
&self,
start_from: Option<usize>,
stop_height: Option<usize>
) -> Result<(usize, Option<usize>)>
Returns statistics about the unspent transaction output set. This call may take some time. Read more
Returns information about network traffic, including bytes in, bytes out, and current time. Read more
Returns the estimated network hashes per second based on the last n blocks.