pub trait Blockchain {
    // Required methods
    fn send_transaction(&self, transaction: &Transaction) -> Result<(), Error>;
    fn get_network(&self) -> Result<Network, Error>;
    fn get_blockchain_height(&self) -> Result<u64, Error>;
    fn get_block_at_height(&self, height: u64) -> Result<Block, Error>;
    fn get_transaction(&self, tx_id: &Txid) -> Result<Transaction, Error>;
    fn get_transaction_confirmations(&self, tx_id: &Txid) -> Result<u32, Error>;
}
Expand description

Blockchain trait provides access to the bitcoin blockchain.

Required Methods§

source

fn send_transaction(&self, transaction: &Transaction) -> Result<(), Error>

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(&self) -> Result<u64, Error>

Returns the height of the blockchain

source

fn get_block_at_height(&self, height: u64) -> Result<Block, Error>

Returns the block at given height

source

fn get_transaction(&self, tx_id: &Txid) -> Result<Transaction, Error>

Get the transaction with given id.

source

fn get_transaction_confirmations(&self, tx_id: &Txid) -> Result<u32, Error>

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

Implementors§