Skip to main content

Blockchain

Trait Blockchain 

Source
pub trait Blockchain {
    // Required methods
    fn send_transaction<'life0, 'life1, 'async_trait>(
        &'life0 self,
        transaction: &'life1 Transaction,
    ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn get_network(&self) -> Result<Network, Error>;
    fn get_blockchain_height<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<u64, Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn get_block_at_height<'life0, 'async_trait>(
        &'life0 self,
        height: u64,
    ) -> Pin<Box<dyn Future<Output = Result<Block, Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn get_transaction<'life0, 'life1, 'async_trait>(
        &'life0 self,
        tx_id: &'life1 Txid,
    ) -> Pin<Box<dyn Future<Output = Result<Transaction, Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn get_transaction_confirmations<'life0, 'life1, 'async_trait>(
        &'life0 self,
        tx_id: &'life1 Txid,
    ) -> Pin<Box<dyn Future<Output = Result<u32, Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

Blockchain trait provides access to the bitcoin blockchain.

Required Methods§

Source

fn send_transaction<'life0, 'life1, 'async_trait>( &'life0 self, transaction: &'life1 Transaction, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Broadcast the given transaction to the bitcoin network.

Source

fn get_network(&self) -> Result<Network, Error>

Returns the network currently used (mainnet, testnet or regtest).

Source

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

Returns the height of the blockchain

Source

fn get_block_at_height<'life0, 'async_trait>( &'life0 self, height: u64, ) -> Pin<Box<dyn Future<Output = Result<Block, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Returns the block at given height

Source

fn get_transaction<'life0, 'life1, 'async_trait>( &'life0 self, tx_id: &'life1 Txid, ) -> Pin<Box<dyn Future<Output = Result<Transaction, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Get the transaction with given id.

Source

fn get_transaction_confirmations<'life0, 'life1, 'async_trait>( &'life0 self, tx_id: &'life1 Txid, ) -> Pin<Box<dyn Future<Output = Result<u32, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Get the number of confirmation for the transaction with given id.

Implementors§