0% found this document useful (0 votes)
228 views

Blockchain Based Voting System

This document outlines a blockchain-based voting system project submitted by three students - Muhammad Shawaiz, Hamza Ali, and Muhammad Adeel - to the Department of Computer Engineering at the University of Engineering and Technology Lahore, Pakistan under the supervision of Dr. Ali Hammad Akbar. The project proposes developing a blockchain voting system using Ethereum to provide a secure, private, and verifiable electronic voting solution. It discusses requirements for blockchain-based voting, relevant research papers, and an overview of how the proposed system would work, with voter registration stored on-chain and votes submitted as encrypted transactions to ensure privacy, integrity, and auditability.

Uploaded by

M Adeel Asif
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
228 views

Blockchain Based Voting System

This document outlines a blockchain-based voting system project submitted by three students - Muhammad Shawaiz, Hamza Ali, and Muhammad Adeel - to the Department of Computer Engineering at the University of Engineering and Technology Lahore, Pakistan under the supervision of Dr. Ali Hammad Akbar. The project proposes developing a blockchain voting system using Ethereum to provide a secure, private, and verifiable electronic voting solution. It discusses requirements for blockchain-based voting, relevant research papers, and an overview of how the proposed system would work, with voter registration stored on-chain and votes submitted as encrypted transactions to ensure privacy, integrity, and auditability.

Uploaded by

M Adeel Asif
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 60

Blockchain based Voting System

Session: 2018 – 2022

Submitted by:
Muhammad Shawaiz 2018-CE-224
Hamza Ali 2018-CE-225
Muhammad Adeel 2018-CE-227

Supervised by:
Dr. Ali Hammad Akbar

Department of Computer Engineering


University of Engineering and Technology
Lahore Pakistan
Blockchain based Voting System
(Session 2018 Computer Engineering)

The thesis is to be submitted to the Department of Computer Engineering,


University of Engineering and Technology, Lahore for the partial fulfillment of
the requirement for the Bachelor’s degree in Computer Engineering.

Internal Examiner External Examiner


Signature: Signature:

Name: Name:

Designation: Designation:

Chairman Dean
Signature: Signature:

Prof. Ali Hammad Akbar Name:

Department of Computer Engineering

University of Engineering and Technology


Lahore Pakistan

i
Declaration
I declare that the work contained in this thesis is my own, except where explicitly
stated otherwise. In addition this work has not been submitted to obtain another
degree or professional qualification.

Signed:
Date:

ii
Acknowledgments
First of all, we would like to acknowledge the constant support, guidance and
assistance from our project advisor Dr. Ali Hammad Akbar. We would also
like to thank all the teachers of our department for their guidance and support.
Lastly, we would like to thank our friends and family members for their continuous
encouragement.

iii
We Dedicate our thesis to All of our family members ,
teachers and especially Dr. Ali Hammad Akbar,
without his constant support and guidance this thesis
was not possible.

iv
Contents

Acknowledgments iii

List of Figures viii

List of Tables ix

Abbreviations x

Abstract xi

1 Introduction 1
1.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.2 Background . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.3 Motivation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.4 Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.5 Problem statement . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.6 Scope of project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.7 Socio-Economic benefits . . . . . . . . . . . . . . . . . . . . . . . . 3

2 Literature Survey 4
2.1 Requirements of blockchain based election system . . . . . . . . . . 4
2.2 Blockchain: concept and properties . . . . . . . . . . . . . . . . . . 7
2.2.1 Blockchain concepts . . . . . . . . . . . . . . . . . . . . . . 7
2.2.2 Types of Consensus . . . . . . . . . . . . . . . . . . . . . . . 8
2.2.3 Types of Blockchain . . . . . . . . . . . . . . . . . . . . . . 10
2.3 Famous Reseach papers on Blockchain based voting system:- . . . . 11
2.3.1 Votereum . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
2.3.2 Voatz . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
2.3.3 BlockVotes . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
2.3.4 SecEVS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
2.4 Blockchain Based E-Voting Recording System Design . . . . . . . . 12
2.5 A CONCEPTUAL SECURE BLOCKCHAIN- BASED ELECTRONIC
VOTING SYSTEM . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
2.6 Conclusion from Literature survey . . . . . . . . . . . . . . . . . . . 13

v
Contents vi

3 Introduction To A Prospective Ethereum-based Blockchain Vot-


ing System 15
3.0.1 Principle of design . . . . . . . . . . . . . . . . . . . . . . . 16
3.0.2 Smart Contract Dataflow Diagram . . . . . . . . . . . . . . 17
3.0.3 Components of the voting system . . . . . . . . . . . . . . . 18
3.0.4 Data collection and Storage: Decentralized database . . . . 19

4 Working of Voting System 20


4.1 Privacy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
4.1.1 Keeping an individual’s vote secret . . . . . . . . . . . . . . 20
4.2 Eligibility . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
4.2.1 Allowing only registered voters to vote, with each such voter
voting only once . . . . . . . . . . . . . . . . . . . . . . . . 21
4.3 Receipt Freeness . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
4.3.1 Voters should be unable to prove to a third party that they
voted in a particular way . . . . . . . . . . . . . . . . . . . . 22
4.4 Convenience . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
4.4.1 - Voters must be able to vote easily, and everyone who is
eligible must be able to vote . . . . . . . . . . . . . . . . . 22
4.5 Verifiability . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
4.5.1 The ability to trust the vote tallying process . . . . . . . . . 22
4.6 Election as a Smart Contract . . . . . . . . . . . . . . . . . . . . . 22
4.6.1 Election Roles . . . . . . . . . . . . . . . . . . . . . . . . . 23
4.6.1.1 Election administrators . . . . . . . . . . . . . . . 23
4.6.1.2 Voters . . . . . . . . . . . . . . . . . . . . . . . . . 23
4.6.1.3 District nodes . . . . . . . . . . . . . . . . . . . . . 24
4.6.1.4 Bootnodes . . . . . . . . . . . . . . . . . . . . . . . 24
4.6.2 Election Process . . . . . . . . . . . . . . . . . . . . . . . . 24
4.6.2.1 Election creation . . . . . . . . . . . . . . . . . . . 24
4.6.2.2 Voter registration . . . . . . . . . . . . . . . . . . 24
4.6.2.3 Vote transaction . . . . . . . . . . . . . . . . . . . 25
4.6.2.4 Tallying results . . . . . . . . . . . . . . . . . . . 25
4.6.2.5 Verifying vote . . . . . . . . . . . . . . . . . . . . . 25

5 Implementation of the BlockChain based Voting System 27


5.1 Program Languages and Dependency . . . . . . . . . . . . . . . . . 27
5.1.1 Program Languages . . . . . . . . . . . . . . . . . . . . . . 27
5.1.2 Dependency . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
5.2 Development Environment . . . . . . . . . . . . . . . . . . . . . . . 28
5.2.1 Remix Ethereum IDE . . . . . . . . . . . . . . . . . . . . . 28
5.2.2 Visual Studio Code . . . . . . . . . . . . . . . . . . . . . . . 28
5.3 Testing Environment . . . . . . . . . . . . . . . . . . . . . . . . . . 28
5.3.1 Chai Assertion Library . . . . . . . . . . . . . . . . . . . . . 29
5.3.2 Mocha.js Library . . . . . . . . . . . . . . . . . . . . . . . . 29
5.4 Ethereum Providers . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
Contents vii

5.4.1 Meta Mask . . . . . . . . . . . . . . . . . . . . . . . . . . . 29


5.4.2 Ganache . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
5.5 Smart Contract Functions . . . . . . . . . . . . . . . . . . . . . . . 30

