pub struct Client { /* private fields */ }
28_1
and non-crate feature 29_0
only.Expand description
Client implements a JSON-RPC client for the Bitcoin Core daemon or compatible APIs.
Implementations§
Source§impl Client
impl Client
Source§impl Client
impl Client
Sourcepub fn check_expected_server_version(&self) -> Result<(), Error>
pub fn check_expected_server_version(&self) -> Result<(), Error>
Checks that the JSON-RPC endpoint is for a bitcoind
instance with the expected version.
Source§impl Client
impl Client
Sourcepub fn best_block_hash(&self) -> Result<BlockHash, Error>
pub fn best_block_hash(&self) -> Result<BlockHash, Error>
Gets the blockhash of the current chain tip.
pub fn get_best_block_hash(&self) -> Result<GetBestBlockHash, Error>
Source§impl Client
impl Client
Sourcepub fn get_block_verbose_zero(
&self,
hash: BlockHash,
) -> Result<GetBlockVerboseZero, Error>
pub fn get_block_verbose_zero( &self, hash: BlockHash, ) -> Result<GetBlockVerboseZero, Error>
Gets a block by blockhash with verbose set to 0.
Sourcepub fn get_block_verbose_one(
&self,
hash: BlockHash,
) -> Result<GetBlockVerboseOne, Error>
pub fn get_block_verbose_one( &self, hash: BlockHash, ) -> Result<GetBlockVerboseOne, Error>
Gets a block by blockhash with verbose set to 1.
Source§impl Client
impl Client
pub fn get_blockchain_info(&self) -> Result<GetBlockchainInfo, Error>
Source§impl Client
impl Client
pub fn get_block_count(&self) -> Result<GetBlockCount, Error>
Source§impl Client
impl Client
pub fn get_block_filter( &self, block: BlockHash, ) -> Result<GetBlockFilter, Error>
Source§impl Client
impl Client
pub fn get_block_hash(&self, height: u64) -> Result<GetBlockHash, Error>
Source§impl Client
impl Client
pub fn get_block_header( &self, hash: &BlockHash, ) -> Result<GetBlockHeader, Error>
pub fn get_block_header_verbose( &self, hash: &BlockHash, ) -> Result<GetBlockHeaderVerbose, Error>
Source§impl Client
impl Client
pub fn get_block_stats_by_height( &self, height: u32, ) -> Result<GetBlockStats, Error>
pub fn get_block_stats_by_block_hash( &self, hash: &BlockHash, ) -> Result<GetBlockStats, Error>
Source§impl Client
impl Client
pub fn get_chain_tips(&self) -> Result<GetChainTips, Error>
Source§impl Client
impl Client
pub fn get_chain_tx_stats(&self) -> Result<GetChainTxStats, Error>
Source§impl Client
impl Client
pub fn get_difficulty(&self) -> Result<GetDifficulty, Error>
Source§impl Client
impl Client
pub fn get_mempool_ancestors( &self, txid: Txid, ) -> Result<GetMempoolAncestors, Error>
pub fn get_mempool_ancestors_verbose( &self, txid: Txid, ) -> Result<GetMempoolAncestorsVerbose, Error>
Source§impl Client
impl Client
pub fn get_mempool_descendants( &self, txid: Txid, ) -> Result<GetMempoolDescendants, Error>
pub fn get_mempool_descendants_verbose( &self, txid: Txid, ) -> Result<GetMempoolDescendantsVerbose, Error>
Source§impl Client
impl Client
pub fn get_mempool_entry(&self, txid: Txid) -> Result<GetMempoolEntry, Error>
Source§impl Client
impl Client
pub fn get_mempool_info(&self) -> Result<GetMempoolInfo, Error>
Source§impl Client
impl Client
pub fn get_raw_mempool(&self) -> Result<GetRawMempool, Error>
pub fn get_raw_mempool_verbose(&self) -> Result<GetRawMempool, Error>
Source§impl Client
impl Client
pub fn get_tx_out_set_info(&self) -> Result<GetTxOutSetInfo, Error>
Source§impl Client
impl Client
Sourcepub fn prune_blockchain(&self, target: u64) -> Result<PruneBlockchain, Error>
pub fn prune_blockchain(&self, target: u64) -> Result<PruneBlockchain, Error>
Instructs the node to prune the blockchain up to a specified height or timestamp.
Source§impl Client
impl Client
pub fn save_mempool(&self) -> Result<SaveMempool, Error>
Source§impl Client
impl Client
pub fn verify_chain(&self) -> Result<VerifyChain, Error>
Source§impl Client
impl Client
pub fn verify_tx_out_proof( &self, proof: &str, ) -> Result<VerifyTxOutProof, Error>
Source§impl Client
impl Client
pub fn get_memory_info(&self) -> Result<GetMemoryInfoStats, Error>
Source§impl Client
impl Client
pub fn get_rpc_info(&self) -> Result<GetRpcInfo, Error>
Source§impl Client
impl Client
pub fn generate_to_address( &self, nblocks: usize, address: &Address, ) -> Result<GenerateToAddress, Error>
Source§impl Client
impl Client
pub fn get_block_template( &self, request: &TemplateRequest, ) -> Result<GetBlockTemplate, Error>
Source§impl Client
impl Client
pub fn get_mining_info(&self) -> Result<GetMiningInfo, Error>
Source§impl Client
impl Client
pub fn get_prioritised_transactions( &self, ) -> Result<GetPrioritisedTransactions, Error>
Source§impl Client
impl Client
pub fn prioritise_transaction( &self, txid: &Txid, fee_delta: SignedAmount, ) -> Result<bool, Error>
Source§impl Client
impl Client
pub fn get_added_node_info(&self) -> Result<GetAddedNodeInfo, Error>
Source§impl Client
impl Client
pub fn get_net_totals(&self) -> Result<GetNetTotals, Error>
Source§impl Client
impl Client
Sourcepub fn server_version(&self) -> Result<usize, Error>
pub fn server_version(&self) -> Result<usize, Error>
Returns the server version field of GetNetworkInfo
.
pub fn get_network_info(&self) -> Result<GetNetworkInfo, Error>
Source§impl Client
impl Client
pub fn get_node_addresses(&self) -> Result<GetNodeAddresses, Error>
Source§impl Client
impl Client
pub fn get_peer_info(&self) -> Result<GetPeerInfo, Error>
Source§impl Client
impl Client
pub fn analyze_psbt(&self, psbt: &Psbt) -> Result<AnalyzePsbt, Error>
Source§impl Client
impl Client
pub fn combine_psbt(&self, txs: &[Psbt]) -> Result<CombinePsbt, Error>
Source§impl Client
impl Client
pub fn combine_raw_transaction( &self, txs: &[Transaction], ) -> Result<CombineRawTransaction, Error>
Source§impl Client
impl Client
pub fn convert_to_psbt(&self, tx: &Transaction) -> Result<ConvertToPsbt, Error>
Source§impl Client
impl Client
pub fn create_psbt( &self, inputs: &[Input], outputs: &[Output], ) -> Result<CreatePsbt, Error>
Source§impl Client
impl Client
pub fn create_raw_transaction( &self, inputs: &[Input], outputs: &[Output], ) -> Result<CreateRawTransaction, Error>
Source§impl Client
impl Client
pub fn decode_psbt(&self, psbt: &str) -> Result<DecodePsbt, Error>
Source§impl Client
impl Client
pub fn decode_raw_transaction( &self, tx: &Transaction, ) -> Result<DecodeRawTransaction, Error>
Source§impl Client
impl Client
pub fn decode_script(&self, script: &str) -> Result<DecodeScript, Error>
Source§impl Client
impl Client
pub fn finalize_psbt(&self, psbt: &Psbt) -> Result<FinalizePsbt, Error>
Source§impl Client
impl Client
pub fn fund_raw_transaction( &self, tx: &Transaction, ) -> Result<FundRawTransaction, Error>
Source§impl Client
impl Client
pub fn get_raw_transaction( &self, txid: Txid, ) -> Result<GetRawTransaction, Error>
pub fn get_raw_transaction_verbose( &self, txid: Txid, ) -> Result<GetRawTransactionVerbose, Error>
Source§impl Client
impl Client
pub fn send_raw_transaction( &self, tx: &Transaction, ) -> Result<SendRawTransaction, Error>
Source§impl Client
impl Client
pub fn sign_raw_transaction( &self, tx: &Transaction, ) -> Result<SignRawTransaction, Error>
Source§impl Client
impl Client
pub fn sign_raw_transaction_with_key( &self, tx: &Transaction, keys: &[PrivateKey], ) -> Result<SignRawTransaction, Error>
Source§impl Client
impl Client
pub fn submit_package( &self, package: &[Transaction], max_fee_rate: Option<FeeRate>, max_burn_amount: Option<Amount>, ) -> Result<SubmitPackage, Error>
Source§impl Client
impl Client
pub fn test_mempool_accept( &self, txs: &[Transaction], ) -> Result<TestMempoolAccept, Error>
Source§impl Client
impl Client
pub fn create_multisig( &self, nrequired: u32, keys: Vec<PublicKey>, ) -> Result<CreateMultisig, Error>
Source§impl Client
impl Client
pub fn estimate_smart_fee(&self, blocks: u32) -> Result<EstimateSmartFee, Error>
Source§impl Client
impl Client
pub fn sign_message_with_privkey( &self, privkey: &PrivateKey, message: &str, ) -> Result<SignMessageWithPrivKey, Error>
Source§impl Client
impl Client
pub fn validate_address( &self, address: &Address, ) -> Result<ValidateAddress, Error>
Source§impl Client
impl Client
pub fn verify_message( &self, address: &Address, signature: &MessageSignature, message: &str, ) -> Result<VerifyMessage, Error>
Source§impl Client
impl Client
pub fn add_multisig_address_with_keys( &self, nrequired: u32, keys: Vec<PublicKey>, ) -> Result<AddMultisigAddress, Error>
pub fn add_multisig_address_with_addresses( &self, nrequired: u32, keys: Vec<Address>, ) -> Result<AddMultisigAddress, Error>
Source§impl Client
impl Client
Sourcepub fn create_wallet(&self, wallet: &str) -> Result<CreateWallet, Error>
pub fn create_wallet(&self, wallet: &str) -> Result<CreateWallet, Error>
Calls createwallet
with wallet
as the only argument.
Sourcepub fn create_legacy_wallet(&self, wallet: &str) -> Result<CreateWallet, Error>
pub fn create_legacy_wallet(&self, wallet: &str) -> Result<CreateWallet, Error>
Creates a legacy wallet (i.e not a native descriptor wallet).
createwallet “wallet_name” ( disable_private_keys blank “passphrase” avoid_reuse descriptors load_on_startup external_signer )
Creates and loads a new wallet.
Arguments:
- wallet_name (string, required) The name for the new wallet. If this is a path, the wallet will be created at the path location.
- disable_private_keys (boolean, optional, default=false) Disable the possibility of private keys (only watchonlys are possible in this mode).
- blank (boolean, optional, default=false) Create a blank wallet. A blank wallet has no keys or HD seed. One can be set using sethdseed.
- passphrase (string, optional) Encrypt the wallet with this passphrase.
- avoid_reuse (boolean, optional, default=false) Keep track of coin reuse, and treat dirty and clean coins differently with privacy considerations in mind.
- descriptors (boolean, optional, default=true) Create a native descriptor wallet. The wallet will use descriptors internally to handle address creation
- load_on_startup (boolean, optional) Save wallet name to persistent settings and load on startup. True to add wallet to startup list, false to remove, null to leave unchanged.
- external_signer (boolean, optional, default=false) Use an external signer such as a hardware wallet. Requires -signer to be configured. Wallet creation will fail if keys cannot be fetched. Requires disable_private_keys and descriptors set to true.
Source§impl Client
impl Client
pub fn dump_priv_key(&self, address: &Address) -> Result<DumpPrivKey, Error>
Source§impl Client
impl Client
pub fn dump_wallet(&self, filename: &Path) -> Result<DumpWallet, Error>
Source§impl Client
impl Client
pub fn get_addresses_by_label( &self, label: &str, ) -> Result<GetAddressesByLabel, Error>
Source§impl Client
impl Client
pub fn get_address_info( &self, address: &Address, ) -> Result<GetAddressInfo, Error>
Source§impl Client
impl Client
pub fn get_balance(&self) -> Result<GetBalance, Error>
Source§impl Client
impl Client
pub fn get_balances(&self) -> Result<GetBalances, Error>
Source§impl Client
impl Client
Sourcepub fn new_address(&self) -> Result<Address, Error>
pub fn new_address(&self) -> Result<Address, Error>
Gets a new address from bitcoind
and parses it assuming its correct.
Sourcepub fn new_address_with_type(&self, ty: AddressType) -> Result<Address, Error>
pub fn new_address_with_type(&self, ty: AddressType) -> Result<Address, Error>
Gets a new address from bitcoind
and parses it assuming its correct.
Sourcepub fn new_address_with_label(
&self,
label: &str,
) -> Result<Address<NetworkUnchecked>, Error>
pub fn new_address_with_label( &self, label: &str, ) -> Result<Address<NetworkUnchecked>, Error>
Gets a new address with label from bitcoind
and parses it assuming its correct.
Sourcepub fn get_new_address(
&self,
label: Option<&str>,
ty: Option<AddressType>,
) -> Result<GetNewAddress, Error>
pub fn get_new_address( &self, label: Option<&str>, ty: Option<AddressType>, ) -> Result<GetNewAddress, Error>
Gets a new address - low level RPC call.