ChainBallot is a hybrid decentralized electoral framework designed to ensure secure, transparent, and tamper-resistant voting using Ethereum blockchain technology. The system integrates gas-optimized Solidity smart contracts for immutable vote recording with an off-chain backend infrastructure for scalable voter management, authentication, and administrative control.
By combining on-chain vote integrity with off-chain database synchronization, ChainBallot addresses scalability, cost efficiency, and role-based access limitations commonly observed in fully on-chain voting systems.
ChainBallot follows a Hybrid On-Chain / Off-Chain Architecture, consisting of:
- Smart Contract Layer (Ethereum)
- Authentication & Server Layer (Node.js)
- Database & API Layer (FastAPI + MySQL)
- Frontend Interaction Layer (HTML/CSS/JS)
- Wallet Authentication Layer (MetaMask + Web3.js)
- Gas-optimized Solidity smart contracts
- Immutable vote recording on Ethereum blockchain
- One-wallet–one-vote enforcement
- Double-voting prevention using address mapping
- Configurable voting start and end timestamps
- Real-time vote count retrieval from blockchain
- 60-second controlled voting session window
- Automatic session expiration
- Prevention of prolonged or malicious voting attempts
- Admin and Voter role segregation
- JWT-based authentication
- Secure login backed by MySQL database
- Controlled candidate registration
- Live vote aggregation directly from blockchain state
- Transparent and publicly verifiable vote counts
- Dynamic frontend result updates
- Blockchain: Ethereum, Solidity, Ganache
- Smart Contract Framework: Truffle
- Backend (Server): Node.js, Express
- Backend (Database API): FastAPI (Python)
- Database: MySQL
- Frontend: HTML, CSS, JavaScript
- Wallet Integration: MetaMask, Web3.js
- Wallet-based identity verification
- Double voting prevention via address tracking
- Smart contract state validation
- Session timeout enforcement
- Backend-database synchronization checks
- Gas-optimized contract structure for reduced transaction cost
The smart contract minimizes unnecessary storage writes and redundant state updates to reduce gas consumption during:
- Candidate registration
- Vote casting
- Result retrieval
This improves cost efficiency while preserving blockchain immutability.
Refer to RUN.md for complete setup instructions.
- Node.js & npm
- Python 3.x
- MySQL Server
- Ganache (running on port 7545)
- MetaMask browser extension
- Hybrid On-Chain/Off-Chain Electoral Architecture
- Efficient Gas Consumption Smart Contract Design
- Real-Time Transparent Result Computation
- Session-Based Security Enforcement
- Role-Based Administrative Control
- Modular Multi-Backend Implementation
- Deployment on public Ethereum testnets
- Zero-Knowledge Proof integration
- Biometric-backed wallet verification
- IPFS-based decentralized voter registry
This project is the intellectual property of Saaiem Salaar and is licensed under the MIT License. This means you are free to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the software for personal or commercial purposes, provided that proper credit is given and the original license and copyright notice are included in all copies or substantial portions of the software. The software is provided "as is", without any warranty of any kind, express or implied, and the author is not liable for any claims, damages, or other liabilities arising from its use.



















