Expand description
Rust Bitcoin Library
This is a library that supports the Bitcoin network protocol and associated primitives. It is designed for Rust programs built to work with the Bitcoin network.
It is also written entirely in Rust to illustrate the benefits of strong type safety, including ownership and lifetime, for financial and/or cryptographic software.
See README.md for detailed documentation about development and supported environments.
Available feature flags
std
- the usual dependency onstd
(default).secp-recovery
- enables calculating public key from a signature and message.base64
- (dependency), enables encoding of PSBTs and message signatures.rand
- (dependency), makes it more convenient to generate random values.serde
- (dependency), implementsserde
-based serialization and deserialization.secp-lowmemory
- optimizations for low-memory devices.no-std
- enables additional features required for this crate to be usable without std. Does not disablestd
. Depends oncore2
.bitcoinconsensus-std
- enablesstd
inbitcoinconsensus
and communicates it to this crate so it knows how to implementstd::error::Error
. At this time there’s a hack to achieve the same without this feature but it could happen the implementations diverge one day.
Re-exports
pub extern crate base64;
pub extern crate bech32;
pub extern crate bitcoinconsensus;
pub extern crate bitcoin_hashes as hashes;
pub extern crate secp256k1;
pub use crate::address::Address;
pub use crate::address::AddressType;
pub use crate::amount::Amount;
pub use crate::amount::Denomination;
pub use crate::amount::SignedAmount;
pub use crate::blockdata::block;
pub use crate::blockdata::block::Block;
pub use crate::blockdata::fee_rate::FeeRate;
pub use crate::blockdata::locktime;
pub use crate::blockdata::locktime::absolute;
pub use crate::blockdata::locktime::relative;
pub use crate::blockdata::script;
pub use crate::blockdata::transaction;
pub use crate::blockdata::transaction::OutPoint;
pub use crate::blockdata::transaction::Sequence;
pub use crate::blockdata::transaction::Transaction;
pub use crate::blockdata::transaction::TxIn;
pub use crate::blockdata::transaction::TxOut;
pub use crate::blockdata::weight::Weight;
pub use crate::blockdata::witness;
pub use crate::blockdata::witness::Witness;
pub use crate::blockdata::constants;
pub use crate::blockdata::opcodes;
pub use crate::consensus::encode::VarInt;
pub use crate::error::Error;
pub use crate::merkle_tree::MerkleBlock;
pub use crate::network::constants::Network;
pub use crate::pow::CompactTarget;
pub use crate::pow::Target;
pub use crate::pow::Work;
Modules
- Bitcoin addresses.
- Bitcoin amounts.
- Base58 encoder and decoder.
- BIP32 implementation.
- BIP152 Compact Blocks
- BIP 158 Compact Block Filters for Light Clients.
- Bitcoin block data.
- Bitcoin consensus.
- ECDSA Bitcoin signatures.
- Contains error types and other error handling tools.
- Bitcoin hash types.
- Bitcoin keys.
- Bitcoin merkle tree functions.
- Bitcoin network support.
- Bitcoin policy.
- Proof-of-work related integer types.
- Partially Signed Bitcoin Transactions.
- Signature hash implementation (used in transaction signing).
- Signature
- Bitcoin string parsing utilities.
- Bitcoin Taproot.
- Utility functions.
Structs
- A bitcoin block hash.
- A Bitcoin ECDSA private key
- A hash of a public key.
- A Bitcoin ECDSA public key
- Bitcoin script slice.
- An owned, growable script.
- A hash of Bitcoin Script bytecode.
- A bitcoin transaction hash/transaction ID.
- SegWit version of a public key hash.
- SegWit version of a Bitcoin Script bytecode hash.
- A bitcoin witness transaction ID.