Skip to content

A decentralized voting system built on Ethereum, offering secure, transparent, and tamper-resistant elections. Features include user authentication, on-chain vote recording, and real-time result tracking via smart contracts.

License

Notifications You must be signed in to change notification settings

kairos1205/Decentralized-Voting-System-Using-Ethereum-Blockchain

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

35 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ—³οΈ Decentralized Voting System Using Ethereum Blockchain

A secure, transparent, and trustless voting platform built on the Ethereum blockchain. This project leverages smart contracts, JWT-based authentication, and a clean frontend interface to demonstrate how decentralized technologies can modernize electoral systems.

⚠️ Note: This project is no longer actively maintained.


πŸ” Overview

This decentralized voting system enables remote, anonymous, and tamper-proof elections. Votes are recorded on the Ethereum blockchain, ensuring full transparency and eliminating centralized points of failure.

🧠 Built for learning and demonstration purposes, this project is ideal for those exploring how blockchain can be applied in real-world governance scenarios.

πŸŽ₯ Live Demo: Watch on YouTube


✨ Features

  • πŸ” JWT Authentication – Secure voter login and role-based access control.
  • ⛓️ Ethereum Integration – Votes are recorded on-chain for full transparency.
  • 🀝 Trustless Process – No central authority; smart contracts manage logic.
  • πŸ“Š Admin Panel – Add candidates, set election periods, and view results.
  • πŸ–₯️ User-Friendly UI – Easy-to-use interface for voters and admins alike.

πŸ› οΈ Tech Stack & Requirements

Backend

  • FastAPI (Python 3.9)
  • MySQL (Port: 3306)
  • JWT Authentication
  • Uvicorn

Frontend

  • Node.js (v18.14.0)
  • Browserify
  • HTML/CSS/JS

Blockchain

  • Truffle
  • Ganache
  • Metamask
  • Solidity (Smart Contracts)

πŸ“Έ Screenshots

Admin Panel Candidate View Voting Interface

πŸš€ Getting Started

1. Clone the Repository

git clone https://github.com/kairos1205/Decentralized-Voting-System-Using-Ethereum-Blockchain.git

2. Set Up Ganache

  • Download Ganache
  • Create a workspace named development
  • Add truffle-config.js to the Truffle projects section

3. Set Up Metamask

4. Set Up MySQL

  • Create a new database: voter_db
  • Create the voters table using:
CREATE TABLE voters (
  voter_id VARCHAR(36) PRIMARY KEY NOT NULL,
  role ENUM('admin', 'user') NOT NULL,
  password VARCHAR(255) NOT NULL
);

πŸ’‘ Tip: Manually insert some user records to begin testing.


βš™οΈ Installation Steps

Install Global Dependencies

npm install -g truffle

Install Node Modules

npm install

Install Python Dependencies

pip install fastapi mysql-connector-python pydantic python-dotenv uvicorn uvicorn[standard] PyJWT

πŸ§ͺ Running the Project

πŸ”§ Before running, make sure to update DB credentials in: ./Database_API/.env

1. Compile Smart Contracts

truffle console
compile
.exit

2. Bundle JS Files

browserify ./src/js/app.js -o ./src/dist/app.bundle.js

3. Start the Node Server

node index.js

4. Start the Python API

cd Database_API
uvicorn main:app --reload --host 127.0.0.1

5. Deploy Smart Contracts

truffle migrate

βœ… Visit the app at: http://localhost:8080

πŸŽ₯ Need help setting it up? Watch the full walkthrough: YouTube Setup Guide


🧾 Project Structure

β”œβ”€β”€ build/                   # Compiled contracts
β”œβ”€β”€ contracts/               # Solidity smart contracts
β”œβ”€β”€ Database_API/            # FastAPI backend
β”œβ”€β”€ migrations/              # Truffle migration scripts
β”œβ”€β”€ public/                  # Favicon and other static assets
β”œβ”€β”€ src/                     # Frontend assets (HTML, CSS, JS)
β”œβ”€β”€ index.js                 # Node.js entry point
β”œβ”€β”€ package.json             # Node project config
β”œβ”€β”€ truffle-config.js        # Truffle settings
└── README.md                # Project documentation

πŸ“„ License

This project is licensed under the MIT License. You're free to use, modify, and distribute it, as long as you retain the original license and attribution.

πŸ”— View LICENSE


🌟 Support

If you found this project helpful, please consider giving it a ⭐. Your support is appreciated!

About

A decentralized voting system built on Ethereum, offering secure, transparent, and tamper-resistant elections. Features include user authentication, on-chain vote recording, and real-time result tracking via smart contracts.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published