A tamper-proof, decentralized voting DApp built on Ethereum. Voters authenticate with their Turkish National ID (TC Kimlik), cast a single on-chain vote for a candidate, and view live election results. An admin panel lets authorized users manage candidates before and during the election.
- Turkish National ID validation — only valid TC Kimlik numbers are accepted via
turkish-id-checker - One-voter-one-vote enforcement — the smart contract tracks voter IDs on-chain to prevent double voting
- Candidate management — admin can add candidates (name + image URL) or remove those with zero votes
- Live vote statistics — a donut chart displays real-time vote counts after voting
- MetaMask integration — transactions are signed through the user's MetaMask wallet
- Reactive Web3 UI — powered by Drizzle for automatic contract state synchronization
| Layer | Technology |
|---|---|
| Smart Contract | Solidity 0.8.11, Truffle |
| Frontend | Vue.js 2, Vue Router, Vuex |
| UI Components | Buefy, Bulma |
| Charts | Chart.js, vue-chartjs |
| Web3 / Blockchain | Drizzle (@drizzle/vue-plugin), MetaMask |
| Local Blockchain | Ganache (port 7545) |
| ID Validation | turkish-id-checker |
- Node.js (v14+)
- Truffle —
npm install -g truffle - Ganache (desktop app or
ganache-cli) - MetaMask browser extension
npm installOpen Ganache and start a workspace on port 7545, or run:
npx ganache-cli -p 7545truffle migrate
# For a clean re-deploy:
truffle migrate --reset- Set the MetaMask network to Localhost 7545
- Import one of the Ganache accounts using its private key
npm run serveOpen http://localhost:8080 in your browser.
Home (enter TC Kimlik ID)
└─▶ Verify (OTP / verification code)
└─▶ Vote (pick a candidate, confirm via MetaMask)
└─▶ Result (thank-you page + live donut chart)
Admin Login ─▶ Admin Panel (add / remove candidates)
Deployed to the local Ganache network. Key functions:
| Function | Description |
|---|---|
addCandidate(name, image) |
Add a new candidate |
deleteCandidate(id) |
Remove a candidate (only if 0 votes) |
vote(candidateId, voterId) |
Cast a vote; reverts if voter already voted |
getCandidates() |
Return all candidates as an array |
isAdmin(username, password) |
Validate admin credentials (stored on-chain) |
Note: Three demo candidates (McDonald's, KFC, Burger King) are added in the constructor.
# Production build
npm run build
# Lint & fix source files
npm run lintSee the Vue CLI Configuration Reference for advanced options.