Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lean Incremental Merkle Tree inclusion proof #17

Open
simon-something opened this issue Jan 1, 2025 · 4 comments
Open

Lean Incremental Merkle Tree inclusion proof #17

simon-something opened this issue Jan 1, 2025 · 4 comments
Labels
feature 🚀 This is enhancing something existing or creating something new

Comments

@simon-something
Copy link

simon-something commented Jan 1, 2025

Describe the package you'd like
A circuit to calculate the root of a lean incremental Merkle tree based on a leaf, its index and its siblings, effectively proving membership of the leaf.

Additional context
There are currently implementations of lean incremental Merkle tree in typescript and solidity in the respective zk-kit repo, but no Circom equivalent. This would provide a way to verify a leaf inclusion, by computing the root based on the leaf, its path/index, and its siblings.

This cannot be done with the current binary Merkle tree taken from Semaphore, as partial subtrees are treated differently (orphan nodes hashed with placeholders vs propagated without hashing).

Side-note: this is a low-hanging fruit as it's already implemented in a @defi-wonderland project (unaudited for now) - I'm just gauging interest in this contribution before writing a readme/proper docs/etc

@simon-something simon-something added the feature 🚀 This is enhancing something existing or creating something new label Jan 1, 2025
@cedoor cedoor added this to ZK-Kit Jan 6, 2025
@github-project-automation github-project-automation bot moved this to 📋 Backlog in ZK-Kit Jan 6, 2025
@cedoor cedoor moved this from 📋 Backlog to ♻️ Grooming in ZK-Kit Jan 6, 2025
@cedoor cedoor moved this from ♻️ Grooming to 📋 Backlog in ZK-Kit Jan 6, 2025
@cedoor
Copy link
Member

cedoor commented Jan 6, 2025

Hi @simon-something, thanks for this issue. Could you point to the implementation of @defi-wonderland?

@simon-something
Copy link
Author

Hi @cedoor ! Thanks for the answer, unfortunately, the repo is private for now (temporarily tho), here is the implementation in a gist: https://gist.github.com/simon-something/b705500d534f25289e9f5db1ffb275d6 (tested with circomkit/zk-kit LIMT, happy to open a PR with all this if you think it can be of any use!)

@ronanyeah
Copy link

That's a great circuit @simon-something - I have implemented it here: https://github.com/ronanyeah/sui-zk-airdrop

@simon-something
Copy link
Author

simon-something commented Jan 17, 2025

Hey @ronanyeah Great! Good job on the Rust one:)

Watchout that this implementation has not been audited, nor been used in prod (yet)/use at your own risk;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature 🚀 This is enhancing something existing or creating something new
Projects
Status: 📋 Backlog
Development

No branches or pull requests

3 participants