6 Demonstration 34
6.1 Front-End Development in JavaScript . . . . . . . . . . . . . . . . . 34
6.2 Website Demonstration on Local Host . . . . . . . . . . . . . . . . 37

7 Conclusion and Further works 44


7.1 Future Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44

References 45
List of Figures

3.1 Architechture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16

4.1 User Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21


4.2 program file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23

5.1 Smart Contract Development1 . . . . . . . . . . . . . . . . . . . . . 30


5.2 Smart Contract Development 2 . . . . . . . . . . . . . . . . . . . . 31
5.3 Smart Contract Development 3 . . . . . . . . . . . . . . . . . . . . 32
5.4 Smart Contract Development 4 . . . . . . . . . . . . . . . . . . . . 33

6.1 Front-end Components structure in Code . . . . . . . . . . . . . . . 35


6.2 Front-end Components Folder structure . . . . . . . . . . . . . . . . 36
6.3 Website Demo(i) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
6.4 Website Demo(ii) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
6.5 Website Demo(iii) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
6.6 Website Demo(iv) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
6.7 Website Demo(v) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
6.8 Website Demo(vi) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
6.9 Website Demo(vii) . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
6.10 Website Demo(viii) . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
6.11 Website Demo(ix) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
6.12 Website Demo(x) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
6.13 Website Demo(xi) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
6.14 Website Demo(xii) . . . . . . . . . . . . . . . . . . . . . . . . . . . 43

viii
List of Tables

ix
Abbreviations

DAO Decentralised Autonomus Organisation


Dapp Decentralized application
EVM Electronic Voting Machine
PoA Proof of Authority
PoS Proof of Stake
PoW Proof of Work
evm ethereum virtual machine

x
Abstract
Online voting has been a hot topic of debate for years. There have been a lot
of security and transparency concerns regarding the online voting systems. The
immutability feature of blockchain has made perfect security of internet voting
possible since its inception. Ethereum is a public blockchain platform for decen-
tralised applications(dapps) such as voting systems. We have analysed the security
issues with the present online voting systems and proposed a voting system which
is based on the Ethereums’public blockchain network.
From the shaking of hands in an ancient Greek assembly to paper ballots and so-
phisticated voting machines, we have witnessed a variety of voting procedures in
the history but the voting location, has mostly remained the same. The majority
of us vote at polling stations or via mail-in votes. We must first register for each
vote, and then attend to the allocated polling place on scheduled vote day if we
wish to vote in person, spending far more time than the actual vote. The cost
of voting is, without a doubt, inhibiting individuals from exercising their right to
vote. The first chapter of this thesis will look at the history and current state of
voting methods and systems, as well as their shortcomings. Voting at polling loca-
tions has become obsolete since the internet’s creation.Governments are working
to create a voting system that does not demand that voters show up in person
at a polling place. In the 2007 Estonian parliamentary election, Estonia was one
of the first countries to use an internet-based voting system, and today there are
more than ten countries that use it [2] . While the new voting platform clearly
enhances voting attendance in such countries due to lower voting costs, genuine
security worries exist regarding the platform. First of all, anyone on the earth can
launch an anonymous attack on the internet. Contrary to physically interfering
with a voting machine in a polling place, assaulting an internet-based voting sys-
tem leaves few traces that may be used to track down the attacker. Other forms
of interference for the internet-based voting system include spoofing and DDoS
(distributed denial-of-service attack), which is defined as incoming traffic over-
whelming the server from several sources and making it impossible for frequent
users to reach the website. There are also viral attacks on voter computers, which
Abstract xii

have the potential to affect anything on the computer, including voting. Further-
more, there are numerous ways to tamper with the server or alter the outcome,
and hackers can do so undetected. Furthermore, because the voting website is
centralised to such a degree, tempering it would have a considerably higher influ-
ence than the present spread polling station. The existing online voting method
will be examined in Chapter 2 as well as the potential for it to be hacked.
A blockchain is a decentralised peer-to-peer network that, by consensus, keeps an
immutable record. It was proposed in 1991 by Stuart Haber and W. Scott Stor-
netta with the intention of creating a system where the data is timestamped to be
unaltered. Later, Bayer, Haber, and Stornetta introduced merge trees into the sys-
tem, enabling the printing of relevant timestamps in a single block. It was Satoshi
Nakamoto who first understood the idea in his well-known Bitcoin Whitepaper
from 2008.A trusted third party is not required for transactions to be completed
in the peer-to-peer electronic payment system known as Bitcoin. You can use the
same token multiple times to get around the issue of double-spending. According
to a predetermined consensus rule for the system, the bitcoin network used a hash
function to encrypt each transaction with a timestamp and integrate them ”into
an ongoing chain of hash-based proof-of-work” (Satoshi, 2018). This created a
record that cannot be easily changed unless the proof-of-work is redone, which is
very challenging to accomplish. In Chapter 3, you’ll learn about the blockchain’s
underlying encryption mechanisms and why they’re the safest in various scenarios.
Blockchain’s irreversibility corresponds to our desire for an online voting system.
The system’s dependability would be greater than that of any voting procedure
used in human history if voting outcomes could not be manipulated. Furthermore,
voters with authorization in this system can stay completely anonymous in digi-
tal voting, whereas traditional voting requires interaction with individuals at the
polling place and the possibility of leaving a record. Furthermore, based on the
voting system’s specific design, the outcome is entirely transparent and verifiable
by authorised people.Last but not least, compared to the government’s enormous
investment in voting, the processing time and cost would be insignificant.
We can enhance the blockchain-based voting system even more by putting smart
Abstract xiii

contracts into it. The smart contract, which was first introduced to the blockchain
in 1997 by Nick Szabo, is another essential component. The idea was developed by
Vitalik Buterin for his blockchain-based platform Ethereum, and it was initially
used for blockchain computation. Using the platform and its own programming
language, Solidity, a voting contract could be created prior to the vote, and autho-
rised users could conduct a vote count using the platform’s self-tally feature. You
may read more about the viability of voting on the Ethereum platform in Chapter
3 and see an illustration of a straightforward voting contract created in Solidity.
Blockchain-based voting will have serious faults if it is not properly developed,
despite appearing to be extremely safe and autonomous. For instance, the ”proof-
of-work” consensus is based on the participants’ simple majority agreement. How-
ever, double-spending—in this example, twice voting—can occur if one entity or a
collection of entities holds more than 50 percent of the computational power. This
is a highly unusual occurrence, but it might be correctly dealt with by changing
the consensus rules when building the system or, as a last resort, by a hard fork,
which effectively pastes the blockchain just before the event.
Chapter 1

Introduction

1.1 Overview
A number of businesses stand to benefit from the new, decentralised, immutable,
and distributed technology known as blockchain. The recent deployment of an e-
voting system by the Government of Pakistan may be able to address the current
issues by using block chain technology.
There is little doubt that a new age on the Internet and online businesses has begun
thanks to the rapidly developing blockchain technology that underpins the well-
known cryptocurrency Bitcoin. While the majority of people are only concerned
with bitcoin and other cryptocurrencies, there are actually many administrative
and fintech operations that were previously only possible online or offline that
can now be done securely online as online services thanks to the immutability of
blockchain. Smart contracts and other features of blockchain, which outperform
those of conventional systems, make it a potent tool.
The blockchain contains functioning pieces of code called smart contracts, which
execute as instructed at each stage of the updating process. E-voting is another
popular yet significant topic regarding internet services. The blockchain with
smart contracts stands out as a leading contender to be employed in the devel-
opment of more cost-effective, safer, and transparent electronic voting systems.
Due to their stability, widespread usage, and accessibility of smart contracts logic,
Ethereum and its network are among the most ideal. A safe e-voting system must
guarantee participant privacy while also not allowing for double voting and being
entirely transparent.
Using Ethereum and the Solidity coding language, we created and evaluated an
e-voting application as a smart contract for the Ethereum network.

1
Chapter 1. Introduction 2

Electronic voting systems that enable voters to cast their ballots whenever it is
most convenient via a cell phone, computer, or other electronic device have been
the subject of much investigation. However, none of these technologies have been
applied widely because of the inherent security risks or worries that these sys-
tems might pose to the fairness of the electoral process. In this project, we used
blockchain technology to implement an electronic voting system that is more secure
than some already in place systems that are currently in use. Future suggestions
to strengthen and secure this electronic voting system—one that guarantees voter
anonymity, transparency, and reliable operation—have also been covered in the
chapters that follow.

1.2 Background
Blockchain is the back bone of major cryptocurrencies like Ethereum, Bitcoin and
Tether. It is a peer to peer network which allows the data transfer from one peer
to another peer without interference of any third party. It is also a decentralised,
distributed and immutable network. The blockchain is secure, transparent and
almost unhackable network which makes it perfect for the different system ar-
chitectures that require anonymity. There can be several use cases of blockchain
technology other than just cryptocurrencies. In this project, we have implemented
a blockchain based voting system where the users can cast their votes securely and
anonymously with complete transparency.

1.3 Motivation
The motivation for doing this project was firstly and most importantly an eager-
ness to undertake a challenging project in an interesting area of research and also
to learn more about the field of Blockchain which has the potential to become one
of the most trending areas of research over the next decade. The second factor that
motivated us to choose this project was to provide an open source, transparent
and rigging free voting system. The existing work in this field has been unsat-
isfactory to say the least, so this motivates us to create a breakthrough product
which would serve our fellow beings.

1.4 Objectives
The ultimate goal and objective of this project is to help Election Commission
of Pakistan (ECP) and Government of Pakistan (GOP) to conduct transparent,
decentralized elections in the country. The results will be immutable and there
can’t be any pre-poll or post-poll rigging and we can enjoy a true democracy in
Chapter 1. Introduction 3

our country. We will start this project with a smaller scope by using this system
first in local body elections and then keep on increasing the scope of project.

1.5 Problem statement


In this modern era, we can remove the flaws in our traditional Voting Systems
using blockchain as a revolutionary technology. Our project aims to use blockchain
technology to address the problems associated with electronic voting. Blockchain-
enabled electronic voting can improve voter access while lowering voter fraud.

1.6 Scope of project


The scope of this project is as follows:

• Make voting system decentralized

• Make the voting system immutable and public

• Maintain all the data of voters in database

• Provide voters with secure account creation and verification

• Allow administrator to add, update, remove data from database

1.7 Socio-Economic benefits


The Socio-Economic benefits of Block-Chain Based Voting System are as follow:

• A highly secure, decentralised, anonymous, yet auditable chain of records


can be created using blockchain technology, which is currently being used in
cryptocurrency systems.

• The ability to record, report, and prevent various forms of voter fraud in
elections using the same technology is also possible.

• Given the erroneous information surrounding the 2020 U.S. presidential elec-
tions, the world may be ready for more extensive blockchain voting.
Chapter 2

Literature Survey

We will look at some of the existing research on blockchain-based online elections


in this chapter.In section 2.1, we explore several efforts at identifying the needs
and expectations from such blockchain-based systems. we provide a brief overview
of the blockchain concept and its characteristics, paying particular attention to its
potential use in election architecture. We sum up some current and proposed
online voting systems based on blockchain in sections 2.3 and 2.4 and discuss their
benefits and drawbacks.

2.1 Requirements of blockchain based election


system
Any democratic system depends on elections, so it is crucial that the process
be error-free and that all parties involved have faith in it. The basic standards
that must be met by online election systems in order for them to be deemed a
major improvement over their legacy equivalents have been the subject of extensive
research following the implementation of such systems.We examine and evaluate
some of this literature in this section. InnoVote looked into important aspects
of election software, such as security, transparency, verifiability, accessibility, and
affordability, in a white paper [27] published in 2016. The essay goes on to explain
how important it is for any voting system to guarantee ballot privacy and safeguard
voters from pressure. Effective techniques for spotting errors and corruption should
also exist. Tabatake et al. [32] mention certain crucial needs such anonymity,
fairness, and precision of vote counting in their 2016 work on Zerocoin based voting
system. In addition, coercion resistance and system efficiency are crucial factors
in determining the suitability of such a system. There may also be additional
characteristics, such as the ability to modify or cancel votes. One of the first

4
Chapter 2. Literature Survey 5

businesses to invest in creating a blockchain-based electoral system that is fit for


the future was Agora [1]. They offer a thorough study of the expectations from
such a voting architecture in their white paper, which was published in 2017.
Transparency, confidentiality, honesty, affordability, and accessibility are a few of
them. They continue by pointing out that some of these expectations are not
met by the present voting methods, which include EVM and ballot paper-based
systems. If blockchain technology can be used to meet these expectations, it
might usher in a new era of election technology. They give the cost, security,
and transparency problems with EVMs and their source code, the accessibility
and manpower problems, and the corruption risk of legacy voting systems based
on ballot paper as examples. Apart from that, the majority of voting systems
based on legacy technology have centralised control, which is a drawback that
may be overcome by adopting blockchain, which is naturally decentralised. In a
white paper [29] that was published by Horizon State in 2018, they describe the
key difficulties that need to be resolved in order to establish a blockchain-based
election solution. The system must first earn the voters’ trust and confidence
and provide security against hackers. When evaluating any new online election
solution, the need of ensuring anonymity, simplicity, openness, and affordability
cannot be overstated. Additionally, the system needs to be adaptable to various
jurisdictions and election processes, such as first past the post and preferential
voting. There needs to be tracking of votes and audit procedures to encourage
trust in the system. Voatz, the company that developed the first online blockchain-
based voting system [12] that was heavily utilised in the USA presidential elections,
published a white paper discussing the drawbacks of such online systems and
possible areas for improvement. Keeping the voter’s device secure and avoiding
MITM attacks during the authentication procedure are two of the most crucial
requirements. In addition, identification verification and binding are essential, as
are the viability of transparent audits following the election. In order to prevent
other votes from being impacted if one voting session key is hacked, the system
should also guarantee perfect forward secrecy. Additionally, the system needs to
be robust to fend against DoS attacks. We may summarise the requirements for
blockchain-based voting systems after reviewing the relevant literature as follows:
Authentication This means that only those voters who are listed as eligible
voters on the electoral rolls may cast ballots. A voter who is ineligible must not
be allowed to cast a ballot, and a voter who is qualified must be permitted to do
so after completing the proper procedures. Additionally, a registered voter should
be limited to one legitimate vote. Additionally, the authentication process must
guard against any entity impersonating the voter.
Chapter 2. Literature Survey 6

