0% found this document useful (0 votes)
16 views64 pages

Project Report Sample Format

The document presents a project report on a decentralized voting application using blockchain technology, authored by Pushkar Kumar under the guidance of Dr. Kanchan Hans. It highlights the benefits of online voting systems, such as increased efficiency, security, and transparency, while addressing challenges like voter privacy and technical accessibility. The report details the system architecture, development tools, and the advantages of employing blockchain to enhance the voting process.

Uploaded by

singhdipti058
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views64 pages

Project Report Sample Format

The document presents a project report on a decentralized voting application using blockchain technology, authored by Pushkar Kumar under the guidance of Dr. Kanchan Hans. It highlights the benefits of online voting systems, such as increased efficiency, security, and transparency, while addressing challenges like voter privacy and technical accessibility. The report details the system architecture, development tools, and the advantages of employing blockchain to enhance the voting process.

Uploaded by

singhdipti058
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 64

Decentralized Voting Application using Blockchain

By

Pushkar Kumar
Roll Number: 2100970140050

Under the Guidance of

Dr. Kanchan Hans


(Department of Computer Applications)

A PROJECT REPORT
KCA - 451

In partial fulfillment of the requirements for Post Graduation degree


of
Master of Computer Applications

Department of Computer Applications


Galgotia’s College of Engineering and Technology
Greater Noida (U.P.)
affiliated to
AKTU, Lucknow,
May 2023
Department of Computer Applications
Galgotias College of Engineering and Technology,
Greater Noida

Certificate

Date: ………………

This is to certify that the dissertation entitled “Decentralized Voting Application


using Blockchain” by Mr. Pushkar Kumar, student of MASTER OF COMPUTER
APPLICATIONS, [2021-2023], of GALGOTIAS COLLEGE OF
ENGINEERING AND TECHNOLOGY, GREATER NOIDA, affiliated to AKTU,
LUCKNOW, is hereby accepted and approved as a credible work. It is further certified
that this work has not been submitted for similar purpose anywhere else. His work has
been found satisfactory for the partial fulfillment of the awardof the degree of MCA.

Internal Examiner External Examiner

Head of Department
Abstract

In any democratic country, Voting is a fundamental right of any citizen that


enables them to choose the leaders of tomorrow. It gives individuals in a
community the facility to voice their opinion.
It helps them to realize the importance of citizenship. Online voting systems are
software platforms used to securely conduct votes and elections. As a digital
platform, they eliminate the need to cast your votes using paper or having to
gather in person. They also protect the integrity of your vote by preventing
voters from being able to vote multiple times. Electronic voting or e-voting has
fundamental benefits over paper-based systems such as increased efficiency and
reduced errors.
The electronic voting system tends to maximize user participation, by allowing
them to vote from anywhere and from any device that has an internet
connection. The blockchain is an emerging, decentralized, and distributed
technology with strong cryptographic foundations that promises to improve
different aspects of many industries. Expanding e-voting into blockchain
technology could be the solution to alleviate the present concerns in e-voting.
Here we propose a blockchain-based voting system that will limit the voting
fraud and make the voting process simple, secure and efficient.
Declaration

I, Pushkar Kumar, hereby declare that the project work entitled


“Decentralized Voting Application using Blockchain” is an authenticated
work carried out by me, under the guidance of Dr. Kanchan Hans for the
partial fulfillment of the award of the degree of MASTER OF COMPUTER
APPLICATIONS AND this work has not been submitted for similar purpose
anywhere else except to GALGOTIAS COLLEGE OF ENGINEERING AND
TECHNOLOGY, GREATER NOIDA,
affiliated to AKTU, LUCKNOW.

Date: Name: Pushkar Kumar

Place: Greater Noida Roll No.: 2100970140050


Acknowledgement

It is high privilege for me to express my deep sense of gratitude to all those


faculty members who helped me in the completion of the project, especially my
internal guide Dr. Kanchan Hans who was always there at hour of need.

My special thanks to Dr. Kanchan Hans, HoD- Department of Computer


Applications, Galgotias College of Engineering and Technology, for helping
me in the completion of project work and its report submission.

Name:Pushkar Kumar

Roll No.: 2100970140050


Table Of Contents

Page No.

I Introduction 1

1.1 Benefits of Decentralized Voting 1


1.2 Challenges and Limitations 1
II System Analysis 2-10

2.1 Traditional System Architecture 2


2.2 Development Tools and Services 3
2.2.1 Blockchain 3
2.2.2 Solidity Contract 4
2.2.3 Hardhat 5
2.2.4 MetaMask 6
2.2.5 React JS 7-8
2.2.6 Web3 8-9
2.2.7 IPFS 9-10
2.3 Proposed Plan of work 10

III Literature Survey 11-12

IV Development Environment 13-15

4.1 Software Requirement 13-15

V System Design 16-23

5.1 Data Model 16-20


5.1.1 System Architecture 16
5.1.2 Merkle Tree 17-18
5.1.3 Voting Process 19
5.1.4 Class Diagram 20
5.2 Process Model 21-23
5.2.1 Use Case Diagram 21
5.2.2 Data Flow Diagram (DFD) 22
5.2.3 Collaboration Diagram 23
VI UI of the Website 24-35

6.1 Homepage 24
6.2 Wallet Login page 25
6.3 Account selection and approval page 26
6.4 Wallet Connected page 27
6.5 Candidate Registration Page 28
6.6 Candidate Confirmation Page 29
6.7 Voter Registration Page 30-31
6.8 Voter List Page 32
VII Architectural Details 36
7.1 Program Design Language 36-38
VIII System Implementation 39-45

8.1 Coding Implementation 39-


45
8.1.1 Voting Contract 39-40
8.1.2 Voter.js 41-42
8.1.3 Allowed Voters.js 43-44
8.1.4 Deploy.js 44-45
IX Data Analysis and Result 46
X Performance and Limitations 47-51

10.1 Merits of the System 47-48


10.2 Limitations of the System 48-49
10.3 Future Enhancements 49-50
10.4 User Manual 50-52

XI Conclusion 53
XII References 54
List of Figures

Figure No. Title Page No.

Figure 4.1 User flow diagram 15

Figure 4.2 Research Methodology 16

Figure 5.1 System Architecture 10

Figure 5.2 Merkle Tree 18

Figure 5.3 Voting Process 20

Figure 5.4 Class Diagram 21

Figure 5.5 User Flow Diagram 22

Figure 5.6 Data Flow Diagram 23

Figure 5.7 Collaboration Diagram 24

Figure 6.1 Homepage 25

Figure 6.2 MetaMask login page 25

Figure 6.3 Account selection page 26

Figure 6.4 Approval page 26

Figure 6.5 Wallet Connect page 27

Figure 6.6 Candidate registration page 28

Figure 6.7 Set Candidate Transaction Fee 28

Figure 6.8 Candidate added page 29


Figure 6.9 Voter registration page 30

Figure 6.10 Voter registration Transaction 30


Fee

Figure 6.11 Payment Confirmation Slip 31

Figure 6.12 Voter List Page 32

Figure 6.13 Voter Transaction Slip 33

Figure 6.14 Voting Success Page 34

Figure 6.15 Duplicate Vote pop-ups 35

Figure 8.1 Solidity Contract 39

Figure 8.2 Voter.js 41

Figure 8.3 Allowed-voters.js 43

Figure 8.4 Deploy.js 44


CHAPTER 1
INTRODUCTION

India is a democratic country and has a democratic country. As now all Indian citizen
become a part of the growing digital India with a digital ID that is Aadhaar card. Voting
schemes have evolved from counting hands in early days to systems that include paper,
punch card and electronic voting machine.
Decentralized voting applications using blockchain technology have been gaining
popularity in recent years due to their ability to provide secure and transparent voting
systems. However, many of these applications still rely on a single decision-making
mechanism, which can lead to biases and unfair outcomes. This is where Ethereum comes
in, offering a unique approach that allows voters to choose between two options, ensuring
a fair and balanced voting process.
Ethereum is a decentralized voting application built on top of the Ethereum blockchain. It
uses smart contracts to manage the voting process and ensure that all votes are recorded
accurately and securely. The platform is designed to be user-friendly, allowing anyone to
participate in the voting process, regardless of technical expertise.

1.1 BENEFITS OF DECENTRALIZED VOTING


