SAVITRIBAI PHULE PUNE UNIVERSITY
A MINI PROJECT REPORT ON
“De-Centralized application for Voting System”
Submitted by
CLASS: BE DIV: A
Name : Tushar R Kamble Roll no : 54
Name : Roll no :
Name : Roll no :
Under the Guidance of
Prof. Swati Jakkan
DEPARTMENT OF COMPUTER ENGINEERING
RMD SINHGAD SCHOOL OF ENGINEERING
WARJE, PUNE 411058
Academic Year 2022 – 23(SEM-I)
DEPARTMENT OF COMPUTER ENGINEERING
RMD SINHGAD SCHOOL OF ENGINEERING
WARJE, PUNE 411058
CERTIFICATE
This is to certify that the project report entitles
“De-Centralized application for Voting System”
Submitted by
Name: Tushar Rajendra Kamble PRN No : 72035895H
is a bonafide work carried out by them under the supervision of Ms. Swati Jakkan. And it is
submitted towards the partial fulfillment of the requirement of University of Pune for Final Year.
(Prof. Swati Jakkan) (Mrs. Vina M. Lomte)
Guide Head,
Department of Computer Engineering Department of Computer Engineering
(Dr. V. V. Dixit)
Principal,
RMD Sinhgad School of Engineering Pune – 58
Certificate by Guide
This is to certify that MR Tushar R Kamble Has completed the MINI Project work under my
guidance and supervision and that, I have verified the work for its originality in
documentation, problem statement, implementation and results presented in the Project. Any
reproduction of other necessary work is with the prior permission and has given due
ownership and included in the references.
Place: Pune
Date:
Signature of Guide
(Mrs. Swati
Jakkan)
Project Title: De-Centralized application for Voting System
Aim: To analyze the factors affecting the current voting system and building an e-
application using new technologies like blockchain.
Theory :
Blockchain is a technology that is rapidly gaining momentum in era of industry 4.0. With
high security and transparency provisions, it is being widely used in supply chain
management systems, healthcare, payments, business, IoT, voting systems, etc.
Why do we need it?
Current voting systems like ballot box voting or electronic voting suffer from various
security threats such as DDoS attacks, polling booth capturing, vote alteration and
manipulation, malware attacks, etc, and also require huge amounts of paperwork, human
resources, and time. This creates a sense of distrust among existing systems.
Some of the disadvantages are:
Long Queues during elections.
Security Breaches like data leaks, vote tampering.
Lot of paperwork involved, hence less eco-friendly and time-consuming.
Difficult for differently-abled voters to reach polling booth.
Cost of expenditure on elections is high.
Solution:
Using blockchain, voting process can be made more secure, transparent, immutable, and
reliable. How? Let’s take an example.
Suppose you are an eligible voter who goes to polling booth and cast vote using EVM
(Electronic Voting Machine). But since it’s a circuitry after all and if someone tampers
with microchip, you may never know that did your vote reach to person for whom you
voted or was diverted into another candidate’s account?
Since there’s no tracing back of your vote. But, if you use blockchain- it stores
everything as a transaction that will be explained soon below; and hence gives you a
receipt of your vote (in a form of a transaction ID) and you can use it to ensure that your
vote has been counted securely.
Now suppose a digital voting system (website/app) has been launched to digitize process
and all confidential data is stored on a single admin server/machine, if someone tries to
hack it or snoop over it, he/she can change candidate’s vote count- from 2 to 22! You
may never know that hacker installs malware or performs clickjacking attacks to steal or
negate your vote or simply attacks central server.
To avoid this, if system is integrated with blockchain- a special property called
immutability protects system. Consider SQL, PHP, or any other traditional database
systems. You can insert, update, or delete votes. But in a blockchain you can just insert
data but cannot update or delete. Hence when you insert something, it stays there forever
and no one can manipulate it- Thus name immutable ledger.
But Building a blockchain system is not enough. It should be decentralized i.e if one
server goes down or something happens on a particular node, other nodes can function
normally and do not have to wait for victim node’s recovery.
So a gist of advantages are listed below:
You can vote anytime/anywhere (During Pandemics like COVID-19 where it’s
impossible to hold elections physically
Secure
Immutable
Faster
Transparent
According to above diagram, voter needs to enter his/her credentials in order to
vote. All data is then encrypted and stored as a transaction. This transaction is then
broadcasted to every node in network, which in turn is then verified. If network
approves transaction, it is stored in a block and added to chain. Note that once a
block is added into chain, it stays there forever and can’t be updated. Users can
now see results and also trace back transaction if they want.
Since current voting systems don’t suffice to security needs of modern generation,
there is a need to build a system that leverages security, convenience, and trust
involved in voting process. Hence voting systems make use of Blockchain
technology to add an extra layer of security and encourage people to vote from any
time, anywhere without any hassle and makes voting process more cost-effective
and time-saving.
De-Centralized Voting Application (D-app) :
The Project Name is Decentralized Voting Application (DApps) which is built on
Solidity Language. This Project showcases a lot of Solidity’s features. It
implements a voting contract. Of course, the main problem of electronic voting is
how to prevent to assign the duplicate Vote.
Some Important Concepts are:
1. Contract:
A contract is just like a class in Solidity which consists (its functions) and data
(its state) that resides at a specific address on the Ethereum Blockchain. In each
Contract, we can define State Variables, Methods, and Events, etc. A smart
contract runs exactly as programmed without any possibility of downtime,
censorship, fraud, and third-party interference.
2. Structure:
The Structure is Collection of different type of Data Types same like C and C++,
which is shown in the following example:
struct Voter{
bool authorized;
bool voted;
}
3. Mapping:
Mapping is just like Hash tables It stores the value based on key. They cannot be
used as parameters or return parameters of contract functions that are publicly
visible. You cannot iterate over mappings, i.e. you cannot enumerate their keys. It
possible to implement a data structure on top of them and iterate over that.
mapping(address=>Voter) info;
4. Modifier: Modifiers are used to easily change the behavior of a function. They
can automatically check conditions before executing the functions.
modifier ownerOn() {
require([Link]==owner);
_;
}
function temaAF(address _address) public {
require(!info[_address].voted, "already voted person");
//If already not vote
require(info[_address].authorized, "You Have No Right
for Vote");
info[_address].voted = true;
teamA++;
totalVotes++;
}
Implementation in Solidity :
// Solidity program to demonstrate
// DApps
pragma solidity 0.5.11;
// Smart Contract for the Voting application
contract VotingForTopper {
// Refer to the owner
address owner;
// Declaring the public variable 'purpose'
// to demonstrate the purpose of voting
string public purpose;
// Defining a structure with boolean
// variables authorized and voted
struct Voter{
bool authorized;
bool voted;
}
// Declaring the unsigned integer
// variables totalVotes, and for the
//3 teams- A,B, and C
uint totalVotes;
uint teamA;
uint teamB;
uint teamC;
// Creating a mapping for the total Votes
mapping(address=>Voter) info;
// Defining a constructor indicating
// the purpose of voting
constructor(
string memory _name) public{
purpose = _name;
owner = [Link];
}
// Defining a modifier to
// verify the ownership
modifier ownerOn() {
require([Link]==owner);
_;
}
// Defining a function to verify
// the person is voted or not
function authorize(
address _person) ownerOn public {
info[_person].authorized= true;
// Defining a function to check and
// skip the code if the person is already
// voted else allow to vote and
// calculate totalvotes for team A
function temaAF(address _address) public {
require(
!info[_address].voted,
"already voted person");
require(
info[_address].authorized,
"You Have No Right for Vote");
info[_address].voted = true;
teamA++;
totalVotes++;
}
// Defining a function to check
// and skip the code if the person
// is already voted else allow to vote
// and calculate totalvotes for team B
function temaBF(address _address) public {
require(
!info[_address].voted,
"already voted person");
require(
info[_address].authorized,
"You Have No Right for Vote");
teamB++;
info[_address].voted = true;
totalVotes++;
}
// Defining a function to check
// and skip the code if the person
// is already voted else allow to vote
// and calculate totalvotes for team C
function temaCF(address _address) public returns(
string memory){
require(
!info[_address].voted,
"already voted person");
require(
info[_address].authorized,
"You Have No Right for Vote");
info[_address].voted = true;
teamC++;
totalVotes++;
return("Thanks for Voting");
}
function totalVotesF() public view returns(uint){
return totalVotes;
}
// Defining a function to announce
// the result of voting and
// the name of the winning team
function resultOfVoting() public view returns(
string memory){
if(teamA>teamB){
if(teamA>teamC){
return"A is Winning";
}
else if(teamC>teamA){
return "C is Winning"; } }
else if(teamB>teamC) {
return "B is Winning";
}
else if(
teamA==teamB && teamA==teamC || teamB==teamC ){
return "No One is Winning";
}
}
}
Conclusion :
In this way we have successfully implemented d-app in Solidity and developed a
new de-centralized using application using techniques of blockchain.