Anonymity: Voters are free to cast their ballots without being identified. No
one should be able to determine the voter’s choice of candidate save the voter
herself.Before, during, and after the election, this will be ensured. Anonymity is
one of the key components of any election system that protects the voter’s privacy.
Accessibility: Voters should be able to readily cast their ballots from any place,
which is one component of accessibility. Additionally, voters with disabilities ought
to have simple access to the system. The voting process must be simple to use
for voters who may not be familiar with cryptography ideas, nevertheless, in the
case of a blockchain-based election system.Consequently, the design of the system
must be such that those with little to no understanding can not only cast their
votes but also have confidence in it.
Coercer Ressistnce: A voting process ought to be set up so that a voter cannot
be coerced into supporting a particular candidate. In other words, there must
not be a way for a voter to persuade someone else that she voted for a particular
candidate. This will hold true both before and after the election.
Affordibility: A voting system’s affordability has two components. One is the
cost-effectiveness of the product. Implementation costs must be less expensive or
at least similar to those of legacy voting systems. The second factor is the election’s
affordability in terms of time required. Millions of votes must be processed during
the election process. The transaction rate in a blockchain-based system is a crucial
factor in determining the system’s viability. The votes should be confirmed by
consensus in a reasonable amount of time. The voting procedure should be finished
in a day so that the voter doesn’t have to wait too long to cast her ballot.
Security: Every communication between the voter and the authentication server
as well as between the voter and the voting network needs to be secure, that is,
have a cryptographic security level of at least 128 bits or more, because voting
involves handling sensitive data like voter credentials and candidate preferences
(i.e. the same security level as RSA 3072). Given that 128 bit security would take
a billion years to be cracked with present computing power, it should be secure
over the long run (next decade). So that sensitive data cannot be obtained by
eavesdroppers, mechanisms against MITM attacks should be in place.
Integrity: A vote cannot be changed once it has been cast by the voter in order
to maintain electoral integrity. Integrity must be ensured for voters to trust an
election system.
Verifiability: The integrity of the voting process is slightly correlated with the
Chapter 2. Literature Survey 7

verifiability property. Voters ought to be able to confirm that their ballot was re-
ceived and counted. The coercion resistance property must, however, be balanced
with this property.A voter shouldn’t be able to prove to a third party that she
supported a certain candidate, even though she should be able to confirm that her
vote was correctly counted.
Fairness: The election results cannot be known before the voting is finished in
order for the election process to be considered fair. Fairness is crucial because if
running election results are made public, people may be persuaded to support a
certain candidate or a politician may be motivated to compel voters who have not
yet cast their ballots.

2.2 Blockchain: concept and properties


In this section, we’ll talk about the idea of a blockchain and go through some of
its characteristics, particularly as they relate to their suitability for use in voting
systems.

2.2.1 Blockchain concepts


Blockchain was first covered by Satoshi Nakomoto in the Bitcoin white paper.
Blockchain is essentially a peer-to-peer network that controls a ledger. The ledger
is kept up by a consensus-based mechanism because there is no central authority.
Blockchain was initially intended to be used for financial exchanges. The network’s
nodes have the ability to start transactions that are sent over the network. Every
node signs the transactions that they start. The transactions must include the
amount transmitted as well as the sender and recipient addresses. A transaction
may also include other information, such as the type of transaction, transaction
fee, or even a string of random data that is saved in the ledger. All nodes in
the network are expected to get the specifics of every transaction. The next step
is a consensus procedure, during which a block of transactions is suggested to
be added to the blockchain’s ledger. The block is referred to as being added to
the blockchain once a consensus threshold is met. The ledger is kept in a copy
at each node. Nodes will not build on invalid blocks that are attempted to be
added to the ledger by any node. Each node verifies each transaction added to the
proposed block throughout the consensus process. Double spending or incorrect
transactions are therefore not recorded in the ledger. A fair distribution of the
ability to propose blocks among participating nodes should be guaranteed by the
consensus method. A set of data structures (blocks) connected to one another
by hashes can be thought of as the ledger. A hash of the preceding block is
Chapter 2. Literature Survey 8

included in each new block. As a result, the blockchain gains the power to be
unchangeable. In order to edit an existing block, an entity must also modify all
of the blocks that follow it in the chain. The following proposer in a distributed
consensus system wouldn’t add to this altered chain. Because the future proposers
will then build on the longest chain, the invalid chain is orphaned (which is valid).
The transactions are saved as hashes within a block. The Merkle tree structure
in which these hashes are placed. Merkle trees are binary trees that have a root
node, several branch nodes, and leaf nodes. Its two progeny are the ancestors
of all nodes other than leaf nodes. Finding a transaction within a block is now
just O(log n) complex since the transactions are stored in a binary tree structure
rather than a linear structure, where n is the total number of transactions within
the block. Instead of taking a constant amount of time like a linear structure,
insertion into a Merkle tree costs O(log n). The hashes of the transactions make
up the leaf nodes in a standard blockchain Merkle tree [18]. The hashes of two
transactions’ combined hashes make up the branch nodes at the following level.
Let there be, for illustration, four transactions in a block: T1, T2, T3, and T4.
The Merkle tree’s bottom level then consists of four nodes with the values H(T1),
H(T2), H(T3), and H. (T4). The following level is made up of two branch nodes
with the values Hb1 = H(T1)——H(T2)) and Hb2 = H(T3)——H(T4)). The hash
of all the values at the second level, represented by the value H(Hb1——Hb2), is
the Merkle root’s final value. Figure 2.1 shows how blocks are organised in a
blockchain. The block may additionally include other information in addition to
the Merkle root and the hash of the previous block, such as a date, a nonce (a
special number used for mining in the case of Bitcoin), and other information.

2.2.2 Types of Consensus


Mining is the term used to describe the process of adding new blocks to a blockchain.
The honour of proposing the next block will go to one node in the peer-to-peer
network. The consensus mechanism is the method through which this is decided.
Different blockchain networks utilise different consensus processes [6]. We’ll speak
briefly about a few of them.
1. Proof of Work: The consensus model employed in the Bitcoin Blockchain
is called Proof of Work. The miner must solve a challenging puzzle in order to
use this technique. The honour of suggesting the following block belongs to the
node that solves the puzzle first. Calculating the pre-image of a hash function
with a specific pattern in the digest could be this challenging task. Once the
miner node locates the preimage, it must include it in its proposed block so that
other nodes in the peer-to-peer network can verify it. The miners must have some
Chapter 2. Literature Survey 9

motivation to solve this challenge because the PoW paradigm requires them to
solve a challenging puzzle that costs money in the form of hardware and energy.
This incentive is provided by the block reward and transaction charge in Bitcoin.
We point out that this approach functions so long as the majority of nodes in the
network are trustworthy. A corrupt node can easily add bogus blocks at will and
undermine this mechanism if it controls more than 50
2. Proof of Stake: The Proof of Stake (PoS) consensus process was first put
up as a PoW substitute in the Peercoin white paper in 2012. In essence, this
means that nodes with a larger interest in the system are allowed to propose more
additional blocks. The value of the currency maintained in the account and the
length of time it has been held are used to calculate stake. For instance, the
stake value of an account that retains 500 coins for 20 days would be 500 x 20
= 10,000. In certain networks, a node’s stake is simply the proportion of the
network’s total currency that it holds. As a result, an account that controls 2This
system is likewise vulnerable to a 51 percent attack, just like PoW. But in this case,
the attack only succeeds if the attackers control a majority of the system. This
discourages such attacks since those who hold a majority stake have no motivation
to compromise the system, which would reduce the currency’s value. Delegated
PoS (DPoS) is a well-known variation of PoS in which the network’s nodes elect
a group of nodes known as delegates to validate blocks. Voting is conducted once
more to select a new group of delegates for verifying the following block. A node’s
stake, or the quantity of coins it has, determines the weight of its vote. The
BitShares blockchain was the first to use DPoS in 2015.
3. Proof of Authority: A consensus process called Proof of Authority is typ-
ically used for blockchain applications that don’t include cryptocurrencies, in-
cluding voting or bank cash transfers. Only the nodes who have been granted
permission to be verifier nodes are able to suggest new blocks for the ledger, mak-
ing this consensus mechanism relatively centralised. It is one of the quickest and
most energy-efficient consensus mechanisms because there is no puzzle to solve.
Naturally, any node in the network may still verify the legitimacy of the transac-
tions logged there since the ledger is still accessible to everyone. The value of the
validators’ standing as validators serves as their motivation. The network would
lose credibility if the validators mined invalid transactions in the blocks, which
might result in the loss of their position as validators.
4. Practical Byzantine Fault Tolerance (PBFT): One of the supported con-
sensus algorithms on the Hyperledger blockchain is PBFT. Among the network’s
nodes, one is chosen at random to serve as the principal node. A node sends a
Chapter 2. Literature Survey 10