Decentralized voting offers numerous benefits over traditional voting methods. First and
foremost, it eliminates the possibility of voter fraud and manipulation. Because each vote
is recorded on the blockchain, it cannot be altered or deleted.

In addition, decentralized voting increases transparency and trust in the voting process.
Voters can be assured that their vote was counted accurately and that the results are
legitimate. Finally, decentralized voting can be more efficient and cost-effective than
traditional voting methods, as it eliminates the need for physical polling stations and paper
ballots.

1.2 CHALLENGES AND LIMITATIONS

Despite its many benefits, decentralized voting still faces several challenges and
limitations. One major challenge is ensuring the privacy of voters. While the blockchain
itself is anonymous, it is possible for someone to trace a vote back to an individual if they
have access to additional information.

Another limitation is the potential for voter apathy. Because decentralized voting requires
a certain level of technical knowledge and access to digital tools, some voters may be
excluded from the process. Finally, there is the issue of scalability. As more people
participate in decentralized voting, the blockchain can become congested, slowing down
the voting process.

1
CHAPTER 2
SYSTEM ANALYSIS

2.1 TRADITIONAL SYSTEM ARCHITECTURE

The Existing System of Election is running manually. The voter has to visit to booths to
vote a candidate so there is a wastage of time. Due to this many people don’t go out to
cast their vote which is one of the most important and Worrying factor. In democracy
Each and every vote is important. This Traditional system can be replaced by a new
online system which will limit the voting frauds and make the voting as well as counting
more efficient and transparent.

Existing Voting application faced several problems, including:


1. Lack of transparency: Traditional voting system often lack transparency,
making it difficult to verify the accuracy of the vote count or detect any potential
fraud. Centralized authorities and intermediaries can manipulate the results and
influence the voting outcome.
2. Security vulnerabilities: Traditional voting system are susceptible to security
breaches, such as hacking or tampering with ballot boxes, which can compromise
the integrity of thevoting process.
3. Limited Accessibility: Traditional voting system can limit accessibility to the
voting process, such as those who are physically unable to access polling stations,
and those whoare unable to vote due to time or location constraints.
4. High Cost: Traditional Voting system can be expensive, requiring significant
resources to set up and maintain polling stations, transport ballot boxes, and
process votes.
5. Slow and inefficient: Traditional voting system can be slow and inefficient,
with theneed for manual counting and the potential for human error.

These problems can lead to a lack of trust in the voting system, disenfranchise
voters, and undermine the legitimacy of the results. Ethereum's decentralized
voting application using blockchain technology offers a solution to these problems
by providing a transparent, secure, accessible, and efficient voting system that is
decentralized and tamper-proof.

2
2.2 DEVELOPMENT TOOLS AND SERVICES

The current voting system requires some improvement in it because of the issues
mentioned above. This can be achieved by replacing the existing system by the new
system which will limit the voting frauds and make the voting as well as counting more
efficient.

 Online Election System would have user registration, user login and admin login.
 This Online Voting System will manage the Voter’s information by which voter
can loginand use his voting rights.
 At the time of registration voter will be asked for this: Full name, age, Aadhaar
card no,mobile no. email id and after being verified will be given the access.
 At the time of requesting vote, voter will be asked to enter his Aadhaar id. Then
voter will be authenticated, and he can give vote from one of the candidates from
the list. Voters canvote for a Candidate only once per Election.
 The software system allows the user to login in to their profiles and upload all
their details including their previous milestone onto the system. The admin can
check each Candidate details.
 The software system also allows Voters to view a list of Candidates in their area.
The admin has overall rights over the system and can moderate and delete any
details not pertaining to Election Rules.

2.2.1 Blockchain

Blockchain can help to implement a system that is immutable, transparent, and efficient
and cannot be hacked into. The inability to change or delete information from blocks
makes the blockchain the most effective technology for voting systems. Blockchain
technology is supported by a distributed network consisting of variety of interconnected
nodes. Each of these nodes have their own copy of the distributed ledger (information)
that contains the total history of all transactions the network has processed. There is no
centralized system that controls the network. If the majority of the nodes agree, then they
accept a transaction. This network permits users to stay anonymous. A basic analysis of
the blockchain technology (including sensible contracts) suggests that it is an appropriate
basis for e-voting and furthermore, it might have the potential to form e-voting a lot of
acceptable and reliable.

Ethereum's decentralized voting application using blockchain technology offers several


advantagesover traditional voting systems:
 Increased security: The use of blockchain technology provides a secure
and tamper-proof way to store and verify votes. Once a vote is recorded on
the blockchain, it cannot be altered or deleted, ensuring the integrity of the
voting process.
 Transparency: The decentralized nature of the blockchain means that
anyone can view the results of the voting process. This helps to build trust
and confidence in the outcome of the vote, as it is visible to all stakeholders.
 Accessibility: Ethereum's decentralized voting application can be accessed
from anywhere in the world with an internet connection, making it more
accessible than traditional voting systems. This can lead to increased
3
participation and engagement in the voting process.
 Efficiency: The use of smart contracts in Ethereum's decentralized voting
application can automate many of the processes involved in the voting
process, reducing the need for manual intervention and streamlining the
overall process. This can save time and reduce costs associated with
traditional voting systems.
 Decentralization: The decentralized nature of Ethereum's voting
application means that there is no central authority controlling the process,
reducing the risk of manipulation or tampering. This can lead to more fair
and democratic outcomes.
Overall, Ethereum's decentralized voting application offers a more secure, transparent,
accessible, efficient, and decentralized way to conduct voting, potentially leading to more
fair and democraticoutcomes.

2.2.2 Solidity Contract

Solidity contracts play a crucial role in developing Ethereum-based decentralized voting


blockchainapplications. Here are some key uses of Solidity contracts in this context:

 Smart Contract Logic: Solidity is the programming language used to write smart
contracts on the Ethereum blockchain. In a decentralized voting application, a
Solidity contract can be created to define the logic and rules of the voting process.
The contract specifies functions to handle voter registration, vote casting, tallying,
and other essential operations.

 Voter Registration and Management: Solidity contracts facilitate the


registration and management of voters. They can maintain a list of eligible voters,
validate voter identities, and enforce restrictions such as preventing duplicate or
unauthorized voting. The contract can include functions to add or remove voters
from the registry and verify their eligibility during the voting process.

 Vote Casting and Tallying: Solidity contracts enable the recording and tallying
of votes. They define functions for voters to cast their votes, specifying the
candidate or choice they support. The contract can implement mechanisms to
ensure that each voter can only cast one vote and that the votes are recorded
securely and transparently.

 Vote Verification and Auditing: Solidity contracts allow for the verification and
auditing of votes. They can provide functions to retrieve and display the voting
results, allowing participants to verify the accuracy and integrity of the vote tallies.
Transparency and immutability are fundamental aspects of the Ethereum
blockchain, ensuring that votes cannot be altered once recorded.

 Security and Trust: Solidity contracts provide security features to protect the
integrity of the voting process. They can implement access controls to ensure that
only authorized individuals can interact with the contract's functions. Additionally,
contract code can be audited and verified by the community and experts to ensure
that it is free from vulnerabilities and tampering.
4
 Event Emission and Notifications: Solidity contracts can emit events to notify
external systems or user interfaces about significant events in the voting process.
For example, events can be emitted when a vote is cast, when the voting period
ends, or when the final results are determined. These events enable real-time
updates and integration with externalapplications.

 Integration with External Systems: Solidity contracts can integrate with other
smart contracts, oracle services, or external systems to enhance the functionality
and features of the decentralized voting application. E.g., they can interact with
identity verification systems, IPFS for storing candidate information or documents,
and other blockchain-based services.

2.2.3 Hardhat

Using a hardhat in the development of an Ethereum-based decentralized voting


application using blockchain is a common practice among Ethereum developers. Hardhat
is a popular development environment for Ethereum that provides a set of tools and
features to streamline the developmentprocess.
Here are some key ways in which a hardhat can be useful for developing a decentralized
votingapplication on Ethereum:

 Smart Contract Development: Hardhat offers a testing and deployment


framework specifically designed for Ethereum smart contracts. You can write and
test your smart contracts using Solidity, the programming language for Ethereum,
and utilize Hardhat's built-in testing capabilities to ensure the correctness of your
code.

 Local Blockchain Network: Hardhat provides a built-in development network


that allows you to deploy and interact with your smart contracts locally. This local
network is useful for rapid development and testing without the need for deploying
to the Ethereum mainnet or test networks.

 Testing and Debugging: Hardhat's testing framework enables you to write unit
