Prerequisites
RotorTree requires Rust 1.90.0 or later. Ensure you have Rust installed:Add to Your Project
Add the dependency
Add RotorTree to your This installs RotorTree with default features (
Cargo.toml:Cargo.toml
blake3 hasher).Feature Flags
RotorTree offers multiple feature flags to optimize for your specific use case:Default Configuration
Cargo.toml
blake3: Blake3 hasher (default)- In-memory tree only (no persistence)
no_stdcompatible
In-Memory with Concurrency
For multi-threaded applications with shared tree access:Cargo.toml
concurrent: Enables&selfmethods with internalRwLock(viaparking_lot)- Thread-safe operations
- Requires
std
In-Memory with Parallelism
For large batch insertions with parallel processing:Cargo.toml
parallel: Rayon-parallelizedinsert_manyfor 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
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
Full-Featured Configuration
For production applications needing all features:Cargo.toml
- All storage features
- Parallel batch processing
- Thread-safe concurrent access
- Serde serialization support
Minimal no_std Configuration
For embedded or constrained environments:Cargo.toml
- Core tree algorithm only
- Zero dependencies
no_stdcompatible- No hasher (bring your own)
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 thestorage feature with tiering:
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
Next Steps
Quickstart Guide
Learn how to create your first Merkle tree and generate proofs
