Blockchain Based voting system
Blockchain Based voting system
Research/Development Based
Project Phase Two
M.C.A(Data Science)
II Semester
SUBMITTED BY
ABHISHEK KUMAR
Batch Year:-2021-2026
Enrollment No:-U2144045
Under the Supervision of:- Dr.FARHA
(i)
DECLARATION
I hereby declare that the project titled "BLOCKCHAIN BASED VOTING SYSTEM" is
an original work undertaken by me as part of M.C.A (Data Science) at Centre Of
Computer Education and Training. The project has not been submitted for any other
degree or diploma at any other Institution. I further declare that all the sources of
information, data, and references used in this report have been duly acknowledged, and
any contributions from others have been clearly identified.
(ii)
CERTIFICATE
This is to certify that the project titled "BLOCKCHAIN BASED VOTING SYSTEM" has
been completed by Abhishek Kumar(Enrollment No:U2144045), as part of the
requirements for the M.C.A(Data Science) at Center Of Computer Education and
Training.
The project presents proper care and shown most sincerity in completion of this project.
I certify that his work in this project as per the guidelines. This project is original and
is never submitted somewhere else for this same purpose.
(iii)
Table Of Contents
1
1.1 PROBLEM DEFINITION
The problem of traditional voting systems, whether paper-based or electronic, face several
major challenges that affect the fairness and security of elections. These challenges include
vote tampering, lack of transparency, voter fraud, and long processing times. In many cases,
election results can be manipulated by altering vote counts, hacking electronic voting
machines, or preventing certain voters from casting their votes. Additionally, manual vote
counting is slow and prone to errors, leading to delays and disputes in announcing results . This
system Electronic voting machines and online voting systems can be hacked, allowing attackers
to change vote counts or steal voter information. Protecting election data from cyber threats is
becoming more difficult, especially as technology advances. Many people worry that
unauthorized individuals or foreign entities could influence elections by hacking into voting
systems.
.
Key Challenges:
1. Voter Privacy vs. Transparency: Balancing the transparency of blockchain with
the need to keep individual votes anonymous.
2. Scalability: Handling a large number of voters and transactions without performance
issues.
3. Voter Authentication: Ensuring that only eligible voters can vote and preventing
duplicate voting.
4. Security: Protecting the system from cyber-attacks, including Sybil attacks and
denial-of-service (DoS) attacks.
5. Trust and Adoption: Gaining public trust and encouraging widespread adoption of
a new digital voting method.
2
1.2 MOTIVATION
The main motivation behind creating a blockchain-based e-voting system is to improve the
way elections are conducted by making them more secure, transparent, and trustworthy.
Traditional voting methods often face issues like vote tampering, hacking, fraud, and lack
of public trust. These problems can lead to unfair results and make people lose confidence
in the voting process.
The motivation behind this project is Blockchain technology offers a powerful solution to
these issues. It records each vote in a way that cannot be changed or deleted, ensuring that
every vote is counted fairly. This builds trust among voters, as they know their votes are
safe and secure. The use of smart contracts also helps to automate the process, making it
faster and free from human errors.
3
2. OBJECTIVES
4
1. REQUIREMENT ANALYSIS AND SPECIFICATION
5
1.2 Non-Functional Requirements
1. Performance:- The system should load quickly and provide a smooth, the
blockchain should synchronize across nodes in real-time.
4. Usability:- The user interface should be intuitive and easy to navigate for users of
all ensuring a seamless experience.
5. Reliability:- The system should be highly available and resilient, with minimal
downtime to ensure a consistent user experience.
6. Security and Privacy:- Implement measures to protect user data and ensure
compliance with data protection regulations.
8. Interoperability:- The ability to work seamlessly with other software and hardware
platforms.
10. Accessibility:- The design must consider users with varying abilities and provide
features that enhance usability for all.
6
1.3 Technical Requirements
7
1.4 SOFTWARE & HARDWARE REQUIREMENTS
Hardware Required
Processor : Intel Core i5 or higher
Camera : Resolution minimum 720p
Software Required
Backend : Python,Flask.
Frotend :HTML,CSS.
Graphics/3D design : Blender, Unity.
IDE : Visual Studio Code.
Browser : Chrome, Mozilla, Edge, Brave
8
2. SYSTEM DESIGN
LEVEL 0
9
LEVEL-1
10
3. ALGORITHMS USED
The In a blockchain-based voting system, the primary algorithm used isn't just a single
standard algorithm like in encryption or sorting, but rather a collection of mechanisms that
together simulate blockchain behavior for secure, transparent, and tamper-proof voting.
Below is a detailed breakdown of the algorithms employed:
1. Hashing Algorithm
Purpose: To ensure data integrity and link blocks.
Implementation: Typically, SHA-256 (Secure Hash Algorithm 256-bit)
Process:
o Each block contains a hash of the previous block.
o This links blocks together, forming a chain.
o If any vote is tampered with, the hashes break, making it detectable.
3. Consensus Algorithm
Purpose: In real blockchains (like Ethereum), consensus algorithms like Proof of Work
or Proof of Stake ensure that everyone agrees on the current state of the blockchain.
11
Process: It’s a centralized system, so you don’t use PoW
the admin/server is trusted to add blocks.
.
12
4. DEVELOPMENT & TESTING
Development Phase
The development phase likely involved planning a Flask-based web application with a
custom blockchain for vote recording, implementing backend logic, and designing user
interfaces.
1. Environment Setup:
Configured an HTML structure with CSS for a responsive layout, including
sidebars for cloth/glasses selection and a central camera container.
Voter registration form Store hashed password Login with session
management.
3. Admin Dashboard:
Login as admin.
View blockchain (all votes).
See vote counts per election type.
4. Election Selection:
Record vote type in blockchain
13
Testing Phase
1. Unit Testing:
Registration/login.
Voting process.
Double voting prevention.
2. Integration Testing:
Registration + Login Integration after registering, can the user log in
successfully.
Only logged-in users should be able to vote.
3. Usability Testing:
An users easily find “Register,” “Login,” “Vote,” and “Admin Panel.
This ensures the system is easy and intuitive for real user.
4. Performance Testing:
Measured frame rates and latency on different devices (e.g., laptops, desktops)
to ensure real-time performance.
Identified and fixed issues test how the system performs under different load.
5. Bug Fixing and Refinement:
Resolved and add background images or CSS polish.
After testing, fix bugs and polish the system.
14
5. MILESTONE
15
6. MEETING WITH THE SUPERVISOR
16
PROJECT REPORT
1. INTRODUCTION
1
1.1 PROBLEM DEFINITION
The problem of traditional voting systems, whether paper-based or electronic, face several
major challenges that affect the fairness and security of elections. These challenges include
vote tampering, lack of transparency, voter fraud, and long processing times. In many cases,
election results can be manipulated by altering vote counts, hacking electronic voting
machines, or preventing certain voters from casting their votes. Additionally, manual vote
counting is slow and prone to errors, leading to delays and disputes in announcing results . This
system Electronic voting machines and online voting systems can be hacked, allowing attackers
to change vote counts or steal voter information. Protecting election data from cyber threats is
becoming more difficult, especially as technology advances. Many people worry that
unauthorized individuals or foreign entities could influence elections by hacking into voting
systems.
.
Key Challenges:
1. Voter Privacy vs. Transparency: Balancing the transparency of blockchain
with the need to keep individual votes anonymous.
2. Scalability: Handling a large number of voters and transactions without
performance issues.
3. Voter Authentication: Ensuring that only eligible voters can vote and
preventing duplicate voting.
4. Security: Protecting the system from cyber-attacks, including Sybil attacks and
denial-of-service (DoS) attacks.
5. Trust and Adoption: Gaining public trust and encouraging widespread
adoption of a new digital voting method.
2
1.2 MOTIVATION
The main motivation behind creating a blockchain-based e-voting system is to improve the
way elections are conducted by making them more secure, transparent, and trustworthy.
Traditional voting methods often face issues like vote tampering, hacking, fraud, and lack
of public trust. These problems can lead to unfair results and make people lose confidence
in the voting process.
The motivation behind this project is Blockchain technology offers a powerful solution to
these issues. It records each vote in a way that cannot be changed or deleted, ensuring that
every vote is counted fairly. This builds trust among voters, as they know their votes are
safe and secure. The use of smart contracts also helps to automate the process, making it
faster and free from human errors.
3
2. OBJECTIVES
4
1. REQUIREMENT ANALYSIS AND SPECIFICATION
5
1.2 Non-Functional Requirements
1. Performance:- The system should load quickly and provide a smooth, the blockchain
4. Usability:- The user interface should be intuitive and easy to navigate for users of all
ensuring a seamless experience.
5. Reliability:- The system should be highly available and resilient, with minimal
downtime to ensure a consistent user experience.
6. Security and Privacy:- Implement measures to protect user data and ensure
compliance with data protection regulations.
8. Interoperability:- The ability to work seamlessly with other software and hardware
platforms.
10. Accessibility:- The design must consider users with varying abilities and provide
features that enhance usability for all.
6
10.1Technical Requirements
7
10.2SOFTWARE & HARDWARE REQUIREMENTS
Hardware Required
Processor : Intel Core i5 or higher
Camera : Resolution minimum 720p
Software Required
Backend : Python,Flask.
Frotend :HTML,CSS.
Graphics/3D design : Blender, Unity.
IDE : Visual Studio Code.
Browser : Chrome, Mozilla, Edge, Brave
8
11. SYSTEM DESIGN
LEVEL 0
9
LEVEL-1
10
12. ALGORITHMS USED
The In a blockchain-based voting system, the primary algorithm used isn't just a single
standard algorithm like in encryption or sorting, but rather a collection of mechanisms that
together simulate blockchain behavior for secure, transparent, and tamper-proof voting.
Below is a detailed breakdown of the algorithms employed.
1. Hashing Algorithm
Purpose: To ensure data integrity and link blocks.
Implementation: Typically, SHA-256 (Secure Hash Algorithm 256-bit)
Process:
o Each block contains a hash of the previous block.
o This links blocks together, forming a chain.
o If any vote is tampered with, the hashes break, making it detectable.
3. Consensus Algorithm
Purpose: In real blockchains (like Ethereum), consensus algorithms like Proof of Work
or Proof of Stake ensure that everyone agrees on the current state of the blockchain.
11
Process: It’s a centralized system, so you don’t use PoW
the admin/server is trusted to add blocks.
.
12
13. DEVELOPMENT & TESTING
Development Phase
The development phase likely involved planning a Flask-based web application with a
custom blockchain for vote recording, implementing backend logic, and designing user
interfaces.
1. Environment Setup:
Configured an HTML structure with CSS for a responsive layout, including
sidebars for cloth/glasses selection and a central camera container.
Voter registration form Store hashed password Login with session
management.
3. Admin Dashboard:
a. Login as admin.
b. View blockchain (all votes).
c. See vote counts per election type.
13
Testing Phase
1. Unit Testing:
Registration/login.
Voting process.
Double voting prevention.
2. Integration Testing:
Registration + Login Integration after registering, can the user log in
successfully.
Only logged-in users should be able to vote.
3. Usability Testing:
An users easily find “Register,” “Login,” “Vote,” and “Admin Panel.
This ensures the system is easy and intuitive for real user.
4. Performance Testing:
Measured frame rates and latency on different devices (e.g., laptops, desktops)
to ensure real-time performance.
Identified and fixed issues test how the system performs under different load.
5. Bug Fixing and Refinement:
Resolved and add background images or CSS polish.
After testing, fix bugs and polish the system.
14
5. PROJECT CODE
Index.html
<!DOCTYPE html>
<html>
<head>
<title>Blockchain Voting</title>
<link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}">
<style>
body {
background-image: url('https://www.livelaw.in/h-upload/2022/11/01/750x450_441859-election-
commission-of-india-eci-and-sc-2.jpg');
background-size: 900px 650px;
background-position: center;
background-attachment: fixed;
background-repeat: no-repeat;
margin: 0;
padding: 0;
font-family: Arial, sans-serif;
min-height: 100vh;
}
.vote-box {
background-color: rgba(255, 255, 255, 0.9);
max-width: 600px;
margin: 50px auto;
padding: 30px;
border-radius: 10px;
box-shadow: 0 0 20px rgba(0, 0, 0, 0.2);
15
h2 {
color: #333;
margin-top: 0;
}
a{
color: #0066cc;
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
form {
margin: 20px 0;
}
select, input[type="submit"] {
padding: 10px;
width: 100%;
margin: 5px 0;
border-radius: 5px;
border: 1px solid #ddd;
}
input[type="submit"] {
background-color: #4CAF50;
color: white;
border: none;
cursor: pointer;
font-weight: bold;
} </div>
</body>
</html>
16
styles.css
body {
font-family: Arial, sans-serif;
background-color: #f0f2f5;
padding: 40px;
}.vote-box {
background-color: #fff;
padding: 30px;
border-radius: 12px;
box-shadow: 0 4px 8px rgba(0,0,0,0.1);
max-width: 450px;
margin: auto;
text-align: center;
}h2 {
color: #333;
}form {
margin-top: 20px;
Input[type="text"], select {
padding: 8px;
width: 90%;
margin-bottom: 20px;
border-radius: 6px;
border: 1px solid #ccc;
input[type="submit"] {
background-color: #007bff;
color: white;
padding: 10px 25px;
border: none;
border-radius: 6px;
cursor: pointer;
input[type="submit"]:hover {
background-color: #0056b3;
}
ul {
list-style-type: none;
padding: 0;
margin-top: 20px;
}
li {
background-color: #e9ecef;
margin: 5px 0;
padding: 8px;
border-radius: 6px;
}
17
App.py
from flask import Flask, render_template, request, redirect,
session, url_for
from blockchain import Blockchain
app = Flask(__name__)
app.secret_key = 'voting-secret-key' # Required for session
handling
blockchain = Blockchain()
# Sample data
POLITICAL_PARTIES = ["BJP", "INC", "AAP", "BSP",
"SP","NIRDALIY PARTY","NOTA"]
VOTER_IDS = ["ABHI01212","ZSO1000", "ZSO1001",
"ZSO1002",
"ZSO1003","ZSO1004","ZSO1005","ZSO1006","ZSO1007
","ZSO1008","ZSO1009","ZSO1010","ZSO1011","ZSO10
12","ZSO1013"]
@app.route('/')
def home():
if 'voter_id' in session:
return redirect('/vote')
return redirect('/login')
18
else:
error = "Invalid Voter ID. Please try again."
return render_template('login.html', error=error)
voter_id = session['voter_id']
message = None
if request.method == 'POST':
party = request.form['party']
if blockchain.has_voted(voter_id):
message = " You have already voted."
else:
blockchain.add_vote(voter_id, party)
blockchain.create_block(previous_hash="dummy_h
ash")
message = f" Vote for {party} submitted
successfully."
vote_counts = blockchain.get_vote_counts()
return render_template('index.html',
voter_id=voter_id,
parties=POLITICAL_PARTIES,
vote_counts=vote_counts,
message=message)
@app.route('/logout')
def logout():
session.pop('voter_id', None)
return redirect('/login')
if __name__ == '__main__':
app.run(debug=True)
19
7. CONCLUSION
The blockchain-based e-voting system provides a modern, secure, and transparent way to
conduct elections. By using blockchain technology, each vote is recorded as a block in a
chain that cannot be easily changed or tampered with. This ensures that the voting process
is fair, trustworthy, and protected from fraud. With features like voter authentication,
tamper-proof vote recording, and real- time result display, this system improves the overall
reliability of elections. Developed using Python and Flask, it is a lightweight and user-
friendly solution suitable for schools, colleges, organizations, or even larger communities.
This project proves that blockchain can be effectively used not just in finance, but also in
strengthening digital democracy. This project aligns with the goal blockchain-based e-
voting system is a secure and transparent solution for modern elections. By recording each
vote on a blockchain, it prevents fraud and ensures that results are accurate and tamper-
proof. The system uses Python and Flask, making it simple, lightweight, and user-friendly.
With features like voter authentication and real-time result tracking, it is ideal for schools,
colleges, and organizations. This project shows that blockchain can greatly improve the
fairness and trust in digital voting processes.
21
8. FUTURE SCOPE
The blockchain-based e-voting system has strong potential for future improvements. It can
be expanded to handle large-scale elections at the national or state level. Voter verification
can be made more secure by integrating biometric systems, Aadhar authentication, or face
recognition. The system can also use smart contracts on public blockchains like Ethereum
to make the process fully automated and decentralized. A mobile app version can be
developed to allow secure remote voting, increasing voter participation. With better data
visualization and stronger security features, this system can become a trusted and widely
used solution for digital voting in schools, colleges, organizations, and government
elections.
22
9. MILESTONES
23
10. MEETINGS WITH THE SUPERVISOR
24
11. BIBLIOGRAPHY AND REFERENCES
25
12. PLAGIARISM REPORT
26