Expand description
Merkle Tree and related data structures.
This crate contains several Merkle Tree implementations and related data structures, many of which are a subset of each other.
Currently BalancedMerkleTree
, UnbalancedMerkleTree
and MerkleMountainRange
and
SparseMerkleTree
are available.
BalancedMerkleTree
is an optimized special case of UnbalancedMerkleTree
, which is in
turn an optimized version of MerkleMountainRange
and all 3 will return the same results for
identical inputs.
SparseMerkleTree
is a special kind of Merkle Tree, usually of untractable size, where most
of the leaves are empty (missing). It will also produce the same root as other trees in case the
tree doesn’t have any empty leaves, though it is unlikely to happen in practice.
Modules§
- balanced
- mmr
- sparse
- Sparse Merkle Tree and related data structures.
- unbalanced
Constants§
- INNER_
NODE_ DOMAIN_ SEPARATOR - Used as a key in keyed blake3 hash for inner nodes of Merkle Trees.
Functions§
- hash_
pair - Helper function to hash two nodes together using [
ab_blake3::single_block_keyed_hash()
] andINNER_NODE_DOMAIN_SEPARATOR
- hash_
pair_ block - Similar to
hash_pair()
but already has left and right nodes concatenated - hash_
pairs - Similar to
hash_pair()
, but hashes multiple pairs at once efficiently.