Rust Bitcoin

Rust Bitcoin is a Rust library that provides support for de/serialization, parsing, and executing data-structures and network messages related to Bitcoin.

Key Features

Rust Bitcoin supports:

  • De/serialization of Bitcoin protocol network messages.
  • De/serialization of blocks and transactions.
  • Script de/serialization.
  • Private keys and address creation, de/serialization, and validation (including full BIP32 support).
  • PSBT v0 de/serialization and all roles except the Input Finalizer. Use rust-miniscript to finalize.

For JSONRPC interaction with Bitcoin Core, it is recommended to use rust-bitcoincore-rpc.


The complete documentation for Rust Bitcoin is available on

Known Limitations


This library must not be used for consensus code (i.e., fully validating blockchain data). It supports this technically, but there are many deviations between this library and the Bitcoin Core reference implementation. In a consensus-based cryptocurrency like Bitcoin, it is critical that all parties use the same rules to validate data. Given the complexity of both C++ and Rust, it is unlikely this will ever be fully fixed, and there are no plans to do so. However, patches to fix specific consensus incompatibilities are welcome.

Support for 16-bit Pointer Sizes

16-bit pointer sizes are not supported, and we can't promise they will be. If you care about this, please let us know to gauge interest and possibly decide to support it.

Building and Testing

To build the library, run:

git clone
cd rust-bitcoin
cargo build

To run tests:

cargo test

For more detailed instructions, refer to the cargo documentation.

Minimum Supported Rust Version (MSRV)

Rust Bitcoin should compile with any combination of features on Rust 1.56.1. To build with the MSRV, you might need to pin several dependencies. See ./contrib/ for the current list.

External Dependencies

Rust Bitcoin integrates with several external libraries, most notably serde. These are available via feature flags. We provide two lock files to ensure compatibility and MSRV stability: Cargo-minimal.lock containing minimal versions of dependencies and Cargo-recent.lock containing recent versions tested in our CI.

Installing Rust

Rust can be installed using your package manager of choice or Using your package manager is generally more secure, but the Rust version might be outdated. Rust Bitcoin supports much older versions than the current stable one, so this is typically not a problem.

Policy on Altcoins/Altchains

Rust Bitcoin does not support any altcoins. Supporting Bitcoin properly is already challenging, and adding support for other coins would increase maintenance burden and decrease API stability. The code is public domain, so feel free to fork it and adapt it for other coins.

Similar Projects


  1. Home
  2. Learn Rust
  3. Get Started
  4. Practice Rust
  5. Challenges
  6. Tutorials
  7. Blog
  8. Open source
  9. Learn Gleam


  1. GitHub
  2. X


  1. Privacy Policy
  2. Terms of Service