Skip to content

About

Trustless on-chain Semaphore group tree for Stellar (LeanIMT + circomlib Poseidon)

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

7 Commits

Folders and files

Repository files navigation

Semaphore for Stellar — Trustless On-chain Groups

A trustless on-chain Semaphore group tree for Soroban/Stellar, companion to the semaphore-stellar library.

In the base library the Merkle tree is kept off-chain and the admin pushes roots (a trust assumption). Here the tree lives on-chain: members are appended and the Merkle root is computed on-chain from the actual membership, using a circomlib-compatible Poseidon (via soroban-poseidon over CAP-75) and the @zk-kit LeanIMT rule. No one — not even the admin — can publish a root that does not match the real members: the root is derived, not asserted.

The on-chain root is identical to what Semaphore's Group / @zk-kit LeanIMT computes, so it interoperates with the sdk-29 verifier in the main library.

Contract (contracts/groups)

  • create_group(admin) → group id
  • add_member(group_id, commitment) → new count (recomputes + emits the root on-chain)
  • root(group_id) → current Merkle root
  • member_count(group_id)

Verified

cargo test            # on-chain Poseidon == circomlib; on-chain root == @zk-kit LeanIMT (sizes 1..5)
stellar contract build

Live on testnet (see DEPLOYMENT.md): adding members 1..5 yields the exact @zk-kit LeanIMT root 11512324111804726054755717642058292259866309947044530224809882918003853859592.

Note on the toolchain

Built against soroban-sdk 28 because the Poseidon host primitive is currently only reachable through soroban-poseidon (sdk-28). The sdk-29 contracts in the other repos consume the root it produces unchanged. Once the SDK exposes a public Poseidon (≥29), this can move to sdk 29.

Status & safety

⚠️ Prototype — unaudited, testnet only. This code has not been audited and runs only on Stellar testnet with small fixtures. Do not use it with real value or on mainnet.

Known limitations

  • add_member recomputes the whole LeanIMT root on-chain (O(n) hashes per add, O(n²) over a group's life) — large groups can hit Soroban resource limits. An incremental-root optimization is planned.
  • No dedup of commitments and no max-depth cap; the Semaphore circuit assumes a fixed maximum depth, which the caller must respect.
  • Storage TTL is managed: create_group/add_member extend the instance storage and the group's admin + leaves entries by ~30 days (bumping when under ~15 days remain), so an actively-used group never archives. A group left completely idle past the bump window still needs a one-time Soroban restore.

Proofs reuse Ethereum's Semaphore trusted-setup ceremony (no new ceremony is performed).

License

MIT — see LICENSE.

About

Trustless on-chain Semaphore group tree for Stellar (LeanIMT + circomlib Poseidon)

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages