alloy-merkle-tree
Minimal Merkle Tree implementation
- type compatible with alloy-primitives
- keccak hash as native hash
- support features: insert, proof, verify
Quick Start
alloy-merkle-tree =
Example
- Insert
let mut tree = new;
// Should be 2 ^ N leaves
let num_leaves = 16;
for i in 0..num_leaves
- Finish finalize tree, meaning calculate root and layers
let mut tree = new;
// fill elements with insertion
tree.finish;
- Create Proof & Verify
Create proof is base on layer, so tree need to be finalized before.
let mut tree = new;
// fill elements with insertion
tree.finish;
for i in 0..num_leaves