transaction to the primary for validation whenever it sends one. The primary node
then receives a response from each of the other (secondary) nodes after sending
this to them. If two-thirds of the secondaries agree, the primary node sends a final
commit message, and the other nodes vote to attain agreement. In the event of a
breakdown or disconnect, there are also systems in place for the secondary nodes
to take the place of the primary.
Other, less popular consensus procedures exist in addition to the ones mentioned
above, such as Proof of Capacity, Proof of Elapsed Time, Proof of Activity, etc.

2.2.3 Types of Blockchain


Numerous applications of blockchain exist, each with their own unique require-
ments. We provide a brief overview of the various blockchain [4], types in this
subsection based on access and decentralisation.
1. Public Blockchain: The majority of cryptocurrencies, including Bitcoin and
Ether, employ public blockchain technology. Anyone with an internet connection
can access the network by running a node on their computer. Any node can
participate in the consensus process, and all blockchain data and transactions are
open to the public. As a result, it is a fully decentralised system in which a copy
of the ledger is kept on each node. Most of these blockchains use PoW or PoS as
their consensus method. In these open networks, miners often require some type
of incentive, such as a block reward or transaction fees.[8]
2. Private Blockchain: For the needs of a specific company, such as inventory
management, accounts administration, etc., a private or permissioned blockchain
network is typically employed. A node needs a working permission token in order
to join a permissioned blockchain. A permissioned blockchain functions similarly
to a public blockchain inside. Only the network’s nodes can see all of the trans-
actions. These blockchains often employ some kind of Proof of Authority as their
consensus model. These blockchains are not distributed ledgers in the traditional
sense because they are managed by an organisation.
3. Hybrid Blockchain: It combines public and private blockchain. These
blockchains contain a mix of public and private data, some of which may only be
accessible to specific nodes. Some transactions’ contents might not be accessible
to the general public, but the transaction itself can be validated. A user may
require a permission token in order to view all transactions or take part fully in
the network. These blockchains are typically applied to voting or government
applications. An illustration of a hybrid blockchain is Hyperledger.
Chapter 2. Literature Survey 11

4. Consortium Blockchaun: This is run by a group rather than a single entity,


similar to a private blockchain. For instance, a group of banks or real estate firms
might oversee a blockchain.
We see that speed and decentralisation are trade-offs in the aforementioned blockchain
variants. Less decentralised blockchains operate more quickly, and vice versa.

2.3 Famous Reseach papers on Blockchain based


voting system:-
2.3.1 Votereum
Blockchain, the underlying technology of the original cryptocurrency, has received
a lot of attention recently. With its distributed ledger, trustless system, and im-
mutability, it not only revolutionised the electronic payment sector but also offers
a practical solution in other contexts where trust is required. The electronic vot-
ing (E-voting) system is an illustration of how the characteristics of blockchain
could be utilised to provide a framework for a transparent, equitable, and widely
verifiable electoral process.Here, we propose Votereum, an electronic voting sys-
tem built on blockchain technology, after first outlining the requirements. The
suggested system is powered by the Ethereum platform, with one server in charge
of system administration and another taking care of all queries pertaining to the
blockchain. In order to assess and analyse a number of security issues, the solution
is also implemented on the Rinkeby testing network. These issues are detailed in
the paper’s conclusion.[7]

2.3.2 Voatz
Absentee voting is available to over one million active duty military personnel
and 2.9 million abroad (non-military) citizens. In 2018, however, just roughly 26
percent of military personnel and 4.7 percent of abroad citizens voted, compared
to 64.9 percent of the civilian voting population. In 2018, 17 percent of military
voters and 26 percent of abroad voters did not vote because their ballot arrived late
or did not arrive at all. A total of 48 percent of military personnel said they would
welcome the option to vote over the internet and that they were more confident in
voting via the internet than other methods of ballot delivery and return. 1 and 2
Last year, some overseas voters expressed their dissatisfaction by initiating a class
action lawsuit against multiple states, demanding the chance to vote electronically.
[2]
Chapter 2. Literature Survey 12

2.3.3 BlockVotes
Electronic voting systems have a number of advantages over traditional ballot-
based voting methods, the most notable of which is the accuracy and speed with
which votes are counted. Electronic voting systems, on the other hand, have a
number of technical and security difficulties that have limited their use in voting
scenarios such as company elections and political elections. By their very nature,
centralised electronic voting systems are insecure, and there are numerous ways
for cyber-attacks to interfere with the voting results. The electronic voting system
should be very secure, tamper-proof, and the voting system should be reliable. We
propose BlockVOTE, a Blockchain-based electronic voting system, in this paper.
The consensus management mechanism of the Blockchain is used in our proposal
to ensure that the voting process is secure and trustworthy. This research provides
architecture design and implementation recommendations. Experimentation was
used to design and test the proposal’s implementation. The study concludes with
the results of the experiment and a discussion of the potential of adopting our
approach in a real election.[1]

2.3.4 SecEVS
The voting system has transitioned from a paper-based to a digital approach
in today’s digital age. Transparency, decentralisation, irreversibility, and non-
repudiation are all characteristics of a digital e-voting system.A number of secu-
rity and transparency concerns have been highlighted by the use of digital e-voting
technologies. In this work, we used blockchain technology to address system needs
and address security concerns in a digital e-voting system. It opens up new possi-
bilities for any organisation or country to implement a secure e-voting system. The
solution is superior to previous solutions because it is a decentralised system that
stores results in the form of bit-coins and distributes them to various locations.
We’ll also look at the security of our proposed voting system, which demonstrates
that our protocol is more secure than alternative options.[5]

2.4 Blockchain Based E-Voting Recording Sys-


tem Design
Digital technology is supporting more and more people’s lives in the modern world.
It uses a lot more traditional paper in its implementation than the election sys-
tem does. The widespread usage of the traditional electoral process endangers the
issues of security and transparency (offline). A single institution still maintains
control over the centralised system used to conduct general elections. Traditional
Chapter 2. Literature Survey 13

electoral systems have some drawbacks, such as the potential for tampering with
the database of substantial opportunities by an institution with total control over
the system and database. Since it is built on a decentralised system in which mul-
tiple people hold the entire database, blockchain technology is one of the answers.
Blockchain has been employed by the Bitcoin system, commonly referred to as the
decentralised banking system. One of the most frequent reasons for database tam-
pering can be lessened by integrating blockchain into the distribution of datasets
on e-voting systems. The usage of the blockchain algorithm to track the outcomes
of every election site is investigated in this study. This thesis proposed a method
based on each node in the built-in blockchain completing a predetermined turn on
the system, in contrast to Bitcoin’s Proof of Work.

2.5 A CONCEPTUAL SECURE BLOCKCHAIN-


BASED ELECTRONIC VOTING SYSTEM
Blockchain is expanding the potential for the development of new categories of
digital services. Even though research on the topic is still in its early phases, it
has mostly focused on the technical and legal challenges rather than utilising this
novel idea and creating better digital services.We’ll outline an idea for an inno-
vative electronic voting system that might be implemented utilising open source
Blockchain technology in municipal or national elections. The Blockchain-based
system will be trustworthy, safe, and anonymous and will help boost voter turnout
and public confidence in governments.

2.6 Conclusion from Literature survey


