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

Final Project Report - A4 - Online Voting System Using Blockchain Technology

Uploaded by

manshishubham09
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views

Final Project Report - A4 - Online Voting System Using Blockchain Technology

Uploaded by

manshishubham09
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 49

ONLINE VOTING SYSTEM

REPORT SUBMITTED
BY:

Soumyadip Bhattacharya (11500220024)


Sohom Das (11500220010)
Manshi Shubham (11500220011)
Asmita Chakraborty (11500220036)

Academic Year (2020-24)


UNDER THE GUIDANCE OF

Mr. Sabyasachi Chakraborty

DEPARTMENT OF INFORMATION TECHNOLOGY

B. P. PODDAR INSTITUTE OF MANAGEMENT AND TECHNOLOGY

FOR THE AWARD OF THE DEGREE OF

Bachelor of Technology
In
Information Technology

DEPARTMENT OF INFORMATION TECHNOLOGY


B.P. PODDAR INSTITUTE OF MANAGEMENT & TECHNOLOGY
(Affiliated to Maulana Abul Kalam Azad University of Technology, West Bengal)
137, V.I.P Road, Poddar Vihar. Kolkata - 700052
ONLINE VOTING SYSTEM
REPORT SUBMITTED
BY:

Soumyadip Bhattacharya (115002200)


Sohom Das (11500220010)
Manshi Shubham (11500220011)
Asmita Chakraborty (11500220036)

Academic Year (2020-24)


UNDER THE GUIDANCE OF

Mr. Sabyasachi Chakraborty

DEPARTMENT OF INFORMATION TECHNOLOGY

B. P. PODDAR INSTITUTE OF MANAGEMENT AND TECHNOLOGY

FOR THE AWARD OF THE DEGREE OF

Bachelor of Technology
In
Information Technology

DEPARTMENT OF INFORMATION TECHNOLOGY


B.P. PODDAR INSTITUTE OF MANAGEMENT & TECHNOLOGY
(Affiliated to Maulana Abul Kalam Azad University of Technology, West Bengal)
137, V.I.P Road, Poddar Vihar. Kolkata - 700052
DEPARTMENT OF INFORMATION TECHNOLOGY
B.P. PODDAR INSTITUTE OF MANAGEMENT & TECHNOLOGY
(Affiliated to Maulana Abul Kalam Azad University of Technology, West Bengal)
137, V.I.P Road, Poddar Vihar. Kolkata - 700052

CERTIFICATE

This is to certify that the Project Synopsis entitled, Voting System submitted by Sohom Das, Manshi
Shubham, Asmita Chakraborty, and Soumyadip Bhattacharya from B. P. Poddar Institute of
Management and Technology, is a record of future Project work will be carried out by them under
my
supervision and guidance and will be worthy of consideration for the award of the degree of Bachelor
of Technology in Information Technology of the Institute.

(Signature of HOD)
(Signature of the Supervisor)
Dept. of Information Technology
Dept. of Information Technology

(Signature of External Examiner)


ACKNOWLEDGEMENT

We are grateful to be a part of this report included in the curriculum of


MAKAUT as well as the college. We are thankful to our parents, teachers, and
friends who have directly or indirectly helped us to complete this Report. The
process of preparing the Report was guided by our teacher, Mr. Sabyasachi
Chakraborty as well as our Principal Ma’am, Dr. Sutapa Mukherjee and was a
great experience. We convey our heart-felt regards and appreciation for their
sincere cooperation in the report.

(Full Signature of the Student(s))

Date:

Dept. of Information Technology

B.P. Poddar Institute of Management & Technology


Table of Content
1. Departmental Mission, Vision, PEO, PO, 1
PSO
2. Title 4
3. Mapping with PO and PSO 5
4. Abstract 7

5. Activity chart 8

6. Introduction 9
7. Literature review 10
8. Theory 17
9. Software requirements 23
10. Proposed system 28
11. Results & Discussions 45

12. Future proposal 47

13. References 48
DEPARTMENTAL MISSION:

Enrich students with sound knowledge in fundamentals and cutting-edge


technologies of Computer Science and Information Technology to excel
globally in challenging roles in industries and academics.
Emphasize quality teaching, learning and research to encourage creative
thoughts through application of professional knowledge and skill.
Inspire leadership and entrepreneurship skills in evolving areas of Computer
Science and Engineering with social and environmental awareness.
Instill moral and ethical values to attain the highest level of accomplishment and
personal growth.

DEPARTMENTAL VISION:
Developing competent professionals in Information Technology, who can adapt
to constantly evolving technologies for addressing industrial and social needs
through continuous learning.

6
Online Voting System Using
Blockchain Technology

7
Abstract:
Building a secure electronic voting system that offers the fairness and privacy of
current voting schemes, while providing the transparency and flexibility offered
by electronic systems has been a challenge for a long time. In this Report, we
evaluate an application of blockchain as a service to implement distributed
electronic voting systems. The Report proposes a novel electronic voting system
based on blockchain that addresses some of the limitations in existing systems
and evaluates some of the popular blockchain frameworks for the purpose of
constructing a blockchain-based e-voting system. In particular, we evaluate the
potential of distributed ledger technologies through the description of a case
study; namely, the process of an election, and the implementation of a
blockchain-based application, which improves the security and decreases the
cost of hosting a fair election. The blockchain is said to be an emerging,
decentralized, and distributed technology that promises to enhance different
aspects of many industries. Expanding electronic voting into blockchain
technology could be the solution to eliminate the present concerns in the
electronic voting system.

8
Activity chart:

Activity 1 Research on the given topic

Activity 2 Project analysis

Activity 3 Learning the required tech stack

Activity 4 Prototyping and designing

Activity 5 Development of smart contract

Activity 6 Development of Frontend in React

Activity 7 Connecting Frontend with Smart Contract

Activity 8 Testing of the product

Table 2: activity chart

9
Introduction:

Elections are fundamental pillar of a democratic system enabling the public to


express their views in the form of a vote. Due to their significance to our society,
the election process should be transparent and reliable so as to ensure
participants of its credibility. Within this context, the approach to voting has
been an ever-evolving domain. This evolution is primarily driven by the efforts
to make the system secure, verifiable, and transparent. In view of its
significance, continuous efforts have been made to improve overall efficiency
and resilience of the voting system. Electronic voting or e-voting has a profound
role in this. Since its first use as punched-card ballots in 1960’s, e-voting
systems have achieved remarkable progress with its adaption using the internet
technologies (Gobel et al, 2015). However, e-voting systems must adhere to
specific benchmark parameters so as to facilitate its widespread adoption. These
parameters include anonymity of the voter, integrity of the vote and non-
repudiation among others. Blockchain is one of the emerging technologies with
strong cryptographic foundations enabling applications to leverage these
abilities to achieve resilient security solutions. A Blockchain resembles a data
structure which maintains and shares all the transactions being executed through
its genesis. It is primarily a distributed decentralized database that maintains a
complete list of constantly germinating and growing data records secured from
unauthorized manipulating, tampering and revision. Blockchain CORE
Metadata, citation, and similar papers at core.ac.uk Provided by UWL
Repository allows every user to connect to the network, send new transactions to
it, verify transactions, and create new blocks. Each block is assigned a
cryptographic hash (which may also be treated as a fingerprint of the block) that
remains valid as long as the data in the block is not altered. If any changes are
made in the block, the cryptographic hash would change immediately indicating
the change in the data which may be due to a malicious activity. Therefore, due
to its strong foundations in cryptography, blockchain has been increasingly used
to mitigate against unauthorized transactions across various.

The focus of our report is to develop an e-voting system using Blockchain as the
core technology and address the key issues such as voter anonymity, vote
confidentiality and end-to-end verification. These challenges form the
foundation of an efficient voting system preserving the integrity of the voting
process. In this report, we present our efforts to explore the use of the
blockchain technology to seek solutions to these challenges.

10
Literature review:
PAPER 1: Implementation of Secure Voting System
using Blockchain.
a. AUTHOR: Dipali Pawar, Pooja Sarode, Shilpa Santpure, Poonam Thore
Department of Computer Engineering JSPM’s Imperial College of
Engineering and Research Pune, India Prof. Pravin Nimbalkar
Department of Computer Engineering JSPM’s Imperial College of
Engineering and Research Pune.
b. PUBLISHED BY: India International Journal of Engineering Research &
Technology (IJERT) http://www.ijert.org ISSN: 2278-0181
IJERTV9IS060974 (This work is licensed under a Creative Commons
Attribution 4.0 International License.) www.ijert.org Vol. 9 Issue 06,
June-2020.
c. SUMMARY: To carry out a national election a certain e voting system
should ensure many of the security requirements. They can be listed as the
voting system should not be traceable. The voting system should ensure
whether the voter’s vote was counted & proof of vote should be provided.
Voting systems should not enable a single entity to control systems. Only
eligible individuals are allowed to participate in voting. The Election
system should not be expensive. Depending on the role, the election
system should provide limited access to participants. The use of
blockchain Technology in the E-Voting system can meet all the above
needs as a blockchain is tamper proof and non-alterable.
Key features of Blockchain:
• HIGH AVAILABILITY
• VERIFIABILITY
• TRANSPARENCY
• IMMUTABILITY
• DISTRIBUTED LEDGERS
• DECENTRALIZED
• ENHANCED SECURITY

Modules of Voting System Typically it consist of two models:


• THE ADMINISTRATOR MODULE: The Administration module is
made for the authorized person or admin of the organization. Admin has
the ability to handle every function of the voter and the Candidate. The
admin can perform the functions such as Insertion of the name, Deletion
of the name, updating the name and the authority to carry out the voting

11
procedure. Admin will able to see if someone tampered with the vote and
he will take necessary action against it.
• THE USER OR VOTER MODULE : In this module User or voter will
be able to see the names of all electing Candidates and vote the candidate.

PAPER 2: Blockchain for Electronic Voting System—


Review and Open Research Challenges
a. AUTHOR : Uzma Jafar , Mohd Juzaiddin Ab Aziz and Zarina
Shukur Faculty of Information Science and Technology, The
National University of Malaysia, Bangi 43600, Malaysia.

b. PUBLISHED BY : Review and Open Research Challenges.


Sensors 2021, 21, 5874. https://doi.org/10.3390/ s21175874,31st
august
2021

c. SUMMARY :
Blockchain technology offers a decentralized node for online voting or
electronic voting. Recently distributed ledger technologies such as
blockchain were used to produce electronic voting systems mainly
because of their end-to-end verification advantages. Blockchain is an
appealing alternative to conventional electronic voting systems with
features such as decentralization, non-repudiation, and security
protection. It is used to hold both boardrooms and public voting. A
blockchain, initially a chain of blocks, is a growing list of blocks
combined with cryptographic connections. Each block contains a hash,
timestamp, and transaction data from the previous block. The blockchain
was created to be data-resistant. Voting is a new phase of blockchain
technology; in this area, the researchers are trying to leverage benefits
such as transparency, secrecy, and non-repudiation that are essential for
voting applications. With the usage of blockchain for electronic voting
applications, efforts such as utilizing blockchain technology to secure
and rectify elections have recently received much attention.
Core Components of Blockchain Architecture :
These are the main architectural components of Blockchain:
• NODE: Users or computers in blockchain layout (every device has a
different copy of a
complete ledger from the blockchain);
• TRANSACTION: It is the blockchain system’s smallest building block
(records and details),

