merk

High-performance Merkle key/value store

Build Status Crate API

Merk is a crypto key/value store - more specifically, it's a Merkle AVL tree built on top of RocksDB (Facebook's fork of LevelDB).

Its priorities are performance and reliability. While Merk was designed to be the state database for blockchains, it can also be used anywhere an auditable key/value store is needed.

NOTE: This crate is still in early development and not fully implemented yet.

FEATURES:

Usage

Install: cargo add merk

Example: ```rust extern crate merk; use merk::*;

// load or create a Merk store at the given path let mut merk = Merk::open("./merk.db").unwrap();

// apply some operations let mut batch: Vec = vec![ (b"key", Op::Put(b"value")), (b"key2", Op::Put(b"value2")), (b"key3", Op::Put(b"value3")), (b"key4", Op::Delete) ]; merk.apply(&mut batch).unwrap(); ```

Status

Merk is currently experimental but developing fast, and is intended to be used in production soon in LotionJS.

Benchmarks

Average performance on my 2017 Macbook Pro, on a store with at least 1M keys, with no concurrency: - Random inserts: ~22,000 per second - Random updates: ~19,000 per second - Random reads: ~117,000 per second - Random deletes: ~15,000 per second - Sequential inserts: ~181,000 per second - Sequential updates: ~174,000 per second - Sequential reads: ~350,000 per second - Sequential deletes: ~148,000 per second - RAM usage: ~30MB average, ~60MB max

This is just the first pass - we can do much better!

TODO: generate more scientific benchmarks, with comparisons to alternatives

Algorithm Details

TODO