Documents

ZK privacy

Anonymous signals with zero-knowledge proofs: private polls on Base Mainnet, how they work and where they are deployed.

Status: LIVE on Base Mainnet since 22 November 2026. The app's Private screen runs polls on it.

Contract Address on Base Mainnet
ARLAnonymousSignal 0x87C05cB26FFB56181ca561Dd9c11DD5D9d2ea2d4
Verifier 0xcC7d37b1Cf9eFd560b6F594F3C4eDB03bEFB6F53
RelationsLib 0xA7c9Dcd8dad85022f3F3ddA21a470C9c7765F368
ZKTranscriptLib 0xb3d028c39A88bBFbB56973FBB44638345749E96b

The record is contracts/deploy/base-mainnet-signal.json. It was written only after the deployed verifier accepted a real proof and refused the same proof with another message. The source of all four is verified on Sourcify (full match), and the contract, the verifier and RelationsLib on Basescan (exact match).

Members of a group can signal (vote in a poll, attest, give feedback) without revealing which member they are, and each member signals once per scope. This follows the Semaphore protocol.

How it works

Part What it is
Identity A secret number. Its public commitment is Poseidon(secret). In the app the secret is derived from a wallet signature over a fixed message, so it is never stored and can be recreated.
Group A Merkle tree (LeanIMT) of commitments. The admin publishes the new commitments (MembersAdded event) and the tree's root; the contract stores only the root.
Proof A zero-knowledge proof (Noir circuit, UltraHonk) that "I know the secret of one commitment under this root", bound to a scope and a message. It reveals neither the secret nor the member.
Nullifier Poseidon(scope, secret): the same every time a member signals in a scope, different across scopes and members. The contract accepts each nullifier once.
Contract ARLAnonymousSignal: groups (admin and root), a one-hour grace period for a replaced root, one signal per nullifier, and the generated verifier.

Code

