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