Expand description
This module contains the StandardMerkleTree, an implementation of the standard Merkle Tree data structure.
Check out StandardMerkleTree for more details.
§Examples
use alloy_merkle_tree::standard_binary_tree::StandardMerkleTree;
use alloy_dyn_abi::DynSolValue;
let num_leaves = 1000;
let mut leaves = Vec::new();
for i in 0..num_leaves {
leaves.push(DynSolValue::String(i.to_string()));
}
let tree = StandardMerkleTree::of_sorted(&leaves);
for leaf in leaves.iter() {
let proof = tree.get_proof(leaf).unwrap();
let is_valid = tree.verify_proof(leaf, proof);
assert!(is_valid);
}
Structs§
- Standard
Merkle Tree - Represents a standard Merkle tree with methods for proof generation and verification.
Enums§
- Merkle
Tree Error - The error type for the StandardMerkleTree.