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§
Sourcefn send_transaction(&self, transaction: &Transaction) -> Result<(), Error>
fn send_transaction(&self, transaction: &Transaction) -> Result<(), Error>
Broadcast the given transaction to the bitcoin network.
Sourcefn get_network(&self) -> Result<Network, Error>
fn get_network(&self) -> Result<Network, Error>
Returns the network currently used (mainnet, testnet or regtest).
Sourcefn get_blockchain_height(&self) -> Result<u64, Error>
fn get_blockchain_height(&self) -> Result<u64, Error>
Returns the height of the blockchain
Sourcefn get_block_at_height(&self, height: u64) -> Result<Block, Error>
fn get_block_at_height(&self, height: u64) -> Result<Block, Error>
Returns the block at given height
Sourcefn get_transaction(&self, tx_id: &Txid) -> Result<Transaction, Error>
fn get_transaction(&self, tx_id: &Txid) -> Result<Transaction, Error>
Get the transaction with given id.