After performing extensive literature review and going through a vast majority of
different research papers spanning over a number of years from 2017 to 2022,What
we aim to achieve is to make a Blockchain based electoral system which will be se-
cured, transparent and rigging-free . After reviewing the existing research papers,
we have been able to conclude that making such a system by using blockchain
technology is a fresh topic of research that needs alot of work to be done.
Literature review is the real backbone of a system’s development. Literature re-
view helps us to get to learn about the existing systems which have been developed
over the years in a particular area of research and also helps us to identify their
pros and cons and where those systems lack behind. Therefore, it becomes easy
for us to decide the scope of the system that we aim to develop. And by perform-
ing extensive research and development work, we get to know about technology
Chapter 2. Literature Survey 14

advancements in our field and also about how these technologies are working and
this makes our vision clear.
Chapter 3

Introduction To A Prospective
Ethereum-based Blockchain
Voting System

Blockchain is a collection of interconnected increasing blocks. Every block in a


typical blockchain comprises transaction data, a timestamp, and a hash function
which is reliant on the previous block. To modify any of the data, the network
must come to an agreement, which is practically difficult.Any attempt to change
the information is more difficult because it must also affect subsequent blocks
because the block generation process uses the previous hash to link the block.
Voters may think the blockchain-based voting system is as simple as a regular
online voting platform, but it actually uses blockchain technology. Just two of the
many components of a voting system are voter registration and the creation of
election forms. The safest voting system conceivable must be developed; it must
be impervious to attempts to alter voting data. It appears promising that the
blockchain concept will be used in the voting process. We may use a variety of
blockchain concepts and techniques in the voting system. It is also feasible to de-
velop a separate voting platform, though doing so would be more expensive than
using an existing platform based on a blockchain. To achieve the same level of
security, we will integrate an existing blockchain platform. Although Bitcoin is
without a doubt the most well-known cryptocurrency, other applications cannot be
run on it. We’ll talk about Ethereum as a voting system backend in this section.
A blockchain platform based on Ethereum would be used in the voting system
based on blockchain, which could resemble the current internet voting website for
voters. Ethereum, a ”Next-Generation Smart Contract and Decentralized Appli-
cation Platform,” was created by Vitalik Buterin in 2013. To put it another way,
15
Chapter 3. Introduction To A Prospective Ethereum-based Blockchain Voting
System 16

Figure 3.1: Architechture

it aims to provide a mechanism for developing decentralised applications (DApps).

3.0.1 Principle of design


Only registered voters are allowed to cast ballots during a particular election ses-
sion. Only registered voters who have gone through additional verification before
casting a ballot are allowed to do so. Each vote is counted without exception.If a
vote is counted and cast by a registered and validated voter, there won’t be any
Chapter 3. Introduction To A Prospective Ethereum-based Blockchain Voting
System 17

votes that are invalid in any way. [3] .


Voting more than once is not allowed. Online voting systems seem to be concerned
about multiple votes from a single voter.Voting systems based on blockchains,
particularly those that use Ethereum as the platform, can easily prevent this,
though. Once a voter has been identified (using a special ID) and cast a ballot,
their status will change to ”voted” (or different variations of ”voted”), making it
impossible for them to do so again but allowing them to confirm that their vote
was indeed cast. Because no one has the authority to alter the results of any
vote so the vote is credible. Before putting the voting mechanism into place, the
source code for the entire system should be evaluated. All information pertaining
to voters and votes must be kept in a secure database, despite the fact that the
source code for the voting system is available to the public. All eligible voters
must first register in order to be given a ballot for the main presidential election.
More than 40 states in the US currently allow for online voter registration. It
makes sense and is practical for election officials to transfer the current resident
transfer database to the Ethereum platform. Another possibility is to integrate
the voting smart contract with an interface to ascertain the voter’s eligibility. The
database will always be protected from unauthorised alterations. Additionally,
voter verification prior to voting requires biometric data, such as images. The
second step is voter verification. Voters have the option of casting their ballots
online or through mobile applications. Facial recognition could be used to verify
a voter’s identity prior to voting. If they can validate the voter’s distinct identity,
other methods of verification may be used.

3.0.2 Smart Contract Dataflow Diagram


A confirmed voter casts one vote from a list of candidates during the voting stage
while remaining anonymous thanks to ring signature encryption, which also en-
ables observers to count the votes without knowing who the voters are. * When
observers tabulate the results, voters’ identities are protected through asymmet-
ric encryption known as Ring signatures. the The fourth stage is vote validation,
where a second voter verification check is performed and the voter status is changed
to ”voted.” Vote totaling and counting, which involves entering the votes into a
database, is the fifth stage. Observers other than the administrator count the
votes.
Chapter 3. Introduction To A Prospective Ethereum-based Blockchain Voting
System 18

3.0.3 Components of the voting system


This voting process has important components that correspond to the various
voting phases. Voter registration and voting via the user interface require the use
of applications like mobile and web. Depending on the laws in each state, they may
be used on a single application or website or several. The backend should make
use of a smart contract and a database server. We only discuss the most basic
component of the voting system for the smart contract segment when discussing
implementation and smart contracts, along with how well it functions and how
much it costs.
Chapter 3. Introduction To A Prospective Ethereum-based Blockchain Voting
System 19

3.0.4 Data collection and Storage: Decentralized database


We intend to employ blockchain as our method of data storage in order to handle
such a large database and ensure verifiability. Election fraud and data tampering
are possible during an e-voting platform election. Ethereum, a decentralised open
source blockchain platform, will be used. We use it since it is completely transpar-
ent and would not be influenced by any creators or parties. A write-once bulletin
board might be a good analogy for this idea. The public has access in order to
track election statistics . After a vote by a verified voter, all verifiable information
is published on the decentralised database. Information cannot be removed once
it has been broadcast, making it a useful tool for preventing
Chapter 4

Working of Voting System

As we have discussed the methodology of our project in chapter 3, in this chapter


we will discuss the working of our project. Our Graphic user interface (GUI) will
be divided into two section. One section will be of Admin Panel, other will be of
User. Admin section has 5 functions which are listed below

• Admin can verify voters.

• Admin can add new candidate.

• Admin can register for voting.

• Admin can start and end voting process.

• Admin can declare results.

Other page will be for Users. User has 3 functions which are listed below

• User can register him/herself.

• User can vote

• User can see results.

Structured diagram and GUI to explain this functionality is given below:

4.1 Privacy
4.1.1 Keeping an individual’s vote secret
For protecting the privacy, features of blockchain’s cryptographic are mostly used
by the system . The blockchain creates a voter hash as soon as a voter registers
20
Chapter 4. Working of Voting System 21

Figure 4.1: User Interface

with the system.The voter’s unique identifier within the blockchain is provided
by the collision resistance property of the cryptographic hash, which also guards
against misuse. As a result, voting is non-trivially traceable, shielding the voter
against coercion.

4.2 Eligibility
4.2.1 Allowing only registered voters to vote, with each
such voter voting only once
All eligible users must register using distinctive identifiers, such as official docu-
ments, to demonstrate their status. Our solution makes use of finger print technol-
ogy to create a robust authentication method that guarantees that only authorised
voters may access the system. The system can prevent double voting by using bio-
metrics.
Chapter 4. Working of Voting System 22

4.3 Receipt Freeness


4.3.1 Voters should be unable to prove to a third party
that they voted in a particular way
This solution creates a cryptographic hash for each such event while allowing voters
to cast their ballots however they see fit (transaction). To obtain verifiability, or
to ascertain whether a specific vote was counted, this is required. The voter’s
voting history cannot be decoded using this hash, though.

4.4 Convenience
4.4.1 - Voters must be able to vote easily, and everyone
who is eligible must be able to vote
Only a small amount of user input is needed for the voting process. using the
system’s easy-to-use web-based interface.The authentication process uses finger-
printing to get rid of the need to memorise usernames and passwords. The user
can readily interact with it because each stage is connected to the others.

