You are on page 1of 44

PROJECT ON

DECENTRALIZED
VOTING APP

1|Page
DECENTALIZED VOTING APP

A PROJECT REPORT

Submitted by
Abhishek (22BCS15126)
Sehajdeep Singh (22BCS15520)
Harsh Gautam (22BC14231)
Dhruv Sharma (22BCS13922)
Udit Sharma(22BCS12728)

in partial fulfillment for the award of the degree of

BACHELOR OF ENGINEERING
IN
COMPUTER SCIENCE AND ENGINEERING

Chandigarh University

MAY 2023

2|Page
BONAFIDE CERTIFICATE

Certified that this project report “DECENTRALIZED VOTING APP” is the


bonafide work of “Harsh Gautam , Abhishek , Sehaj deep , Dhruv Sharma , Udit
Sharma” who carried out the project work under my/our supervision.

SIGNATURE SIGNATURE

Dr. Urvashi Garg. Dr. Urvashi Garg


SUPERVISOR
HEAD OF THE DEPARTMENT
Head of department (AU-5)

Computer Science Engineering. Computer Science Engineering.

Submitted for the project viva-voce examination held on 22/05/2023

INTERNAL EXAMINER EXTERNAL EXAMINER

3|Page
TABLE OF CONTENTS

List of Figures .........................................................................................................6


List of Tables ..........................................................................................................7

List of Standards .....................................................................................................8

CHAPTER 1. INTRODUCTION ...................................................................... 10


Identification of Client/ Need/ Relevant Contemporary issue .............................11

Identification of Problem ......................................................................................11


Identification of Tasks ..........................................................................................11

Timeline ................................................................................................................13

Organization of the Report ...................................................................................13

CHAPTER 2. LITERATURE REVIEW/BACKGROUND STUDY ............. 15


Review of the Literature………………………………………………………...15

Existing solutions .................................................................................................16


Bibliometric analysis ............................................................................................16
Goals/Objectives ...................................................................................................17

CHAPTER 3. DESIGN FLOW/PROCESS ...................................................... 18


Evaluation & Selection of Specifications/Features ..............................................18
Design Constraints ................................................................................................19
Analysis of Features and finalization subject to constraints ................................20

Design Flow ..........................................................................................................22


Design selection ....................................................................................................23

Implementation plan/methodology.......................................................................24

4|Page
CHAPTER 4. RESULTS ANALYSIS AND VALIDATION ..........................30
Analysis and validation .......................................................................................30

CHAPTER 5. CONCLUSION AND FUTURE WORK .................................. 32


Conclusion ............................................................................................................32
Future work...........................................................................................................32

REFERENCES .......................................................................................................33
APPENDIX ............................................................................................................. 35
1. Plagiarism Report ...........................................................................................35

2. Design Checklist .............................................................................................35

USER MANUAL .................................................................................................... 36

5|Page
List of Figures

Figure 1:- Timeline along with the different phases of work distribution

6|Page
List of Tables

Table no. Title Page no


1 Work Distribution 12

2 Review of the literature 15


Authors

7|Page
List of Standards (Mandatory For Engineering Programs)

Publishi
Standar ng About the standard Page
d no
Agency
IEEE 802.11 is part of the
IEEE 802 set of local area
network (LAN) technical
standards and specifies the
IEEE Mention page no where
IEEE
set of media access control
802.1 standard is used
(MAC) and physical layer
1
(PHY) protocols
for
implementing wireless local
area network (WLAN)
computer
communication.

8|Page
ABSTRACT

This project proposes a Block chain-based voting system using the Ethereum
platform and the Solidity programming language. The proposed system provides a
secure and transparent way of conducting voting procedures, ensuring the accuracy
and integrity of the results. The system allows anyone to propose themselves as a
candidate, and voters can cast their votes for their preferred candidate. The system
uses two mappings to store candidate information and voting data, respectively. The
candidate information mapping stores the candidate's name and a hash of their
personal data, while the voting data mapping stores the candidate's name and the
number of votes they received. The system also maintains two lists: a list of
candidates and a list of voters. To ensure that each voter can only vote once, the
system uses a modifier that checks if a voter has already cast their vote before
allowing them to vote.

ABBREVIATIONS
General terms and abbreviations
API Application Programming Interface Back-end Server-side, refers to things the
user can’t see e.g. databases and servers.

Smart contract Protocol for digitally verifying negotiations of a contract.

Hash function Algorithm that converts data in a one way manner.

DAPP Decentralized Applications, e.g. the suggested prototype. Decentralized


system A system with no central authority.

9|Page
CHAPTER
CHAPTER -1
INTRODUCTION

1.1:-Identification of Client /Need / Relevant Contemporary issue


This voting system smart contract is written in Solidity. The contract serves a
number of purposes, such as:

By giving their name, age, and an ID string, anyone can use representate to
represent oneself as a candidate. The candidate's name is added to the candidates
array along with the candidate's data hash, which is stored by this function.

A list of all the candidates is returned by the function getCandidates.

votes: enables a voter to cast their ballot for a candidate by supplying their name.
The function increases the number of votes for the candidate.

onlyOnce: a qualifier that determines whether a voter has already cast a ballot and
forbids them from doing so again.

getCandidateVotes: provides the total votes cast for a certain candidate.

getVoteResult: produces a string containing the names of the candidates and the
number of votes they received for each.

