Expand description
Sparse Merkle Tree implementation
This is a Soroban-compatible port of the Sparse Merkle Tree implementation from:
- circuits/src/test/utils/sparse_merkle_tree.rs (Rust reference implementation)
- circomlibjs: https://github.com/iden3/circomlibjs/blob/main/src/smt.js
This implementation uses Poseidon2 hash function for compatibility with the circomlib circuits
§Design Considerations
This is a full on-chain implementation where all tree nodes are stored in contract storage. While not the most cost-efficient approach, it provides:
- Easy interaction and verification for users
- Complete on-chain state for non-membership proofs
- Flexibility to migrate to IPFS-based storage later if needed
For scalability with large blocked key lists, consider the hybrid approach from: https://www.newswise.com/pdf_docs/170903654855378_1-s2.0-S2096720923000519-main.pdf We still present this implementation, as it allows making the decision to switch to IPFS-based storage later if needed.
Structs§
- ASPNon
Membership - ASPNon
Membership Args - ASPNonMembershipArgs is a type for building arg lists for functions defined in “ASPNonMembership”.
- ASPNon
Membership Client - ASPNonMembershipClient is a client for calling the contract defined in “ASPNonMembership”.
- Find
Result - Result of a find operation in the sparse Merkle tree