A secure, transparent, and immutable voting system built with Flask and blockchain technology.
- π Secure Authentication: Separate login systems for voters and administrators
- π³οΈ Vote Casting: Easy-to-use interface for casting votes
- π Blockchain Integration: All votes are recorded in an immutable blockchain
- π Real-time Dashboard: Live voting results with charts and blockchain ledger
- π‘οΈ Vote Integrity: Each voter can only vote once
- π¨ Modern UI: Responsive design with Bootstrap 5
- Python 3.7 or higher
- pip (Python package installer)
-
Clone or download the project
cd "Voting system"
-
Create a virtual environment (recommended)
python -m venv .venv .venv\Scripts\activate # On Windows # or source .venv/bin/activate # On Linux/Mac
-
Install dependencies
pip install -r requirements.txt
-
Run the application
python app.py
-
Access the application
- Open your browser and go to
http://localhost:5000
- Open your browser and go to
- Register: Click "Register Voter" and fill in your details
- Login: Use your Voter ID and password to login
- Vote: Select your preferred political party and submit
- Login: Use admin credentials (default: username:
admin, password:admin123)
- Dashboard: View real-time results, blockchain ledger, and winner
Real-time Results:
Blockchain Ledger:
Validator Login:

- Environment Variables: Set
SECRET_KEYandADMIN_PASSWORDenvironment variables for production - Blockchain Validation: Automatic integrity checks on the blockchain
- One Vote Per Voter: Prevents duplicate voting
- Session Management: Secure session handling
For production deployment, set these environment variables:
export SECRET_KEY="your-secure-secret-key"
export ADMIN_PASSWORD="your-secure-admin-password"- Backend: Flask (Python web framework)
- Database: SQLite (lightweight database)
- Blockchain: Custom implementation with SHA-256 hashing
- Frontend: Bootstrap 5, Chart.js
- Security: Session-based authentication
Voting system/
βββ app.py # Main Flask application
βββ blockchain.py # Blockchain implementation
βββ database.db # SQLite database (created automatically)
βββ requirements.txt # Python dependencies
βββ templates/ # HTML templates
β βββ index.html # Home page
β βββ login.html # Login page
β βββ register.html # Registration page
β βββ vote.html # Voting page
β βββ admin_dashboard.html # Admin dashboard
βββ README.md # This file