uint2str the aiding function that changes a string from an unsigned integer.
winner: displays "There was a Draw" in the event of a tie or the name of the
candidate who received the most votes.

The candidate's data hash and accompanying vote total are stored in the contract
using mappings. In order to prevent repeated voting, the list of candidates and the
hashes of the voter list are also stored in arrays. The owner of the contract is
additionally saved as an address variable.

1.2:- Identification of Problem

While decentralized voting apps have the potential to revolutionize the


10 | P a g e
voting process by providing a more secure, transparent, and democratic
CHAPTER
system, there are several problems that need to be addressed in the
development of such apps.

Adoption: One of the main problems with decentralized voting apps is


the adoption rate. Many people are still unfamiliar with blockchain
technology and may be hesitant to use a decentralized voting app. This
may be especially true for older generations who may be less
comfortable with technology.

Security: While blockchain technology offers a high degree of security,


it is not immune to attack. Hackers may attempt to manipulate the voting
process by gaining access to the network or by disrupting the voting
process. Therefore, a robust security system needs to be developed to
ensure the integrity of the voting process.

Verification: A decentralized voting app needs to ensure that each vote


is authentic and has not been tampered with. The app must have a
verification process in place to ensure that the voter is eligible to vote
and has only cast one vote.

Scalability: Decentralized voting apps need to be scalable to accommodate a large


number of users. This requires a robust infrastructure and network that can handle
the demand during peak periods.

Legal and regulatory frameworks: Decentralized voting apps need to


operate within legal and regulatory frameworks. This includes
compliance with data protection laws, electoral laws, and other relevant
regulations. Therefore, a thorough legal and regulatory analysis needs to
be conducted before the app is launched to ensure compliance.

1.3:-Identification of Tasks

The Decentralized Voting App project involves several tasks that are required to
identify, build, and test the solution. These tasks can be broadly categorized into the
following:

Identification Tasks:
The identification tasks involve defining the project scope, identifying the
stakeholders, and gathering the requirements. This includes identifying the client's
needs, understanding the contemporary issues related to the project, and defining the
11 | P a g e
problem statement. The identification
CHAPTERtasks also involve analyzing the legal and
regulatory frameworks and conducting a feasibility study to determine the project's
viability.

Building Tasks:
The building tasks involve the actual development of the Decentralized Voting App.
This includes designing the architecture and user interface, developing the smart
contracts, and building the blockchain infrastructure. The building tasks also involve
integrating the different components of the app and testing the system's functionality.

Testing Tasks:
The testing tasks involve verifying the system's performance and ensuring that it
meets the requirements. This includes conducting unit testing, system testing, and
integration testing to ensure that the app is secure, reliable, and scalable. The testing
tasks also involve conducting user acceptance testing to ensure that the app meets the
user's needs and is user-friendly.

It is important to note that these tasks are interdependent, and the success of the
project depends on their successful execution. Effective project management and
communication among team members are essential to ensure that these tasks are
completed on time and within budget.

TEAM ROLES:
MEMBER NAME ASSIGNED WORK
Abhishek  Idea generation
 Coding and Testing
 Design process
Sehajdeep  Code implementation
 Project report
 Research paper
Harsh Gautam  Research paper
 Literature Survey
 Ppt
Dhruv Sharma  literature review
 ppt
Udit Sharma  literature review
 idea generation
 Code testing
Table 01:- Work Distribution

12 | P a g e
1.4:-Timeline CHAPTER

Figure 1:Timeline along with the different phases of work distribution

1.5: Organization of the Report


The chapters of the Decentralized Voting App project will depend on the project's
specific requirements and scope. However, some common elements that could be
expected in each chapter are:

Introduction: This chapter would provide an overview of the Decentralized Voting


App project, including the problem statement, the client's needs, and the project
scope. It would also describe the expected outcomes and benefits of the project.

Literature Review: This chapter would review the relevant literature related to
decentralized voting apps, blockchain technology, and smart contracts. It would
provide a theoretical background for the project and highlight the existing research
gaps.

Methodology:
hodology: This chapter would describe the project methodology, including the
research design, data collection methods, and analysis procedures. It would provide a
roadmap for the project's execution, outlining the specific tasks, timelines, and
milestones.

System Design: This chapter would describe the system architecture and design,
including the user interface, smart contracts, and blockchain infrastructure. It would
also describe the security and verification mechanisms built into the system.
13 | P a g e
CHAPTER
Implementation: This chapter would describe the implementation of the
Decentralized Voting App, including the programming languages and tools used,
and the system integration process. It would also describe the testing process and the
results obtained.

Results and Discussion: This chapter would present and discuss the results obtained
from the testing of the Decentralized Voting App. It would compare the results with
the project's objectives and assess the app's performance, reliability, and security.

Conclusion: This chapter would summarize the key findings of the project, highlight
the contributions, and provide recommendations for future research. It would also
discuss the implications of the project for decentralized voting apps and blockchain
technology.

14 | P a g e
CHAPTER
CHAPTER -2
LITERATURE REVIEW/BACKGROUND STUDY

2.1 Review of the literature:

S .no Author(s) Findings


