Skip to content

v0.6.3: ZK Polls

Choose a tag to compare

@stackdump stackdump released this 19 Mar 20:11
· 61 commits to main since this release
834c86d

bitwrap v0.6.3

Anonymous voting with zero-knowledge proofs. Create polls, cast secret ballots, verify results — all from a Petri net model.

ZK Poll System

  • Vote template — visual Petri net model for voting state machines (voterRegistry, nullifiers, tallies, pollConfig)
  • VoteCast circuit — Groth16 proof of voter eligibility and valid choice without revealing identity or choice
  • Secret ballots — vote choice hidden behind blinded commitment mimcHash(voterSecret, choice), can't be brute-forced
  • Circuit-enforced boundsmaxChoices public input rejects out-of-range choices at the proof level
  • 5 public inputs: pollId, voterRegistryRoot, nullifier, voteCommitment, maxChoices

Poll Lifecycle

  • Create — wallet signature required (EIP-191 personal_sign), rate limited (5/hr per IP + wallet)
  • Vote — ZK proof generated client-side, server re-verifies via gnark, tally updated in real-time
  • Close — only the creator's wallet can close
  • Results — event-sourced through the Petri net runtime: State(t) = fold(apply, initialState, events[0..t])

Privacy Model

Data Visibility
Voter identity Hidden (nullifier unlinkable to registry leaf)
Vote choice Hidden (blinded commitment, never persisted per-vote)
Voter secret Hidden (never leaves browser)
Vote count Public
Per-choice tallies Public (derived from event log)

On-Chain Governance

  • IVerifier interface with Groth16 proof verification in castVote
  • Contract stores voteCommitments[nullifier], not plaintext choices
  • Foundry bundle: contract + verifier + tests + deploy script (8/8 tests pass)
  • Constructor: (voterRegistryRoot, maxChoices, verifier)

Poll UI

  • bitwrap.io/poll — create, vote, close, view results
  • bitwrap.io/poll#deploy — download Foundry bundle or Solidity contract
  • MetaMask integration for poll creation and wallet-derived voter secrets

API Endpoints

Method Path Purpose
POST /api/polls Create poll (wallet sig required)
GET /api/polls/{id} Get poll config + state
POST /api/polls/{id}/vote Submit ZK-proven vote
POST /api/polls/{id}/close Close poll (creator only)
POST /api/polls/{id}/reveal Reveal vote (fallback)
GET /api/polls/{id}/results Tallies from event log
GET /api/polls/{id}/nullifiers Public audit log

Size Limits

  • Title: 200 chars, Description: 2000 chars
  • Choices: 2–256 (matches circuit's 8-bit range proof)
  • Voter commitments: 10,000 max
  • Duration: up to 90 days