Expand description
Sparse Merkle Tree implementation compatible with circomlibjs/smt.js
This is a Rust port of the Sparse Merkle Tree implementation from:
- JavaScript: https://github.com/iden3/circomlibjs/blob/main/src/smt.js
This implementation uses Poseidon2 hash function for compatibility with circomlib circuits.
Structs§
- Find
Result - Find result for internal operations
- SMTMemDB
- In-memory database implementation Stores every node (leaves and internal nodes) as raw BigInt vectors, matching circomlibjs layout.
- SMTProof
- Proof data tailored for Circom inputs (BigInt-based).
- SMTResult
- Result of SMT operations
- Sparse
Merkle Tree - Sparse Merkle Tree implementation matching circomlibjs/smt.js Provides insert/update/delete/find helpers that operate entirely over BigInts so test harnesses can generate witnesses identical to the JavaScript reference implementation.
Traits§
- SMTDatabase
- Database trait for SMT storage
Functions§
- new_
mem_ empty_ trie - Create a new empty SMT with an in-memory database
- poseidon2_
compression_ sparse - Poseidon2 hash of two field elements using optimized compression mode
- poseidon2_
hash3_ sparse - Poseidon2 hash function for leaf nodes (key, value, 1)
- prepare_
smt_ proof - Prepare an SMT proof after pre-populating the tree with values 0..100
- prepare_
smt_ proof_ with_ overrides - Build a sparse SMT from
overridesand return a proof forkey.overridesis (key, value) pairs already reduced modulo field.