tests for your smart contracts, ensuring their functionality and robustness.
Additionally, Hardhat provides debugging tools that allow you to inspect the state
of your smart contracts duringtesting and development.

 Deployment to Ethereum Networks: Hardhat allows you to deploy your smart


contracts to various Ethereum networks, such as the Ethereum mainnet, test
networks (e.g., Ropsten, Rinkeby), or private networks. This capability is crucial
for deploying your decentralized voting application to a live Ethereum network for
actual usage.

 Integration with Tools and Libraries: Hardhat integrates well with other tools
and libraries commonly used in Ethereum development. For example, it supports
integration with popular libraries like ethers.js and web3.js, which simplify
interaction with Ethereum networks and smart contracts from your application's
frontend.
5
Overall, using Hardhat as your development environment can enhance the efficiency and
reliability of developing a decentralized voting application on the Ethereum blockchain. It
provides a comprehensive set of tools and features that facilitate smart contract
development, testing, debugging, and deployment to Ethereum networks.

2.2.4 MetaMask

MetaMask is a popular browser extension wallet that allows users to interact with
Ethereum-based decentralized applications (DApps) using their web browsers. It provides
a user-friendly interface for managing Ethereum accounts, securely storing private keys,
and signing transactions.

When developing an Ethereum-based decentralized voting application using blockchain,


Metamaskcan be used in various ways:

 Account Management: Metamask simplifies the process of managing Ethereum


accounts for users. It generates and stores private keys securely, allowing users to
create and import accounts easily. This feature ensures that voters have control
over their private keys, which are necessary for signing and submitting
transactions.

 Transaction Signing: Voting on the blockchain requires users to sign transactions


with their private keys to authenticate their actions. Metamask provides a seamless
way to sign transactions securely within the browser, eliminating the need for
users to manually handle cryptographic operations. Developers can leverage
Metamask's APIs to prompt users to sign voting transactions using their Ethereum
accounts.

 Wallet Integration: Metamask enables integration with your decentralized voting


application, allowing users to interact with the application directly from their
browser. Users can connect their Metamask wallet to the application, granting it
permission to access their Ethereum accounts and interact with smart contracts
involved in the voting process.

 Network Connectivity: Metamask supports various Ethereum networks, such as


the mainnet, testnets, and private networks. During development, you can connect
Metamask to the desired network and deploy your smart contracts and conduct
testing without the need for a separate Ethereum client. This flexibility makes it
easier to iterate and test your decentralized voting application.

2.2.5 React JS

ReactJS is a popular JavaScript library for building user interfaces, and it can be utilized
in developing an Ethereum-based decentralized voting application using blockchain. Here
are somekey use cases of ReactJS in this context:

 User Interface (UI) Development: ReactJS provides a component-based


architecture that allows developers 6to create reusable UI components. These
components can be used to build the user interface for the voting application,
including login/signup forms, candidate lists, voting screens, result displays, and
more. ReactJS simplifies UI development by providing a declarative syntax and
efficient rendering.

 State Management: ReactJS incorporates a state management system that enables


efficient handling of application state changes. In a decentralized voting
application, the state can include data such as voter information, candidate details,
voting status, and election results. React's state management, either using the built-in
`useState` hook or external libraries like Redux, can be leveraged to manage and update
this state as users interact with the application.

 Interactivity and Event Handling: ReactJS enables the implementation of


interactive features in the voting application. For example, users can click on a
candidate's name to cast a vote, and React's event handling capabilities can capture
and process these user interactions. React's event system, combined with Ethereum
smart contracts, allows for seamless integration between the user interface and the
underlying blockchain.

 Integration with Ethereum: ReactJS can be used to interact with Ethereum


through the web3 library or Ethereum-specific frameworks like ethers.js or
web3.js. These libraries enable communication with Ethereum nodes and smart
contracts. React components can make calls to smart contracts, retrieve data from
the blockchain, and update the UI accordingly. Users can also sign transactions
and interact with their Ethereum accounts through Metamask or other wallet
integrations.

 Responsive and Dynamic UI: ReactJS facilitates the development of responsive


and dynamic user interfaces. As the voting application's state changes, React
efficiently updates only the necessary components, leading to a more responsive
and performant UI. This dynamic nature is particularly useful when displaying live
voting results or updating the UI based on real-time events on the Ethereum
blockchain.

 Testing and Debugging: ReactJS has a robust ecosystem for testing and
debugging applications. Testing frameworks like Jest and Enzyme can be used to
write unit tests and integration tests for React components. The React Developer
Tools extension provides a debugging environment to inspect and debug React
components, inspecting the application'sstate and props.

By utilizing ReactJS in the development of an Ethereum-based decentralized voting


application, developers can leverage its powerful features for UI development, state
management, interactivity, integration with Ethereum, responsiveness, and testing. React's
ecosystem and community support also provide a wide range of libraries and tools that can
enhance the development process and ensure the quality of the application.

2.2.6 Web 3

7
Web3 is a powerful technology that enables the development of decentralized applications
(DApps) on the Ethereum blockchain. When building an Ethereum-based decentralized
voting application, Web3 plays a crucial role in several aspects:

 Connecting to the Ethereum Network: Web3 allows developers to connect their


application to the Ethereum network. It provides a set of libraries and APIs that
facilitatecommunication with the blockchain. Developers can use Web3 to interact
with smart contracts, send transactions, and retrieve data from the Ethereum
network.

 Smart Contract Integration: Ethereum-based decentralized voting applications


typically rely on smart contracts to handle the logic of the voting process. Web3
provides tools and libraries, such as Truffle or Hardhat, that assist in deploying,
interacting, and testing smart contracts. Developers can use Web3 to deploy their
voting smart contracts and interact withthem through the application's frontend.

 User Wallet Integration: Web3 allows seamless integration with user wallets,
such as MetaMask. User wallets enable users to securely store their private keys
and interact with DApps. Web3 libraries like MetaMask's Ethereum Provider
enable DApps to request user signatures for transactions, authenticate users, and
access their account balances.

 Transaction Handling: Web3 provides functionalities to handle Ethereum


transactions. Developers can use Web3 to create, sign, and broadcast transactions
to the Ethereum network. In the context of a voting application, Web3 can be used
to send voting transactions and record them on the blockchain.

 Retrieving Data from the Blockchain: Web3 enables developers to retrieve data
from the Ethereum blockchain. This includes querying smart contract states,
fetching transaction histories, and accessing other on-chain data. In a voting
application, Web3 can be used to display voting results, verify voter eligibility,
and retrieve information about candidates or voting events.

 Event Handling: Ethereum emits events when specific actions occur on the
blockchain. Web3 allows developers to subscribe to these events and listen for
updates. In a voting application, Web3 event handling can be used to notify users
when new votes are cast, when voting periods begin or end, and other relevant
events.

 Security Considerations: Web3 provides security measures to protect user funds


and ensure the integrity of transactions. By leveraging cryptographic principles,
such as digital signatures and secure communication channels, Web3 helps
safeguard the voting application against fraudulent activities and unauthorized
access.

In summary, Web3 is instrumental in the development of Ethereum-based decentralized


voting applications. It facilitates interaction with the Ethereum network, integration of
smart contracts and user wallets, handling transactions, retrieving blockchain data, event
handling, and ensuring security throughout the voting process.
8
2.2.7 IPFS

The use of IPFS (Interplanetary File System) in developing an Ethereum-based


decentralized voting application can provide several benefits and enhance the
functionality of the application. Here are some use cases for IPFS in this context:

 Storage of Documents and Media: IPFS can be used to store important


documents andmedia files related to the voting process, such as candidate profiles,
election rules, and voting instructions. These files can be stored in a decentralized
manner, ensuring their availability and integrity throughout the voting process.

 Immutable Data: IPFS utilizes content addressing, which means that each file is
identified by its unique hash. This characteristic ensures the immutability of the
stored data, making it suitable for storing voting records and results. Immutable
data can enhance transparency and trust in the voting process, as it becomes
tamper-proof and resistant to censorship.

 Faster Content Delivery: IPFS uses a distributed network of nodes, allowing for
faster and more efficient content delivery. When a user requests a document or
media file related to the voting process, it can be retrieved from the nearest or
most available node, reducing latency and improving user experience.

 Resilience and Redundancy: IPFS is designed to be a resilient and redundant


