pub trait Reader {
Show 16 methods
// Required methods
fn estimate_smart_fee(
&self,
conf_target: u16,
) -> impl Future<Output = ClientResult<u64>> + Send;
fn get_block_header(
&self,
hash: &BlockHash,
) -> impl Future<Output = ClientResult<Header>> + Send;
fn get_block(
&self,
hash: &BlockHash,
) -> impl Future<Output = ClientResult<Block>> + Send;
fn get_block_height(
&self,
hash: &BlockHash,
) -> impl Future<Output = ClientResult<u64>> + Send;
fn get_block_header_at(
&self,
height: u64,
) -> impl Future<Output = ClientResult<Header>> + Send;
fn get_block_at(
&self,
height: u64,
) -> impl Future<Output = ClientResult<Block>> + Send;
fn get_block_count(&self) -> impl Future<Output = ClientResult<u64>> + Send;
fn get_block_hash(
&self,
height: u64,
) -> impl Future<Output = ClientResult<BlockHash>> + Send;
fn get_blockchain_info(
&self,
) -> impl Future<Output = ClientResult<GetBlockchainInfo>> + Send;
fn get_current_timestamp(
&self,
) -> impl Future<Output = ClientResult<u32>> + Send;
fn get_raw_mempool(
&self,
) -> impl Future<Output = ClientResult<Vec<Txid>>> + Send;
fn get_mempool_info(
&self,
) -> impl Future<Output = ClientResult<GetMempoolInfo>> + Send;
fn get_raw_transaction_verbosity_zero(
&self,
txid: &Txid,
) -> impl Future<Output = ClientResult<GetRawTransactionVerbosityZero>> + Send;
fn get_raw_transaction_verbosity_one(
&self,
txid: &Txid,
) -> impl Future<Output = ClientResult<GetRawTransactionVerbosityOne>> + Send;
fn get_tx_out(
&self,
txid: &Txid,
vout: u32,
include_mempool: bool,
) -> impl Future<Output = ClientResult<GetTxOut>> + Send;
fn network(&self) -> impl Future<Output = ClientResult<Network>> + Send;
}
Expand description
Basic functionality that any Bitcoin client that interacts with the Bitcoin network should provide.
§Note
This is a fully async
trait. The user should be responsible for
handling the async
nature of the trait methods. And if implementing
this trait for a specific type that is not async
, the user should
consider wrapping with tokio
’s
spawn_blocking
or any other method.
Required Methods§
Sourcefn estimate_smart_fee(
&self,
conf_target: u16,
) -> impl Future<Output = ClientResult<u64>> + Send
fn estimate_smart_fee( &self, conf_target: u16, ) -> impl Future<Output = ClientResult<u64>> + Send
Estimates the approximate fee per kilobyte needed for a transaction to begin confirmation within conf_target blocks if possible and return the number of blocks for which the estimate is valid.
§Parameters
conf_target
: Confirmation target in blocks.
§Note
Uses virtual transaction size as defined in BIP 141 (witness data is discounted).
By default uses the estimate mode of CONSERVATIVE
which is the
default in Bitcoin Core v27.
Sourcefn get_block_header(
&self,
hash: &BlockHash,
) -> impl Future<Output = ClientResult<Header>> + Send
fn get_block_header( &self, hash: &BlockHash, ) -> impl Future<Output = ClientResult<Header>> + Send
Gets a Header
with the given hash.
Sourcefn get_block(
&self,
hash: &BlockHash,
) -> impl Future<Output = ClientResult<Block>> + Send
fn get_block( &self, hash: &BlockHash, ) -> impl Future<Output = ClientResult<Block>> + Send
Gets a Block
with the given hash.
Sourcefn get_block_height(
&self,
hash: &BlockHash,
) -> impl Future<Output = ClientResult<u64>> + Send
fn get_block_height( &self, hash: &BlockHash, ) -> impl Future<Output = ClientResult<u64>> + Send
Gets a block height with the given hash.
Sourcefn get_block_header_at(
&self,
height: u64,
) -> impl Future<Output = ClientResult<Header>> + Send
fn get_block_header_at( &self, height: u64, ) -> impl Future<Output = ClientResult<Header>> + Send
Gets a Header
at given height.
Sourcefn get_block_at(
&self,
height: u64,
) -> impl Future<Output = ClientResult<Block>> + Send
fn get_block_at( &self, height: u64, ) -> impl Future<Output = ClientResult<Block>> + Send
Gets a Block
at given height.
Sourcefn get_block_count(&self) -> impl Future<Output = ClientResult<u64>> + Send
fn get_block_count(&self) -> impl Future<Output = ClientResult<u64>> + Send
Sourcefn get_block_hash(
&self,
height: u64,
) -> impl Future<Output = ClientResult<BlockHash>> + Send
fn get_block_hash( &self, height: u64, ) -> impl Future<Output = ClientResult<BlockHash>> + Send
Gets the BlockHash
at given height.
Sourcefn get_blockchain_info(
&self,
) -> impl Future<Output = ClientResult<GetBlockchainInfo>> + Send
fn get_blockchain_info( &self, ) -> impl Future<Output = ClientResult<GetBlockchainInfo>> + Send
Gets various state info regarding blockchain processing.
Sourcefn get_current_timestamp(
&self,
) -> impl Future<Output = ClientResult<u32>> + Send
fn get_current_timestamp( &self, ) -> impl Future<Output = ClientResult<u32>> + Send
Gets the timestamp in the block header of the current best block in bitcoin.
§Note
Time is Unix epoch time in seconds.
Sourcefn get_raw_mempool(
&self,
) -> impl Future<Output = ClientResult<Vec<Txid>>> + Send
fn get_raw_mempool( &self, ) -> impl Future<Output = ClientResult<Vec<Txid>>> + Send
Gets all transaction ids in mempool.
Sourcefn get_mempool_info(
&self,
) -> impl Future<Output = ClientResult<GetMempoolInfo>> + Send
fn get_mempool_info( &self, ) -> impl Future<Output = ClientResult<GetMempoolInfo>> + Send
Returns details on the active state of the mempool.
Sourcefn get_raw_transaction_verbosity_zero(
&self,
txid: &Txid,
) -> impl Future<Output = ClientResult<GetRawTransactionVerbosityZero>> + Send
fn get_raw_transaction_verbosity_zero( &self, txid: &Txid, ) -> impl Future<Output = ClientResult<GetRawTransactionVerbosityZero>> + Send
Gets a raw transaction by its Txid
.
Sourcefn get_raw_transaction_verbosity_one(
&self,
txid: &Txid,
) -> impl Future<Output = ClientResult<GetRawTransactionVerbosityOne>> + Send
fn get_raw_transaction_verbosity_one( &self, txid: &Txid, ) -> impl Future<Output = ClientResult<GetRawTransactionVerbosityOne>> + Send
Gets a raw transaction by its Txid
.
Sourcefn get_tx_out(
&self,
txid: &Txid,
vout: u32,
include_mempool: bool,
) -> impl Future<Output = ClientResult<GetTxOut>> + Send
fn get_tx_out( &self, txid: &Txid, vout: u32, include_mempool: bool, ) -> impl Future<Output = ClientResult<GetTxOut>> + Send
Returns details about an unspent transaction output.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.