A decentralized electronic voting platform built using blockchain technology to ensure transparency, security, and trust in the voting process. This dApp enables secure online voting, making election processes tamper-proof and verifiable, ideal for organizations, universities, or small-scale governmental use.
- Overview
- Features
- System Architecture
- Technology Stack
- Getting Started
- Smart Contract Documentation
- Frontend Usage
- Testing
- Team Members
- License
This project is a Final Year Project (FYP) aiming to implement a real-world electronic voting (e-voting) system leveraging blockchain's immutability and transparency. Participants can securely cast votes, and results can be audited by anyone.
Objectives:
- Prevent vote tampering and fraud
- Enable transparency for all participants
- Make voting accessible via the internet
- Ensure only eligible voters can participate
- Decentralized Voting: Powered by Ethereum-compatible smart contracts.
- User Authentication: Voters are registered and verified before casting votes.
- Anonymous Voting: Vote privacy is preserved; no link between voter and vote.
- Real-Time Results: Anyone can track the election results in real-time.
- Auditability: Irrefutable records for all votes cast.
- Admin Dashboard: Election administrators can manage candidates and voters.
-
Frontend (dApp):
- User interface for voters and administrators
- Interacts with smart contracts on the blockchain
-
Smart Contract:
- Manages elections, candidates, voter registration, and votes.
- Stores all vote records immutably.
-
Blockchain Network:
- Ethereum or compatible testnet (e.g., Ganache, Sepolia)
- All transactions are publicly verifiable
- Smart Contracts: Solidity
- Frontend: JavaScript, React.js, Web3.js / Ethers.js
- Development Tools: Truffle / Hardhat, Ganache
- Wallet: MetaMask
- Node.js (>=16.x)
- npm or yarn
- MetaMask browser extension
- Truffle/Hardhat (for smart contract development)
- Ganache (for local blockchain testing)
git clone https://github.com/SakhiLarik/blockchain_e_voting.git
cd blockchain_e_votingnpm install # for Node dependencies
cd contracts
npm install # if contracts use a separate package.jsonStart Ganache, or connect to Sepolia/Testnet as needed.
truffle migrate --network development
# or for Hardhat:
npx hardhat run scripts/deploy.js --network localhostcd client
npm install
npm startVisit http://localhost:3000 in your browser.
- Election.sol
Manages:- Election creation
- Voter registration and authorization
- Candidate addition
- Vote casting
- Election result computation
| Function | Description |
|---|---|
addCandidate(name) |
Add a candidate to the election |
registerVoter(address) |
Register a voter |
vote(candidateId) |
Cast a vote for registered voter |
getResults() |
Get real-time results of the election |
endElection() |
Ends the election and prevents further votes |
VoterRegistered(address voter)VoteCast(address voter, uint candidateId)ElectionEnded()
- Only registered voters can vote
- One person, one vote enforcement
- Admin-only functions for election management
- Connect MetaMask wallet
- Register as a voter/admin if authorized
- View live list of candidates and results
- Cast your vote (button becomes inactive after voting)
- All core functionality is covered by automated tests in
/testdirectory. - Run:
truffle test # or for Hardhat npx hardhat test
- Hasinain Khokhar
- Farhan Ahmed
- Piyoosh Kumar
This project is for academic purposes. For other uses, please review the LICENSE file or contact the authors.
Contributions are welcome! Feel free to report issues or submit pull requests.