grovedb 3.1.0

Fully featured database using balanced hierarchical authenticated data structures
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
# GroveDB

| Branch | Tests | Coverage |
|--------|-------|----------|
| master | [![Tests]https://github.com/dashevo/grovedb/workflows/CI/badge.svg?branch=master]https://github.com/dashevo/grovedb/actions | [![codecov]https://codecov.io/gh/dashpay/grovedb/branch/master/graph/badge.svg?token=6Z6A6FT5HV]https://codecov.io/gh/dashpay/grovedb |

**GroveDB: Hierarchical Authenticated Data Structure Database**

GroveDB is a high-performance, cryptographically verifiable database system that implements a hierarchical authenticated data structure - organizing data as a "grove" where each tree in the forest is a Merkle AVL tree (Merk). This revolutionary approach solves the fundamental limitations of flat authenticated data structures by enabling efficient queries on any indexed field while maintaining cryptographic proofs throughout the hierarchy.

Built on cutting-edge research in hierarchical authenticated data structures, GroveDB provides the foundational storage layer for [Dash Platform](https://dashplatform.readme.io/docs/introduction-what-is-dash-platform) while being flexible enough for any application requiring trustless data verification.

## Table of Contents

- [Key Features]#key-features
- [Architecture Overview]#architecture-overview
- [Core Concepts]#core-concepts
- [Getting Started]#getting-started
- [Usage Examples]#usage-examples
- [Query System]#query-system
- [Performance]#performance
- [Documentation]#documentation
- [Contributing]#contributing

## Key Features

### 🌳 Hierarchical Tree-of-Trees Structure
- Organize data naturally in nested hierarchies
- Each subtree is a fully authenticated Merkle AVL tree
- Efficient navigation and organization of complex data

### πŸ” Efficient Secondary Index Queries
- Pre-computed secondary indices stored as subtrees
- O(log n) query performance on any indexed field
- No need to scan entire dataset for non-primary key queries

### πŸ” Cryptographic Proofs
- Generate proofs for any query result
- Supports membership, non-membership, and range proofs
- Minimal proof sizes through optimized algorithms
- Layer-by-layer verification from root to leaves

### πŸš€ High Performance
- Built on RocksDB for reliable persistent storage
- Batch operations for atomic updates across multiple trees
- Intelligent caching system (MerkCache) for frequently accessed data
- Cost tracking for all operations

### πŸ”— Advanced Reference System
- 7 types of references for complex data relationships
- Automatic reference following (configurable hop limits)
- Cycle detection prevents infinite loops
- Cross-tree data linking without duplication

### πŸ“Š Built-in Aggregations
- Sum trees for automatic value totaling
- Count trees for element counting
- Combined count+sum trees
- Big sum trees for 256-bit integers

### 🌐 Cross-Platform Support
- Native Rust implementation
- Runs on x86, ARM (including Raspberry Pi), and WebAssembly

## The Forest Architecture: Why Hierarchical Matters

Traditional authenticated data structures face a fundamental limitation: they can only efficiently prove queries on a single index (typically the primary key). Secondary index queries require traversing the entire structure, resulting in large proofs and poor performance.

GroveDB's breakthrough is using a **hierarchical authenticated data structure** - a forest where each tree is a Merk (Merkle AVL tree). This architecture enables:

### 🌲 The Forest Metaphor
- **Grove**: The entire database - a forest of interconnected trees
- **Trees**: Individual Merk trees, each serving as either:
  - **Data Trees**: Storing actual key-value pairs
  - **Index Trees**: Storing references for secondary indices
  - **Aggregate Trees**: Maintaining sums, counts, or other computations
- **Root Hash**: A single cryptographic commitment to the entire forest state

### πŸ”— Hierarchical Authentication
Each Merk tree maintains its own root hash, and parent trees store these hashes as values. This creates a hierarchy where:
1. The topmost tree's root hash authenticates the entire database
2. Each subtree can be independently verified
3. Proofs can be generated for any path through the hierarchy
4. Updates propagate upward, maintaining consistency

### πŸ“ˆ Efficiency Gains
By pre-computing and storing secondary indices as separate trees:
- Query any index with O(log n) complexity
- Generate minimal proofs (only the path taken)
- Update indices atomically with data
- Maintain multiple views of the same data

## Architecture Overview

GroveDB combines several innovative components:

```
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                     GroveDB Core                       β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
β”‚  β”‚   Element   β”‚  β”‚    Query     β”‚  β”‚     Proof     β”‚  β”‚
β”‚  β”‚   System    β”‚  β”‚    Engine    β”‚  β”‚   Generator   β”‚  β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
β”‚  β”‚   Batch     β”‚  β”‚  Reference   β”‚  β”‚   Version     β”‚  β”‚
β”‚  β”‚ Operations  β”‚  β”‚   Resolver   β”‚  β”‚  Management   β”‚  β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                      Merk Layer                        β”‚
β”‚         (Merkle AVL Tree Implementation)               β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
β”‚  β”‚  AVL Tree   β”‚  β”‚    Proof     β”‚  β”‚     Cost      β”‚  β”‚
β”‚  β”‚  Balancing  β”‚  β”‚    System    β”‚  β”‚   Tracking    β”‚  β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                   Storage Layer                        β”‚
β”‚            (RocksDB Abstraction)                       β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
β”‚  β”‚ Prefixed    β”‚  β”‚ Transaction  β”‚  β”‚    Batch      β”‚  β”‚
β”‚  β”‚  Storage    β”‚  β”‚   Support    β”‚  β”‚ Processing    β”‚  β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
```

### Component Details

1. **GroveDB Core**: Orchestrates multiple Merk trees into a unified hierarchical database
2. **Merk**: High-performance Merkle AVL tree implementation with proof generation
3. **Storage**: Abstract storage layer with RocksDB backend, supporting transactions and batching
4. **Costs**: Comprehensive resource tracking for all operations
5. **Version Management**: Protocol versioning for smooth upgrades

## Core Concepts

### The Foundation: Merk Trees

At the heart of GroveDB's forest are **Merk trees** - highly optimized Merkle AVL trees that serve as the building blocks of the hierarchical structure:

- **Self-Balancing**: AVL algorithm ensures O(log n) operations
- **Authenticated**: Every node contains cryptographic hashes
- **Efficient Proofs**: Generate compact proofs for any query
- **Rich Features**: Built-in support for sums, counts, and aggregations

Each Merk tree in the grove can reference other Merk trees, creating a powerful hierarchical system where authentication flows from leaves to root.

### Elements

GroveDB supports 8 element types:

```rust
// Basic storage
Element::Item(value, flags)           // Arbitrary bytes
Element::Reference(path, max_hops)    // Link to another element
Element::Tree(root_hash)             // Subtree container

// Aggregation types
Element::SumItem(value)              // Contributes to sum
Element::SumTree(root_hash, sum)     // Maintains sum of descendants
Element::BigSumTree(root_hash, sum)  // 256-bit sums
Element::CountTree(root_hash, count) // Element counting
Element::CountSumTree(root_hash, count, sum) // Combined
```

### Hierarchical Paths

Data is organized using paths:
```rust
// Path: ["users", "alice", "documents"]
db.insert(
    &["users", "alice"], 
    b"balance", 
    Element::new_item(b"100")
)?;
```

### Reference Types

Seven reference types enable complex relationships:
- `AbsolutePathReference`: Direct path from root
- `UpstreamRootHeightReference`: Go up N levels, then follow path
- `UpstreamFromElementHeightReference`: Relative to current element
- `CousinReference`: Same level, different branch
- `SiblingReference`: Same parent tree
- `UtilityReference`: Special system references

## Getting Started

### Requirements

- Rust 1.74+ (nightly)
- RocksDB dependencies

### Installation

Add to your `Cargo.toml`:
```toml
[dependencies]
grovedb = "3.0"
```

### Basic Setup

```rust
use grovedb::{GroveDb, Element};
use grovedb_version::version::GroveVersion;

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

// Create a tree structure
db.insert(&[], b"users", Element::new_tree(None), None, None, grove_version)?;
db.insert(&[b"users"], b"alice", Element::new_tree(None), None, None, grove_version)?;

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

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

## Usage Examples

### Building Your Forest: From Trees to Grove

The following examples demonstrate how individual Merk trees combine to form a powerful hierarchical database.

#### Conceptual Structure
```
🌲 Grove Root (Single Merk Tree)
β”œβ”€β”€ πŸ“‚ users (Merk Tree)
β”‚   β”œβ”€β”€ πŸ‘€ alice (Merk Tree)
β”‚   β”‚   β”œβ”€β”€ name: "Alice"
β”‚   β”‚   β”œβ”€β”€ age: 30
β”‚   β”‚   └── city: "Boston"
β”‚   └── πŸ‘€ bob (Merk Tree)
β”‚       β”œβ”€β”€ name: "Bob"
β”‚       └── age: 25
β”œβ”€β”€ πŸ“Š indexes (Merk Tree)
β”‚   β”œβ”€β”€ by_age (Merk Tree)
β”‚   β”‚   β”œβ”€β”€ 25 β†’ Reference(/users/bob)
β”‚   β”‚   └── 30 β†’ Reference(/users/alice)
β”‚   └── by_city (Merk Tree)
β”‚       └── Boston β†’ Reference(/users/alice)
└── πŸ’° accounts (Sum Tree - Special Merk)
    β”œβ”€β”€ alice: 100 (contributes to sum)
    └── bob: 200 (contributes to sum)
    └── [Automatic sum: 300]
```

Each node marked as "Merk Tree" is an independent authenticated data structure with its own root hash, all linked together in the hierarchy.

### Creating Secondary Indexes

```rust
// Create user data
db.insert(&[b"users"], b"user1", Element::new_tree(None), None, None, grove_version)?;
db.insert(&[b"users", b"user1"], b"age", Element::new_item(b"25"), None, None, grove_version)?;
db.insert(&[b"users", b"user1"], b"city", Element::new_item(b"Boston"), None, None, grove_version)?;

// Create indexes
db.insert(&[], b"indexes", Element::new_tree(None), None, None, grove_version)?;
db.insert(&[b"indexes"], b"by_age", Element::new_tree(None), None, None, grove_version)?;
db.insert(&[b"indexes"], b"by_city", Element::new_tree(None), None, None, grove_version)?;

// Add references in indexes
db.insert(
    &[b"indexes", b"by_age"], 
    b"25_user1",
    Element::new_reference(ReferencePathType::absolute_path(vec![
        b"users".to_vec(), 
        b"user1".to_vec()
    ])),
    None,
    None,
    grove_version
)?;
```

### Using Sum Trees

```rust
// Create account structure with balances
db.insert(&[], b"accounts", Element::new_sum_tree(None, 0), None, None, grove_version)?;

// Add accounts with balances
db.insert(&[b"accounts"], b"alice", Element::new_sum_item(100), None, None, grove_version)?;
db.insert(&[b"accounts"], b"bob", Element::new_sum_item(200), None, None, grove_version)?;
db.insert(&[b"accounts"], b"charlie", Element::new_sum_item(150), None, None, grove_version)?;

// Get total sum (automatically maintained)
let sum_tree = db.get(&[], b"accounts", None, grove_version)?;
// sum_tree now contains Element::SumTree with sum = 450
```

### Batch Operations

```rust
use grovedb::batch::GroveDbOp;

let ops = vec![
    GroveDbOp::insert_op(vec![b"users"], b"alice", Element::new_tree(None)),
    GroveDbOp::insert_op(vec![b"users", b"alice"], b"name", Element::new_item(b"Alice")),
    GroveDbOp::insert_op(vec![b"users", b"alice"], b"age", Element::new_item(b"30")),
];

// Apply atomically
db.apply_batch(ops, None, None, grove_version)?;
```

### Generating Proofs

```rust
use grovedb::query::PathQuery;
use grovedb_merk::proofs::Query;

// Create a path query
let path_query = PathQuery::new_unsized(
    vec![b"users".to_vec()],
    Query::new_range_full(),
);

// Generate proof
let proof = db.prove_query(&path_query, None, None, grove_version)?;

// Verify proof independently
let (root_hash, results) = GroveDb::verify_query(proof.as_slice(), &path_query, grove_version)?;
```

## Query System

### Basic Queries

```rust
// Get all items in a subtree
let query = Query::new_range_full();
let path_query = PathQuery::new_unsized(vec![b"users".to_vec()], query);
let results = db.query(&path_query, false, false, None, grove_version)?;
```

### Range Queries

```rust
// Get users with names from "A" to "M"
let mut query = Query::new();
query.insert_range(b"A".to_vec()..b"N".to_vec());

let path_query = PathQuery::new_unsized(vec![b"users".to_vec()], query);
let results = db.query(&path_query, false, false, None, grove_version)?;
```

### Complex Queries with Subqueries

```rust
// Get all users and their documents
let mut query = Query::new_with_subquery_key(b"documents".to_vec());
let path_query = PathQuery::new_unsized(vec![b"users".to_vec()], query);
let results = db.query(&path_query, false, false, None, grove_version)?;
```

### Query Types

GroveDB supports 10 query item types:
- `Key(key)` - Exact key match
- `Range(start..end)` - Exclusive range
- `RangeInclusive(start..=end)` - Inclusive range
- `RangeFull(..)` - All keys
- `RangeFrom(start..)` - From key onwards
- `RangeTo(..end)` - Up to key
- `RangeToInclusive(..=end)` - Up to and including key
- `RangeAfter(prev..)` - After specific key
- `RangeAfterTo(prev..end)` - After key up to end
- `RangeAfterToInclusive(prev..=end)` - After key up to and including end

### Advanced Query Features (v2+)

**Parent Tree Inclusion**: When performing subqueries, you can include the parent tree element itself in the results:

```rust
let mut query = Query::new();
query.insert_key(b"users".to_vec());
query.set_subquery(Query::new_range_full());
query.add_parent_tree_on_subquery = true;  // Include parent tree

let path_query = PathQuery::new_unsized(vec![], query);
let results = db.query(&path_query, false, false, None, grove_version)?;
// Results include both the "users" tree element AND its contents
```

This is particularly useful for count trees and sum trees where you want both the aggregate value and the individual elements.

## Performance

### The Power of Hierarchical Structure

The forest architecture delivers exceptional performance by leveraging the hierarchical nature of Merk trees:

#### Query Performance
- **Primary Index**: O(log n) - Direct path through single Merk tree
- **Secondary Index**: O(log n) - Pre-computed index trees eliminate full scans
- **Proof Generation**: O(log n) - Only nodes on the query path
- **Proof Size**: Minimal - Proportional to tree depth, not data size

Compare this to flat structures where secondary index queries require O(n) scans and generate O(n) sized proofs!

### Benchmarks

Performance on different hardware:

| Hardware | Full Test Suite |
|----------|----------------|
| Raspberry Pi 4 | 2m 58s |
| AMD Ryzen 5 1600AF | 34s |
| AMD Ryzen 5 3600 | 26s |
| Apple M1 Pro | 19s |

### Optimization Features

1. **MerkCache**: Keeps frequently accessed Merk trees in memory
2. **Batch Operations**: Update multiple trees atomically in single transaction
3. **Cost Tracking**: Fine-grained resource monitoring per tree operation
4. **Lazy Loading**: Load only required nodes from Merk trees
5. **Prefix Iteration**: Efficient traversal within subtrees
6. **Root Hash Propagation**: Optimized upward hash updates through tree hierarchy

## Documentation

### Detailed Documentation

- [Merk - Merkle AVL Tree]docs/crates/merk.md
- [Merk Deep Dive - Nodes, Proofs, and State]docs/merk-deep-dive.md
- [Storage Abstraction Layer]docs/crates/storage.md
- [GroveDB Core]docs/crates/grovedb.md
- [Cost Tracking System]docs/crates/costs.md
- [Auxiliary Crates]docs/crates/auxiliary.md

### Examples

See the [examples](examples/) directory for:
- Basic CRUD operations
- Secondary indexing patterns
- Reference usage
- Batch operations
- Proof generation and verification

## Building from Source

```bash
# Install Rust
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

# Clone repository
git clone https://github.com/dashevo/grovedb.git
cd grovedb

# Build
cargo build --release

# Run tests
cargo test

# Run benchmarks
cargo bench
```

## Debug Visualization

GroveDB includes a web-based visualizer for debugging:

```rust
let db = Arc::new(GroveDb::open("db")?);
db.start_visualizer(10000); // Port 10000

// Visit http://localhost:10000 in your browser
```

## Contributing

We welcome contributions! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.

### Development Setup

1. Fork the repository
2. Create a feature branch
3. Write tests for new functionality
4. Ensure all tests pass
5. Submit a pull request

### Testing

```bash
# Run all tests
cargo test

# Run specific test
cargo test test_name

# Run with verbose output
cargo test -- --nocapture
```

## License

GroveDB is licensed under the MIT License. See [LICENSE](LICENSE) for details.

## Support

- [GitHub Issues]https://github.com/dashevo/grovedb/issues
- [Discord]https://discord.gg/dash
- [Documentation]https://dashplatform.readme.io

## Acknowledgments

GroveDB implements groundbreaking concepts from cryptographic database research:

### Academic Foundation
- **[Database Outsourcing with Hierarchical Authenticated Data Structures]https://ia.cr/2015/351** - The seminal work by Etemad & KΓΌpΓ§ΓΌ that introduced hierarchical authenticated data structures for efficient multi-index queries
- **Merkle Trees** - Ralph Merkle's foundational work on cryptographic hash trees
- **AVL Trees** - Adelson-Velsky and Landis's self-balancing binary search tree algorithm

### Key Innovation
GroveDB realizes the vision of hierarchical authenticated data structures by implementing a forest of Merkle AVL trees (Merk), where each tree can contain other trees. This solves the fundamental limitation of flat authenticated structures - enabling efficient queries on any index while maintaining cryptographic proofs throughout the hierarchy.

Special thanks to the Dash Core Group and all contributors who have helped make this theoretical concept a production reality.