1. Ryan, P. Y. A., Schneider, P. They proposed e voting to address the issue of a
Y. A., and Chaum single point of failure in the voting process, an e-
voting system has been suggested wherein the
administrator is granted complete authority.
2. A. Kiayias and M. Yung M.Yung and Kiavas presented a decentralized block
chain-based electronic voting system that boasts a
distributed architecture, resulting in excellent
availability. The system utilizes double envelope
encryption for electronic voting. However, it should
be noted that this research lacks both user anonymity
and work proof.
3. Nakamoto, S Nakamoto proposed e-voting system based on a
hybrid cryptosystem has been suggested. One
significant advantage of this system is the use of
SMS for vote verification, providing an additional
layer of security for the voting process.

4. Kadam, Jha, and Jaiswal They proposed secure e-voting system based on
block chain has been conceptualized, which
addresses both technical and legal issues. However,
the proposed system has several limitations, such as
the assumption that all voters will utilize a secured
service, despite the existence of security
vulnerabilities. Nonetheless, the system offers the
advantage of utilizing a decentralized approach that
allows for voting via internet connectivity
Table 02: Review of the literature authors

15 | P a g e
CHAPTER
2.2 Existing Solutions

There are a number of existing solutions for decentralized voting apps using
blockchain. Some of the most notable include:

 Athena: Athena is a decentralized voting app that uses the Ethereum blockchain to
ensure security and transparency. It allows users to vote on a variety of topics,
including elections, referendums, and polls.
 Electo: Electo is another decentralized voting app that uses the Ethereum blockchain.
It is designed to be used for elections and referendums.
 Votingchain: Votingchain is a decentralized voting app that uses the Hyperledger
Fabric blockchain. It is designed to be used for elections and referendums.
 Votem: Votem is a decentralized voting app that uses the EOS blockchain. It is
designed to be used for elections and referendums.

These are just a few of the many existing solutions for decentralized voting apps
using blockchain. As the technology continues to develop, we can expect to see even
more innovative and secure solutions emerge.

2.3:Bibliometric analysis

Key Features

The key features of decentralized voting apps using blockchain include:

 Security: Blockchain is a secure and tamper-proof technology. This makes it ideal


for voting, as it can help to prevent fraud and ensure that votes are counted
accurately.
 Transparency: Blockchain is a transparent technology. This means that all votes
are visible to everyone on the network. This can help to build trust and confidence
in the voting process.
 Cost-effectiveness: Blockchain can be a cost-effective way to vote. This is because
it can help to reduce the need for expensive voting machines and infrastructure.
 Accessibility: Blockchain can be an accessible way to vote. This is because it can
be used on any device with an internet connection. This can help to make voting
more accessible to people who may not have access to traditional voting methods.
16 | P a g e
Effectiveness CHAPTER
Blockchain-based voting systems have the potential to be more effective than
traditional voting systems in a number of ways. First, blockchain-based systems are
more secure. This is because blockchain is a tamper-proof technology. Second,
blockchain-based systems are more transparent. This is because all votes are visible
to everyone on the network. Third, blockchain-based systems are more cost-
effective. This is because they can help to reduce the need for expensive voting
machines and infrastructure. Fourth, blockchain-based systems are more accessible.
This is because they can be used on any device with an internet connection.

Drawbacks

Despite the potential benefits of blockchain-based voting systems, there are also
some drawbacks that need to be considered. First, blockchain-based systems are still
under development. This means that there is a risk of security vulnerabilities.
Second, blockchain-based systems can be complex to implement and use. This could
be a barrier to adoption for some organizations. Third, blockchain-based systems
may not be suitable for all types of elections. For example, they may not be suitable
for elections where there is a need for secrecy.

Overall, blockchain-based voting systems have the potential to be more effective


than traditional voting systems. However, there are also some drawbacks that need to
be considered. As the technology continues to develop, we can expect to see even
more innovative and secure blockchain-based voting systems emerge.

2.4 Goals/Objectives

 To create a secure and tamper-proof voting system.


 To ensure that all votes are counted accurately.
 To make the voting process more transparent.
 To reduce the costs of voting.
 To make voting more accessible to everyone.
 To improve voter participation.

17 | P a g e
CHAPTER
CHAPTER-3
DESIGN FLOW/PROCESS

3.1:Evaluation & Selection of Specifications/Features for the Voting System:

Requirements and Specifications Evaluation:


Purpose: The voting system aims to facilitate elections or polls where individuals can
cast their votes for candidates.
Target Audience: The system is designed for registered voters or members of a
specific organization.
Legal/Regulatory Requirements: The system should adhere to principles of
transparency, security, and privacy to comply with relevant laws and regulations.
Desired Features and Functionalities:

Candidate Representation:

Feature: Allow individuals to propose themselves as candidates for the voting


process.
Specification: Store candidate information, including their name, age, and a unique
identifier.
Specification: Ensure the privacy and integrity of candidate data to maintain fairness
and prevent tampering.
Voting Process:

Feature: Enable voters to cast their votes for a specific candidate.


Specification: Implement measures to ensure that each voter can only vote once,
preventing duplicate votes.
Specification: Maintain the anonymity and privacy of voters' identities to uphold the
integrity of the process.
Specification: Implement security measures to prevent unauthorized access or
tampering with the voting process.
Result Calculation:

Feature: Count and track the votes received by each candidate.


Specification: Determine the winner based on the highest number of votes obtained
by a candidate.
Specification: Handle tie scenarios appropriately, such as declaring a draw or
implementing tiebreaker rules to ensure a fair outcome.
Key Objectives:

