A blockchain-based voting system that achieves true anonymity through zero-knowledge proofs while maintaining verifiability. This system runs on a local blockchain to eliminate transaction costs and provides cryptographic receipts for verification without compromising privacy.
This voting system solves the fundamental tradeoff between anonymity and verifiability in digital voting by implementing:
- True Anonymity: Uses zero-knowledge proofs to completely sever the link between a voter's identity and their choices
- Local Blockchain: Eliminates transaction costs while maintaining security and transparency
- Modular Architecture: Three specialized contracts rather than a monolithic structure
- Cryptographic Receipts: Allows voters to verify their vote was counted without revealing their choice
- Intuitive Interface: Vue.js frontend designed for ease of use
The project is organized into two main components:
- VotingCore: Main contract handling poll creation and vote management
- Authentication: Handles secure voter authentication without revealing identity
- ZKP Verification: Implements zero-knowledge proof verification
- API Server: Express.js server for secure hash generation and batch management
- Database Adapters: Flexible storage with support for both MongoDB and SQLite
- Admin Dashboard: Central hub for accessing all administrative functions
- Poll Management: Interface for creating, editing, and managing polls
- Voter Code Generation: Tools for generating and distributing secure voter codes
- System Monitoring: Real-time dashboard for monitoring system health, security alerts, and transactions
- Results Visualization: Comprehensive tools for visualizing poll results with multiple chart types and analytics
- Voting Interface: Intuitive interface for participants to cast their votes
- Receipt Verification: System for voters to verify their votes were counted correctly
This project uses Hardhat for smart contract development and testing:
- Local Blockchain: Custom network configuration with Hardhat
- Testing Framework: Comprehensive test suite using Chai and Waffle
- CI/CD Pipeline: Automated testing and deployment with GitLab CI/CD
The voting system includes robust security features:
- Secure Storage: AES-256-GCM authenticated encryption for sensitive data
- Key Management: Secure key storage with versioning and rotation capabilities
- Field-Level Encryption: Selective encryption of sensitive fields
- JWT Authentication: Secure token-based authentication
- Audit Logging: Security event logging for compliance and monitoring
For detailed security documentation, see SECURITY.md.
- Node.js (v16+)
- npm or yarn
- MongoDB (optional if using SQLite)
-
Clone the repository:
git clone https://gitlab.emse.fr/ext.r.fernandes/voting-system.git cd voting-system -
Set up the backend:
cd backend npm install -
Compile the smart contracts:
npx hardhat compile
-
Run tests:
npx hardhat test
-
Start the local Hardhat node:
cd backend npx hardhat node -
In a separate terminal, deploy the contracts:
cd backend npx hardhat run scripts/deploy.js --network localhost
The anonymous voting process follows these steps:
-
Getting Your Unique Hash Code: The admin generates unique hash codes and distributes them securely.
-
Authenticating to Vote: Users authenticate with their unique hash code - no wallet or blockchain knowledge required.
-
Making Your Choice: The system verifies the code without storing any connection to the user's identity, then they select their candidate.
-
Cryptographic Magic: Behind the scenes, zero-knowledge proofs ensure votes are valid and counted without revealing choices.
-
Getting Your Receipt: Users receive a cryptographic receipt that lets them verify their vote was included in the final tally.
This project follows GitLab Flow with feature branches and merge requests:
- Create a branch for each issue:
git checkout -b issue-number-description - Make changes and commit:
git commit -m "Descriptive message" - Push changes:
git push origin issue-number-description - Create a merge request in GitLab
This project is currently in active development as part of a master's project.
This project is licensed under the MIT License.