How lucianolupo/zk-voting-semaphore-001 works
This is a Semaphore-based anonymous voting dApp. Poll creators configure polls; voters create or import a local identity, register during the registration phase, generate a membership proof to vote, and view public results. The frontend reads and writes poll state through Wagmi to the voting contract, which manages poll phases, Semaphore groups, proof verification, and nullifiers. The sampled sources show the frontend call paths; contract internals are represented from the README because Solidity excerpts were not provided.
Main entry points: [id]/page.tsx Poll participation · useVoting.ts Poll queries and actions · create/page.tsx Poll creation · useIdentity.ts Identity management
Components 14
Voting frontend
- Poll listing
app/app/page.tsx - Poll creation
app/app/create/page.tsx - Poll participation
app/app/poll/[id]/page.tsx - Wallet providers
app/app/providers.tsx - Poll queries and actions
app/hooks/useVoting.ts
Identity and proofs
- Identity management
app/hooks/useIdentity.ts - Local identity storage
app/lib/storage.ts - Proof generation
app/hooks/useSemaphore.ts
On-chain voting
- Contract binding
app/lib/contracts.ts - Poll lifecycle and voting
contracts/SemaphoreVoting.sol - Voting ABI
app/lib/abi.json
Other components
- Poll creator
- Voter
- Semaphore protocol
Connections 12
- Poll creator → Poll creation: creates poll
app/app/create/page.tsx - Poll creation → Poll queries and actions: calls createPoll
app/app/create/page.tsx - Poll listing → Poll queries and actions: queries poll data
app/app/page.tsx - Voter → Poll participation: registers and votes
README.md - Poll participation → Poll queries and actions: queries and submits
app/app/poll/[id]/page.tsx - Poll participation → Identity management: uses identity
app/app/poll/[id]/page.tsx - Poll participation → Proof generation: requests vote proof
app/app/poll/[id]/page.tsx - Identity management → Local identity storage: loads and saves
app/hooks/useIdentity.ts - Proof generation → Semaphore protocol: generates proof
README.md - Poll queries and actions → Contract binding: uses address and ABI
app/hooks/useVoting.ts - Contract binding → Voting ABI: imports ABI
app/lib/contracts.ts - Poll lifecycle and voting → Semaphore protocol: verifies proofs
README.md