storage system. Files are distributed across multiple nodes, ensuring that even if
some nodes go offline or are compromised, the data remains accessible. This
feature can be critical in maintaining the availability and integrity of voting-related
information during the electionperiod.

 Peer-to-Peer Communication: IPFS can facilitate peer-to-peer communication


between participants in the voting process. It enables secure and direct
communication channels between voters, election organizers, and other
stakeholders, reducing reliance on centralizedservers and intermediaries.

 Data Privacy: IPFS allows for encrypted storage and retrieval of data, which can
be crucial in maintaining the privacy of sensitive voting information. By
encrypting the stored files, only authorized parties with the appropriate decryption
keys can access and retrieve the data, enhancing the confidentiality and privacy of
the voting process.

It's important to note that while IPFS provides valuable features for decentralized storage
and distribution of data, it should be used in conjunction with the Ethereum blockchain to
ensure the integrity and immutability of the voting process. The Ethereum blockchain can
handle the logic of the voting smart contracts, while IPFS can be used for storing
associated files and media. This combination can provide a robust and decentralized
infrastructure for developing an Ethereum- based decentralized voting application.

2.3 PROPOSED PLAN OF WORK


9
For our proposed plan of work, we are considering two modules that are to be completed
in three phases. Two modules are as follows:
1. Front-end for the application
2. Back-end using Solidity to implement Blockchain.

Each of these modules will be considered as one phase and the remaining one phase will
cover the connection and testing of these modules.

• Phase 1: In this phase we will cover the front-end module, in which we will build the
interactive user-interface for the admin as well as the user. In parallel the research work
related to the implementation of Blockchain in decentralized application will be done.

• Phase 2: In this phase we will cover the back-end module, we will implement the
Blockchain using Ethereum framework and convert the system into a decentralized
application.

• Phase 3: The connection of two different module along with the testing of the platform
will be completed in this phase.

10
CHAPTER 3
LITERATURE SURVEY

Currently increasing digital technology helped many people lives. In contrast to the
electoral system, there are many conventional uses of paper in its implementation. The
aspect of security and transparency is a threat from still widespread election with the
conventional system. Block chain technology is one of solutions, because it embraces a
decentralized system and the entire database are owned by many users.
There is no doubt that the revolutionary concept of the blockchain, which is the
underlying technology behind the famous crypto currency Bitcoin and its successors, is
triggering the start of a new era in the Internet and the online services. In this work, we
have implemented and tested a sample e-voting application as a smart contract for the
Ethereum network using the Ethereum wallets and the Solidity language.
Block chain was first introduced by Satoshi Nakamoto (a pseudonym), who proposed a
peer to-peer payment system that allows cash transactions through the Internet without
relying on trust or the need for a financial institution. Block chain is secure by design, and
an example of a system with a high byzantine failure tolerance.
E-voting is a potential solution to the lack of interest in voting amongst the young tech
savvy population. For e-voting to become more open, transparent, and independently
auditable, a potential solution would be base it on block chain technology. Block chain
technology has a lot of promise; however, in its current state it might not reach its full
potential.
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 block chain technologies, a number of initiatives have
been made to explore the feasibility of using block chain to aid an effective solution to e-
voting. It presented one such effort which leverages benefits of block chain 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.
Recent major technical challenges relating to e-voting systems embrace, however not
restricted to secure digital identity management. Any potential citizen ought to be
registered to the electoral system before the elections. Their data ought to be in a very

11
digitally processable format. Besides, their identity data ought to be unbroken personal in
any involving information. Ancient E-voting system could face following problems:
 Anonymous vote-casting.
 Individualized ballot processes.
 Ballot casting verifiability by (and only by) the voter.
 High initial setup costs.
 Increasing security problems.
 Lack of transparency and trust.
 Voting delays or inefficiencies related to remote/absentee voting
To mitigate these threats, software mechanisms which promise the following should be
deployed:
1. Prevention of evidence deletion.
2. Transparency with privacy.

Using a Blockchain, the most important requirements are satisfied:


• Authentication: Only registered voters will be allowed to vote.
• Anonymity: The system prevents any interaction between the votes casted by the
voters and their identities.
• Accuracy: Votes once cast are permanently recorded and cannot be modified or
• changed under any circumstances.
• Verifiability: The system will be verifiable such that the number of votes is
accounted .As technology advances, many countries have now opted for electronic
voting systems.

Any voting system must follow principles of transparency and impartiality in order to
achieve fairness; the electronic voting process must also be protected against cyberattacks
ordenial-of-service attacks (DDOS) because such attacks may affect the
processing time in voting procedures and even hinder the fairness in voting. This study
establishes a network security mechanism for voting systems based on blockchain
technology. The blockchain mechanism employs a distributed architecture that can
prevent system shutdown resulting from malicious cyber-attacks; additionally, any user in
the blockchain can authenticate data integrity, which satisfies requirements of
transparency and impartiality in voting systems.

12
CHAPTER 4
DEVELOPMENT ENVIRONMENT

4.1 SOFTWARE REQUIREMENT

Two modules are as follows:


1. Front-end for the application.
2. Back-end using Solidity to implement Blockchain.

 Phase 1: In this phase we will cover the front-end module, in which we will build
the interactive user-interface for the admin as well as the user. In parallel the
research work related to the implementation of Blockchain in decentralized
application will be done.

Division of Phase One:

 We have considered 2 main modules which are as follows:


A. Admin- The admin module is divided into 5 components.
1.Dashboard- It will contain various charts to display information such as number of
parties, number of voters etc.
2. Add Candidate - In this feature of admin, he can add candidates who are standing in
the election. After candidate is added it will be displayed on the user sides.
3. Create Election- This feature of admin will allow him to create election. A user can
cast his vote only after the election is created by admin. A user can cast vote between
the start date and end date.
4. Election Details- In this section admin can update election details such asstart date, end
date etc.
5. Candidate Details- In candidate details all the candidates added by admin will be
displayed. Admin can update the candidate details if in case a wrong entry is done.
B. User- The user module is divided into 4 components
1.Dashboard- The user dashboard contains information about parties andtheir candidates.
A user can see all the information about candidate.

13
2. Voter Register- In this section first user will have to register himself only then he will
be able to cast his vote.
3. Voting Area- After user is registered, then only he will be directed tothis page and then
he can cast his vote.
4. Results- In this component the user will be able to see the results of the election.

Fig. 4.1 User Flow Diagram

14
Research Methodology of Phase Two

Fig.4.2 Research methodology

15
CHAPTER 5
SYSTEM DESIGN

5.1 DATA MODEL

5.1.1 System Architecture

The architecture of the proposed system is as shown in Fig 5.1. The Voting App may be
accessed using the command line interface or the web browser which in our case will be
Chrome with the MetaMask plugin embedded in it. If the user accesses the app using
command line interface, he is greeted with the NPM command. The commands have to be
typed in VS Code. Else, the user can utilize the user interface built using HTML, CSS and
JavaScript to send the commands. Web3.js is a collection of libraries which allow you to
interact with a local or remote Ethereum node, using an HTTP, WebSocket or IPC
connection. The commands are sent by Web3js using RPC(s) and are detected at the RPC
Endpoint of Local host (hardhat) to be further processed by the Ethereum Virtual
Machine. The voting smart contract created will be deployed over this blockchain. The
config file controls the various configuration parameters of the blockchain.

Fig.:5.1 System Architecture

16
5.1.2 Merkle Tree

Each block in the blockchain is made up of a fixed number of transactions. In blockchain,


as the transactions arrive they are stored in a data structure called the merkle tree. The
merkle tree as shown in Fig 5.2, is created in a bottom up approach. As soon as a
transaction arrives (leaf nodes), it’s hash is calculated and stored in the merkle tree which
forms the penultimate layer of the tree. Next these hashes are concatenated into pairs and
the pairwise hash is calculated. This process is repeated until the merkle root is obtained.
In this way, the hash of each block is obtained. Through the use of merkle tree, the nodes
don’t have to wait for all the transactions to come before a block can be formed which
adds to the security of the blockchain

Fig.: 5.2 Markel tree

Merkle trees can be used in a decentralized voting application to ensure the integrity and
transparency of the voting process. Here's how Merkle trees can be employed in such a
scenario:

 Voter Registration and Verification: Each eligible voter's information, such as


