Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

34 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

Blockchain-Based E-Voting dApp

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.

📋 Table of Contents


📝 Overview

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

🌟 Features

  • 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.

🏗 System Architecture

  1. Frontend (dApp):

    • User interface for voters and administrators
    • Interacts with smart contracts on the blockchain
  2. Smart Contract:

    • Manages elections, candidates, voter registration, and votes.
    • Stores all vote records immutably.
  3. Blockchain Network:

    • Ethereum or compatible testnet (e.g., Ganache, Sepolia)
    • All transactions are publicly verifiable

🛠 Technology Stack

  • Smart Contracts: Solidity
  • Frontend: JavaScript, React.js, Web3.js / Ethers.js
  • Development Tools: Truffle / Hardhat, Ganache
  • Wallet: MetaMask

🚀 Getting Started

Prerequisites

  • Node.js (>=16.x)
  • npm or yarn
  • MetaMask browser extension
  • Truffle/Hardhat (for smart contract development)
  • Ganache (for local blockchain testing)

1. Clone the repository

git clone https://github.com/SakhiLarik/blockchain_e_voting.git
cd blockchain_e_voting

2. Install dependencies

npm install    # for Node dependencies
cd contracts
npm install    # if contracts use a separate package.json

3. Run Local Blockchain

Start Ganache, or connect to Sepolia/Testnet as needed.

4. Deploy Smart Contracts

truffle migrate --network development
# or for Hardhat:
npx hardhat run scripts/deploy.js --network localhost

5. Start the Frontend

cd client
npm install
npm start

Visit http://localhost:3000 in your browser.


⚡ Smart Contract Documentation

Main Contracts

  • Election.sol
    Manages:
    • Election creation
    • Voter registration and authorization
    • Candidate addition
    • Vote casting
    • Election result computation

Key Functions

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

Events

  • VoterRegistered(address voter)
  • VoteCast(address voter, uint candidateId)
  • ElectionEnded()

Security Features

  • Only registered voters can vote
  • One person, one vote enforcement
  • Admin-only functions for election management

🖥️ Frontend Usage

  • 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)

🧪 Testing

  • All core functionality is covered by automated tests in /test directory.
  • Run:
    truffle test
    # or for Hardhat
    npx hardhat test

👥 Team Members

  1. Hasinain Khokhar
  2. Farhan Ahmed
  3. Piyoosh Kumar

📜 License

This project is for academic purposes. For other uses, please review the LICENSE file or contact the authors.


🤝 Contributions

Contributions are welcome! Feel free to report issues or submit pull requests.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages