[ANN] Rollblock 0.1 - A super-fast rollbackable key-value store
â Rust đ 2025-11-15 đ¤ surdeus đī¸ 6Hi Rustaceans! ![]()
I'm excited to announce the initial release of Rollblock, a high-performance, rollbackable block-oriented key-value store optimized for blockchain and state machine workloads.
What is Rollblock?
Rollblock is designed to solve a specific problem: storing blockchain state with the ability to efficiently rollback to any previous block. While building infrastructure for myhashisnice.org[1], I needed to process 1.5 billion operations in under 24 hours with full rollback support. I couldn't find any existing database that was both fast enough and had true rollback capabilities - they were all too slow and lacked proper block-based rollback support. So I built Rollblock.
Key Features
- Blazing fast: ~1.4M ops/s on Apple M4 (35x faster than LMDB)
- Block-scoped atomic updates: All operations within a block succeed or fail together
- Efficient rollback: Jump back to any previous block instantly
- Memory-mapped snapshots: Fast restarts with Blake3 checksum validation
- Production-ready: Built-in metrics, health reporting, and structured tracing
- Configurable parallelism: Optional Rayon-based parallel execution with sharding
Benchmark Results
Replaying ~1.52 billion operations on Apple M4 (24 GB RAM):
- Async multi-threaded (reference): â1.40M ops/s
- Async single-threaded: â1.27M ops/s (1.1x slower)
- Sync multi-threaded: â0.80M ops/s (1.7x slower)
- Sync single-threaded: â0.82M ops/s (1.7x slower)
- LMDB baseline: â0.04M ops/s (35x slower)
Quick Example
use rollblock::{MhinStoreFacade, StoreConfig, types::Operation};
fn main() -> Result<(), Box<dyn std::error::Error>> {
let config = StoreConfig::new("./data", 4, 1000, 1, false);
let store = MhinStoreFacade::new(config)?;
// Apply operations at block 1
store.set(1, vec![Operation {
key: [1u8, 0, 0, 0, 0, 0, 0, 0],
value: 100,
}])?;
// Read current value
let value = store.get([1u8, 0, 0, 0, 0, 0, 0, 0])?;
println!("Value: {}", value);
// Rollback to genesis
store.rollback(0)?;
Ok(())
}
Use Cases
- Blockchain nodes: Store chain state with instant reorg support
- State machines: Snapshot and rollback to any previous state
- Event sourcing: Replay events with rollback capability
- High-throughput analytics: Process billions of operations efficiently
- Testing: Quickly reset state between test runs
Links
- Crate: crates.io: Rust Package Registry
- Docs: rollblock - Rust
- Repository: GitHub - ouziel-slama/rollblock: A super-fast, rollbackable block-oriented key-value store.
- Examples: Check out the
examples/directory for blockchain reorgs, parallel processing, and more
What's Next?
This is the initial release, and I'd love to get feedback from the community:
- Are there features you'd find useful?
- Any performance bottlenecks in your specific use case?
- Ideas for API improvements?
One key feature I'm planning to add is configurable key and value sizes. Currently, keys are fixed at [u8; 8] and values at u64, which is optimized for my personal use case, but I'd like to make this more flexible for broader applications.
Issues, PRs, and suggestions are very welcome! ![]()
Built with: hashbrown, parking_lot, rayon, memmap2, heed, blake3, zstd
Licensed under MIT OR Apache-2.0
see also:
GitHub - ouziel-slama/myhashisnice âŠī¸
1 post - 1 participant
đˇī¸ Rust_feed