Skip to main content

Prerequisites

RotorTree requires Rust 1.90.0 or later. Ensure you have Rust installed:
rustc --version

Add to Your Project

1

Add the dependency

Add RotorTree to your Cargo.toml:
Cargo.toml
[dependencies]
rotortree = "0.15.0"
This installs RotorTree with default features (blake3 hasher).
2

Choose your features

Configure feature flags based on your use case. See the sections below for different configurations.

Feature Flags

RotorTree offers multiple feature flags to optimize for your specific use case:

Default Configuration

Cargo.toml
[dependencies]
rotortree = "0.15.0"
Includes:
  • blake3: Blake3 hasher (default)
  • In-memory tree only (no persistence)
  • no_std compatible

In-Memory with Concurrency

For multi-threaded applications with shared tree access:
Cargo.toml
[dependencies]
rotortree = { version = "0.15.0", features = ["concurrent"] }
Includes:
  • concurrent: Enables &self methods with internal RwLock (via parking_lot)
  • Thread-safe operations
  • Requires std

In-Memory with Parallelism

For large batch insertions with parallel processing:
Cargo.toml
[dependencies]
rotortree = { version = "0.15.0", features = ["parallel"] }
Includes:
  • parallel: Rayon-parallelized insert_many for large batches
  • Significant performance gains for bulk operations
  • Requires std
The parallel feature works exceptionally well for batch insertions. The in-memory benchmark achieves peak throughput up to ~190M leaves/sec.

With WAL Persistence

For crash-safe persistence with write-ahead logging:
Cargo.toml
[dependencies]
rotortree = { version = "0.15.0", features = ["storage"] }
Includes:
  • storage: Write-ahead log (WAL) with checkpointing
  • Memory-mapped data files for cold levels
  • File locking and durability guarantees
  • Requires std
  • Automatically includes: parking_lot, arc-swap, wincode, crc-fast, fs4, memmap2
For production applications needing all features:
Cargo.toml
[dependencies]
rotortree = { version = "0.15.0", features = ["storage", "parallel", "concurrent", "serde"] }
Includes:
  • All storage features
  • Parallel batch processing
  • Thread-safe concurrent access
  • Serde serialization support

Minimal no_std Configuration

For embedded or constrained environments:
Cargo.toml
[dependencies]
rotortree = { version = "0.15.0", default-features = false }
Includes:
  • Core tree algorithm only
  • Zero dependencies
  • no_std compatible
  • No hasher (bring your own)
This configuration requires you to implement your own hasher trait.

Additional Feature Flags

wincode

Adds wincode serde derives to proof types for efficient serialization.

serde

Adds standard Serde support with serde_with for ecosystem compatibility (e.g., Jolt prover).

test-helpers

Testing utilities (development only).

docs

Documentation utilities (development only).

Capacity Planning

When using the storage feature with tiering:
~4.3B nullifiers in 41 GiB
For most use cases, consider using a new tree per generation and encoding nullifiers with the generation to keep storage manageable.

Verify Installation

Create a simple test to verify your installation:
src/main.rs
use rotortree::{LeanIMT, Blake3Hasher};

fn main() {
    let tree = LeanIMT::<Blake3Hasher, 4, 20>::new(Blake3Hasher);
    println!("RotorTree initialized successfully!");
}
Run with:
cargo run

Next Steps

Quickstart Guide

Learn how to create your first Merkle tree and generate proofs

Build docs developers (and LLMs) love