their address and eligibility status, can be stored as leaf nodes in a Merkle tree.
The Merkle tree's root hash represents the entire voter registry. This allows for
efficient verification of voter eligibility by comparing a user's address and status
against the Merkle tree root hash.

 Vote Casting and Verification: Each vote cast by a voter can be stored as a leaf
node in a separate Merkle tree, representing the voting data. The root hash of this
voting Merkle treeencapsulates the entire set of votes.

17
By comparing the root hash with the publicly known root hash, anyone can verify the
integrity ofthe voting data, ensuring that no votes have been tampered with or modified.

 Efficient Auditing and Verification: Merkle proofs can be used to efficiently


audit and verify individual votes. A Merkle proof is a set of hash values that
proves the inclusion of a specific leaf node (vote) in the Merkle tree. By providing
a Merkle proof, a voter can demonstrate the validity of their vote without revealing
the entire voting Merkle tree. This allows for efficient and privacy-preserving vote
verification.

 Transparent Results: The root hash of the voting Merkle tree can be publicly
disclosedafter the voting period ends. This allows anyone to verify the accuracy of
the final vote count by comparing their locally computed root hash with the
disclosed root hash. The transparency provided by the Merkle tree ensures that the
voting process is fair and free from manipulation.

 Efficient Dispute Resolution: In case of disputes or challenges regarding the


voting results, Merkle proofs can be utilized to provide evidence and resolve
discrepancies. By presenting Merkle proofs of specific votes or sections of the
Merkle tree, stakeholders can verify the accuracy of the results and address any
concerns or discrepancies.

By incorporating Merkle trees into a dApp voting application, it becomes possible to


achieve transparency, integrity, and efficient verification of the voting process. Merkle
proofs allow for trustless verification of individual votes, while the root hashes of the
Merkle trees provide a meansto verify the overall integrity of the voting data. This ensures
the credibility and fairness of the voting application, enhancing trust among participants.

18
5.1.3 Voting Process

 The system verifies the credentials of the voter.


 After the positive authentication, the corresponding smart contract is prompted for
continued voting. Candidates are listed on smart contract. A voter may choose to
do so.
 When a candidate has been selected by a voter, he or she proceeds to sign its vote.
 When the vote is verified as valid, consensus has been reached on the particular
vote. Theelector receives a transaction identification of his corresponding vote.
 The vote will then be added to the block after the verification.

Fig.:5.3 Voting process

19
5.1.4 Class Diagram

 It shows the building blocks of a secured database system using blockchain


technology. This class diagrams depict the static view of the model or part of the
model, describing what attributes and behavior it has rather than detailing the
methods for achieving operations.
 Each class contains various attributes and methods (Functions) which call other
classattributes to share data.

Fig.: 5.4 Class Diagram

20
5.2 PROCESS MODEL

5.2.1 Use case Diagram

Use case modeling is the process of modeling a system’s functions in terms of business
events, who initiated the events, and how the system responds to the events. Use case is a
behaviorally related sequence of steps (a scenario), both automated and manual, for the
purpose of completing a single business task. Use cases are initiated or triggered by
external users or systems called actors. An actor represents anything that needs to interact
with the system to exchange information. An actor is a user, a role, which could be an
external system as well as a person. Fig 5.5 shows the Use Case diagram of the new
system. Here, the voter will be able to register, login with their details, vote and view
result. Admin will be able to login with their details, register candidate, and start voting,
stop voting and reset voting. It is guaranteed that voter can only select their desired
candidate and vote once.

Fig.5.5 Use Case Diagram

21
5.2.2 Data Flow Diagram

Dataflow diagram (DFD) will be used to model the new system by showing the graphical
representation of the flow of data through an information system, modeling its process
aspects. Dataflow diagram shows the way information flow through a process or system.
It includes inputs and output; data stores and various sub processes the data moves
through. Here, dataflow diagram begins with voter registration and login with his/her
detail after successful authentication the system display receipt showing that login was
successful, then the voter can now caste his/her vote to desired candidate which will be
processed in the Ethereum smart contract as well as communicate with the Ethereum
wallet. Ethereum blockchain update candidate and election parameter through the
dashboard and manages Ethereum wallet which communicate directly with the private
blockchain and updated by miners. Fig. 5.6 shows the dataflow diagram of the proposed
system.

Fig.:5.6 Data flow Diagram

22
5.2.3 Collaboration Diagram

Collaboration diagram will be used (fig. 5.7). Collaboration diagrams show how messages
flow between objects in an object-oriented application and also imply the basic
associations (relationships) between classes. Messages are added to the associations and
are shown as short arrows pointing in the direction of the message flow. The sequence of
messages is shown through a numbering scheme. The collaboration begins with the voter
registration through the dashboard after which he/she can login to the system; once the
login is successful the system will display receipt showing that the login was successful,
then the voter can now caste his/her vote to desired candidate which will be processed in
the Ethereum smart contract as well as communicate with the Ethereum wallet. Ethereum
blockchain update candidate and election parameter through the dashboard and manages
Ethereum wallet which communicate directly with the private blockchain and updated by
miners. Fig.5.7 shows the collaboration diagram of the proposed system.

Fig.5.7 Collaboration Diagram

23
CHAPTER 6
UI OF WEBSITE
6.1 HOMEPAGE

Fig.6.1 Homepage
 This is the main login page where you have to connect your account, register
yourself, andcast your vote.
 The homepage consists of one option: "Connect wallet (MetaMask)."
 If you don't have an account, open MetaMask in your Chrome Browser, download