12
which blockchain uses;
• BLOCK: A block is a collection of data structures used to process
transactions over the
network distributed to all nodes.
• CHAIN: A series of blocks in a particular order;
• MINERS: Correspondent nodes to validate the transaction and add that
block into the
blockchain system;
• CONSENSUS: A collection of commands and organizations to carry
out blockchain
processes.

Security Requirements for Voting System :

Suitable electronic voting systems should meet


the following electronic voting requirements:
• ANONYMITY : Throughout the polling process, the voting turnout
must be secured from external interpretation. Any correlation between
registered votes and voter identities inside the electoral structure shall be
unknown.
• AUDITABILITY AND ACCURACY : Accuracy, also called
correctness, demands that the declared results correspond precisely to
the election results. It means that nobody can change the voting of other
citizens, that the final tally includes all legitimate votes.
• DEMOCRACY/SINGULARITY : A “democratic” system is defined
if only eligible voters can vote , and only a single vote can be cast for
each registered voter.
• VOTE PIRACY : After the vote is cast, no one should be in a position
to attach the identity of a voter with its vote.
• ROBUSTNESS/INTEGRITY :This condition means that a reasonably
large group of electors or representatives cannot disrupt the election. It
ensures that registered voters will abstain without problems or encourage
others to cast their legitimate votes for themselves.
• LACK OF EVIDENCE : While anonymous privacy ensures electoral
fraud safeguards , no method can be assured that votes are placed under
bribery or election rigging in any way.
• TRANSPARENCY AND FAIRNESS : It means that before the count
is released , no one can find out the details. It avoids acts such as
manipulating late voters’ decisions by issuing a prediction or offering a
significant yet unfair benefit to certain persons as to be the first to know.

13
• AVAILABILITY AND MOBILITY : During the voting period, voting
systems should always be available. Voting systems should not limit the
place of the vote.
• ACCESSIBILITY AND REASSURANCE : To ensure that everyone
who wants to vote has opportunity to avail the correct polling station and
it must be open and accessible for the voter.
• RECOVERABILITY AND IDENTIFICATION : Voting systems can
track and restore voting information to prevent errors , delays and
attacks.
• VOTERS VERIFIABILITY : Verifiability means that processes exist
for election auditing to ensure that it is done correctly. Three separate
segments are possible for this purpose: (a) uniform verification or public
verification that implies that anybody such as voters, governments, and
external auditors can test the election after the declaration of the tally; (b)
transparent verifiability against a poll, which is a weaker prerequisite for
each voter to verify whether their vote has been taken into account
properly .

PAPER 3: Blockchain based E-voting System


a. AUTHOR : Albin Benny, Aparna Ashok Kumar, Abdul Basit, Betina
Cherian and Amol Kharat Department of Computer Engineering, PCE,
Navi Mumbai, India – 410206.

b. SUMMARY :
Extensive research has been done on electronic voting systems that
enable voters to vote at their convenience using a mobile phone,
computer or any other electronic device. Still, none of these technologies
have been incorporated on a larger scale due to inherent security
threats/concerns that these systems might pose to the integrity of the
voting process. In this paper, they discuss the electronic voting system
using blockchain , a secure and robust system that ensures anonymity of
the voter, transparency, and robust functioning. The blockchain is a
digital platform for digital assets. It consists of a continuously growing
list of records known as blocks that are linked and secured using
cryptography. Major usage of Blockchain has been in all cryptocurrency
transactions, mainly Bitcoin . However, they are increasingly being used
in a number of other applications because of their inherent resistance to

14
modification to the transaction/block/whole distributed ledger
– Blockchain.
The entire system is divided into two sub-system :
● REGISTRATION SYSTEM : A voting registration System is
developed using Html/Css front-end and SQL back-end which
contains the user's personal details already stored for eg:One can
consider this as an Aadhar database. A biometric device would be
used for validation purpose.If the user is a valid user then he/her is
handed a hash code /address which is used as a credential for login
into the voting machine.

● VOTING SYSTEM : The voting system can be considered as a


replacement for EVM.It is a decentralized app with a front-end in
Bootstrap or Html and a Blockchain in back-end.The smart
contract is written in solidity language.The candidate name with
symbol of candidate is mentioned in smart-contract.A smart
contract is the actual logic piece of entire voting system. Each and
every change made in a blockchain is called a
Transaction.Transaction is the way, by which the external world
interacts with the Ethereum network. Transaction is used when
they wish to modify or update the state stored in the Ethereum
network.

Diagram 1: proposed voting dapp diagram

15
PAPER 4: Blockchain Enabled Online-Voting System
a. AUTHOR : Akhil Shah, Nishita Sodia, Shruti Shah, Soumi Banerjee,
Madhuri Chavan Ramrao Adik Institute of Technology Mumbai
University Navi Mumbai, India.

b. PUBLISHED BY: ITM web of Conferences 32, 03018 (2020)


https://doi.org/10.1051/itmconf/20203203018 ICACC-2020.

c. SUMMARY :
They are proposing a system which has greater accessibility as it is an
android application and possesses greater security as authentication,
authorisation and verification. In this system the voter/user has to first
register themselves using a registration form available within the android
application and once the registration form is being submitted, an entry is
being made in the centralized database. After the registration the user can
log into the application and be a part of the polling process. The user with
its valid credentials can log into the system and verify them by entering
the one-time-password which is valid for a limited period of time. Once
the user is logged into their respective account the dashboard contains all
the information which is retrieved from the centralized database. After the
user logs into the account the user is being authenticated using fingerprint.
Each account is provided with a single token which he will use to cast a
vote, casting of vote will take place by transferring the token from the
respective user account to the candidate’s wallet. A web application is
being developed to measure the majority of votes which has the details
about the total number of voters, the number of votes cast and the
percentage of votes cast. Only one vote can be casted from one account
and once a vote is being casted from an account the account is disabled
from the current voting process.
PROPOSED METHODOLOGY :
● BLOCKCHAIN
● ETHERIUM
● HASHING
● REGISTRATION MODULE
● LOGIN MODULE
The login screen is being displayed wherein if a person is a new user the
person can register itself with the application and if the user is an existing
one they can login with valid user-id and password and thus login for the

