A secure, transparent, and tamper-proof electronic voting system built using blockchain technology. This project demonstrates how cryptographic principles and decentralized infrastructure can ensure vote integrity and public trust.
This application leverages blockchain, SHA-256 hashing, digital signatures, and proof-of-work to build a robust and secure voting platform. It features a Flask-based web interface for voters to cast votes, view blockchain data, mine new blocks, and validate the system.
- Ensure vote integrity through cryptographic signatures and immutability.
- Increase voter trust by providing a transparent and verifiable voting process.
- Prevent vote tampering via decentralized consensus and proof-of-work.
- π Secure Voting: All votes are digitally signed using private keys and stored immutably on the blockchain.
- π Decentralization: No central authorityβdata is stored in a distributed and tamper-proof ledger.
- π§Ύ Auditability: Full blockchain ledger can be viewed and verified at any time.
- β‘ Real-Time Results: Votes are counted instantly after block mining.
- π Blockchain Validation: Every block is verified using hash, proof-of-work, and signature integrity checks.
- Python 3
- Flask β Web application framework
- PyCryptodome / cryptography β For key generation and digital signatures
- SHA-256 β For hashing and linking blocks
- HTML/CSS β Frontend templates
- User accesses the voting interface and submits a vote.
- The vote is digitally signed using a private key.
- The vote is added to pending transactions.
- A new block is mined using proof-of-work.
- Mined blocks are added to the blockchain.
- The blockchain can be validated at any time.
- Real-time results can be viewed based on mined votes.
| Route | Method | Description |
|---|---|---|
/ |
GET | Homepage with navigation |
/vote |
POST | Submit a new vote (voter_id, candidate_id) |
/mine |
GET | Mine pending transactions into a block |
/chain |
GET | View the entire blockchain |
/results |
GET | View current voting results |
/validate |
GET | Validate blockchain integrity |
/public_key |
GET | View system's public key for signature verification |
- Ensures immutability and integrity of blocks.
- Each blockβs hash depends on its data and the previous blockβs hash.
- Votes are signed using the voter's private key.
- Signatures are verified using the public key to ensure authenticity.
- Prevents tampering by adding computational cost.
- New proof must satisfy:
hash(new_proof^2 - previous_proof^2)starting with"0000".
- Handles the web interface using Flask.
- Routes for voting, mining, chain viewing, and result display.
- Manages blockchain operations:
create_blockadd_voteproof_of_workis_chain_validvalidate_votes
- Implements:
sign_voteverify_votehash_blockget_public_key_pem
This project is for educational and demonstration purposes. Not intended for production use without security review.
For questions, feel free to reach out via GitHub or during the course showcase.