Expand description
Sparse Merkle Tree and related data structures.
Sparse Merkle Tree is essentially a huge Balanced Merkle Tree, where most of the leaves are
empty. By “empty” here we mean [0u8; 32]
. In order to optimize proofs and their verification,
hashing function is customized and returns [0u8; 32]
when both left and right branch are
[0u8; 32]
, otherwise BLAKE3 hash is used like in a Balanced Merkle Tree.
Structs§
- Sparse
Merkle Tree - Sparse Merkle Tree variant that has hash-sized leaves, with most leaves being empty
(have value
[0u8; 32]
).
Enums§
- Leaf
- Sparse Merkle Tree Leaf
Constants§
- INNER_
NODE_ DOMAIN_ SEPARATOR - Used as a key in keyed blake3 hash for inner nodes of Merkle Trees.
Functions§
- ensure_
supported_ bits - Ensuring only supported
NUM_BITS
can be specified forSparseMerkleTree
. - hash_
pair - Helper function to hash two nodes together using [
ab_blake3::single_block_keyed_hash()
] andINNER_NODE_DOMAIN_SEPARATOR