Candidate Representation:
18 | P a g e
CHAPTER
Objective: Provide a mechanism for individuals to express their interest in becoming
candidates, facilitating inclusivity and democratic participation.
Objective: Store candidate information securely and associate it with a unique
identifier to maintain data integrity and prevent impersonation.
Voting Process:

Objective: Ensure that the voting process is fair, transparent, and tamper-proof,
instilling confidence in the integrity of the system.
Objective: Implement measures to prevent double voting and unauthorized access,
safeguarding the fairness and accuracy of the results.
Result Calculation:

Objective: Determine the outcome of the voting process accurately and efficiently,
enabling timely declaration of the winner.
Objective: Handle tie scenarios appropriately, providing a clear and decisive result
without ambiguity.
By evaluating the requirements, determining the desired features, and defining key
objectives, we establish the necessary foundation for designing and implementing a
robust and effective voting system. These specifications and features will guide the
subsequent stages of system design and development, ensuring that the system meets
the identified requirements and objectives.

3.2:Design Constraints:

Security Constraints:

The system must ensure the confidentiality of voter identities and votes to maintain
the privacy and integrity of the voting process.
Robust security measures should be implemented to prevent unauthorized access,
tampering, or manipulation of candidate data and voting results.
Protection against denial of service (DoS) attacks or any attempts to disrupt the
system's availability and functionality.
Scalability Constraints:

The system should be designed to handle a large number of candidates and voters
efficiently without compromising performance.
Scalable storage and processing capabilities must be considered to accommodate
increasing data volumes as the number of participants grows.
Usability Constraints:

19 | P a g e
CHAPTER
The user interface should be intuitive, user-friendly, and accessible to voters with
varying levels of technical expertise.
Clear instructions and feedback should be provided to guide voters through the
process and ensure a seamless voting experience.
Legal and Regulatory Constraints:

The system must comply with relevant laws and regulations governing elections,
privacy, data protection, and security.
Adherence to transparency requirements, auditability, and the ability to provide an
audit trail for verification purposes.
Compatibility Constraints:

The system should be compatible with multiple platforms and devices, allowing
voters to access and participate in the voting process using various devices (e.g.,
desktop, mobile).
Consideration of interoperability with existing systems or frameworks for voter
registration, authentication, or result dissemination if applicable.
Reliability Constraints:

The system should be highly reliable, minimizing the possibility of errors, failures, or
disruptions during the voting process.
Robust error handling, fault tolerance mechanisms, and backup procedures to ensure
the availability and integrity of the system.
Ethical Constraints:

Ensuring fairness and neutrality in the system's design and implementation, avoiding
any biases or favoritism towards specific candidates or voter groups.
Protection of voter anonymity and prevention of any attempts to trace votes back to
individuals to maintain confidentiality.
These design constraints guide the development process, ensuring that the voting
system is designed and implemented with consideration for important factors such as
security, scalability, usability, compliance, compatibility, reliability, and ethical
considerations.

3.3.Analysis of Features and Finalization subject to Constraints:


After evaluating the design constraints for the voting system, the following features
and functionalities have been analyzed and finalized:

Candidate Representation:

20 | P a g e
The system allows anyone to be CHAPTER
proposed as a candidate by calling the representate
function and providing candidate details such as name, age, and candidate ID.
Candidate representation is stored in the candidateId mapping, associating the
candidate's name with their personal data hash.
Voting Process:

The system provides a vote function for voters to cast their votes for a specific
candidate.
The onlyOnce modifier ensures that each voter can only vote once by checking their
hash against the votants array.
When a vote is cast, the corresponding candidate's vote count is incremented in the
candidateVotes mapping.
Result Calculation:

The system allows retrieving the total votes for each candidate through the
getCandidateVotes function.
The getVoteResult function returns a formatted string representing the candidates
and their vote counts.
The winner function determines the candidate with the highest vote count and returns
their name as the winner.
In case of a tie, the system indicates that there was a draw.
Considering the design constraints previously identified, the finalized features align
with the requirements and ensure compliance with the constraints:

Security Constraints: The system ensures the privacy of voter information by using
hashed values and prohibits multiple voting through the onlyOnce modifier.
Scalability Constraints: The system can accommodate a growing number of
candidates and voters by using dynamic arrays and efficient data structures.
Usability Constraints: The functions are designed to be user-friendly, allowing easy
representation of candidates, casting of votes, and retrieving voting results.
Legal and Regulatory Constraints: The system follows the laws and regulations by
maintaining privacy, integrity, and transparency in the voting process.
Compatibility Constraints: The system is platform-agnostic and accessible from
various devices, providing compatibility with different user environments.
Reliability Constraints: The system incorporates error handling, ensures data
integrity, and protects against disruptions to ensure a reliable voting process.
Ethical Constraints: The system maintains voter anonymity and treats all candidates
impartially, adhering to ethical standards of fairness and neutrality.
By analyzing the features and ensuring their alignment with the identified
constraints, the design of the voting system addresses key requirements while
adhering to the necessary limitations and considerations.

21 | P a g e
CHAPTER

3.4. Design Flow:


Requirements Gathering: Understand the requirements for the voting system,
including candidate representation, voting process, and result calculation.

Evaluation & Selection of Specifications/Features:

Evaluate the requirements and specifications of the voting system.


Determine the desired features and functionalities based on the requirements.
Identify key objectives such as candidate representation, voting process, and result
calculation.
Design Constraints:

Identify design constraints such as security, scalability, usability, legal and regulatory
compliance, compatibility, reliability, and ethical considerations.
Analysis of Features and Finalization subject to Constraints:

Analyze the features and functionalities of the voting system.


Ensure that the selected features align with the identified design constraints.
Finalize the features, taking into account the constraints and requirements.
Design Selection:

Choose the appropriate design approach for implementing the voting system.
Select the programming language and frameworks suitable for the project, such as
Solidity for smart contract development.
Implementation Plan/Methodology:

Determine the implementation plan and methodology for developing the voting
system.
Define the steps involved in coding, testing, and deploying the smart contract.
Consider factors such as modular development, code review, and version control.
Code Implementation:

Implement the smart contract code based on the finalized features and design
decisions.
Write the necessary functions for candidate representation, voting, result calculation,
and winner determination.
Ensure proper data structures, modifiers, and error handling mechanisms are in place.
Testing and Quality Assurance:

22 | P a g e
CHAPTER
Conduct thorough testing to verify the correctness and reliability of the implemented
code.
Perform unit testing, integration testing, and system testing to identify and fix any
issues.
Ensure the system meets the defined requirements and functions as expected.
Deployment:

Deploy the smart contract on the appropriate blockchain network, such as Ethereum.
Consider factors such as gas costs, network congestion, and security considerations
during deployment.
Maintenance and Updates:

Regularly monitor and maintain the deployed voting system to ensure its continued
functionality and security.
Address any issues or vulnerabilities that may arise.
Incorporate updates and improvements based on user feedback and evolving
requirements.
By following this design flow, the voting system can be effectively developed, taking
into account the requirements, design constraints, and best practices for
implementation and deployment.

3.5. Design Selection:

Based on the requirements and constraints of the voting system, the following design
selections are made:

Programming Language: Solidity

Solidity is a popular programming language specifically designed for writing smart


contracts on the Ethereum blockchain.
It provides the necessary features and syntax for implementing the voting system as a
smart contract.
Solidity is widely supported by Ethereum development tools and frameworks.
Smart Contract Architecture: Single Contract

The chosen design approach involves implementing the entire voting system logic
within a single smart contract.
This simplifies the system's structure and reduces complexity, making it easier to
understand and maintain.
Data Structures:

23 | P a g e
CHAPTER
Mapping: To relate a candidate's name with their personal data hash and votes count,
mappings are used.
Array: Two arrays, candidates and votants, are used to store the list of candidates and
the hashes of the voters respectively.
Modifiers:

onlyOnce: This modifier is used to ensure that a voter can only vote once by
checking their hash against the existing votants' hashes.
It prevents duplicate voting and maintains the integrity of the voting process.
Functions:

representate(): This function allows anyone to be proposed as a candidate by


providing their name, age, and candidate ID.
getCandidates(): This function retrieves the list of candidates.
vote(): This function allows voters to cast their vote for a specific candidate.
getCandidateVotes(): This function retrieves the number of votes received by a
particular candidate.
getVoteResult(): This function generates a string representing the vote results,
including each candidate's name and vote count.
uint2str(): This internal function is used to convert an unsigned integer to a string for
displaying vote counts.
winner(): This function determines the winner of the voting process based on the
candidate with the highest number of votes.
Security Considerations:

The usage of keccak256 function for hashing candidate data and voter addresses
helps protect the privacy and integrity of the system.
The onlyOnce modifier prevents duplicate voting, ensuring the fairness and accuracy
of the voting process.
By selecting Solidity as the programming language, implementing a single contract
design, utilizing appropriate data structures and modifiers, and considering security
measures, the design choices align with the requirements and constraints of the
voting system.

3.6. Implementation Plan/Methodology:

Solidity Environment Setup:


Install the required development tools, such as Solidity compiler and Ethereum
client.
Set up a local development environment or choose a suitable Ethereum development

24 | P a g e
platform. CHAPTER
Smart Contract Development:
Create a new Solidity file and define the VotingContract contract.
Implement the constructor function to set the contract owner.
Define the necessary mappings, arrays, and variables for candidate information and
vote counts.
Implement the representate function to allow candidate representation.
Implement the getCandidates function to retrieve the list of candidates.
Implement the vote function with the onlyOnce modifier to handle the voting
process.
Implement the getCandidateVotes function to retrieve the vote count for a specific
candidate.
Implement the getVoteResult function to generate the overall vote results.
Implement the helper functions uint2str and winner to support result calculations.
Testing and Debugging:

Write test cases to cover different scenarios of candidate representation and voting.
Deploy the smart contract to a local or test Ethereum network.
Interact with the contract using test accounts and simulate the voting process.
Debug and fix any issues or errors that arise during testing.
Security Auditing:

Perform a security audit of the smart contract code to identify potential


vulnerabilities.
Address any security concerns by implementing necessary measures, such as input
validation and secure hashing.
Deployment and Integration:

Choose an appropriate Ethereum network for deployment, such as the mainnet or a


testnet.
Deploy the smart contract to the selected network, ensuring proper configuration and
gas fee estimation.
Integrate the deployed smart contract with frontend applications or user interfaces for
easy interaction.
Documentation and Maintenance:
Create comprehensive documentation that covers the contract's functionality, usage
instructions, and any external dependencies.
Provide clear guidelines on how to use the voting system, including candidate
representation, voting, and result retrieval.
Regularly maintain and update the smart contract as needed, addressing any potential
scalability or security improvements.

