How ZK voting on Cardano works: what the contracts guarantee, and where it stops

We built an open-source zero-knowledge voting protocol on Cardano L1: a port of Semaphore to BLS12-381 with Plutus v3 validators written in Aiken, plus a hosted app on Mainnet and Preprod. This post walks through the mechanism and says precisely what is enforced by the chain, what is enforced by the application, and what is not enforced at all.

  1. Identity

On registration, the voter’s browser draws two secrets and keeps them. Only a commitment, a hash of both, is registered with the organiser. Commitments form a Merkle tree. When the organiser publishes the event, the tree’s root is written into the voting contracts’ datum on-chain and cannot change for that event.

  1. Proof

To vote, the browser builds a Groth16 proof with four public inputs: the group root, a nullifier, the hash of the vote message, and an event-specific value (the validator’s own script hash). The proof states: I know a secret whose commitment is in this tree. It does not say which one.

  1. Verification on-chain

Plutus v3 has BLS12-381 builtins, so the pairing check runs inside the validator. The verification key sits in a reference UTxO that every vote transaction reads. The relay checks the proof before paying for the transaction, but the chain does not rely on that check.

  1. One vote per person

The nullifier is derived from the secret and the event-specific value, so one identity always yields one nullifier per event. Used nullifiers live in a Merkle Patricia trie whose root is in the datum; the validator checks non-membership, inserts the nullifier, and updates the root. A second vote from the same identity fails on-chain.

  1. Tally

The vote message is CBOR, hashed with blake2b-256 and bound to the proof as a public input. The voting validator decodes it, checks the option indices and, for weighted votes, that the points sum to the voter’s weight, and updates the per-option counts in the datum. Simple and weighted votes use the same path.

  1. No wallet for voters

The browser sends proof, nullifier and signal to a relay; the relay builds, pays and submits the transaction. The proof binds the signal, so the relay cannot alter a vote. No voter address appears on-chain. Organisers need a wallet; voters need only their invitation link.

Where it stops

Cardano has no private state, and we would rather say where the design ends than overpromise:

  • Anonymity, not ballot secrecy. The proof hides who voted. The chosen option is readable on-chain, just not attributable to anyone. Interim results are hidden by the application, not by cryptography. Encrypted ballots or commit-reveal are the next construction.
  • A hosted server could correlate. The voter asks the server for their Merkle path and then submits the vote through the same server; an operator who logs both can link them. Self-hosting removes that trust in us; serving the frozen group so that clients compute their own path is the protocol-level fix on the roadmap.
  • The relay is a delivery intermediary. It can delay or withhold a vote; it cannot forge or alter one. A second relay or an independent submission path is not in place yet.
  • Throughput is bounded. Every vote spends the same state UTxOs, so votes are serialised per network and each waits for the previous one to be on-chain. A large group needs a long window.

What the contracts do guarantee

Only invited members can vote, each at most once, the tally cannot be edited after the fact, and anyone can recount it from the chain. The contracts went through a property-based audit: every property each validator must uphold was stated before reading the code, then traced to the enforcing condition and a test. The report, the test reports and the full list of known limits are in the repository.

Links

Questions on the design are welcome, especially on the ballot secrecy question. If your group wants to run a real vote with it, or fork it to self-host, say so here or open an issue.