Minimal Bitcoin implementation using protocol-engine for protocol abstraction and consensus-proof for consensus decisions.
This crate provides a minimal, production-ready Bitcoin node implementation that uses the protocol-engine crate for protocol abstraction and consensus-proof for all consensus decisions. It adds only the non-consensus infrastructure: storage, networking, RPC, and orchestration.
This is Tier 4 of the 5-tier Bitcoin Commons architecture (BLLVM technology stack):
1. Orange Paper (mathematical foundation)
2. consensus-proof (pure math implementation)
3. protocol-engine (Bitcoin abstraction)
4. reference-node (full node implementation) ← THIS CRATE
5. developer-sdk (governance infrastructure)
- Zero Consensus Re-implementation: All consensus logic from consensus-proof
- Protocol Abstraction: Uses protocol-engine for variant support
- Pure Infrastructure: Only adds storage, networking, RPC, orchestration
- Production Ready: Full Bitcoin node functionality
The reference-node supports multiple Bitcoin protocol variants:
- Regtest (default): Regression testing network for development
- Testnet3: Bitcoin test network
- BitcoinV1: Production Bitcoin mainnet
Usage:
use reference_node::{ReferenceNode, ProtocolVersion};
// Default: Regtest for safe development
let node = ReferenceNode::new(None)?;
// Explicit testnet
let testnet_node = ReferenceNode::new(Some(ProtocolVersion::Testnet3))?;
// Mainnet (use with caution)
let mainnet_node = ReferenceNode::new(Some(ProtocolVersion::BitcoinV1))?;git clone https://github.com/BTCDecoded/reference-node
cd reference-node
cargo build --releaseThe build automatically fetches consensus-proof from GitHub.
If you're developing both reference-node and consensus-proof:
-
Clone both repos:
git clone https://github.com/BTCDecoded/consensus-proof git clone https://github.com/BTCDecoded/reference-node
-
Set up local override:
cd reference-node mkdir -p .cargo echo '[patch."https://github.com/BTCDecoded/consensus-proof"]' > .cargo/config.toml echo 'consensus-proof = { path = "../consensus-proof" }' >> .cargo/config.toml
-
Build:
cargo build
Changes to consensus-proof are now immediately reflected without git push.
# Run all tests
cargo test
# Run with verbose output
cargo test -- --nocaptureuse reference_node::{ReferenceNode, ProtocolVersion};
// Default: Regtest for safe development
let node = ReferenceNode::new(None)?;
// Explicit testnet
let testnet_node = ReferenceNode::new(Some(ProtocolVersion::Testnet3))?;
// Mainnet (use with caution)
let mainnet_node = ReferenceNode::new(Some(ProtocolVersion::BitcoinV1))?;# Start node in regtest mode (default)
cargo run
# Start in testnet mode
cargo run -- --network testnet
# Start in mainnet mode (use with caution)
cargo run -- --network mainnetSee SECURITY.md for security policies and BTCDecoded Security Policy for organization-wide guidelines.
Important: This implementation is designed for pre-production testing and development. Additional hardening is required for production mainnet use.
- consensus-proof: All consensus logic (git dependency)
- tokio: Async runtime for networking
- serde: Serialization
- anyhow/thiserror: Error handling
- tracing: Logging
- clap: CLI interface
See CONTRIBUTING.md and the BTCDecoded Contribution Guide.
MIT License - see LICENSE file for details.