Path Contents
zk/semaphore/ Noir circuit (max depth 16, 65,536 members); 5 circuit tests
zk/check.sh Runs the circuit tests and rebuilds the circuit and verifier; fails if the committed artifacts differ
packages/zk/ @arl/zk: identities, groups, circuit inputs, proving (noir_js + bb.js) and verification; circuit/ holds the compiled circuit
contracts/src/ARLAnonymousSignal.sol The signal contract (Apache-2.0)
contracts/zk/ARLSemaphoreVerifier.sol The UltraHonk verifier, generated by bb 5.2.0 (evm target: keccak transcript, zero knowledge), committed as generated
contracts/zk-script/DevZk.s.sol Deploys the verifier and the contract on local Anvil only (the app's fixture)
contracts/test-zk/ Contract tests with real proofs (FOUNDRY_PROFILE=zk forge test); fixture from npm run fixture -w @arl/zk

The verifier lives in a separate Foundry profile because Slither cannot parse the generated file; Slither still analyses ARLAnonymousSignal.

Choices

  • Noir and Barretenberg, not circom and snarkjs. snarkjs and circomlib are GPL-3.0; the Noir compiler, noir_js, bb.js and the libraries used are MIT or Apache-2.0.
  • Poseidon(secret) identities (as in Semaphore v3) instead of Semaphore v4's Baby Jubjub keys. The Noir Baby Jubjub library used by Semaphore-Noir has no license, so it is not used. The circuit is also smaller (about 19,000 gates), which keeps proving in a browser practical.
  • Root published by the admin instead of an on-chain tree: no on-chain Poseidon, and group membership rules (for example verified whitelist members) stay with the group's admin.

Deployment on Base Mainnet

The contracts are deployed like every other ARL contract: a Foundry dry run writes the transactions, the app's Deploy screen checks them and the owner signs them one at a time.

Step What
Script contracts/zk-script/DeployMainnetSignal.s.sol (Base Mainnet and the local chain only): the verifier, then ARLAnonymousSignal with that verifier
Plan apps/dapp/public/plans/8453-signal.json, opened on the Deploy screen with ?plan=8453-signal
Checks Before anything is signed the screen compares each transaction with the build, byte for byte (below)
Record node packages/deploy/src/signal-record-cli.ts <run.json> https://mainnet.base.org contracts/deploy/deployments/8453-signal.json: written only if the deployed verifier accepts a real proof and refuses a changed one

The generated verifier calls two libraries, RelationsLib and ZKTranscriptLib. Forge creates libraries through the canonical CREATE2 deployer with the zero salt, so a library's address follows from its code alone and is the same on every chain. The Deploy screen therefore accepts:

  • a library creation only when it goes to that deployer, uses the zero salt and carries exactly the library code of the build;
  • the verifier only when the two library addresses inside its code are the addresses that follow from that library code, and the rest of its code is the build;
  • ARLAnonymousSignal only when its code is the build; its verifier argument is shown.

ZKTranscriptLib does not depend on the circuit and already exists on Base Mainnet at its address, with the same code as the build, so the plan creates RelationsLib only. The whole plan was rehearsed on a fork of Base Mainnet: three transactions, about 6.5 million gas, and the deployed verifier accepted a real proof.

The plan was signed on 22 November 2026 from the deployer's nonces 53 to 55 (blocks 60,748,351, 60,748,732 and 60,749,975). Every contract was created at the address the rehearsal gave, and signal-record-cli.ts passed all nine checks on Base Mainnet.

The relayer

A proof never says which member voted, but a transaction has a sender. If a member sends the vote from a wallet that is linked to them, the sender gives away what the proof hides. A relayer sends the transaction instead, so the sender on chain is the relayer.

Part What it is
Rule packages/zk/src/relay.ts: what is relayed and what is refused
Service functions/api/zk/relay.js: GET /api/zk/relay says whether it is on and for which polls; POST relays one signal
App The Private screen sends a vote through the relayer when the relayer serves that poll, and from the connected wallet otherwise; the page says which

It is the one ARL service that holds a key, and the key pays gas and nothing else. It cannot vote or change a vote: the proof binds the group, the poll, the option and the nullifier, and the contract checks it. Because it pays, it guards what it pays for:

  • it relays only the polls named in its settings (group:poll), so what it can spend is one fee per member per served poll, and nobody can open a group or a poll of their own at its cost;
  • it simulates the call first and sends nothing the contract would refuse (a second vote, an unknown root, an invalid proof);
  • it refuses when the network fee is above its ceiling, and a call that needs more gas than a signal of this circuit uses;
  • it answers only the app on the same site.

The key is a secret of the deployment, set by the operator and never in the repository. Without the key, the contract address and the list of polls the service is off, and the app sends votes from the connected wallet. Like any web service it sees the network address a request comes from; it does not store it. A member who does not want to rely on that can vote from a wallet of their own that is not linked to them.

Rehearsed on a fork of Base Mainnet with the committed fixture: the relayer sent a real proof (about 2.6 million gas), and a repeated vote and a changed message were refused with nothing sent.

In the app

The app's Private screen runs an anonymous poll with this contract; see app.md.

Costs and limits

  • Proving takes a few seconds (about 4 s for prove and verify in the tests).
  • On-chain verification costs about 3 million gas per signal.
  • The admin decides who is in the group and can publish a new root; the admin cannot signal for members, learn who signalled or reuse a nullifier. Renouncing the admin role freezes the group.
  • Anyone who sees a signal transaction can resubmit the same proof; it records the same signal and is then refused as a used nullifier.

Tests

Suite Command Covers
Circuit nargo test in zk/semaphore Single-member group, sibling order, nullifier per scope, zero secret refused, over-long proof refused
TypeScript npm test -w @arl/zk Commitments, LeanIMT, field hashing, non-members refused, a real proof verified, a changed message refused
Contract FOUNDRY_PROFILE=zk forge test Valid signals accepted once per scope; changed message, scope, nullifier, proof byte or root refused; root grace period; admin