Skip to content

codex1589/secureVote

Repository files navigation

🗳️ SecureVote: Multi-Position Blockchain Voting System

SecureVote is a state-of-the-art voting application that combines biometric identity verification (Face Recognition) with blockchain technology to ensure immutable and transparent election results.

🏗️ System Architecture

  • Mobile App: React Native / Expo (Tailwind CSS, Lucide Icons)
  • Backend Server: Node.js / Express (Prisma ORM, PostgreSQL, JWT Authentication)
  • Blockchain: Ethereum / Hardhat (Solidity Smart Contracts)
  • Biometric Service: FastAPI / OpenCV (Face Recognition)

🛠️ Prerequisites

Before you begin, ensure you have the following installed:

  • Node.js: v18.x or higher
  • PostgreSQL: v14.x or higher
  • Python: v3.9+ (with pip)
  • Git: For cloning the repository

🚀 One-Click Startup (Windows)

If you are on Windows and have all prerequisites configured, you can launch all services at once using the provided PowerShell script:

./run_all.ps1

🔧 Manual Setup Guide

1. Database Configuration

  1. Start your PostgreSQL server.
  2. Create a database named voter_db.
  3. Configure environment variables in server/.env:
    PORT=5000
    DATABASE_URL="postgresql://postgres:YOUR_PASSWORD@localhost:5432/voter_db?schema=public"
    JWT_SECRET="your_secure_secret"
    DEMO_OTP="123456"

2. Install Dependencies

Install dependencies for all sub-projects:

# Root (Frontend)
npm install

# Backend Server
cd server && npm install && cd ..

# Blockchain
cd blockchain && npm install && cd ..

# Face Service
cd face_service && pip install -r requirements.txt && cd ..

3. Blockchain Deployment

  1. Start a local Hardhat node:
    cd blockchain
    npx hardhat node
  2. In a NEW terminal, deploy the smart contract:
    cd blockchain
    npx hardhat run scripts/deploy.js --network localhost

4. Backend Setup

  1. Sync the database schema:
    cd server
    npx prisma db push
  2. Seed the admin account:
    node seed-admin.js
  3. Start the server:
    npm start

5. Face Verification Service (AI)

The face service has a fallback mode if face_recognition (which requires complex C++ setup on Windows) is not installed.

  1. Basic setup (Fallback Mode):
    cd face_service
    pip install fastapi uvicorn pydantic opencv-python numpy
    uvicorn main:app --reload --port 8000
  2. For Real Face Recognition, refer to the detailed guide in face_service/README.md.

6. Mobile Application

  1. Start the Expo development server:
    npm start
  2. Scan the QR code with your Expo Go app (Android) or Camera (iOS).

🔐 Default Credentials (Admin)

  • Voter ID: ADMIN-001
  • Password: admin123

📁 Repository Structure

  • /app: Expo Router file-based screens.
  • /server: Node.js Express API and Prisma schema.
  • /blockchain: Hardhat project for Solidity contracts.
  • /face_service: Python FastAPI service for facial verification.
  • /src: React Native components and state management.

🤝 Troubleshooting

  • Database Connection: Ensure PostgreSQL is running and the DATABASE_URL in server/.env is correct.
  • Blockchain Transactions: If transactions fail, ensure the Hardhat node is running and the contract has been deployed to the localhost network.
  • Python Dependencies: If pip install fails, ensure you have Python 3.9+ and pip installed.

Built with ❤️ for Secure and Transparent Democracy.

About

SecureVote: Smart Authentication in Blockchain-Based Digital-Voting System

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors