Expand description
Merkle Sum Sparse Merkle Tree implementation
This crate provides an implementation of a Merkle Sum Sparse Merkle Tree (MSSMT) based on this implementation https://github.com/lightninglabs/taproot-assets/tree/main/mssmt, which combines the properties of both Merkle Sum Trees and Sparse Merkle Trees.
The tree supports:
- Efficient sparse storage
- Sum aggregation at each level
- Cryptographic verification
- Flexible storage backend through the
Db
trait
Structs§
- Branch
- A branch is a node that has exactly 2 children. Those children can either be
any type of
Node
. Those nodes hold the sum of all their descendants. - Compact
Leaf - A compact leaf is a leaf doesn’t require all the empty parts of the path to be inserted. When required we can extract all the branches on that path. The node hash is the hash of the node at the top of the path.
- CompactMSSMT
- A compact Merkle Sum Sparse Merkle Tree implementation.
- Compressed
Proof - A compressed merkle proof for a given key. We don’t store all the nodes if they are empty.
- Computed
Node - A computed node. Useful for traversing the tree without reconstructing branches which contains their children and are expensive to reconstruct.
- Empty
Leaf - Represents an empty leaf in the tree. Those leaves have no
value
and hold0
as sum value. - Empty
Tree - Helper struct to create an empty mssmt.
- MSSMT
- Merkle sum sparse merkle tree.
- Memory
Db - A simple in-memory database implementation for testing
- Proof
- A merkle proof for a given key.
Enums§
Traits§
- Db
- Store for the tree nodes
- Hasher
- Simple hash trait required to hash the nodes in the tree
- Thread
Safe - Thread safety marker trait
Functions§
- walk_up
- Walk up the tree from the node to the root node.