25 | P a g e
By following this implementation plan and methodology, the voting system can be
CHAPTER
effectively developed, tested, and deployed, ensuring its

Methodology:
The VotingContract
otingContract is a smart contract that implements a voting system. This system
allows anyone to propose themselves as a candidate, and anyone else to vote for one
of the candidates.
The first thing that happens is the definition of the owner of the contract.
contrac This is done
by defining the variable "owner" as a public address, which can be accessed by
anyone.
After that, there are two mappings. The first one is "candidateId", which relates each
candidate's name to a unique hash value that represents their personal pers data. The
second one is "candidateVotes", which relates each candidate's name to the number
of votes they have received.
There are also two arrays defined. The first one is "candidates", which stores the list
of all the candidates proposed so far. The second one is "votants", which stores the
hash of each voter to make sure they don't vote more than once.
The constructor function is defined to set the owner of the contract to the address of
the contract deployer.
This line specifies the version of Solidity that the contract is written in. It ensures that
the contract is compiled using a compatible version of the Solidity compiler.

This is a comment that indicates the license under which the code is released. In this
case, it is UNLICENSED, whic
whichh means there is no specific license associated with
the code.

This line begins the declaration of the smart contract named "VotingContract".

26 | P a g e
CHAPTER

This line starts the definition of the VotingContract contract

This line declares a public state vari


variable
able named "owner" of type "address". It will
store the address of the contract owner, i.e., the account that deploys the contract.

This line declares a mapping named "candidateId". It associates each candidate's


name (a string) with their personal datdataa hash (a bytes32 value). The mapping allows
for efficient storage and retrieval of the data.

This line declares another mapping named "candidateVotes". It associates each


candidate's name (a string) with the number of votes they have received (a uint
value). The mapping allows for tracking and updating the vote count for each
candidate.

This line declares a dynamic array named "candidates" that will store the names of
all the candidates. The array can grow or shrink dynamically as candidates are added
or removed.

This line declares another dynamic array named "votants" that will store the hashes
27 | P a g e
of all the voters. The use of hashes helps protect the privacy of the voters while still
CHAPTER
allowing for validation and uniqueness checks.

This is the constructor function of the contract. It is executed once during the
contract deployment. Here, it sets the "owner" variable to the address of the account
that deployed the contract. The "msg.sender" is a special variable representing the
caller of the function.

This function allows anyone to propose themselves as a candidate. It takes the


candidate's name, age, and personal ID as input. The inputs are concatenated and
hashed using the keccak256 hashing algorithm to create a unique hash for each
candidate.
te. The hash is then stored in the "candidateId" mapping under the candidate's
name. Additionally, the candidate's name is added to the end of the "candidates"
array.

This function retrieves the list of all candidates by returning the "candidates" array.
arra
The "view" keyword indicates that the function does not modify the contract state
and only reads data.

28 | P a g e
This function allows a voter to cast their vote for a specific candidate. The
CHAPTER
candidate's name is provided as input, and the vote count for that candidate
ca is
incremented by one in the "candidateVotes" mapping.

29 | P a g e
CHAPTER
CHAPTER -4
RESULTS ANALYSIS AND VALIDATION

RESULT ANALYSIS OF DECENTRALIZED VOTING APP/WEBSITE---

Decentralized voting apps/websites using blockchain technology have been gaining


popularity in recent years due to the increased need for secure and transparent voting
systems. The use of blockchain technology offers a tamper-proof and transparent
way of recording and tallying votes. Here is a possible result analysis of a
decentralized voting app/website using blockchain:

Increased Transparency: One of the most significant advantages of using a


blockchain-based voting system is the increased transparency. Every vote cast is
recorded on the blockchain, and this record is immutable and transparent, making it
easy to verify the integrity of the voting process.

Improved Security: The use of blockchain technology provides a secure and tamper-
proof way of recording and tallying votes. This ensures that the voting process is
secure and free from any tampering.

Faster Results: With a blockchain-based voting system, the results can be tallied in
real-time, providing faster and more accurate results than traditional voting methods.

Increased Voter Participation: Decentralized voting apps/websites can increase voter


participation by making it more convenient and accessible for people to vote. Voters
can cast their vote from the comfort of their own homes, using their smartphones or
computers.

Reduced Costs: A decentralized voting system can significantly reduce the costs
associated with traditional voting methods, such as printing ballots, staffing polling
stations, and transporting ballot boxes.

Increased Trust in the Voting Process: The use of blockchain technology provides
increased trust in the voting process, as the system is transparent and tamper-proof.
This can help to increase the public's trust in the democratic process and improve
voter turnout.

In conclusion, decentralized voting apps/websites using blockchain technology offer


a secure, transparent, and tamper-proof way of recording and tallying votes. This can
30 | P a g e
lead to increased transparency, CHAPTER
improved security, faster results, increased voter
participation, reduced costs, and increased trust in the voting process.

VALIDATION OF DECENTRALIZED VOTING APP/WEBSITE BY


BLOCKCHAIN---

Validating a decentralized voting app/website using blockchain involves verifying


the integrity and security of the system to ensure that the votes are accurately
recorded and cannot be tampered with. Here are some steps that could be taken to
validate such a system:

Verify the blockchain network: The first step is to ensure that the blockchain network
being used is reliable and secure. It should have a strong consensus algorithm that
ensures the validity of each transaction and prevents any unauthorized modifications.
Ethereum, for example, is a popular blockchain platform that offers a secure and
reliable network for decentralized applications.

Audit the smart contract: The next step is to audit the smart contract that powers the
voting app/website. A smart contract is a self-executing program that runs on the
blockchain and is responsible for managing the voting process. The smart contract
should be thoroughly tested to ensure that it functions as intended and is free of
vulnerabilities or loopholes that could be exploited.

Conduct penetration testing: To validate the security of the voting app/website,


penetration testing should be conducted to simulate attacks and identify any
weaknesses in the system. This should include testing the app/website's network
security, server security, and application security.

Implement identity verification: To prevent fraudulent voting, an identity verification


system should be implemented. This could involve using a government-issued ID or
other biometric authentication methods to verify the identity of voters.

Ensure voter privacy: Voter privacy should be ensured by implementing


cryptographic techniques such as zero-knowledge proofs or homomorphic
encryption. This will ensure that the identity and vote of each voter remain
anonymous.

Monitor the voting process: Finally, the voting process should be closely monitored
to detect any unusual activity or suspicious behavior. This could involve monitoring
the blockchain network for any unauthorized modifications, as well as monitoring the
app/website's logs for any suspicious activity.

31 | P a g e
CHAPTER
CHAPTER-5
CONCLUSION AND FUTURE WORK

5.1: Conclusion
In conclusion, decentralised voting application using blockchain technology is a
promising solution that has the potential to revolutionize the voting system. By
utilizing blockchain technology, the voting process can be made more secure,
transparent, and efficient. With decentralization, the system becomes less vulnerable
to cyber-attacks and hacking attempts, ensuring the integrity of the voting process.

However, there are still some challenges that need to be addressed, such as ensuring
voter privacy while maintaining transparency and accountability. The adoption of
blockchain-based voting systems also faces resistance from traditional political
establishments, who may be hesitant to embrace such a disruptive technology.

5.2: Future work

In the future, the scope of decentralised voting applications using blockchain


technology is immense. Further research and development can be done to refine the
technology, making it more accessible and user-friendly for all. This can include
improvements in user interface, security, and scalability.

Moreover, blockchain-based voting can be applied to other areas beyond political


elections, such as corporate governance and community decision-making. The
decentralised and transparent nature of blockchain technology can facilitate more
inclusive and democratic decision-making processes, ensuring the participation and
representation of all stakeholders.

In conclusion, the potential of decentralised voting applications using blockchain


technology is enormous, and its future looks promising. With continued research,
development, and adoption, blockchain-based voting can transform the way we
conduct elections and make decisions in various fields.

32 | P a g e
REFERENCES
[1] Ryan, P. Y. A., Schneider, P. Y. A., and Chaum, D. (2005). A realistic voter-verifiable election
mechanism, in ESORICS'05: Proceedings of the 10th European Conference on Research in
Computer Security. 118–139, Berlin and Heidelberg: Springer-Verlag, 2005.

[2] A fair and reliable voting system by broadcast, 5th International Conference on E-voting, 2012,
Dalia, K., Ben, R., Peter Y. A., and Feng, H.

[3] A study by Lee, P. H.-J., Shahandashti, S. F., Randell, B., Kreeger, M. N., Hao, and Clarke was
published in 2014. The focus of the 14th Electronic Voting Technology Workshop/Workshop on
Trustworthy Elections (EVT/WOTE 14) was "Every vote counts: Ensuring integrity in large-scale
electronic voting." San Diego, California: USENIX Association, 2014

[4] Anonymous voting through a two-round public debate, IET Information Security, vol. 4, no. 2,
June 2010, pp. 62–67. Ryan, P. Y. A., Zielinski, and Hao, F. Gobel (2015), Keeler (2015),
Krzesinski (2015), and Taylor (2015).

[5] The Selfish-Mine Strategy in the Presence of Propagation Delay in the Bitcoin
Blockchain, May 2015.Double Spending Prevention in the Bitcoin Network was published in the
International Journal of Computer Engineering and Applications in August 2015 by Kadam, Jha,
and Jaiswal.

[6] Self-tallying Elections with Optimal Voting Privacy, A. Kiayias and M. Yung, 2002 Heidelberg
Berlin Springer, Berlin, 2002, pp. 141–158. Using In March 2015, Springer published Blockchain-
Based Consensus System: Difficulty Control, Peer-to-Peer Networking and Applications.

[7] McCorry, P., S. F. Shahandashti, and F. Hao (2017). In the proceedings of FC 2017, a smart
contract for boardroom voting with the highest level of voter privacy. blockchain apps on an open
platform, Multichain (2017). Last accessed in December 2017 at: www.multichain.com.

[8] 2009 [Online]: Bitcoin: A apeer-to digital monetary system. Nakamoto, S. It is possible to
access Bitcoin at http://bitcoins.info/bitcoin-a-peer-to-peer-electroniccash-system-satoshi-
nakamoto. accessed on December 17.

[9] Rosenfeld. M. (2017). Analysis of hashrate-based double-spending. [Online]. Available:


http://arxiv.org/abs/1402.2009 last accessed: December 2017.

[10] Gobel, J., Keeler, H. P., Krzesinski, A.E. and Taylor, P.G. (2015). Bitcoin Blockchain
Dynamics: the Selfish-Mine Strategy in the Presence of Propagation Delay, May 2015.

[11] Narayanan, A., Bonneau, J., Felten, E., Miller, A. and Gold, S. (2015) Bitcoin and Cryp
tocurrency Technologies, Chapter 2 and 3, Draft October 2015.

[12] Shahandashti, F. S. and Hao, F. (2016) DRE-ip: A Verifiable E-Voting Scheme without
Tallying Authorities, the 21st European Symposium on Research in Computer Security
(ESORICS), 2016.

33 | P a g e
REFERENCES
[13] Sandler, D., Derr, K. and Wallach, D. S. (2008) Votebox: A tamper-evident, verifiable
electronic voting system, in Proceedings of the 17th Conference on Security Symposium, ser.
SS'08. Berkeley, CA, USA: USENIX Association, 2008, pp. 349{364}

[14] Bohli, J. M., Muller-Quade, J. and Rohrich, S. (2007). Bingo voting: Secure and coercion-
free voting using a trusted random number generator, in Proceedings of the 1st International
Conference on E-voting and Identity, ser. VOTE-ID'07. Berlin, Heidelberg: Springer-Verlag, 2007,
pp. 111-124.

[15] Chaum, D., Essex, A., Carback, R., Clark, J., Popoveniuc, S., Sherman, A. and Vora, P.
(2008) Scantegrity: End-to-end voter-veri_able optical- scan voting, IEEE Security Privacy, vol. 6,
no. 3, pp. 40- 46, May 2008.

34 | P a g e
APPENDIX

1. Plagiarism Report

2. Design Checklist

35 | P a g e
USER MANUAL
36
Voting Contract User Manual (Using Remix IDE, Ganache, and Meta Mask)

This user manual provides detailed instructions on how to connect, deploy, and
interact with the VotingContract smart contract using Remix IDE, Ganache, and
MetaMask. The contract enables voting for candidates and determines the winner
based on the votes received. Follow the steps below to get started.

Prerequisites:

Step1: Install Ganache: Download and install Ganache from the official website.
Launch Ganache and ensure it's running and connected to your blockchain network.

Step 2:-Install
Install MetaMask: Make sure you have installed the MetaMask wallet and
added it to your web browser. You can download it from the official
offi MetaMask
website and follow the installation instructions.

36 | P a g e
USER MANUAL
37

Step 3:-Access
Access Remix IDE: Go to the Remix IDE website
(https://remix.ethereum.org) and ensure you have a working Solidity development
environment.

Deploying the Smart Contract

To deploy
oy the VotingContract smart contract using Remix IDE and Ganache, follow
these steps:

1.Open
Open Remix IDE in your web browser.
2.Create
Create a new Solidity file and paste the contents of the Vote.sol code into the file.

37 | P a g e
USER MANUAL
38

3.In
In the Remix IDE, select the appropria
appropriate
te Solidity compiler version for the contract
(e.g., 0.8.0).

4.Click
Click on the "Compile" button to compile the contract.

5.In
In the "Deploy & Run Transactions" panel, select "Injected Provider-Metamask"
Provider as
the environment.

38 | P a g e
USER MANUAL
39

6.In
In MetaMask, make sure you are connected to the Ganache network. If not, click
on the MetaMask extension and select the Ganache network.

39 | P a g e
USER MANUAL
40

7.Click
Click on the "Connect to Localhost" button in the Remix IDE.

40 | P a g e
USER MANUAL

8.Confirm
41
Confirm the connection in MetaMask when prompted.

9. In the "Deploy & Run Transactions" panel, click on the "Deploy" button to deploy
the contract to the Ganache network.

10. Note the address of the deployed contract displayed in the Remix IDE.

41 | P a g e
USER MANUAL
Interacting with the VotingContract
42
To interact
eract with the VotingContract smart contract using Ganache, MetaMask, and
Remix IDE, follow the steps below:

Representing Candidates

To propose yourself as a candidate, follow these steps:

1.Open
Open MetaMask and ensure you are connected to the Ganache network.
2. In the Remix IDE, locate the deployed VotingContract instance and find the
function called "representate".
3. Enter your desired candidate name, age, and candidate ID as parameters for the
"representate" function.
4. Click on the function name to execute the representation transaction.
5. Confirm the transaction in MetaMask by clicking "Confirm".

Casting Votes

To cast a vote for a candidate, follow these steps:

1. Open MetaMask and ensure you are connected to the Ganache network.
2.In the Remix IDE, locate the deployed VotingContract instance and find the
function called "vote".
3.Enter
Enter the candidate name you want to vote for as a parameter for the "vote"
function.

42 | P a g e
USER MANUAL
43
4. Click on the function name to execute the voting transaction.

5. Confirm
firm the transaction in MetaMask by clicking "Confirm".

Retrieving Candidate Votes and the Winner

To retrieve the number of votes received by a specific candidate and determine the
winner, follow these steps:

1. Open MetaMask and ensure you are conne


connected
cted to the Ganache network.

2.In
In the Remix IDE, locate the deployed VotingContract instance and find the
functions for retrieving candidate votes and the winner.

43 | P a g e
USER MANUAL
44

3. Click on the respective functions to trigger their execution

4. The results will be displayed in the Remix IDE's output panel.

44 | P a g e

You might also like