This project implements a decentralized voting protocol that combines token burning mechanisms with zero-knowledge proofs to ensure vote privacy and weight verification.
Before setting up the project, ensure the following tools are installed:
- Node.js (>=16.0.0) - Install Node.js
- Rust (for Cargo) - Install Rust
- Homebrew (for macOS) - Install Homebrew
- Circom - Install Circom
To set up the project, follow these steps to get the project up and running on your local machine.
-
Clone the Repository:
git clone git@github.com:zero-savvy/POB-Anonymous-Voting.git cd POB-Anonymous-Voting -
Install Project Dependencies:
npm install npm run install-deps
This will:
- Install all Node.js dependencies including Circomlib, ganache-cli and snarkjs.
- Run additional setup scripts to install Rapidsnark in the circuits folder.
-
Start Ganache Locally:
ganache
This will start a local blockchain instance for testing.
-
Add the deployer private key to Makefile deploy command:
Copy Private key from ganache accounts and add to deploy command in Makefile.
-
Deploy contract:
make deploy
-
Run circuit commands:
make trusted_setup make vote_circuit make vote_zkey make vote_vkey
-
Generate a burn address:
cargo run -- burn-address
-
Generate Nullifier:
First, generate the required input.json file:
cargo run -- nullifier <private-key> <ceremony-id> <blinding-factor>
Then, execute the entire nullifier workflow with:
make nullifier
This command will:
- Compile the circuit.
- Perform the trusted setup.
- Generate the witness.
- Create the proof.
- Verify the proof.
- Clean up intermediate files.
-
Burn some ETH:
cargo run -- burn
-
Vote:
cargo run -- vote
-
Check your vote proof:
cargo run -- verify
- Vote Privacy: Ensures complete privacy in proof generation and submission using zero-knowledge proofs.
- Public Verifiability: Allows public verification of vote weights without revealing individual votes.
- Coercion Resistance: Prevents vote selling and coercion through unique burn addresses tied to personal data.
- Double Voting Prevention: Uses nullifiers to prevent double voting and ensure each vote is unique.
- Token Burning: Users burn tokens to create irreversible, publicly verifiable vote weights.
- Zero-Knowledge Proofs: Prove correct weight attribution while preserving vote privacy.
- Nullifier Construction: Prevents double voting and allows public verification.
- Burn Transaction: Users burn tokens during the voting period, generating a unique burn address.
- Proof Generation: Generate zero-knowledge proofs to prove token burn and vote validity.
- Proof Submission: Submit proofs and votes to the smart contract for verification.
- Replay Attack Prevention: Nullifiers prevent resubmission of votes.
- Privacy: zk-SNARKs ensure voter identities and token amounts remain hidden.
- Verifiable Results: All proofs and votes are verified and tallied on-chain.
This protocol provides a secure, private, and verifiable decentralized voting system using token burning and zero-knowledge proofs. It addresses key challenges in decentralized voting, including vote privacy, public verifiability, and double voting prevention.