Crate bitcoincash

source ·
Expand description

Rust Bitcoin Cash Library

This is a library that supports the Bitcoin Cash 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 for detailed documentation about development and supported environments.

Available feature flags

  • std - the usual dependency on std (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), implements serde-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 disable std. Depends on hashbrown and core2.


pub use bitcoin_hashes as hashes;
pub use secp256k1;
pub use bech32;
pub use crate::blockdata::block::Block;
pub use crate::blockdata::block::BlockHeader;
pub use crate::blockdata::locktime;
pub use crate::blockdata::locktime::LockTime;
pub use crate::blockdata::locktime::PackedLockTime;
pub use crate::blockdata::script::Script;
pub use crate::blockdata::transaction::SigHashType;
pub use crate::blockdata::transaction::EcdsaSighashType;
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::witness::Witness;
pub use crate::consensus::encode::VarInt;
pub use crate::network::constants::Network;
pub use crate::util::address::Address;
pub use crate::util::address::AddressType;
pub use crate::util::amount::Amount;
pub use crate::util::amount::Denomination;
pub use crate::util::amount::SignedAmount;
pub use crate::util::ecdsa;
pub use crate::util::ecdsa::EcdsaSig;
pub use crate::util::ecdsa::EcdsaSigError;
pub use crate::util::key::PrivateKey;
pub use crate::util::key::PublicKey;
pub use crate::util::merkleblock::MerkleBlock;
pub use crate::util::schnorr;
pub use crate::util::schnorr::SchnorrSig;
pub use crate::util::schnorr::SchnorrSigError;
pub use crate::util::sighash::SchnorrSighashType;
pub use crate::util::psbt;
pub use crate::util::Error;
pub use crate::hash_types::*;


Bitcoin block data.
Bitcoin consensus.
Contains error types and other error handling tools.
Bitcoin hash types.
Bitcoin network support.
Bitcoin policy.
Utility functions.


Opaque data structure that holds a keypair consisting of a secret and a public key.
An x-only public key, used for verification of Schnorr signatures and serialized according to BIP-340.