4.5 Verifiability
4.5.1 The ability to trust the vote tallying process
A user receives their specific transaction ID in the form of a cryptographic hash
after accurately voting. To find out if their vote was counted, a user can look up
the transaction ID. However, this procedure does not allow users to watch their
votes, which was established to reduce threats when voting under duress. This
highlights the effectiveness of the suggested method in relation to the particular
needs of e-voting.It also emphasises the importance of blockchain’s unique qualities
and their crucial role in creating the foundation for an effective e-voting system.
We therefore believe that the work given here is very helpful for using blockchain.

4.6 Election as a Smart Contract


When discussing a ”smart contract,” it is necessary to specify the roles played
by the parties to the agreement (in this case, the election agreement) as well as
the numerous components and transactions that make up the agreement process.
Here the election procedure is introduced first, then the election roles.
Chapter 4. Working of Voting System 23

Figure 4.2: program file

4.6.1 Election Roles


The following positions are made possible via elections for individuals or insti-
tutions. where the same function can be enrolled by numerous institutions and
people.
4.6.1.1 Election administrators
This function is registered with numerous reputable organisations and businesses.
Election administrators construct the aforementioned election, configure ballots,
register voters, choose the election’s lifetime, and assign permissioned nodes. They
also determine the election type.
4.6.1.2 Voters
Voters can authenticate themselves, load ballots, cast their votes, and check their
votes after an election has ended for elections to which they are entitled. In the
near future, voting in elections could be rewarded with tokens, and this could be
done in conjunction with a smart city initiative.
Chapter 4. Working of Voting System 24

4.6.1.3 District nodes


When election administrators begin an election, each ballot smart contract for each
voting district is put onto the blockchain. When the ballot smart contracts are
created, each of the connected district nodes receives permission to communicate
with their specific smart contract. When a block time has been reached after each
voter has cast his vote using his corresponding smart contract, the votes that are
accepted by all the related district nodes are attached to the blockchain.
4.6.1.4 Bootnodes
Each institution runs a bootnode that has authorised access to the network. A
bootnode facilitates district node discovery and communication. In order to help
district nodes discover their peers more quickly, bootnodes run on static IP ad-
dresses and do not maintain any state on the blockchain.

4.6.2 Election Process


The election administrators instantiate a set of smart contracts on the blockchain
to represent each election process. One smart contract is established for each vot-
ing district, so there are many smart contracts involved in an election. Whenever
a user authenticates themselves when voting for a certain voter with their spec-
ified voting district location, defined in the voters registration phase, the smart
contract with the relevant location will be prompted to the voter. Following are
the primary election-related activities:
4.6.2.1 Election creation
Election administrators produce ballots for elections(dApp) using a decentralised
software.The administrator of an election creation smart contract, which details a
list of candidates and voting districts, is in communication with this decentralised
software. Every voting district has a parameter in every smart contract for a
ballot. With a list of the candidates for each voting district, this smart contract
generates a number of ballot smart contracts and puts them onto the blockchain.
When the election is created, permission to connect with each pertinent district
node’s associated ballot smart contract is granted.
4.6.2.2 Voter registration
The election administrators are in charge of voter registration. Election admin-
istrators must include a deterministic list of eligible voters when they create an
election. To securely authenticate and authorise qualified individuals, this calls
for a component of a government identity verification service. Each qualified voter
should have an electronic ID and PIN number as well as knowledge of the voting
Chapter 4. Working of Voting System 25

district they are situated in using such verification services. Each qualified voter
would have a corresponding wallet created for them. Another method might be
implemented to establish a wallet specifically for each voter so that the system
itself is unaware of which wallet corresponds to each election for which the voter
is qualified.
4.6.2.3 Vote transaction
Each time a voter uses a voting district, they interact with a ballot smart contract
that defines each voter’s voting district exactly the same way.The relevant district
node, which this smart contract uses to communicate with the blockchain, adds the
vote to the blockchain if agreement is obtained by the majority of the associated
district nodes. Each voter receives a transaction ID to use for verification, and
every vote is recorded as a transaction on the blockchain. Information regarding
who was chosen and where the vote was cast is included in every transaction on the
blockchain. If all relevant district nodes concur on the verification of the vote data,
the related ballot smart contract will append each vote into the blockchain. Voters
are only allowed to cast one ballot per election since each ballot they cast lightens
their wallet’s load by one. On the public Ethereum blockchain, a single transaction
contains the transaction ID, the block in which the transaction is stored, the age
of the transaction, the wallets that sent and received the transaction, the total
amount sent, and the transaction fee. In our system, a transaction just needs the
transaction ID, the block in which it is included, and the smart contract to which
it was delivered; it does not need any further data. The transaction’s value, which
is the data that was chosen to be cast, reveals that party D received the majority
of the vote in this transaction. Therefore, no information on the specific voter who
cast this particular vote is included in a transaction in our system. The age of a
single transaction is excluded to prevent timing attacks on specific voters.
4.6.2.4 Tallying results
In the smart contracts, the election results are calculated instantly. Each voting
smart contract keeps track of the results for its respective location in its own
storage. The final outcome for each smart contract is made public after an election.
4.6.2.5 Verifying vote
The transaction ID associated with each voter’s vote is provided. After establishing
their identity with their electronic ID and matching PIN, each voter can visit
their elected official and display their transaction ID. The government official uses
the blockchain explorer to find the transaction on the blockchain that has the
appropriate transaction ID using district node access to the network. As a result,
Chapter 4. Working of Voting System 26

the voter can check the accuracy and completeness of his vote by viewing it on
the blockchain.
Chapter 5

Implementation of the
BlockChain based Voting System

In this chapter, the implementation and deployment of our blockchain based voting
system will be discussed in detail. The implementation contains smart contracts
and website front end for both the user and the election administrator. We will list
down all the tools and frameworks used in the implementation of this blockchain
based voting system.

5.1 Program Languages and Dependency


5.1.1 Program Languages
JavaScript
For web pages, JavaScript is a very popular scripting language. It is primarily
used to enhance the functionality of web pages in browsers, but many environ-
ments other than browsers also make use of it, such as Node.js. For both admin
and client side functionalities of our voting system, we implemented the front-end
functionality using JavaScript. In addition, to interact with any Smart Contract
from both the front-end and the back-end, we used Web3.js, a JavaScript API
offered by Ethereum.
Solidity
On the Ethereum blockchain, Smart Contracts are primarily implemented us-
ing the contract-oriented programming language Solidity. C++, Python, and
JavaScript all have an effect on Solidity. A smart contract in Solidity has its
own state variables and functions, just like a class in C++. The function call in
a Smart Contract is frequently asynchronous because Smart Contract functions
are executed when miners start mining the block that contains them. In order

27
Chapter 5. Implementation of the BlockChain based Voting System 28

to track the outcomes of the function calls, Ethereum provides us with an Event
mechanism. An event is triggered when a function is called, and when an event is
triggered, it sends the desired values back to the transaction sender.

5.1.2 Dependency
Web3.js
Web3.js is a JavaScript API provided by Ethereum to interact with any Smart
Contract from both front-end as well as back-end.We are using web3.js for front
end integration of our smart contract. There is an alternate library available for
interaction with smart contracts know as ethers.js. Both of these are constantly
improving but web3.js has better documentation available out there. Therefore,
we are using web3 in our project for all the smart contract interactions.
Truffle
Truffle is a framework provided by Ethereum to deploy the smart contacts, migrate
them to any evm compatible blockchain network.There is a complete truffle suite
available for contract compiling, deploying, migration and automated testing of the
smart contracts. We can install the separate packages through the node package
manager as well.

5.2 Development Environment


