Skip to content

Latest commit

Β 

History

History
128 lines (99 loc) Β· 4 KB

File metadata and controls

128 lines (99 loc) Β· 4 KB

πŸ—³οΈ BlockVote - Blockchain-Based E-Voting System

Tamper-proof voting. Powered by Blockchain.

A secure and decentralized web application that enables online voting using blockchain technology to ensure transparency, tamper-resistance, and trust. Built with a full-stack architecture using React, Node.js, MongoDB, and JWT-based authentication.


πŸ” Key Features

  • Blockchain-Powered Voting: Every vote is recorded in a tamper-proof blockchain ledger.
  • Secure Passwords: User passwords are hashed using bcrypt before storing in the database.
  • Two Roles: Admins can create/manage sessions, voters can vote and view results.
  • Session Management: Admins can create and close voting sessions, view live vote counts, and validate the blockchain.
  • Real-time Results: Results are available once sessions are closed.
  • Authentication & Authorization: JWT-secured login and protected routes.
  • Responsive UI: Built using TailwindCSS, optimized for both desktop and mobile views.
  • Session-based State: Sessions are categorized into active and completed for voters.


πŸ” Authentication & Security

  • Password Hashing: All user passwords are hashed using bcrypt before being stored in MongoDB. Plain text passwords are never saved.
  • JWT Authentication: On login, users receive a signed JWT token that is stored in localStorage and used to access protected routes.
  • Role-Based Access Control: Admin and Voter roles are enforced both on frontend (UI) and backend (API) using middleware.
  • Blockchain Integrity: Votes are written to a tamper-proof blockchain with SHA256 hashing, and admins can validate chains.

πŸš€ Tech Stack

Frontend Backend Database Security
React Node.js MongoDB JWT Auth
React Router Express Mongoose Role-Based Middleware
Tailwind CSS Blockchain Validation
Password Hashing using bcrypt

πŸ“¦ Project Structure

EVotingSystem/ β”‚ β”œβ”€β”€ Backend/ β”‚ β”œβ”€β”€config/ β”‚ β”œβ”€β”€ models/ β”‚ β”œβ”€β”€ routes/ β”‚ β”œβ”€β”€ middleware/ β”‚ β”œβ”€β”€ utils/ β”‚ └── server.js β”‚ β”œβ”€β”€ Frontend/ β”‚ β”œβ”€β”€ src/ β”‚ β”‚ β”œβ”€β”€ api/ β”‚ β”‚ β”œβ”€β”€ assets/ β”‚ β”‚ β”œβ”€β”€ pages/ β”‚ β”‚ β”œβ”€β”€ components/ β”‚ β”‚ β”œβ”€β”€ context/ β”‚ β”‚ β”œβ”€β”€ utils/ β”‚ β”‚ β”œβ”€β”€ index.css/ β”‚ β”‚ └── App.jsx β”‚ β”œβ”€β”€ .gitignore β”œβ”€β”€ README.md └── package.json


πŸ› οΈ Setup Instructions

πŸ”‘ Prerequisites

  • Node.js and npm installed
  • MongoDB running locally or cloud-based (e.g. MongoDB Atlas)

πŸ”§ Backend

  1. Navigate to the backend folder:
    cd Backend
  2. Create a .env file with:
    PORT=5050
    MONGO_URI=your_mongodb_connection_string
    JWT_SECRET=your_jwt_secret
    
  3. Install dependencies:
    npm install
    
  4. Start backend server:
    node server.js
    

Frontend

  1. Navigate to the frontend folder:
    cd Frontend
  2. Install dependencies:
    npm install
  3. Start React frontend:
    npm run dev
    
    ---
    

Skills Demonstrated

  • Full-stack development with React, Node, and MongoDB
  • RESTful API design and secure authentication with JWT
  • Blockchain data structure for verifiable transactions
  • React Router DOM navigation and conditional rendering
  • Role-based route protection
  • UI/UX design using TailwindCSS
  • Clean code architecture with modular separation

Why is it Secure?

  • Blockchain Integrity: Every vote is added as a new block linked to the previous one using SHA256 hashing. Blocks are immutable once written.
  • JWT Authentication: Prevents unauthorized access to admin or voter routes.
  • Role-based Authorization: Admin-only and voter-only APIs protected by middleware.
  • Tamper Detection: Admin can validate the blockchain integrity for each session.

Contact

Built by Olivia Chattopadhyay