16
further process. The user will sign in to the credentials in the
authentication module and after which credentials will be checked and the
user will only be able to access the dashboard after the verification has
been completed. The first process in the dashboard is the OTP
Verification. Once the user is verified then the user is authenticated with
their fingerprint only after which the voter wallet is generated and a token
is provided to the voter which will be used to cast their vote. The votes are
casted by transferring the token from the voter’s wallet to the respective
candidate’s wallet.
They have deployed an online-based blockchain voting framework in this
project where smart contracts are used to allow secure and cost-effective
elections while preserving the secrecy of the voters. Compared with
previous research, they have shown that the blockchain technology
provides a new opportunity for democratic countries to move from the
pen and paper election scheme and paperless direct-recording electronic
voting machine (DRE) to a more cost-effective and time-efficient election
scheme, thus mounting the security measures of the current scheme and
offering new accessibility.

17
Theory:
Blockchain is a technology that is rapidly gaining momentum in the era of
industry 4.0. With high security and transparency provisions, it is being widely
used in supply chain management systems, healthcare, payments, business, IoT,
voting systems, etc.
Why do we need it?
Current voting systems like ballot box voting or electronic voting suffer from
various security threats such as DDoS attacks, polling booth capturing, vote
alteration and manipulation, malware attacks, etc, and also require huge amounts
of paperwork, human resources, and time. This creates a sense of distrust among
existing systems.
Some of the disadvantages are:
● Long Queues during elections.
● Security Breaches like data leaks, vote tampering.
● Lot of paperwork involved, hence less eco-friendly and time-
consuming.
● Difficult for differently-abled voters to reach polling booth.
● Cost of expenditure on elections is high.

Solution:
Using blockchain, the voting process can be made more secure, transparent,
immutable, and reliable. How? Let’s take an example.
Suppose you are an eligible voter who goes to a polling booth and casts a vote
using EVM (Electronic Voting Machine). But since it’s a circuitry after all and
if someone tampers with a microchip, you may never know that your vote
reaches the person for whom you voted or was diverted into another candidate’s
account.
Since there’s no tracing back of your vote. But, if you use blockchain- it stores
everything as a transaction that will be explained soon below; and hence gives
you a receipt of your vote (in the form of a transaction ID) and you can use it to
ensure that your vote has been counted securely.

