MCPcopy Index your code
hub / github.com/dashpay/grovedb

github.com/dashpay/grovedb @v5.0.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release v5.0.0 ↗ · + Follow
6,538 symbols 41,651 edges 437 files 1,741 documented · 27%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

GroveDB

Hierarchical Authenticated Data Structure Database

A high-performance, cryptographically verifiable database that organizes data as a "grove" — a forest of Merkle AVL trees (Merk). Enables efficient queries on any indexed field while maintaining cryptographic proofs throughout the hierarchy.

Read the GroveDB Book — comprehensive documentation covering architecture, element types, proofs, queries, and more. Available in 16 languages.

Branch Tests Coverage
develop Tests codecov

Per-Crate Coverage

Crate Coverage
grovedb codecov
merk codecov
storage codecov
commitment-tree codecov
mmr codecov
bulk-append-tree codecov
element codecov

Key Features

  • Hierarchical tree-of-trees — organize data in nested Merk trees with a single root hash authenticating everything
  • Efficient secondary indexes — pre-computed index trees give O(log n) queries on any field
  • Cryptographic proofs — membership, non-membership, and range proofs with minimal size
  • 7 reference types — cross-tree linking without data duplication
  • Built-in aggregations — sum trees, count trees, big sum trees, and combined variants
  • Batch operations — atomic updates across multiple trees
  • Append-only structures — MMR trees, bulk append trees, commitment trees (Sinsemilla/Halo 2)
  • Cross-platform — x86, ARM, WebAssembly

Quick Start

[dependencies]
grovedb = "3.0"
use grovedb::{GroveDb, Element};
use grovedb_version::version::GroveVersion;

let db = GroveDb::open("./my_db")?;
let v = GroveVersion::latest();

// Create trees
db.insert(&[], b"users", Element::new_tree(None), None, None, v)?;
db.insert(&[b"users"], b"alice", Element::new_tree(None), None, None, v)?;

// Insert data
db.insert(&[b"users", b"alice"], b"age", Element::new_item(b"30"), None, None, v)?;

// Query
let age = db.get(&[b"users", b"alice"], b"age", None, v)?;

// Generate and verify proofs
let path_query = PathQuery::new_unsized(vec![b"users".to_vec()], Query::new_range_full());
let proof = db.prove_query(&path_query, None, None, v)?;
let (root_hash, results) = GroveDb::verify_query(&proof, &path_query, v)?;

Building

cargo build --release
cargo test
cargo bench

Contributing

Install pre-commit to catch formatting and lint issues before CI:

pip install pre-commit        # or: brew install pre-commit
pre-commit install             # fmt + typos on every commit
pre-commit install --hook-type pre-push  # clippy on push

Architecture

GroveDB is built in three layers:

  1. GroveDB Core — orchestrates multiple Merk trees, elements, references, queries, proofs, and batch operations
  2. Merk — self-balancing Merkle AVL tree with proof generation, cost tracking, and lazy loading
  3. Storage — RocksDB abstraction with prefixed storage, transactions, and batching

For deep dives into each layer, see the GroveDB Book.

Academic Foundation

GroveDB implements concepts from Database Outsourcing with Hierarchical Authenticated Data Structures (Etemad & Kupcu, 2015) — using a forest of Merkle AVL trees where each tree can contain other trees, solving the fundamental limitation of flat authenticated structures.

Built by Dash Core Group as the storage layer for Dash Platform.

License

MIT — see LICENSE.

Links

Extension points exported contracts — how you extend this code

StorageContext (Interface)
Storage context. Provides operations expected from a database abstracting details such as whether it is a transaction or [9 …
storage/src/storage.rs
Visualize (Interface)
Pretty visualization of GroveDB components. [13 implementers]
visualize/src/lib.rs
MMRStoreReadOps (Interface)
Read access to the MMR backing store. Implementations return the element at a given MMR position, or `None` if the posi [7 …
grovedb-merkle-mountain-range/src/mmr_store.rs
TreeCache (Interface)
get_batch_run_mode is defined for future use [3 implementers]
grovedb/src/batch/mod.rs
Fetch (Interface)
A source of data to be used by the tree when encountering a pruned node. This typically means fetching the tree node fro [3 …
merk/src/tree/walk/fetch.rs
TryFromVersioned (Interface)
(no doc) [3 implementers]
grovedb-version/src/lib.rs
CostsExt (Interface)
Extension trait to add costs context to values. [1 implementers]
costs/src/context.rs
ElementCostSizeExtension (Interface)
(no doc)
grovedb-element/src/element/mod.rs

Core symbols most depended-on inside this repo

unwrap
called by 7422
costs/src/context.rs
to_vec
called by 3484
path/src/subtree_path.rs
as_ref
called by 2616
grovedb/src/util.rs
insert
called by 2364
grovedb/src/operations/insert/mod.rs
clone
called by 1354
merk/src/merk/source.rs
as_slice
called by 1087
grovedb/src/batch/key_info.rs
wrap_with_cost
called by 825
costs/src/context.rs
map
called by 679
costs/src/context.rs

Shape

Function 4,324
Method 1,869
Class 232
Enum 79
Interface 34

Languages

Rust100%
TypeScript1%
Python1%

Modules by API surface

grovedb/src/tests/proof_coverage_tests.rs148 symbols
grovedb/src/batch/mod.rs106 symbols
grovedb/src/tests/misc_coverage_tests.rs103 symbols
grovedb-element/src/element/helpers.rs98 symbols
grovedb/src/tests/operations_coverage_tests.rs92 symbols
grovedb/src/tests/aggregate_count_query_tests.rs91 symbols
grovedb-dense-fixed-sized-merkle-tree/src/proof/tests.rs91 symbols
grovedb/src/query/mod.rs86 symbols
grovedb-query/src/proofs/encoding.rs83 symbols
grovedb-epoch-based-storage-flags/src/lib.rs83 symbols
grovedb-query/src/query_item/mod.rs79 symbols
grovedb-commitment-tree/src/commitment_tree/tests.rs77 symbols

For agents

$ claude mcp add grovedb \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact