Available on crate feature
unstable only.Expand description
Blake2b256 Merkle tree.
This module implements a binary Merkle tree using Blake2b256 and the RFC-6962-style domain-separation scheme:
- leaves are hashed as
BLAKE2b-256(0x00 || leaf_bytes), - inner nodes are hashed as
BLAKE2b-256(0x01 || left_bytes || right_bytes), - empty subtrees are represented as the all-zero 32-byte node.
Levels with an odd number of nodes are padded with one Node::Empty
sibling on the right.
None of the types in this module implement Serialize or Deserialize:
the Merkle tree and its proofs are in-memory constructs. Code that needs
to transport a proof across a process boundary should define its own wire
representation and convert at the boundary.
Structs§
- Merkle
NonInclusion Proof - A non-inclusion proof for a tree built over sorted leaves.
- Merkle
Proof - An inclusion proof for a leaf in a
MerkleTree. - Merkle
Tree - A Blake2b256 Merkle tree.
Enums§
- Merkle
Error - An error returned by Merkle tree construction or proof verification.
- Node
- A node in the Merkle tree.
Constants§
- DIGEST_
LEN - Byte length of a Merkle digest (32 bytes; Blake2b256).
- EMPTY_
NODE - The 32-byte representation of an empty subtree.
- INNER_
PREFIX - Domain-separation prefix applied to every inner node before hashing.
- LEAF_
PREFIX - Domain-separation prefix applied to every leaf before hashing.