it, createan account, and then try to connect with the application.
 You can create account in MetaMask by following some steps:

 Install MetaMask: Visit the MetaMask website (https://metamask.io/) and


install the MetaMask extension for your preferred web browser (such as
Chrome, Firefox, or Brave).

 Launch MetaMask: Once installed, click on the MetaMask extension icon in


yourbrowser's toolbar to launch the application.

 Set Up a New Account: On the MetaMask welcome screen, click on "Get


Started" or"Create a Wallet" to begin setting up a new account.

 Create a Password: Enter a strong password for your MetaMask account. Make
sure to choose a password that is secure and not easily guessable. Confirm the
password by entering it again in the provided field.

 Backup Seed Phrase: MetaMask will display a unique 12 or 24-word seed


phrase. This phrase is extremely important and serves as a backup for your
account

 Account Creation: After confirming the seed phrase, MetaMask will create
youraccount.

24
6.2 WALLET LOGIN PAGE

Fig.6.2 MetaMask Login Page

 Once you create your account on MetaMask, simply click on"Connect Wallet."
 After that, you will be directed to the login page where you have to enter your
login credentials (password) to access your MetaMask account.

25
6.3 ACCOUNT SELECTION & APPROVAL PAGE

Fig 6.3: Account selection page Fig.6.4: Approval page

 Once your credentials are successfully submitted, you will be directed to this page.
 On this page, you have to choose your account for the transaction during candidate
registration, voter registration, and for voting purposes.
 It is mandatory to have Ethereum (ETH) in your account, which will be used to
pay theGAS fee for every transaction.
 After clicking on "Next," you will be allowed to connect your account with
Localhost:3000.
 Make sure that our localhost is connected properly. To do this, you need to open
VS Code,go to the terminal, and then enter the following command:
npx hardhat node (hit Enter)

26
6.4 WALLET CONNECTED PAGE

Fig 6.5 Wallet Connect page

 Once you successfully connect with the wallet and choose the account, refresh the
homepage to receive the "Connect Wallet" notification.
 Now you are ready to use the D-app for voting purposes.

 You will also see four different options in a dashboard, such as:
 Home
 Candidate Registration
 Voter Registration
 Voter List
 Now you have to choose the given option from the Dashboard
 Once you choose Candidate Registration then you are allowed to
register a New Candidate
 You need to enter the details of the candidate for the successful
registration Like
o Name of the Candidate
o Address (Organizer’s Account Address) because
only Organizer can add candidate.
o Candidate AGE
o Then click Authorized Candidate

27
6.5 CANDIDATE REGISTRATION PAGE

Fig. 6.6 Candidate registration page

 After you click on the "Authorized" button, you will be redirected to the wallet for the
transaction of gas fees applicable for candidate registration.
 Once you confirm the payment, the candidate will be registered successfully.
 Refresh the home page to see the registered candidate.

Fig. 6.7 Set Candidate Transaction fee slip

28
6.6 CANDIDATE CONFIRMATION PAGE

Fig 6.8. Candidate Added successfully Page

Now you have to choose the given option from the Dashboard
 Once you choose Voter Registration then you are allowed to register a New
Voter
 You need to enter the details of the candidate for the successful registration Like
 Name of the Voter
 Address (Different address then the Organizer’s Account Address)
but the Connect account should be ofOrganizer.
 Voter AGE
 Then click Authorized Voter

29
6.7 VOTER REGISTRATION PAGE

Fig.6.9 Voter registration page

 After you click on the "Authorized" button, you will be redirected to the wallet for the
transaction of gas fees applicable for Voter registration.
 Once you confirm the payment, the Voter will be registered successfully.

Fig. 6.10 Voter registration transaction fee

30
Fig.:6.11 Payment Confirmation Slip

 Refresh the home page to see the registered Voter, you have to click on the Voter
list tab inthe dashboard.
 Once you click on the Voter list tab you can see the registered Voter have voted or
not.

31
6.8 VOTER LIST PAGE

Fig.6.12: Voter list page

 Now you have to give your vote to the registered candidate.


o You need to use a different account for casting your vote. Change the
account from MetaMask to a different one.
o Otherwise, it will show that you have already voted.
o After connecting the different account, click on the "Home" tab in the
dashboardand select "Give Vote" for the registered candidate.
o Upon clicking, you will be directed to the Wallet page for the transaction
to validate the voter.

32
Fig.6.13 Voter Transaction Slip

 Once you confirm the transaction, vote is casted successfully.

33
Fig 6.14: Voting success page

 If you have already cast your vote, you will not be able to vote again using the same
account,which is a major benefit of the Blockchain technology.
 It ensures that each user can vote only once, preventing any duplicate voting.
 If you attempt to submit a fake vote, a pop-up will appear on your screen showing
“Sorry!, You have already voted, Reload Browser”.

34
Fig.: 6.15 Duplicate Vote pop-ups

 Immutability: Once a vote is cast, it cannot be changed or deleted.


 Transparency: All votes are publicly visible on the blockchain.
 Security: Blockchain is a very secure technology, making it difficult to hack or tamper
withvotes.
 These security benefits would help to ensure that the voting process is fair and
transparent, andthat the results of the election are accurate.

35
CHAPTER 7
ARCHITECTURAL DETAILS

7.1 PROGRAM DESIGN LANGUAGE

When it comes to developing an Ethereum-based decentralized voting application using


blockchain, there are several important aspects to consider: architecture, program design,
andprogramming languages. Let's explore each of these in more detail:

 Architecture: The architecture of your application refers to the overall structure and
components that make up the system. For an Ethereum-based decentralized voting
application, a typical architecture would involve the following components:

o Smart Contracts: These are self-executing contracts written in Solidity


(Ethereum's programming language) that define the rules and logic of the
voting process. They are deployed on the Ethereum blockchain and handle the
storage and processing of votes and other relevant data.

o User Interface (UI): The UI provides the interface through which users can
interact with the voting application. It can be a web-based interface, a mobile
app, or any other user-friendly interface that allows voters to cast their votes
securely.

o Backend: The backend of the application handles the communication between


the user interface and the Ethereum blockchain. It is responsible for interacting
with the smart contracts and fetching and updating data as needed.

o Ethereum Blockchain: This is the underlying decentralized ledger that stores


all the transactional data and smart contracts. It ensures the immutability and
transparency ofthe voting process.

o Security and Authentication: Proper security measures, such as encryption


and authentication mechanisms, should be implemented to ensure the integrity
and confidentiality of the voting system.

36
 Program Design: Program design involves designing the logic and flow of the
application. For a decentralized voting application, you need to consider the following
design aspects:

o User Registration and Identity Verification: You need to design a process


for users to register and verify their identities securely. This helps prevent fraud
and ensures that each voter is eligible to participate.

o Ballot Creation and Management: Design a mechanism for creating and


managing the ballots. This includes defining the candidates or options, setting
up voting parameters (e.g., start and end time), and handling any updates or
changes to the ballot during the voting process.

o Vote Casting and Tallying: Design the process for voters to cast their votes
securely and anonymously. Also, define the logic for tallying the votes and
determining the finalresults.

o Auditability and Transparency: Ensure that the voting process is transparent


and auditable. Design mechanisms to allow stakeholders to verify the integrity
of the votesand the overall process.

o Error Handling and Security: Design error handling mechanisms to handle


any exceptions or errors that may occur during the voting process. Implement
robust securitymeasures to protect against potential attacks or vulnerabilities.

 Programming Languages: Developing an Ethereum-based decentralized voting


applicationtypically involves using the following programming languages:

o Solidity: Solidity is the most commonly used programming language for


developing smart contracts on the Ethereum blockchain. It provides a way to
define the behaviorand logic of the voting application's smart contracts.

37
o JavaScript: JavaScript is often used for developing the frontend user interface
and the backend of the application. Libraries like Web3.js or Ethers.js are
commonly used for interacting with the Ethereum blockchain.

o HTML/CSS: For developing the user interface, HTML and CSS are
commonly used forstructuring the UI elements and styling the application.

 It's worth noting that there are various frameworks, tools, and libraries available that
can simplify the development process for Ethereum-based decentralized applications.
These includeframeworks like Truffle and libraries like Open Zeppelin, which provide
pre-built smart contract templates and utilities.

 Keep in mind that developing a secure and robust decentralized voting application
requires expertise in blockchain development, smart contract programming, and
security best practices. It's crucial to thoroughly test and audit your code and consult
with experts in the field to ensurethe integrity and reliability of your application.

38
CHAPTER 8
SYSTEM IMPLEMENTATION

8.1 CODING IMPLEMENTATION

8.1.1 Voting Contract

Fig.: 8.1 Solidity Contract

The given code represents a smart contract written in Solidity for a voting system. Here is
itsfunctionality:

The contract allows for the creation of candidates and voters in the voting system.

 Candidates:
- The contract has a struct called "Candidate" that stores information about a
candidate, such as their ID, age, name, image, vote count, address, and
IPFS(InterPlanetary File System) hash.
- The contract keeps track of candidate addresses in an array called
"candidateAddress".
- The contract uses a mapping called "candidates" to associate each
candidate addresswith their corresponding Candidate struct.
- A function named "setCandidate" is provided to set the details of a
candidate. This function can only be called by the voting organizer, as
specified by the "require" statement.
- Other functions like "getCandidate", "getCandidateLength", and
"getCandidateData" allow access to candidate information.
39
 Voters:
- The contract has a struct called "Voter" that stores information about a
voter, including their ID, name, image, address, allowed voting status, vote
choice, andIPFS hash.
- The contract keeps track of voter addresses in an array called
"votersAddress".
- The contract uses a mapping called "voters" to associate each voter address
withtheir corresponding Voter struct.
- A function named "voterRight" is provided to authorize a voter's right to
vote. Thisfunction can only be called by the voting organizer.
- A function named "vote" allows a voter to cast their vote for a specific
candidate. It updates the vote count for the chosen candidate and prevents
multiple votes from thesame voter.
- Other functions like "getVoterLength", "getVoterData",
"getVotedVotersList", and "getVoterList" provide access to voter-related
information.

Overall, this contract provides functionality for creating candidates, authorizing voters,
andrecording votes in a voting system.

40
8.1.2 Voter.js

Fig. 8.2 Voter.js

The given code is a React component that defines a context provider for a voting
application. It sets up the necessary configurations and functions for interacting with
Ethereum and IPFS.

 The required dependencies are imported, including React, Web3Modal, ethers,


ipfs-http-client, axios, and useRouter from Next.js.

 The code defines a constant `VotingAddress` and `VotingAddressABI` imported


from a filenamed `constants.js`.

 IPFS configurations are set up using the `ipfs-http-client` library and the Infura
IPFSservice.

 The `fetchContract` function is defined, which creates an instance of a contract


using theprovided signer or provider.

 The code creates a context named `VotingContext` using `React.createContext()`.

 The `VotingProvider` component is defined as the context provider. It takes


`children` as aprop.

 Inside the provider component, various state variables are declared using the
`useState`hook to manage the application's state.

41
 The `checkIfWalletIsConnected` function is defined to check if MetaMask is
installed and connected. It sets the current account and retrieves voter data and
candidate data.
 The `connectWallet` function is defined to connect the user's MetaMask wallet and
updatethe current account and retrieve voter data and candidate data.

 The `uploadToIPFS` and `uploadToIPFSCandidate` functions are defined to


upload files toIPFS and return the corresponding URL.

 The `createVoter` function is defined to create a voter by interacting with the


smart contract. It takes form input and a file URL as parameters and adds the voter
data to IPFS.

 The `getAllVoterData` function is defined to retrieve all voter data from the smart
contract.

 The `giveVote` function is defined to allow a user to vote by interacting with the
smartcontract.

 The `setCandidate` function is defined to set a candidate by interacting with the


smart contract. It takes candidate form data, a file URL, and the router object as
parameters.

 The `getNewCandidate` function is defined to retrieve all candidate data from the
smartcontract.

Finally, the provider component returns the `VotingContext.Provider` component,


providing thenecessary values and functions to the children components.

Overall, this code sets up a context provider for a voting application, handles interactions
withMetaMask, IPFS, and the Ethereum blockchain, and manages the application's state.

42
8.1.3 Allowed Voters.js

Fig. 8.3 Allowed-voters.js

The code provided is a React component for creating and managing allowed voters in a
blockchainvoting system. Here is a summary of its functionality:

 The component imports necessary dependencies and styles.


 It imports the `VotingContext` from the "Voter" context file.
 The component defines state variables using the `useState` hook, including
`fileUrl` for storing the uploaded file URL and `formInput` for storing voter
information.
 It initializes the Next.js router.
 The component consumes the `VotingContext` using the `useContext` hook to
accessfunctions and data related to voting.
 The `onDrop` function is defined to handle the file drop event for uploading to
IPFS (InterPlanetary File System), and the `useDropzone` hook is used to enable
file dropfunctionality.

43
 The `useEffect` hook is used to fetch the list of voters from the context on
componentmount.
 The component renders a form for creating a new voter and displays information
about the uploaded file and existing voters.
 If a file is uploaded (`fileUrl` is not null), the component displays the file
information alongwith the voter's name, address, and position.
 If no file is uploaded, the component displays a side panel with information about
the votingorganization and a list of existing voters fetched from the context.
 The component provides an input field for each voter attribute (name, address,
position) andupdates the `formInput` state accordingly.
 The component renders a button to create an authorized voter. When clicked, it
calls the
`createVoter` function from the context with the provided voter information and
file URL.
 The component also displays a notice section at the bottom with information about
thevoting organizer.
Overall, this component allows users to create and manage authorized voters in a
blockchain voting system. It integrates with IPFS for file storage and uses the
`VotingContext` to interact with the voting contract and retrieve voter data.

8.1.4 Deploy.js

Fig. 8.4 Deploy.js

The code provided is a JavaScript script using the Hardhat framework for deploying a
contractnamed "Create" to the Ethereum network. Here is a summary of its functionality:

44
 The code imports the Hardhat framework using the `require` statement.
 The `main` function is defined as an async function, indicating that it contains
asynchronousoperations.
 Within the `main` function, it uses `hre.ethers.getContractFactory` to retrieve the
contractfactory for the "Create" contract.
 It then uses the contract factory to deploy an instance of the "Create" contract
using the
`deploy` method.
 The `await create.deployed()` statement ensures that the deployment is completed
beforeproceeding.
 Finally, it logs a message to the console, indicating that the contract with 1 ETH
locked hasbeen deployed and displays the address of the deployed contract.
 The `main` function is called at the end of the script.
 If any errors occur during the execution of the script, they are caught and logged to
theconsole using `console.error`.
 The `process.exitCode` is set to 1 to indicate an error occurred.

Overall, this script deploys the "Create" contract using the Hardhat framework and logs
the deployment address to the console. It is commonly used in Ethereum development
workflows fordeploying and interacting with smart contracts.

45
CHAPTER-9
DATA ANALYSIS AND RESULT

The existing system for voting in India is the EVM (Electronic Voting Machine) based
system. Prior to this system there were paper ballots and manual counting. The paper
ballots method was widely criticized because of fraudulent voting and booth
capturing,where party loyalists captured booths and stuffed them with pre-filled fake
ballots.
Replacing the existing system with a new election system is critical to limit fraud and
having the voting process traceable and verifiable. As we can see the internethas brought a
revolution in each and every domain possible, by trying to shift the existing system
towards the online platform to make the proceedings fast and user convenient.
We know that the existing system is reliable but that does not mean that we should not
take a step ahead towards the betterment of the existing system. Online voting system
using blockchain can bethat step.
A blockchain is a distributed, immutable, incontrovertible, public ledger. This new
technologyworks through four main features:
The ledger exists in many different locations: No single point of failure in the
maintenance of thedistributed ledger.

There is distributed control over who can append new transactions to the ledger.

Any proposed “new block” to the ledger must reference the previous version ofthe ledger,
creatingan immutable chain from where the blockchain gets its name, and thus preventing
tampering with the integrity of previous entries.

We have tried to build a user interface of the decentralized application that will make the
voting process more convenient. The UI portion can be assumed as 30% of the totalwork
that is to be completed. The major portion in this system is related to the blockchain
technology which will beresponsible for the reliable voting process.

46
CHAPTER 10
PERFORMANCE AND LIMITATIONS

10.1 MERITS OF THE SYSTEM

The Ethereum-based decentralized voting application using blockchain offers several


merits:

 Transparency: The use of blockchain technology ensures transparency in the


voting process. All transactions and votes are recorded on the blockchain, making
it possible foranyone to verify the integrity of the voting system.

 Security: Blockchain provides a high level of security for the voting application.
The decentralized nature of blockchain makes it difficult for any single entity to
manipulate or tamper with the voting data. The use of cryptographic algorithms
ensures the authenticity and immutability of the votes.

 Elimination of Intermediaries: By leveraging blockchain, the decentralized


voting application eliminates the need for intermediaries such as centralized
authorities or third- party entities. This reduces the risk of fraud and manipulation
by removing centralized control over the voting process.

 Increased Accessibility: Ethereum-based decentralized voting applications can be


accessed by anyone with an internet connection and a compatible device. This
increases accessibility and allows voters to participate from anywhere, reducing
geographical barriers and increasing voter turnout.

 Cost Efficiency: Traditional voting systems often involve significant costs for
infrastructure, personnel, and logistics. Decentralized voting applications built on
Ethereum can reduce these costs by eliminating the need for physical polling
stations and manual votecounting processes.

 Immutable and Auditable Records: The use of blockchain ensures that all
voting records are immutable and cannot be altered retroactively. This feature
provides an auditable trail of votes, enabling independent audits and verifications
of the voting process.

 Increased Trust and Confidence: The transparency, security, and verifiability


offered by Ethereum-based decentralized voting applications can help build trust
and confidence in the voting system. This can lead to greater public participation
and trust in the electoral process.

 Simplified Voting Process: Blockchain-based voting applications can streamline


the voting process by automating tasks such as voter registration, vote counting,
and result verification. This simplification can lead to faster declaration of results.

47
 Accessibility for Overseas Voters: Decentralized voting applications can enable
overseas voters to participate in the electoral process without the need for physical
presence. This ensures inclusivity and allows citizens living abroad to exercise
their voting rights.

 Resistance to DDoS Attacks: Blockchain-based decentralized applications are


inherently resistant to Distributed Denial of Service (DDoS) attacks. The
decentralized nature of the network ensures that there is no single point of failure,
making it difficult for attackers todisrupt the voting process.

Overall, Ethereum-based decentralized voting applications provide a secure, transparent,


and efficient solution for conducting elections, enhancing trust in the democratic process,
and ensuringthe integrity of voting outcomes.

10.2 LIMITATIONS OF THE SYSTEM

While Ethereum-based decentralized voting applications using blockchain offer several


advantages, they also have certain limitations that need to be considered. Here are some
limitations of such applications:

 Scalability: Ethereum's current architecture faces scalability challenges, with


limitations on transaction throughput and high gas fees during network congestion.
This can impact the speed and efficiency of vote processing and result in delays.

 Cost: The cost of executing transactions and smart contracts on the Ethereum
network can be expensive, especially during times of high network activity. This
may discourage participation from some voters or limit the number of transactions
that can be processed within a given budget.

 Privacy: Ethereum's blockchain is public, meaning that all transactions and


associated data are visible to anyone. While the identity of the voters may be
pseudonymous, the voting patterns and preferences of individuals can potentially
be analyzed and traced back to them. Maintaining voter privacy and anonymity can
be a challenge.

 Immutability: Once a vote is recorded on the Ethereum blockchain, it becomes


immutable and cannot be modified or deleted. While immutability ensures
transparency and trust, it also means that any errors or irregularities in the voting
process cannot be easily rectified.

 Voter Authentication: Ensuring the authentication and eligibility of voters is


crucial in any voting system. Ethereum-based decentralized voting applications
need to implement robust mechanisms to verify the identity of voters and prevent
fraudulent or duplicate voting.

 User Experience: Interacting with decentralized applications (DApps) on the


Ethereum network often requires users to have a certain level of technical
expertise and familiarity with blockchain concepts. This can pose a barrier to entry
for some voters and may limit theaccessibility and usability of the application.
48
 Governance and Consensus: Decentralized voting applications require
mechanisms for governance and decision-making. Designing effective and
inclusive governance models that address the diverse needs and perspectives of
stakeholders can be challenging and may require additional off-chain processes.

 Regulatory and Legal Considerations: Decentralized voting applications may


need to comply with existing legal and regulatory frameworks governing elections
and voting processes. Navigating these legal requirements while maintaining the
decentralized andtransparent nature of the application can be complex.

It is important to carefully consider these limitations and address them appropriately when
developing and deploying Ethereum-based decentralized voting applications. Each
limitation may require specific design choices, trade-offs, and additional safeguards to
ensure the integrity, security, and usability of the voting system.

10.3 FUTURE ENHANCEMENTS

Future enhancements for an Ethereum-based decentralized voting application using


blockchain:

 Improved Security Measures: Enhance the security measures by implementing


robust encryption algorithms, multi-factor authentication, and identity verification
protocols toensure the integrity of the voting process and protect against fraud.

 Privacy Enhancements: Implement privacy features to protect the anonymity of


voters. Techniques such as zero-knowledge proofs or homomorphic encryption
can be explored to allow verifiability of the votes without revealing the identity of
the voters.

 Scalability Solutions: Explore scalability solutions, such as layer 2 solutions (e.g.,


state channels or sidechains) or sharding, to improve the throughput and efficiency
of the voting application. This will enable handling a larger number of voters and
accommodate increasedparticipation.

 User-Friendly Interfaces: Develop intuitive and user-friendly interfaces for


voters to interact with the application. This includes designing responsive web or
mobile interfaces that provide a seamless voting experience and clear instructions
for participating in the election.

 Integration with Existing Voting Systems: Explore integration with existing


voting systems to enable a smooth transition from traditional voting methods to
blockchain-based voting. This may involve collaboration with government bodies,
electoral commissions, or other relevant stakeholders to ensure compatibility and
regulatory compliance.

49
 Auditing and Transparency: Implement mechanisms for auditing and
transparency to allow independent verification of the voting results. This could
involve publishing the smart contract code, recording all transactions on a public
blockchain explorer, and enabling stakeholders to verify the integrity of the voting
process.

 Secure Infrastructure: Ensure the infrastructure supporting the decentralized


voting application is secure by regularly auditing smart contracts, performing
vulnerability assessments, and employing best practices for secure development
and deployment.

 Accessibility Considerations: Address accessibility considerations to ensure the


inclusivity of the voting application. This involves designing interfaces that are
accessible to individuals with disabilities and providing alternative voting methods
for those who may not have access to digital platforms.

 Internationalization and Localization: Support multiple languages and adapt the


application to local voting regulations and requirements. This includes providing
language options for voters, accommodating different voting systems, and
complying with legal frameworks specific to different regions.

 Continuous Improvement and Community Feedback: Foster an active


community of users and stakeholders and encourage feedback to identify areas for
improvement. Regularly update the application based on user feedback, security
audits, and emerging technologies to ensure the voting system remains reliable,
secure, and user-friendly.

Remember that these enhancements should be implemented while considering legal and
regulatory requirements, ensuring transparency, and addressing potential challenges in
deploying blockchain-based voting systems in real-world scenarios.

10.4 USER MANUAL

User Manual: Ethereum-based Decentralized Voting Application using Blockchain

1. Introduction

The Ethereum-based Decentralized Voting Application is a secure and transparent voting


system built on the Ethereum blockchain. This user manual provides step-by-step
instructions on how touse the application to participate in the voting process.

2. Prerequisites

- Web browser with MetaMask extension installed


- Ethereum account with ETH for transaction fees

50
3. Accessing the Application

- Open your web browser and ensure that the MetaMask extension is enabled.
- Navigate to the Ethereum-based Decentralized Voting Application website.

4. Creating an Ethereum Account

- If you don't have an Ethereum account, click on the MetaMask extension icon
and followthe instructions to create a new account.
- Fund your Ethereum account with ETH to cover transaction fees.

5. Connecting to the Application

- Once you have an Ethereum account, click on the MetaMask extension icon and
ensurethat you are connected to the Ethereum network.
- Open the Ethereum-based Decentralized Voting Application website and wait for
it toload.
6. Participating in the Voting Process

- On the application's main page, you will see the list of candidates and their
details.
- Read through the candidate information and make an informed decision on
whom to votefor.

7. Registering as a Voter

- Before casting your vote, you may need to register as a voter if you haven't done
soalready.
- Click on the "Register as Voter" button and follow the prompts.
- Provide the necessary information, such as your name and identification details,
asrequired.
- Confirm the registration transaction using MetaMask and wait for the transaction
to beconfirmed on the blockchain.

8. Casting Your Vote

- Once registered, locate the candidate you wish to vote for and click on the "Vote"
buttonnext to their name.
- MetaMask will open, showing the transaction details. Confirm the vote
transaction andwait for it to be confirmed on the blockchain.

51
9. Verifying Your Vote

- After your vote is confirmed, you can verify that your vote has been recorded
correctly.
- Check the candidate's vote count on the application's main page. It should reflect
your vote.

10. Conclusion

Congratulations! You have successfully participated in the Ethereum-based


Decentralized Voting Application. Your vote has been securely recorded on the
blockchain, ensuring transparency and immutability. Thank you for your
participation in the democratic process!

52
CHAPTER 11
CONCLUSION

The design of a secured database system using blockchain technology is important to the
society. As the world is advancing in a new technological age, especially in undeveloped
countries like Nigeria that manage a lot of data due to its large population, there is a need
to create a decentralizeddatabase system that will enable transparency in registering voters
and casting votes without involving third party. If not adopted, may lead to mutability of
data, single point failure regarding the third party and various security threats that might
lead to malicious acts. This has contributed to the massive manipulation of votes in our
voting system as well as being vulnerable to attackers.
Therefore, introducing a blockchain-based database in our voting system will help
minimize the scalability issues which will in turn creates trust between different
participants who want to enterinto a business agreement through the consensus algorithm,
complete transparency of data and decentralized while keeping the users’ privacy.
The system will enable the government and Independent National Electoral Commission
to minimize the cost of conducting elections while increasing trust, security, transparency
and traceability of data shared across a business network and as well encourage more
people to participate in the democratic process.
If we cannot combat the single point of failure and mutability of data in our voting system
as well as security threats that might arise while using our system, our voting system will
surely be at risk. More research and innovation are needed to maintain the trust,
transparency and decentralized form of a secured database system using blockchain
technology as blockchain is still in its infancy.

53
REFERENCES

1. Liu, Y.; Wang, Q. An E-voting Protocol Based on Blockchain. IACR Cryptol. Eprint
Arch.
2. Shahzad, B.; Crowcroft, J. Trustworthy Electronic Voting Using Adjusted Blockchain
Technology.
3. Racsko, P. Blockchain and Democracy. Soc. Econ. 2019, 41, 353–369. [CrossRef]
4. Yaga, D.; Mell, P.; Roby, N.; Scarfone, K. Blockchain technology overview
5. The Economist. https://infographics.economist.com/2018/DemocracyIndex/
6. Cullen, R.; Houghton, C. Democracy online: An assessment of New Zealand
government websites..
7. Schinckus, C. The good, the bad and the ugly: An overview of the sustainability of
blockchaintechnology. Energy Res. Soc. Sci.
8. Gao, S.; Zheng, D.; Guo, R.; Jing, C.; Hu, C. An Anti-Quantum E-Voting Protocol in
Blockchainwith Audit Function. IEEE Access
9. Hang, L.; Kim, D.-H. Design and implementation of an integrated iot blockchain
platform forsensing data integrity.
10. Daulat Hussain YouTube Channel; to learn the concept of solidity.

54

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy