Stores only D sibling hashes (the "frontier") instead of the full tree, giving O(D) memory regardless of how many elements have been inserted. Supports depths up to 256, enabling trees with up to 2^256 leaf slots.
Produces identical root hashes and append proofs as IncrementalMerkleTree for the same key sequence. On-chain IncrementalMerkleTree.append() and verifyMembership() work unchanged with proofs from this tree.
Membership proofs require an external element source — see proveMembership.
Returns (newTree, appendProof) where appendProof is D * 32 bytes of sibling hashes (bottom-up), compatible with on-chain IncrementalMerkleTree.append().
Generate a membership proof for the element at the given slot.
Generate a membership proof for the element at the given slot.
Since the frontier tree does not store the full tree, an external element source is required. The getElement function must return the original key at each slot index (0 until size).
Returns D * 33 bytes: D repetitions of (direction[1] + sibling[32]), compatible with on-chain IncrementalMerkleTree.verifyMembership().
Value parameters
cache
optional cache for subtree hashes; reuse across multiple proofs for O(D) per proof after the first O(N) warmup
getElement
function returning the original key at a given slot index