A Rust library for working with Bitcoin Cash (BCH) — de/serialization, parsing, and execution of data structures and network messages.
Warning
This library is under active construction and is NOT ready for production use.
Do not use this library with real BCH funds. The API is unstable, behaviour may be incorrect or incomplete, and funds could be lost. Use at your own risk.
rust-bitcoincash is a fork of rust-bitcoin
reoriented exclusively toward Bitcoin Cash (BCH). The goal is a clean, well-tested Rust
library that tracks the BCH protocol — not BTC or any other chain.
Current scope (partial — work in progress):
- De/serialization of Bitcoin Cash network messages
- De/serialization of blocks and transactions
- Script de/serialization
- Private keys and address creation, de/serialization and validation (including BIP-32)
This library is in early development. Large parts of the codebase still reflect Bitcoin (BTC) semantics inherited from the upstream fork. BCH-specific protocol rules (e.g. replay protection, CashAddr, OP_RETURN limits, CHIP changes) may be missing or incorrect.
This library must not be used for consensus code (i.e. fully validating blockchain data). There are many known and unknown deviations from the Bitcoin Cash Node reference implementation. In a consensus-based system it is critical that all participants use identical rules; this library cannot guarantee that.
The API is considered unstable until a 1.0.0 release is made. Breaking changes may occur between any two versions without notice.
16-bit pointer sizes are not supported.
git clone <repo-url>
cd rust-bitcoincash
cargo build
Run tests with:
cargo test --all-features
The std cargo feature is enabled by default. To build without the Rust standard library:
cargo build --no-default-features
Docs are built with the nightly toolchain:
RUSTDOCFLAGS="--cfg docsrs" cargo +nightly rustdoc --all-features -- -D rustdoc::broken-intra-doc-links
RUSTFLAGS='--cfg=bench' cargo +nightly bench
This library targets Rust 1.63.0. Use Cargo-minimal.lock to reproduce the MSRV build
(copy it to Cargo.lock before building).
Contributions are welcome. Please open an issue before starting large changes to avoid duplicated effort. For bug reports, questions, or feature requests, open a GitHub issue.
See CONTRIBUTING.md for more details.
See ROADMAP.md for the planned direction of the project.
The code in this project is licensed under the Creative Commons CC0 1.0 Universal license.