Skip to content

E-voting-Using-Blockchain/Off-Chain-Verification

Repository files navigation

Off-Chain Verification System

Setup & Run Instructions

This project consists of a Django Backend (API & Admin) and a React Frontend (User Interfaces). Follow the steps below to run the complete system.

Prerequisites

  • Python 3.10+
  • Node.js 16+
  • PostgreSQL (Optional, defaults to SQLite)

✅ Key Features

  • Secure Authentication: JWT-based auth with Role-Based Access Control (RBAC).
  • Strict Verification Workflow:
    • Student Registration: Uploads ID cards, account starts as PENDING.
    • Faculty Registration: Teachers/HODs register, account starts as PENDING.
    • Approval System: Accounts must be approved by the respective authority (Class Teacher/HOD) before login is allowed.
  • Audit Logging: Immutable logs for sensitive actions (viewing, approving, rejecting) ensuring data integrity.
  • Improved Department Management:
    • Archival System: Archive unused departments instead of deleting them.
    • Manual Code Entry: Flexibility to define custom department codes.
  • Role-Based Dashboards:
    • HOD: Class & Faculty management, Department-wide oversight.
    • Teachers: Verification Queue, Class management.
    • Students: Verification status, Voting interface.
    • Admin: Global stats, System configuration.
  • Blockchain Integration: Store specialized data verifying student identity hash on-chain.
  • Modern UI: Polished, responsive React frontend with real-time validation and feedback.

🏗 Architecture

  • Backend: Django REST Framework (DRF)
  • Frontend: React + Vite + Tailwind CSS
  • Database: SQLite (Dev) / PostgreSQL (Prod)
  • Authentication: SimpleJWT (Django)

📂 Project Structure

OffChain_Verification/
├── evoting_backend/        # Django Project Root
│   ├── accounts/           # User authentication & role management
│   ├── audit/              # Logging & system audit trails
│   ├── blockchain/         # Blockchain integration (Web3.py)
│   ├── dashboards/         # Role-specific dashboard views
│   ├── elections/          # Election management logic
│   ├── verification/       # Identity verification workflows
│   ├── manage.py           # Django management script
│   └── requirements.txt    # Python dependencies
│
└── evoting_frontend/       # React Project Root (Vite)
    ├── src/
    │   ├── components/     # Reusable UI components
    │   ├── pages/          # Page views (Admin, Student, Faculty)
    │   ├── context/        # Global state (Auth, Theme)
    │   └── services/       # API integration using Axios
    ├── package.json        # Node dependencies
    └── vite.config.js      # Vite configuration

1. Backend Setup (Django)

Open a terminal in evoting_backend/.

# 1. Create & Activate Virtual Environment (if not already done)
python -m venv venv
venv\Scripts\Activate

# 2. Install Dependencies
pip install -r requirements.txt

# 3. Apply Migrations
python manage.py makemigrations
python manage.py migrate

# 4. Populate Demo Data (Users, Roles, Elections)
python manage.py populate_data

# 5. Start Server
python manage.py runserver

Backend runs at: http://127.0.0.1:8000


2. Frontend Setup (React + Vite)

Open a new terminal in evoting_frontend/.

# 1. Install Dependencies
npm install

# 2. Start Dev Server
npm run dev

Frontend runs at: http://localhost:5173


3. Demo Credentials

The populate_data script creates the following default users:

Role Email Password
Super Admin admin@college.edu adminpass
HOD (CS) shalupk@college.edu 123123123
Teacher (CS) shamalam@college.edu 123123123
Student student.alice@college.edu studentpass

4. Application Flow

  1. Initial Setup: Admin creates Departments and assigns HODs.
  2. Registration:
    • Students: Sign up -> Upload IDs -> Status: PENDING.
    • Faculty: Sign up -> Select Department -> Status: PENDING.
  3. Verification:
    • HOD approves Faculty.
    • Teachers/HOD approve Students.
  4. Operations:
    • HODs manage classes and view audits.
    • Admins oversee the entire system.

Note

For a detailed step-by-step guide on how to operate the system, please refer to the Operations Guide.

About

Off-chain voter verification system for a blockchain-based e-voting platform. Built with Django REST Framework, it supports role-based verification, election-wise eligibility checks, secure document handling, audit logs, and prepares verified voters for secure on-chain voting.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors