Project Report Sample Format
Project Report Sample Format
By
Pushkar Kumar
Roll Number: 2100970140050
A PROJECT REPORT
KCA - 451
Certificate
Date: ………………
Head of Department
Abstract
Name:Pushkar Kumar
Page No.
I Introduction 1
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
XI Conclusion 53
XII References 54
List of Figures
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.
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.
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
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.
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.
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.
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
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.
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.
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:
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.
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:
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.
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.
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.
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.
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.
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
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.
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.
14
Research Methodology of Phase Two
15
CHAPTER 5
SYSTEM DESIGN
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.
16
5.1.2 Merkle 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:
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.
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.
18
5.1.3 Voting Process
19
5.1.4 Class Diagram
20
5.2 PROCESS MODEL
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.
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.
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.
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:
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.
Account Creation: After confirming the seed phrase, MetaMask will create
youraccount.
24
6.2 WALLET 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
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
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
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.
28
6.6 CANDIDATE CONFIRMATION 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
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.
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
32
Fig.6.13 Voter Transaction Slip
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
35
CHAPTER 7
ARCHITECTURAL DETAILS
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 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.
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 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.
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
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
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.
IPFS configurations are set up using the `ipfs-http-client` library and the Infura
IPFSservice.
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 `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 `getNewCandidate` function is defined to retrieve all candidate data from the
smartcontract.
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
The code provided is a React component for creating and managing allowed voters in a
blockchainvoting system. Here is a summary of its functionality:
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
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
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.
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.
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.
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.
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.
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.
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.
1. Introduction
2. Prerequisites
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.
- 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.
- 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.
- 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
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