Rust crates available / v0.2.1

Build roots.Verify everything.

MerkleForge is a generic Rust toolkit for constructing Merkle trees, generating compact inclusion proofs, and verifying data integrity without carrying the full dataset.

ROOT HASH L0 L1 L2 L3 L4 L5 L6 L7
LanguageRust 2024
Hash adaptersSHA-256 / Keccak / BLAKE3
Proof modelStateless verification
SafetyNo unsafe code
Explore / 01

Everything needed to understand and use MerkleForge.

The official site keeps implementation guidance, real examples, benchmark evidence, and generated Criterion reports in one place.

01 / Documentation

Understand the architecture

Learn the trait model, domain separation, proof structure, tree metadata, and crate boundaries.

Read the docs →
02 / Examples

Copy working Rust

Construct a tree, swap hash functions, generate proofs, verify them, and serialize proof data.

Open examples →
03 / Evidence

Inspect measured performance

Compare operations, tree sizes, and hash algorithms with direct links to statistical reports.

View benchmarks →
Workspace / 02

Small crates. Clear responsibilities.

Use the foundation alone, add official hash adapters, or pull in the ready-made tree implementation.

Foundation

merkle-core

Shared traits, proof types, metadata, serialization, and unified errors.

API docs ↗
Cryptography

merkleforge-hash

Domain-separated SHA-256, Keccak-256, and BLAKE3 adapters.

API docs ↗
Trees

merkle-variants

Binary Merkle trees today, with sparse and Patricia variants on the roadmap.

API docs ↗
Quick start / 03

A root and an inclusion proof in a few lines.

Tree behavior is generic over the hash adapter, so changing algorithms is a type-level decision with no runtime dispatch.

src/main.rsBinaryMerkleTree<Sha256>
use merkle_core::{traits::MerkleTree, types::LeafIndex};
use merkle_variants::BinaryMerkleTree;
use merkleforge_hash::Sha256;

fn main() -> Result<(), merkle_core::error::MerkleError> {
    let mut tree = BinaryMerkleTree::<Sha256>::new();
    tree.insert(b"alice:100")?;
    tree.insert(b"bob:250")?;

    let proof = tree.generate_proof(LeafIndex(0))?;
    let root = tree.root().expect("tree is not empty");

    assert!(BinaryMerkleTree::<Sha256>::verify(
        root,
        b"alice:100",
        &proof,
    ));
    Ok(())
}