18
Now suppose a digital voting system (website/app) has been launched to digitize
the process and all confidential data is stored on a single admin server/machine,
if someone tries to hack it or snoop over it, he/she can change candidate’s vote
count- from 2 to 22! You may never know that a hacker installs malware or
performs clickjacking attacks to steal or negate your vote or simply attacks the
central server.
To avoid this, if a system is integrated with blockchain- a special property called
immutability protects the system. Consider SQL, PHP, or any other traditional
database systems. You can insert, update, or delete votes. But in a blockchain
you can just insert data but cannot update or delete. Hence when you insert
something, it stays there forever and no one can manipulate it- Thus name
immutable ledger.
But Building a blockchain system is not enough. It should be decentralized i.e if
one server goes down or something happens on a particular node, other nodes
can function normally and do not have to wait for the victim node’s recovery.
So a gist of advantages are listed below:
● You can vote anytime/anywhere (During Pandemics like COVID-19
where it’s impossible to hold elections physically
● Secure
● Immutable
● Faster
● Transparent

Let’s visualize process

It is always interesting to learn things if it’s visually explained. Hence diagram


given below explains how blockchain voting works.

19
Diagram 2: blockchain voting process

According to the above diagram, a voter needs to enter his/her credentials to


vote. All data is then encrypted and stored as a transaction. This transaction is
then broadcasted to every node in the network, which in turn is then verified. If a
network approves a transaction, it is stored in a block and added to the chain.
Note that once a block is added into a chain, it stays there forever and can’t be
updated. Users can now see results and also trace back transactions if they want.
Since current voting systems don’t suffice to the security needs of the modern
generation, there is a need to build a system that leverages security,
convenience, and trust involved in the voting process. Hence voting systems
make use of Blockchain technology to add an extra layer of security and
encourage people to vote from any time, anywhere without any hassle and
makes the voting process more cost-effective and time-saving.

To develop an electronic voting system using Block-Chain technology we need


to focus on the following terms:-
Smart Contract

 Smart contracts refer to high-level program codes compiled into EVM


before being posted to the Ethereum blockchain for execution.

20
 It enables you to conduct trustworthy transactions without the
involvement of a third party; these transactions are traceable and
irreversible.

 Programming languages commonly used to create and write smart


contracts are Serpent, Solidity, Mutan, and LLL.

Solidity
Solidity is an object-oriented programming language created specifically by the
Ethereum Network team for constructing and designing smart contracts on
Blockchain platforms.

 It's used to create smart contracts that implement business logic and
generate a chain of transaction records in the blockchain system.

 It acts as a tool for creating machine-level code and compiling it on the


Ethereum Virtual Machine (EVM).

 It has a lot of similarities with C and C++ and is pretty simple to learn
and understand. For example, a “main” in C is equivalent to a
“contract” in Solidity.

Like other programming languages, Solidity programming also has variables,


functions, classes, arithmetic operations, string manipulation, and many other
concepts.

EVM or Ethereum Virtual Machine

 The Ethereum Virtual Machine (EVM) provides a runtime environment


for Ethereum smart contracts.

 It is primarily concerned with ensuring the security and execution of


untrusted programs through the use of an international network of
public nodes.

 EVM is specialized in preventing Denial-of-Service attacks and


certifies that the programs do not have access to each other's state, as
well as establishing communication, with no possible interference.

21
Diagram 3: compiling process of smart contract

Byte Code

Bytecode is the information that our Solidity code gets “translated” into. It
contains instructions to the computer in binary. Bytecode is generally compact
numeric codes, constants, and other pieces of information. Each instruction step
is an operation which is referred to as “opcodes,” which are typically one-byte
(eight-bits) long. This is why they’re called “bytecode”—one-byte opcodes.
Every line of code that is written gets broken down into opcodes so that the
computer knows exactly what to do when running our code.
In the Ethereum world, the bytecode is actually what gets deployed to the
Ethereum blockchain. When we deploy to an Ethereum network and confirm the
transaction using a browser-based wallet like Metamask, we can actually see the
bytecode that gets deployed.

ABI

ABIs are application binary interfaces. They define the methods and variables
that are available in a smart contract and which we can use to interact with that
smart contract. Since smart contracts are converted into bytecode before they get
deployed to the blockchain, we need a way to know what operations and

22
interactions we can initiate with them, and we need a standardized way to
express those interfaces so that any programming language can be used to
interact with smart contracts. While JavaScript is the most commonly used
language for interacting with smart contracts (mainly because JavaScript is a
frontend browser language and we often use frontend web pages to interact with
smart contracts), you can interact with a smart contract using any coding
language as long as you have the ABI for that smart contract and a library to
help you communicate with any one node to give you an entry point into the
Ethereum network.

Web3.js

Web3 is a collection of JS libraries that lets you interact with an Ethereum node
remotely or locally. Simply, it provides us with an API to use so we can easily
work with the blockchain. Web3 works as a wrapper for JSON RPC to connect
to a remote or local Ethereum node with either a HTTP or IPC connection.
Web3 is basically a connection between the Ethereum blockchain and your
smart contract.Behind the scenes, Web3 uses JSON RPC. RPC is used in many
different types of programming languages.

React.js

React (also known as React.js or ReactJS) is a free and open-source front-


end JavaScript library for building user interfaces based on UI components. It is
maintained by Meta (formerly Facebook) and a community of individual
developers and companies. React can be used as a base in the development
of single-page, mobile, or server-rendered applications with frameworks
like Next.js. However, React is only concerned with state management and
rendering that state to the DOM, so creating React applications usually requires
the use of additional libraries for routing, as well as certain client-side
functionality.

23
Software requirements:
Following software are needed for the development of E-Voting system using
Blockchain:-
Remix IDE:
Remix IDE (Integrated Development Environment) is a web application that can
be used to write, debug, and deploy Ethereum Smart Contracts.
Remix IDE is generally used to compile and run Solidity smart contracts.
Below are the steps for the compilation, execution, and debugging of the smart
contract.
Step 1: Open Remix IDE on any of your browsers, select on the New File and
click on Solidity to choose the environment.

Fig 1: remix IDE

Step 2: Write the Smart contract in the code section, and click the Compile
button under the Compiler window to compile the contract.

Fig 2: writing solidity code

24
Step 3: To execute the code, click on the Deploy button under Deploy and Run
Transactions window.

Fig 3: deploying smartcontract

Step 4: After deploying the code click on the method calls under the drop-
down of deployed contracts to run the program, and for output, check to click
on the drop-down on the console.

Fig 4: calling smart contract functions

Step 5: For debugging click on the Debug button corresponding to the method
call in the console. Here you can check each function call and variable
assignments.

Fig 5: debugging smart contract

25
Vs Code IDE:
Visual Studio Code (famously known as VS Code) is a free open source text
editor by Microsoft. VS Code is available for Windows, Linux, and macOS.
Although the editor is relatively lightweight, it includes some powerful features
that have made VS Code one of the most popular development environment
tools in recent times.

The VS Code user interface allows for a lot of interaction compared to other text
editors. To simplify user experience, VS Code is divided into five main regions:

 The activity bar


 The side bar
 Editor groups
 The panel
 The status bar

The image below shows how these regions are displayed:-

Fig 6: different sections of Vs Code IDE

 Download and install VS Code.


o From https://code.visualstudio.com/download

26
MetaMask Wallet:
MetaMask is a cryptocurrency wallet that enables users to access the Web 3
ecosystem of decentralized applications (dapps). MetaMask is a browser plugin
that serves as an Ethereum wallet, and is installed like any other browser plugin.
Once it's installed, it allows users to store Ether and other ERC-20 tokens,
enabling them to transact with any Ethereum address.
Though it might seem complicated to beginners, MetaMask is one of the simpler
Ethereum wallets and dapp browsers to use, and can be set up in a couple of
minutes in most cases.
To use MetaMask, you will need either Chrome, a Chromium-based browser
such as Brave, or Firefox.
First, you’ll need to download and install the official Metamask extension (also
known as a plugin or add-on) for your chosen browser. For most people, this is
theGoogle Chrome extension or the Firefox addon.
Once installed, you should see the splash screen. Click the ‘Get Started’ button
to begin creating your Ethereum wallet using MetaMask.

Fig 7: Metamask wallet chrome Extension

27
Ganache:
Ganache is a personal blockchain for rapid Ethereum and Corda distributed
application development. You can use Ganache across the entire development
cycle; enabling you to develop, deploy, and test your dApps in a safe and
deterministic environment.
Ganache comes in two flavors: a UI and CLI. Ganache UI is a desktop
application supporting both Ethereum and Corda technology.

Fig 8: Ganache local blockchain network

28
Proposed system:
Level 0 DFD:

Diagram 4: Level 0 diagram of proposed system

Level 1 DFD:

Diagram 5: Level 1 diagram of proposed system

29
ER Diagram:

Diagram 6: ER diagram of proposed system

Data Dictionary:

Voters:
Attribute name Description Datatype Constraint

Voter no Unique Voter Id card no integer Primary key

Has_nominated Status of nomination Boolean Not null

Has_voted Status of voting Boolean Not null


Table 3: voters data dictionary
Admin:
Attribute name Description Datatype Constraint

Employee id Unique employee id integer Primary key

Account no Account address of wallet address Not null

Table 4: Admin data dictionary


Contestants:
Attribute name Description Datatype Constraint

Contestant id Id number automatically integer Primary key


assigned

Voter no Voter id card no integer Not null

30
Name Name of contestant string Not null

Age Age of contestant integer Not null

Party name Name of party string Not null

Vote count No of votes contestant get integer Not null

Has_verified Verification status of candidate Boolean Not null


Table 5: contestants data dictionary
Poll:
Attribute name Description Datatype Constraint

Poll id Poll number integer Primary key

Topic Description of the poll string Not null

Has_started Status of poll Boolean Not null

Has_ended Status of poll Boolean Not null


Table 6: poll data dictionary

Architecture for proposed e-voting system:

Diagram 7:Architecture for proposed system

31
Smart Contract:
The solidity smart contract for the authentication of user and admin is:-

// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0 <0.9.0;

contract loginsignup{
address owner;
uint signupnumber;
uint loginnumber;
string employeeloginnumber;
constructor() { //constructor setting the owner address at the time
of deployment
owner = msg.sender;
}
modifier onlyAdmin() { //a modifier that will identify admin
only require(msg.sender == owner);
_;
}
struct
user{ uint
voterid; string
password;
string mobileno;
bool hassignedup;
}
mapping(uint => user) users;
function signup(uint _voterid,string memory _mobileno, string memory
_password1, string memory _password2) public{
require(users[_voterid].hassignedup==false);
if(keccak256(abi.encodePacked(_password1))

== keccak256(abi.encodePacked(_password2))){
users[_voterid].password=_password1;
users[_voterid].mobileno=_mobileno;
users[_voterid].hassignedup=true;
signupnumber=_voterid;

}
else{ signupnumb
er=0;
}
}
function getsignupnumber() public view returns(uint)
{ return signupnumber;
}

function login(uint _voterid,string memory _password) public{

32
require(users[_voterid].hassignedup==true);
if(keccak256(abi.encodePacked(users[_voterid].password))==keccak256(abi.encode
Packed(_password))){
loginnumber=_voterid;
}
else{ loginnumbe
r= 0;
}
}
function getmobilenumber(uint _voterid) public view returns(string memory){
return users[_voterid].mobileno;
}
function getloginnumber() public view returns(uint)
{ return loginnumber;
}
struct employee{
string eid;
string password;
}

mapping(string => employee) employees;


function addemployee(string memory _eid,string memory _password) public
onlyAdmin {
employees[_eid].password=_password;
}
function employeelogin(string memory _eid,string memory _password) public
onlyAdmin{ if(keccak256(abi.encodePacked(employees[_eid].password))==keccak256(ab
i.encode Packed(_password))){
employeeloginnumber=_eid;
}
else{ employeeloginnumber="0
";
}
}
function getemployeeloginnumber() public onlyAdmin view returns(string
memory){
return employeeloginnumber;
}
}
Let’s discuss what is in this contract.
The very first line says that the solidity compiler version must be within 0.7.0 to
0.9.0. Then we have our smart contract which has:-
Owner: address of the account which was used to deploy the contract

function signup(uint _voterid,string memory _mobileno, string memory


_password1, string memory _password2) public: will take user data and
create a new user and store the data

33
function getsignupnumber() public view returns(uint): will return the voter
id if signup is successful else will return 0

function login(uint _voterid,string memory _password) public: will take user


input voter id an password and check the authentication for login

function getloginnumber() public view returns(uint): will return the voterid if


login successful else will return 0

function getmobilenumber(uint _voterid) public view returns(string


memory): will return the registered mobile number of the user that will be used
for sending the OTP

function addemployee(string memory _eid,string memory _password)


public onlyAdmin: function to add admin accounts in the system and only
accessible to the owner

The solidity smart contract for the voting process is:-

// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0 <0.9.0;

contract election
{ address owner;
uint pollcount=0;
uint public candidatecount=0; //number of verified candidates
uint public nominationcount=0; //number of nominated
candidates bool public publishresult=false;
string public topic=""; //topic of the poll
uint totalvote=0; //total no of votes

struct voter { //structure of


voter uint256 voterid;
bool hasvoted;
bool
hasnominated;
}
mapping(uint => voter) public voters; //mapping of voterid with
voters mapping(uint =>uint) public idvoterid; //mapping of id with
voterid

struct candidate { //structure of


candidate uint nominationid;
uint256 voterid;
string name;
string partyname;
uint256 age;

34
uint256 votes;
bool hasverified;
bool
hasnominated;
}
mapping(uint256 => candidate) public candidates; //mapping each candidate
with id

struct poll { //structure of


poll bool start;
bool end;
}
mapping(uint => poll)polls;

constructor() { //constructor setting the owner address at the time


of deployment
owner = msg.sender;
}

modifier onlyAdmin() { //a modifier that will identify admin


only require(msg.sender == owner);
_;
}

function create_poll(string memory _topic) public onlyAdmin{ //function


for assignning topic of poll
require(polls[0].start ==false);
topic= _topic;
}

function add_candidate(uint256 _voterid,string memory _name,string memory


_partyname,uint256 _age) public { //function for
nominations require(msg.sender != owner);
require(candidates[nominationcount].hasnominated==false);
require(voters[_voterid].hasnominated==false);
candidate memory newcandidate =
candidate({ nominationid: nominationcount,
voterid: _voterid,
name: _name,
partyname:
_partyname, age:
_age,
votes: 0,
hasverified: false,
hasnominated: true
});
candidates[nominationcount]=newcandidate;
nominationcount+=1;
voters[_voterid].hasnominated=true;
}

35
function start_poll()public onlyAdmin{ //function to start the voting
phase
polls[0].start =true;
polls[0].end=false;
}

function vote(uint id,uint _voterid) public{ //function of


voting require(msg.sender != owner);
require(voters[_voterid].hasvoted==false);
require(candidates[id].hasverified==true);
require(polls[0].start ==true && polls[0].end
==false); candidates[id].votes +=1;
voters[_voterid].hasvoted=true;
idvoterid[totalvote]=_voterid;
totalvote+=1;
}

function end_poll()public onlyAdmin{ //function to end the voting


polls[0].end =true;
polls[0].start=false;
}

function has_started() public view returns(uint){ //getter function to


chech if voting has started or not
if(polls[0].start==true && polls[0].end==false)
{ return 1;
}
else{ retu
rn 0;
}

function has_ended() public view returns(uint){ //getter function to chech


if voting has ended or not
if(polls[0].start==false && polls[0].end==true)
{ return 1;
}
else{ retu
rn 0;
}

function gettopic() public view returns(string memory){ //getter function to


get the topic of poll
return(topic);
}

36
function has_votted(uint _voterid) public view returns(uint){ //function to
check id voter has already voted or not
if(voters[_voterid].hasvoted==true){
return 1;
}
else{ retu
rn 0;
}
}

function votecount(uint id) public view returns(uint){ //function to


return vote count of any candidate
require(polls[0].end ==true);
require(publishresult==true);
return
(candidates[id].votes);
}

function setpublishresult() public onlyAdmin{ //function to publish result


require(polls[0].end ==true);
publishresult=true;
}

function acceptcandidate(uint id) public onlyAdmin{ //function to accept


candidates upon verification
require(polls[0].start
==false);
candidates[id].hasverified=true;
candidatecount+=1;
}

function rejectcandidate(uint id,uint _voterid)


public onlyAdmin{ //function to reject candidates upon
verification candidates[id].hasnominated=false;
voters[_voterid].hasnominated=false;
candidates[id].hasverified=false;
}

function has_verified(uint id) view public returns(bool){ //check if


candidate is verified or not
return(candidates[id].hasverified);
}

function reset() public onlyAdmin{ //function to reset all the variables


so that new vote canbe started
require(polls[0].end ==true);
require(publishresult==true);
for(uint i=0;i<nominationcount;i++){
candidates[i].hasverified=false;
candidates[i].hasnominated=false;
candidates[i].votes=0;

37
}
publishresult=false;
topic="";
for(uint i=0;i<totalvote;i++){
voters[idvoterid[i]].hasvoted=false;
voters[idvoterid[i]].hasnominated=false;
}
totalvote=0;
candidatecount=0;
nominationcount=0;
}
}

Let’s discuss what is in this contract.


The very first line says that the solidity compiler version must be within 0.7.0 to
0.9.0. Then we have our smart contract which has:-
Owner: address of the account which was used to deploy the contract

Nominationcount,candidatecount: no. of nominations and no. of candidates

modifier onlyAdmin(): a modifier that will identify admin only

function create_poll(string memory _topic) public onlyAdmin: function for


assigning topic of poll only by admin

function add_candidate(uint256 _voterid,string memory _name,string


memory _partyname,uint256 _age) public: function for submitting
nominations by candidates

function start_poll()public onlyAdmin: function to start the voting phase only


by admin

function vote(uint id,uint _voterid) public: function for voting by voters

function end_poll()public onlyAdmin: function to end the voting only by


admin

function has_started() public view returns(uint): getter function to check if


voting has started or not

function has_ended() public view returns(uint): getter function to check if


voting has ended or not

function setpublishresult() public onlyAdmin; function to publish result only


by admin

38
function acceptcandidate(uint id) public onlyAdmin: function to accept
candidates upon verification only by admin

function rejectcandidate(uint id,uint _voterid) public onlyAdmin: function


to reject candidates upon verification only by admin

function reset() public onlyAdmin: function to reset all the variables so that
new vote can be started

function votecount(uint id) public view returns(uint): function to return vote


count of any candidate
function gettopic() public view returns(string memory): getter function to get
the topic of poll
React Application:
After installing react.js we must make a folder where all the development work
will be done. For creating a react application , in the vs code terminal we have to
write: “npx create-react-app voting”. An react application will be created. To run
this Application we have to write the command: “npm run”.

Our application files look like:-

voting/: React App files for Frontend

voting/public/: contain static web files

voting/src/: source files for react app

voting/src/client: components of application

voting/package.json/: all dependencies

Dependecies:

"dependencies": {
"@auth0/auth0-react": "^1.12.0",
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^13.4.0",
"@testing-library/user-event":
"^13.5.0", "apexcharts": "^3.36.3",
"firebase": "^9.22.0",

39
"react": "^18.2.0",
"react-apexcharts": "^1.4.0",
"react-avatar": "^5.0.3",
"react-dom": "^18.2.0",
"react-minimal-pie-chart": "^8.4.0",
"react-multilevel-dropdown":
"^4.0.0", "react-phone-number-input":
"^3.2.23", "react-router-dom":
"^6.4.2",
"react-scripts": "5.0.1",
"web-vitals": "^2.1.4",
"web3": "^1.8.0"
},
Connecting Metamask with React Application:

const metamask = async () => {


if (typeof window.ethereum !== 'undefined')
{ const { ethereum } = window;
const accounts = await ethereum.request({ method: 'eth_requestAccounts'
});
setaccount(accounts[0]);
}
else{
alert("install metamask first")
}
};
Connecting Smart Contract with React Application:

async function smartcontract()


{ const ABI = [ …
];
const Address="0x6AEc73ef9Bd1808F5428b70AC38c0a034DaCbAAC" ;
window.web3=await new Web3(window.ethereum);
window.contract= await new window.web3.eth.Contract(ABI,Address);
}

We will get the ABI and Address from Remix IDE after compiling and
deploying the Smart Contract in out local Ganache Network of Block Chain.

40
User Interface:
1. Main home page:

Fig 10: application home page

2. User Login/Signup:

Fig 11: user login/signup option page

41
3. User Login page:

Fig 12: user login page

4. User Signup page:

Fig 13: user signup page

5. OTP verification at the time of login:

42
Fig 14: OTP verification while login

6. Employee Login page:

Fig 15: employee login page


7. User Home page:

Fig 16: user home page

43
8. Admin Home page:

Fig 17: admin home page

9. Nomination Submission page:

Fig 18: nomination submission page


10.Verify Nomination page:

Fig 19: verify nomination page

44
11.User Voting page:

Fig 20: voting page

12.Result page:

Fig 21: result showing page

45
Conclusions:
First we have built the Smart Contract. Our Smart Contract is written in Solidity
language and it is deployed in the local blockchain network called Ganache
using Remix IDE. Then we have Developed the Frontend using React.js in Vs
Code IDE.
We have Used Web3.js for connection between the smart Contract and Frontend
using the ABI and Address of the deployed Contract. Now we are ready with a
Fully functional Electronic Voting System using Block-chain. This system have
been designed for supporting multiple candidates in a poll. Everything of the
poll can be controlled by the Admin. Every User need to provide their mobile
number and that will be verified by OTP at the time of sign up and while login
users have to provide the OTP sent to their registered mobile numbers. The
implementation result shows that it is a practical and secure e-voting system,
which solves the problem on forgery of votes during e-voting.

The proposed system fulfils:-

Privacy - Keeping an individual’s vote secret: The system leverages


cryptographic properties of blockchain to achieve privacy of a voter. More
specifically, as voter is registered into the system, a voter hash is generated by
blockchain which is the unique identifier of a voter into the blockchain and is
protected from misuse due to collision resistance property of the cryptographic
hash. Due to this, the traceability of a vote is also non-trivial thereby protecting
the voter when under duress.

Eligibility - Allowing only registered voters to vote, with each such voter voting
only once:All eligible users are required to register using government-issued
voterid to assert their eligibility. In addition to this, our system implements
strong authentication mechanism using finger printing technology to assert that
only authorized voters can access the system.

Receipt Freeness - Voters should be unable to prove to a third party that they
voted in a particular way: The proposed system enables a voter to vote as per
their choice and creates a cryptographic hash for each such event (transaction).
This is important to achieve verifiability i.e. to verify if a certain vote was
included in the count. However, possession of this hash does not allow to extract
information about the way voter has voted.

Convenience - Voters must be able to vote easily, and everyone who is eligible
must be able to vote: The system has been implemented using a user-friendly
web based interface with the voting process requiring minimal input from the

46
user. Furthermore, the overall process is integrated which enables the user to
interact with it in a seamless manner.

The analysis presented above highlights the performance of the proposed system
with respect to the specific requirements of e-voting. It also highlights the
significance of defining characteristics of blockchain and their profound role in
achieving the cornerstones of an efficient e-voting system. Therefore, we believe
the work presented here makes significant contribution to the existing
knowledge with respect to the application of blockchain technology to achieve a
secure digital voting system.

47
Limitations and Future Proposal:
Electronic voting has been used in varying forms since 1970s with fundamental
benefits over paper based systems such as increased efficiency and reduced
errors. With the extraordinary growth in the use of blockchain technologies, a
number of initiatives have been made to explore the feasibility of using
blockchain to aid an effective solution to e-voting. This report has presented one
such effort which leverages benefits of blockchain such as cryptographic
foundations and transparency to achieve an effective solution to e-voting. The
proposed approach has been implemented with Multichain and in- depth
evaluation of approach highlights its effectiveness with respect to achieving
fundamental requirements for an e-voting scheme. In continuation of this work,
we are focused at improving the Security and Authentication system. Integrating
blockchain-based voting systems with secure digital identity solutions can
further enhance the authentication and verification of voters. Mobile
applications can be developed to provide a user-friendly interface for casting
votes securely from smartphones. As blockchain technology continues to evolve,
ongoing research and development efforts should focus on addressing
scalability, energy efficiency, and user experience challenges. Innovation in
consensus algorithms and blockchain interoperability can further improve the
suitability of blockchain for online voting systems. Future modifications can
focus on improving the scalability and interoperability of blockchain-based
voting systems to accommodate a larger number of participants and integrate
with existing election infrastructure seamlessly.

48
References / Bibliography:
 https://core.ac.uk/download/pdf/155779036.pdf
 Blockchain Enabled Online-Voting System | ITM web of
Conferences (itm-conferences.org)
 Sensors | Free Full-Text | Blockchain for Electronic Voting System
— Review and Open Research Challenges (mdpi.com)
 IRJET-V6I9209.pdf
 [PDF] Decentralized Voting Platform Based on Ethereum Blockchain
| Semantic Scholar
 Blockchain based e-voting recording system design | IEEE
Conference Publication | IEEE Xplore
 https://www.tutorialspoint.com/solidity/index.html
 https://remix-ide.readthedocs.io/en/latest/
 https://www.freecodecamp.org/news/developing-an-ethereum-
decentralized-voting-application-a99de24992d9/ etc..

49

You might also like