Expand description
merkle-tree-db is a highly flexible library for working with merkle trees. It supports persistance over any key-value database backend. The merkle tree data structures are stored as sparse merkle trees allowing for efficient lookups, updates and persistence. The library is generic over the hasher used and the depth of the tree. Sparse merkle trees that leverage circuit friendly hash functions (e.g Poseidon, Rescue-Prime) are performant in a ZKP setting and as such this library can serve this purpose. This library supports both indexed merkle trees (max depth 64) and keyed (addressable) merkle trees (max depth usize::MAX).
Structs§
- Index
TreeDB - An immutable merkle tree db that uses a u64 index to specify the leaves in the tree. Wraps a KeyedTreeDB and converts a u64 index to a Key of the appropriate depth to access the underlying TreeDB.
- Index
TreeDB Builder - Used to construct an IndexTreeDB
- Index
TreeDB Mut - A mutable merkle tree db that uses a u64 index to specify the leaves in the tree. Wraps a KeyedTreeDBMut and converts a u64 index to a Key of the appropriate depth to access the underlying TreeDB.
- Index
TreeDB MutBuilder - Used to construct a IndexTreeDBMut
- Recorder
- Recorder to record database reads.
- Storage
Proof - A proof that some set of key-value pairs are included in a sparse merkle tree.
- TreeDB
- An immutable merkle tree db that uses a byte slice key to specify the leaves in the tree.
- TreeDB
Builder - Used to construct a TreeDB
- TreeDB
Mut - A mutable merkle tree db that uses a byte slice key to specify the leaves in the tree.
- TreeDB
MutBuilder - TreeDBMutBuilder use to build a TreeDBMut
Enums§
- Tree
Error - Errors associated with the tree. These errors are returned by the tree methods and wrap errors returned by the underlying components, these include:
Traits§
- HashDB
- Trait modelling datastore keyed by a hash defined by the
Hasher
. - HashDB
Ref - Trait for immutable reference of HashDB.
- Hasher
- Trait describing an object that can hash a slice of bytes. Used to abstract
other types over the hashing algorithm. Defines a single
hash
method and anOut
associated type with the necessary bounds. - Index
Tree - A immutable index-value datastore implemented as a database-backed sparse merkle tree.
- Index
Tree Mut - A mutable index-value datastore implemented as a database-backed sparse merkle tree.
- Keyed
Tree - A immutable key-value datastore implemented as a database-backed sparse merkle tree.
- Keyed
Tree Mut - A mutable key-value datastore implemented as a database-backed sparse merkle tree.
- Tree
Recorder - A trait that allows recording of tree nodes.
Type Aliases§
- DBValue
- The type of value stored in the database backend.