Exonum MerkleDB

Travis Build Status Docs.rs rust 1.36.0+ required License: Apache-2.0

Exonum MerkleDB is a persistent storage implementation based on RocksDB which provides APIs to work with merkelized data structures.

Available Database Objects

Usage

Include exonum-merkledb as a dependency in your Cargo.toml:

```toml [dependencies] exonum-merkledb = "0.13.0-rc.1"

```

If you need only to read the data you can create Snapshot. Objects created from Snapshot provide a read-only access to the storage data. To modify data you need to create an object based on Fork. Fork and Snapshot can be obtained from the Database object. Currently only one database backend is supported - RockDB.

```rust use std::path::Path; use exonum_merkledb::{ProofListIndex, Database, ListProof, DbOptions, RocksDB};

let dboptions = DbOptions::default(); let db = RocksDB::open(&Path::new("db"), &dboptions).unwrap(); let list_name = "list";

// Read-only list let snapshot = db.snapshot(); let list: ProofListIndex<_, u8> = ProofListIndex::new(list_name, &snapshot);

// Mutable list let fork = db.fork(); let mut list: ProofListIndex<_, u8> = ProofListIndex::new(list_name, &fork);

```

After adding elements to the object you can obtain cryptographic proofs for their existence or absence.

```rust list.push(1);

asserteq!(ListProof::Leaf(1), list.getproof(0));

if let ListProof::Absent(proof) = list.getproof(1) { println!("Element with index 1 is absent") }

```

Further Reading

License

exonum-merkledb is licensed under the Apache License (Version 2.0). See LICENSE for details.