NodeClient

Trait NodeClient 

Source
pub trait NodeClient {
    // Required methods
    fn get_best_block_hash<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<BlockHash>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn get_block_header<'life0, 'life1, 'async_trait>(
        &'life0 self,
        block_hash: &'life1 BlockHash,
    ) -> Pin<Box<dyn Future<Output = Result<BlockHeader>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn get_block<'life0, 'life1, 'async_trait>(
        &'life0 self,
        block_hash: &'life1 BlockHash,
    ) -> Pin<Box<dyn Future<Output = Result<Block>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

Trait for communicating with a Bitcoin node.

This trait defines the common interface for interacting with Bitcoin nodes, allowing different client implementations (e.g., SV node, Teranode) to provide the same functionality.

Required Methods§

Source

fn get_best_block_hash<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<BlockHash>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

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

Source

fn get_block_header<'life0, 'life1, 'async_trait>( &'life0 self, block_hash: &'life1 BlockHash, ) -> Pin<Box<dyn Future<Output = Result<BlockHeader>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Returns the block header for the specified block hash.

§Arguments
  • block_hash - The hash of the block to retrieve
Source

fn get_block<'life0, 'life1, 'async_trait>( &'life0 self, block_hash: &'life1 BlockHash, ) -> Pin<Box<dyn Future<Output = Result<Block>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Returns the complete block data for the specified block hash.

§Arguments
  • block_hash - The hash of the block to retrieve

Implementors§