Stellar
Compliance without deanonymising
A second circuit that proves a withdrawer is on an approved list without saying who they are.
Overview
Veilum's Association Set Provider circuit extends the transfer circuit. On unshield, it additionally proves the owner's key is a leaf in the ASP membership tree, so pool operators can gate exits while transfers inside the pool stay private and ASP-free.
The code
packages/circuits-asp/src/main.nrView on GitHub ↗
fn main(
// … private inputs, including the ASP Merkle path and
membership_blinding: Field,
// … public inputs shared with the transfer circuit, plus
asp_membership_root: pub Field,
owner_pk_public: pub Field,
) {
// …
assert(owner_pk == owner_pk_public);
let asp_leaf = poseidon2_hash3(owner_pk, membership_blinding, 2);
assert((if verify_asp_path(asp_leaf, asp_merkle_siblings, asp_merkle_directions, asp_membership_root) { 1 } else { 0 } - 1) * mode == 0);
// … then the same note, nullifier and conservation constraints as the transfer circuit
}
How it works
- The membership leaf is a Poseidon2 hash of the owner key and a private blinding
- The membership check is multiplied by mode, so it only binds on withdrawals
- The public owner key must match the one derived from the spending key, linking the two proofs