Skip to main content

private_vote Circuit

private_vote lets a token holder cast a boolean vote while proving eligibility (balance at least a threshold), committing to both the balance and the vote with Poseidon — without revealing the balance or linking the vote to an identity. Size: k=11.


What it proves

For the witnesses below and a public threshold, the circuit proves:

  1. balance_commitment = Poseidon(balance, randomness_balance).
  2. vote_commitment = Poseidon(vote, randomness_vote).
  3. vote ∈ {0, 1} — the vote is boolean.
  4. balance ≥ threshold — voter eligibility, without revealing the balance.

Witness

private_vote.json
{
"balance": "500",
"randomness_balance": "11",
"vote": "1",
"randomness_vote": "22",
"threshold": "100"
}
FieldTypeVisibilityDescription
balanceu64privateVoter's token balance
randomness_balancefieldprivateCommitment randomness for balance
voteu64privateBoolean vote value (0 or 1)
randomness_votefieldprivateCommitment randomness for vote
thresholdu64publicMinimum balance required to vote

Public inputs

InputDescription
balance_commitmentPoseidon(balance, randomness_balance)
thresholdPublic eligibility threshold
vote_commitmentPoseidon(vote, randomness_vote)
note

The current circuit exposes the commitments and threshold as public inputs; it does not expose a nullifier, so double-vote prevention would be enforced by the surrounding contract (e.g. a registry of balance_commitments).