pub struct Client { /* private fields */ }
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<()>
pub fn check_expected_server_version(&self) -> Result<()>
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>
pub fn best_block_hash(&self) -> Result<BlockHash>
Gets the blockhash of the current chain tip.
pub fn get_best_block_hash(&self) -> Result<GetBestBlockHash>
Source§impl Client
impl Client
Sourcepub fn get_block_verbose_zero(
&self,
hash: BlockHash,
) -> Result<GetBlockVerboseZero>
pub fn get_block_verbose_zero( &self, hash: BlockHash, ) -> Result<GetBlockVerboseZero>
Gets a block by blockhash with verbose set to 0.
Sourcepub fn get_block_verbose_one(
&self,
hash: BlockHash,
) -> Result<GetBlockVerboseOne>
pub fn get_block_verbose_one( &self, hash: BlockHash, ) -> Result<GetBlockVerboseOne>
Gets a block by blockhash with verbose set to 1.
Source§impl Client
impl Client
pub fn get_blockchain_info(&self) -> Result<GetBlockchainInfo>
Source§impl Client
impl Client
pub fn get_block_count(&self) -> Result<GetBlockCount>
Source§impl Client
impl Client
pub fn get_block_filter(&self, block: BlockHash) -> Result<GetBlockFilter>
Source§impl Client
impl Client
pub fn get_block_hash(&self, height: u64) -> Result<GetBlockHash>
Source§impl Client
impl Client
pub fn get_block_header(&self, hash: &BlockHash) -> Result<GetBlockHeader>
pub fn get_block_header_verbose( &self, hash: &BlockHash, ) -> Result<GetBlockHeaderVerbose>
Source§impl Client
impl Client
pub fn get_block_stats_by_height(&self, height: u32) -> Result<GetBlockStats>
pub fn get_block_stats_by_block_hash( &self, hash: &BlockHash, ) -> Result<GetBlockStats>
Source§impl Client
impl Client
pub fn get_chain_tips(&self) -> Result<GetChainTips>
Source§impl Client
impl Client
pub fn get_chain_tx_stats(&self) -> Result<GetChainTxStats>
Source§impl Client
impl Client
pub fn get_difficulty(&self) -> Result<GetDifficulty>
Source§impl Client
impl Client
pub fn get_mempool_ancestors(&self, txid: Txid) -> Result<GetMempoolAncestors>
pub fn get_mempool_ancestors_verbose( &self, txid: Txid, ) -> Result<GetMempoolAncestorsVerbose>
Source§impl Client
impl Client
pub fn get_mempool_descendants( &self, txid: Txid, ) -> Result<GetMempoolDescendants>
pub fn get_mempool_descendants_verbose( &self, txid: Txid, ) -> Result<GetMempoolDescendantsVerbose>
Source§impl Client
impl Client
pub fn get_mempool_entry(&self, txid: Txid) -> Result<GetMempoolEntry>
Source§impl Client
impl Client
pub fn get_mempool_info(&self) -> Result<GetMempoolInfo>
Source§impl Client
impl Client
pub fn get_raw_mempool(&self) -> Result<GetRawMempool>
pub fn get_raw_mempool_verbose(&self) -> Result<GetRawMempool>
Source§impl Client
impl Client
pub fn get_tx_out_set_info(&self) -> Result<GetTxOutSetInfo>
Source§impl Client
impl Client
Sourcepub fn prune_blockchain(&self, target: u64) -> Result<PruneBlockchain>
pub fn prune_blockchain(&self, target: u64) -> Result<PruneBlockchain>
Instructs the node to prune the blockchain up to a specified height or timestamp.
Source§impl Client
impl Client
pub fn verify_chain(&self) -> Result<VerifyChain>
Source§impl Client
impl Client
pub fn verify_tx_out_proof(&self, proof: &str) -> Result<VerifyTxOutProof>
Source§impl Client
impl Client
pub fn get_memory_info(&self) -> Result<GetMemoryInfoStats>
Source§impl Client
impl Client
pub fn get_rpc_info(&self) -> Result<GetRpcInfo>
Source§impl Client
impl Client
pub fn generate_to_address( &self, nblocks: usize, address: &Address, ) -> Result<GenerateToAddress>
Source§impl Client
impl Client
pub fn get_block_template( &self, request: &TemplateRequest, ) -> Result<GetBlockTemplate>
Source§impl Client
impl Client
pub fn get_mining_info(&self) -> Result<GetMiningInfo>
Source§impl Client
impl Client
pub fn prioritise_transaction( &self, txid: &Txid, fee_delta: SignedAmount, ) -> Result<bool>
Source§impl Client
impl Client
pub fn get_added_node_info(&self) -> Result<GetAddedNodeInfo>
Source§impl Client
impl Client
pub fn get_net_totals(&self) -> Result<GetNetTotals>
Source§impl Client
impl Client
Sourcepub fn server_version(&self) -> Result<usize>
pub fn server_version(&self) -> Result<usize>
Returns the server version field of GetNetworkInfo
.
pub fn get_network_info(&self) -> Result<GetNetworkInfo>
Source§impl Client
impl Client
pub fn get_node_addresses(&self) -> Result<GetNodeAddresses>
Source§impl Client
impl Client
pub fn get_peer_info(&self) -> Result<GetPeerInfo>
Source§impl Client
impl Client
pub fn analyze_psbt(&self, psbt: &Psbt) -> Result<AnalyzePsbt>
Source§impl Client
impl Client
pub fn combine_psbt(&self, txs: &[Psbt]) -> Result<CombinePsbt>
Source§impl Client
impl Client
pub fn combine_raw_transaction( &self, txs: &[Transaction], ) -> Result<CombineRawTransaction>
Source§impl Client
impl Client
pub fn convert_to_psbt(&self, tx: &Transaction) -> Result<ConvertToPsbt>
Source§impl Client
impl Client
pub fn create_psbt( &self, inputs: &[Input], outputs: &[Output], ) -> Result<CreatePsbt>
Source§impl Client
impl Client
pub fn create_raw_transaction( &self, inputs: &[Input], outputs: &[Output], ) -> Result<CreateRawTransaction>
Source§impl Client
impl Client
pub fn decode_psbt(&self, psbt: &str) -> Result<DecodePsbt>
Source§impl Client
impl Client
pub fn decode_raw_transaction( &self, tx: &Transaction, ) -> Result<DecodeRawTransaction>
Source§impl Client
impl Client
pub fn decode_script(&self, script: &str) -> Result<DecodeScript>
Source§impl Client
impl Client
pub fn finalize_psbt(&self, psbt: &Psbt) -> Result<FinalizePsbt>
Source§impl Client
impl Client
pub fn fund_raw_transaction( &self, tx: &Transaction, ) -> Result<FundRawTransaction>
Source§impl Client
impl Client
pub fn get_raw_transaction(&self, txid: Txid) -> Result<GetRawTransaction>
pub fn get_raw_transaction_verbose( &self, txid: Txid, ) -> Result<GetRawTransactionVerbose>
Source§impl Client
impl Client
pub fn send_raw_transaction( &self, tx: &Transaction, ) -> Result<SendRawTransaction>
Source§impl Client
impl Client
pub fn sign_raw_transaction( &self, tx: &Transaction, ) -> Result<SignRawTransaction>
Source§impl Client
impl Client
pub fn sign_raw_transaction_with_key( &self, tx: &Transaction, keys: &[PrivateKey], ) -> Result<SignRawTransaction>
Source§impl Client
impl Client
pub fn test_mempool_accept( &self, txs: &[Transaction], ) -> Result<TestMempoolAccept>
Source§impl Client
impl Client
pub fn create_multisig( &self, nrequired: u32, keys: Vec<PublicKey>, ) -> Result<CreateMultisig>
Source§impl Client
impl Client
pub fn estimate_smart_fee(&self, blocks: u32) -> Result<EstimateSmartFee>
Source§impl Client
impl Client
pub fn sign_message_with_privkey( &self, privkey: &PrivateKey, message: &str, ) -> Result<SignMessageWithPrivKey>
Source§impl Client
impl Client
pub fn validate_address( &self, address: &Address<NetworkChecked>, ) -> Result<ValidateAddress>
Source§impl Client
impl Client
pub fn verify_message( &self, address: &Address<NetworkChecked>, signature: &MessageSignature, message: &str, ) -> Result<VerifyMessage>
Source§impl Client
impl Client
pub fn add_multisig_address_with_keys( &self, nrequired: u32, keys: Vec<PublicKey>, ) -> Result<AddMultisigAddress>
pub fn add_multisig_address_with_addresses( &self, nrequired: u32, keys: Vec<Address>, ) -> Result<AddMultisigAddress>
Source§impl Client
impl Client
pub fn create_wallet(&self, wallet: &str) -> Result<CreateWallet>
Source§impl Client
impl Client
pub fn dump_priv_key(&self, address: &Address) -> Result<DumpPrivKey>
Source§impl Client
impl Client
pub fn dump_wallet(&self, filename: &Path) -> Result<DumpWallet>
Source§impl Client
impl Client
pub fn get_addresses_by_label(&self, label: &str) -> Result<GetAddressesByLabel>
Source§impl Client
impl Client
pub fn get_address_info(&self, address: &Address) -> Result<GetAddressInfo>
Source§impl Client
impl Client
pub fn get_balance(&self) -> Result<GetBalance>
Source§impl Client
impl Client
pub fn get_balances(&self) -> Result<GetBalances>
Source§impl Client
impl Client
Sourcepub fn new_address(&self) -> Result<Address>
pub fn new_address(&self) -> Result<Address>
Gets a new address from bitcoind
and parses it assuming its correct.
Sourcepub fn new_address_with_type(&self, ty: AddressType) -> Result<Address>
pub fn new_address_with_type(&self, ty: AddressType) -> Result<Address>
Gets a new address from bitcoind
and parses it assuming its correct.
Sourcepub fn new_address_with_label(
&self,
label: &str,
) -> Result<Address<NetworkUnchecked>>
pub fn new_address_with_label( &self, label: &str, ) -> Result<Address<NetworkUnchecked>>
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>
pub fn get_new_address( &self, label: Option<&str>, ty: Option<AddressType>, ) -> Result<GetNewAddress>
Gets a new address - low level RPC call.
Source§impl Client
impl Client
pub fn get_raw_change_address(&self) -> Result<GetRawChangeAddress>
Source§impl Client
impl Client
pub fn get_received_by_address( &self, address: &Address<NetworkChecked>, ) -> Result<GetReceivedByAddress>
Source§impl Client
impl Client
pub fn get_transaction(&self, txid: Txid) -> Result<GetTransaction>
Source§impl Client
impl Client
pub fn get_unconfirmed_balance(&self) -> Result<GetUnconfirmedBalance>
Source§impl Client
impl Client
pub fn get_wallet_info(&self) -> Result<GetWalletInfo>
Source§impl Client
impl Client
pub fn list_address_groupings(&self) -> Result<ListAddressGroupings>
Source§impl Client
impl Client
pub fn list_labels(&self) -> Result<ListLabels>
Source§impl Client
impl Client
pub fn list_lock_unspent(&self) -> Result<ListLockUnspent>
Source§impl Client
impl Client
pub fn list_received_by_address(&self) -> Result<ListReceivedByAddress>
Source§impl Client
impl Client
pub fn list_since_block(&self) -> Result<ListSinceBlock>
Source§impl Client
impl Client
pub fn list_transactions(&self) -> Result<ListTransactions>
Source§impl Client
impl Client
pub fn list_unspent(&self) -> Result<ListUnspent>
Source§impl Client
impl Client
pub fn list_wallets(&self) -> Result<ListWallets>
Source§impl Client
impl Client
pub fn load_wallet(&self, filename: &str) -> Result<LoadWallet>
Source§impl Client
impl Client
pub fn rescan_blockchain(&self) -> Result<RescanBlockchain>
Source§impl Client
impl Client
pub fn send_to_address( &self, address: &Address<NetworkChecked>, amount: Amount, ) -> Result<SendToAddress>
pub fn send_to_address_rbf( &self, address: &Address<NetworkChecked>, amount: Amount, ) -> Result<SendToAddress>
Source§impl Client
impl Client
pub fn sign_message( &self, address: &Address, message: &str, ) -> Result<SignMessage>
Source§impl Client
impl Client
pub fn sign_raw_transaction_with_wallet( &self, tx: &Transaction, ) -> Result<SignRawTransaction>
Source§impl Client
impl Client
pub fn wallet_create_funded_psbt( &self, inputs: Vec<WalletCreateFundedPsbtInput>, outputs: Vec<BTreeMap<Address, Amount>>, ) -> Result<WalletCreateFundedPsbt>
Source§impl Client
impl Client
pub fn wallet_process_psbt(&self, psbt: &Psbt) -> Result<WalletProcessPsbt>
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Client
impl !RefUnwindSafe for Client
impl Send for Client
impl Sync for Client
impl Unpin for Client
impl !UnwindSafe for Client
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more