5.2.1 Remix Ethereum IDE
Remix Ethereum IDE is an online integrated development environment for solidity
smart contracts. It is an ide provided by ethereum to deploy the smart contracts
on blockchain online without requiring any additional software to install. We can
write all the code in browser and deploy it to blockchain network by using any
ethereum web3 providers such as metamask.

5.2.2 Visual Studio Code


We will use visual studio code for writing and compiling the front end code of our
website. Most of the code is in JavaScript. We will be using node.js and node
package manager for deploying the website on localhost.

5.3 Testing Environment


In smart contracts development, testing is a very important stage. Due to the
immutability of the smart contracts, data once written on the blockchain cannot
be altered; consequently, we must fully test smart contracts before deploying them
on the blockchain.. There are two most famous javascripts libraries used for smart
Chapter 5. Implementation of the BlockChain based Voting System 29

contract testing. We will discuss them in detail below.

5.3.1 Chai Assertion Library


Chai is an assertion library and test framework for node.js and the browser that
may be combined with any JavaScript testing framework. This library can be used
to do unit testing on intelligent contracts.

5.3.2 Mocha.js Library


For asynchronous testing, Mocha is a JavaScript test framework that operates in
the browser and on Node.js. All Mocha test cases are conducted sequentially,
allowing for accurate and customizable reporting while mapping uncaught excep-
tions to the corresponding test cases.

5.4 Ethereum Providers


In order to connect with a blockchain network, we need to become a part of that
blockchain by running a node. Running a full node of a blockchain can be quite
expensive for the computer resources. There are some ethereum providers that
can provide access to the remote node of ethereum for free. You can be a part
of blockchain without any need to save all the data on your computer. In our
project, we only need to deploy the smart contracts from the admin side, while
the user only need to vote via ethereum transactions. Both of these tasks can be
carried through remote node easily. Some of the most famous ethereum provides
are given below:

5.4.1 Meta Mask


Meta Mask is an Ethereum based web3 wallet which is used to send and receive
transactions on the blockchain. In the production stage, user can connect his
registered metamask wallet with our front end to cast his vote.

5.4.2 Ganache
Ganache is a local blockchain network designed for quick Ethereum implementa-
tion. Ganache can be used during the whole lifecycle of the project to create,
deploy, and test our decentralised applications in a secure and deterministic envi-
ronment. In addition to the desktop application, the Ethereum network also offers
a command line interface for faster transactions.
Chapter 5. Implementation of the BlockChain based Voting System 30

Figure 5.1: Smart Contract Development1

5.5 Smart Contract Functions


Below are the main functions of the Election smart contract written in solidity
programming language.
Chapter 5. Implementation of the BlockChain based Voting System 31

Figure 5.2: Smart Contract Development 2


Chapter 5. Implementation of the BlockChain based Voting System 32

Figure 5.3: Smart Contract Development 3


Chapter 5. Implementation of the BlockChain based Voting System 33

Figure 5.4: Smart Contract Development 4


Chapter 6

Demonstration

In this section, we will show you the demonstration of our blockchain based voting
system. The demonstration includes front-end side code as well as demo Website
on our local host. The smart contracts for conducting the Election will be deployed
on the Ethereum public blockchain but will be integrated with a front end to
enhance the user experience and make the whole voting process easier.

6.1 Front-End Development in JavaScript


For the Front end of our dapp, we have implemented it in JavaScript using node.js
and node package manager (aka npm ) for downloading and installing all of the
required dependencies and libraries. Lets start by demonstrating the important
components of our front end side. The main components structure of our front
end website is given below both in form of code as well as in folder structure.

34
Chapter 6. Demonstration 35

Figure 6.1: Front-end Components structure in Code


Chapter 6. Demonstration 36

Figure 6.2: Front-end Components Folder structure


Chapter 6. Demonstration 37

Figure 6.3: Website Demo(i)

6.2 Website Demonstration on Local Host


For the website demonstration, we will need to run the ganache-cli server in the
console. We will keep it running in the background and deploy the election smart
contract. After that we will run the front end website on the local host and load
it in a web3 compatible browser. Some screen shots of the Website demo are
attached below:
Chapter 6. Demonstration 38

Figure 6.4: Website Demo(ii)

Figure 6.5: Website Demo(iii)


Chapter 6. Demonstration 39

Figure 6.6: Website Demo(iv)

Figure 6.7: Website Demo(v)


Chapter 6. Demonstration 40

Figure 6.8: Website Demo(vi)

Figure 6.9: Website Demo(vii)


Chapter 6. Demonstration 41

Figure 6.10: Website Demo(viii)

Figure 6.11: Website Demo(ix)


Chapter 6. Demonstration 42

Figure 6.12: Website Demo(x)

Figure 6.13: Website Demo(xi)


Chapter 6. Demonstration 43

Figure 6.14: Website Demo(xii)


Chapter 7

Conclusion and Further works

The ultimate aim of this project was to create an online voting system based on
the blockchain technology that enables registered voters to cast vote online from
anywhere in the world. In order to create the voting system more transparent
and advanced, a lot of research and development has been started recently in this
field. Blockchain is by far the most suitable option to replace the traditional paper
voting and electronic voting with online voting via blockchain. There are a lot of
advantages of using such revolutionary technology such as more transparency,
lesser election cost and higher security but there are also some factors which are
hindering the global adoption of blockchain based voting system. The one primary
issue in this regard is user’s privacy, security and double spending. We have
implemented such a system which prevents double spending and keeps the overall
process transparent. The anonymity of user is also ensured by using the public
key addresses for casting votes instead of voter name or cnic number.

7.1 Future Works


This project has addressed some key issues with the traditional voting system but
still a lot of improvements are needed to be done. Some of which are mentioned
below:

• Facial and Biometric Identification.

• Additional layers of Security.

• Two Factor Authentication.

44
References

[1] Chinnapong Angsuchotmetee, Pisal Setthawong, and Sapjarern


Udomviriyalanon. Blockvote: An architecture of a blockchain-based
electronic voting system. In 2019 23rd International Computer Science and
Engineering Conference (ICSEC), pages 110–116. IEEE, 2019.

[2] Ahmed Ben Ayed. A conceptual secure blockchain-based electronic voting


system. International Journal of Network Security & Its Applications, 9(3):
01–09, 2017.

[3] Fririk Hjálmarsson, Gunnlaugur K Hreiarsson, Mohammad Hamdaqa, and


Gı́sli Hjálmtỳsson. Blockchain-based e-voting system. In 2018 IEEE 11th
international conference on cloud computing (CLOUD), pages 983–986. IEEE,
2018.

[4] Sana Sabah Sabry, Nada Mahdi Kaittan, and Israa Majeed. The road to the
blockchain technology: Concept and types. Periodicals of Engineering and
Natural Sciences (PEN), 7(4):1821–1832, 2019.

[5] Ashish Singh and Kakali Chatterjee. Secevs: Secure electronic voting sys-
tem using blockchain technology. In 2018 International Conference on Com-
puting, Power and Communication Technologies (GUCON), pages 863–867.
IEEE, 2018.

[6] William Stallings. A blockchain tutorial. The Internet Protocol Journal, 20:
40, Novemner, 2017.

[7] Linh Vo-Cao-Thuy, Khoi Cao-Minh, Chuong Dang-Le-Bao, and Tuan A


Nguyen. Votereum: An ethereum-based e-voting system. In 2019 IEEE-
RIVF International Conference on Computing and Communication Technolo-
gies (RIVF), pages 1–6. IEEE, 2019.

[8] Rebecca Yang, Ron Wakefield, Sainan Lyu, Sajani Jayasuriya, Fengling Han,
Xun Yi, Xuechao Yang, Gayashan Amarasinghe, and Shiping Chen. Public
45
References 46

and private blockchain in construction business process and information inte-


gration. Automation in construction, 118:103276, 2020.

You might also like