New Report mini
New Report mini
New Report mini
Submitted in partial fulfilment of the requirements for the award of the degree of
BACHELOR OF ENGINEERING
IN
COMPUTER SCIENCE AND ENGINEERING
Submitted by
INIJA A NATARAJ 1KI22CS051
SAPNA 1KI22CS100
TEJASWINI R 1KI22CS112
VIDYA P B 1KI22CS120
NH-206, TIPTUR-572201
AY : 2024 - 2025
KALPATARU INSTITUTE OF TECHNOLOGY
NH-206, TIPTUR-572201
CERTIFICATE
This is to certify that the Mini–Project (BCS586) entitled “DECENTRALIZED VOTING
SYSTEM USING WEB3 AND BLOCKCHAIN” is a bonafide work carried out by
Is Student of Kalpataru Institute of Technology in partial fulfilment for the award of Bachelor of
Engineering in Computer Science & Engineering in Visvesvaraya Technological University,
Belgaum during the year 2023-2024.It is certified that all corrections/suggestions indicated for
Internal Assessment have been incorporated in the report deposited in the departmental library. The
Mini-Project report has been approved as it satisfies the academic requirements in respect of work
prescribed for the said Degree.
Internal Viva
Name of Examiners Signature with date
1.
2.
KALPATARU INSTITUTE OF TECHNOLOGY
NH -206, TIPTUR-572201
DECLARATION
Place: Tiptur
Date:
Signature of Students:
1. INIJA A NATARAJ
2. SAPNA
3. TEJASWINI R
4. VIDYA P B
KALPATARU INSTITUTE OF TECHNOLOGY
Department of Computer Science and Engineering
Tiptur-572201.
ACKNOWLEDGEMENT
The satisfaction and great happiness that accompany the successful completion of any task would
be in complete without mentioning about the people who made it possible. Here we make an
honest attempt to express our deepest gratitude to all those who have been helpful and responsible
for the successful completion of our Mini-Project work.
We would like to thank Dr. Maithri C, Head of Department, Department of Computer Science
and Engineering, Kalpataru Institute of Technology, Tiptur for her continuous support and
encouragement throughout the course of this Mini-Project work.
We are immensely indebted to our internal guide Prof. Guide name with designation,
Department of Computer Science and Engineering, Kalpataru Institute of Technology, Tiptur
for his/her support, technical assistance and constructive suggestions and guidance for successful
completion of our project. We are very much thankful to him/her for the encouragement that has
infused at most real into us to complete the Mini-Project work.
We would like to thank all faculty members of Department of Computer Science and Engineering
,KIT ,Tiptur, our family members, and to our friends who are directly or indirectly responsible
for our success.
Thanking you
INIJA A NATARAJ
SAPNA
TEJASWINI R
VIDYA P B
I
ABSTRACT
II
TABLEOFCONTENTS
ACKNOWLEDGEMENT I
ABSTRACT II
7 CONCLUSION 27
8 FUTURE ENHANCEMENT 28
REFERENCES 34-36
Decentralized Voting Application Using blockchain
CHAPTER 1
INTRODUCTION
1.1 Overview
1.2 Blockchain
Blockchain is a distributed ledger technology that allows data to be securely stored, verified,
and transferred in a decentralized and transparent manner. Unlike traditional centralized
systems where a central authority, such as a bank or government, controls and verifies
transactions, blockchain operates on a peer-to-peer network. This means that no single entity
has control over the entire system, making it more resilient, secure, and transparent.
At its core, a blockchain is a chain of blocks, where each block contains a set of transactions.
These blocks are linked together in chronological order, forming an immutable record. Once a
block is added to the blockchain, it cannot be altered or deleted, ensuring the integrity of the
data. Each block is cryptographically secured using a hashing algorithm, which creates a unique
digital fingerprint of the block’s contents. This cryptographic feature prevents fraud and
tampering, making blockchain a trusted medium for storing data.
Blockchain relies on consensus mechanisms to validate transactions across the network. The
most common consensus mechanisms are Proof of Work (PoW) and Proof of Stake (PoS). In
PoW, miners solve complex mathematical puzzles to validate transactions and add new blocks
to the chain. In PoS, validators are chosen based on the number of tokens they hold and are
willing to "stake" or lock up as collateral. These mechanisms ensure that all participants agree
on the validity of transactions, eliminating the need for intermediaries like banks.
One of the key advantages of blockchain is its decentralization. Traditional databases rely on a
central server to store and manage data, creating a single point of failure. In contrast,
blockchain’s distributed nature means that data is stored across multiple nodes in the network,
making it highly resistant to attacks or downtime. Even if one or several nodes are
compromised, the integrity of the blockchain is not affected.
1.3 Web3
Web 3 is the next generation of the internet, built on decentralized technologies such as
blockchain. Unlike Web 2.0, which relies on centralized platforms like Google or Facebook,
Web 3 empowers users by giving them control over their data and digital identities. It uses
blockchain to securely store and verify data, ensuring transparency and immutability.
Web 3 also introduces decentralized autonomous organizations (DAOs), where decisions are
made collectively by token holders rather than a central authority. It promotes privacy, allowing
users to manage their digital identity and personal data securely, without relying on central
systems.
1.4 Summary
A Decentralized Voting System using Web 3 and blockchain aims to transform traditional
voting methods by ensuring transparency, security, and fairness. Built on blockchain
technology, this system eliminates the need for intermediaries, making the voting process
more efficient and tamper-resistant. Web 3 principles empower voters by giving them
control over their identities and data through decentralized applications (DApps) and
cryptographic techniques.
In such a system, votes are recorded on an immutable blockchain, ensuring that they
cannot be altered or erased, providing a high level of transparency and accountability.
Smart contracts automate the voting process, reducing the potential for fraud and ensuring
that votes are cast in accordance with pre-defined rules. Voters authenticate themselves
using digital wallets, ensuring privacy and security.
The decentralized nature of the system eliminates central authorities, reducing the risk of
manipulation, censorship, or corruption. Additionally, it enables greater accessibility by
allowing anyone with an internet connection to participate, overcoming geographic and
institutional barriers. Overall, a decentralized voting system powered by Web 3 and
blockchain enhances the integrity of elections and builds trust in the democratic process.
CHAPTER 2
LITERATURE SURVEY
The concept of a decentralized voting application using blockchain technology has been widely
discussed in various IEEE conference papers. These works provide detailed insights into how
blockchain can address the limitations of traditional voting systems by enhancing security,
transparency, and efficiency.
Chandana K. G , S. M. R. Ahamed, and V. G. S. Srirama [1] their work outlines a
Blockchain based decentralized voting system designed to ensure the integrity and transparency
of elections. This paper emphasizes how blockchain can secure votes through its immutable
ledger, which prevents any alterations or tampering after votes are cast. The authors discuss the
role of blockchain in eliminating fraud and ensuring transparency, which can help in rebuilding
trust in electoral processes, particularly in areas prone to election rigging. The decentralized
nature ensures that there is no central authority, which also reduces the risks of corruption and
unauthorized data manipulation. The integration of smart contracts is a key feature, automating
election processes such as vote counting and candidate verification, reducing human errors and
delays.
Amarendra Kumar , G. V. R. P. Reddy, and M. S. Khan [2] their work focuses on the
focuses on a blockchain-based e- voting system designed to address privacy concerns, security
issues, and the need for transparency in elections. In this system, voters’ identities are encrypted,
and their votes are securely recorded using a blockchain ledger. This approach ensures that no
one can alter the results after voting is completed, and it also enables a transparent system where
anyone can verify the accuracy of the voting process. The authors explore how blockchain
technology guarantees data integrity by making it nearly impossible to tamper with voting data
once it is added to the ledger. This system’s decentralized architecture ensures that the voting
process isless prone to cyberattacks and manipulation compared to centralized systems.
S. K. Singh, R. K. Gupta, and J. P. Singh [3] dives deeper into using blockchain to build a
fully automated voting platform . This paper highlights how the use of smart contract
allows for automatic vote validation, eliminating the need for manual intervention. The
decentralized application (DApp) ensures that voters' identities are verified through secure
cryptographic methods, while their votes are stored in a way that cannot be altered by any single
party. The authors focus on the scalability of blockchain systems for large-scale elections, where
thousands of votes need to be processed in real-time. The results show that a blockchain-based
voting system can significantly reduce administrative overhead and potential fraud risks while
maintaining a high level of privacy for voters.
Deepak Agarwal, S. Choudhury, and R. Gupta [5] they explored blockchain as a solution to
the inherent risks of centralized voting systems, such as tampering and data breaches. The
authorsintroduce a multi-layer blockchain architecture to handle scalability and ensure that
large- scale elections can be conducted efficiently without compromising security. This paper
presents proof-of-stake as a potential consensus mechanism for reducing energy consumption
and improving scalability, which is critical for wide adoption in large-scale democratic
processes. The use of zero-knowledge proofs for ensuring privacy while still verifying votes is
another key element discussed. The authors demonstrate that blockchain’s inherent
transparency allows voters and election officials to track the integrity of the election process
without revealing sensitive data.
M. K. Sharma and N. Agarwal (IEEE Xplore, 2022) [ 6 ] delves into the technical aspects
of using smart contracts to automate and secure the voting process. By leveraging Ethereum’s
blockchain, the paper describes how smart contracts can be programmed to automatically
validate and record votes, ensuring that each vote is counted only once. This eliminates human
error and the potential for fraud. The authors also discuss how distributed ledger technology
(DLT) can be used to store voter information in an encrypted form, which protects the identityof
voters while still ensuring the legitimacy of their votes. The paper concludes by noting that
while blockchain's decentralization provides a high level of security, user interface issues and
public acceptance remain significant hurdles to widespread adoption.
A. Singh, R. K. Gupta, and J. P. Singh [7] in this paper they address the critical issue of voter
privacy within a blockchain-based voting system. The paper highlights privacy- preserving
cryptographic techniques, such as homomorphic encryption, to protect voters' personal details
while still ensuring the authenticity of their votes. The authors demonstrate how blockchain
can be employed to both securely store vote data and ensure that votes remain anonymous.
Their findings suggest that blockchain can provide an effective solutionto the privacy concerns
that often arise in e-voting systems.
Summary:
In summary, the research from these IEEE papers underscores the transformative potential of
blockchain technology in creating secure, transparent, and efficient voting systems. By
leveraging blockchain's decentralized nature, smart contracts, and cryptographic techniques,
these systems offer a way to enhance voter confidence, reduce fraud, and improve the overall
integrity of the electoral process. However, the scalability of such systems, as well as user
acceptance and privacy concerns, still need to be addressed for blockchain-based voting to be
adopted on a larger scale.
CHAPTER 3
Centralized Voting Systems: Traditional voting systems are often centralized, relying on
government or electoral bodies to manage voter registration, ballots, and vote counting. These
systems typically use physical or electronic voting machines and databases.
Disadvantages:
Lack of Transparency: Voter data, election results, and processes are often not
transparent, leading to a lack of trust among voters.
Electronic Voting Machines (EVMs): EVMs are used for electronic voting, where voters
cast their votes on a machine instead of paper ballots. The results are typically stored digitally
and transmitted to central servers for tallying.
Disadvantages:
Security Risks: EVMs are vulnerable to tampering and hacking, especially if they are not
well-secured or connected to unencrypted networks.
Lack of Verifiability: The digital nature of the voting process can make it difficult for
voters toverify that their vote has been properly recorded.
Technical Failures: EVMs can malfunction or experience software bugs, causing delays,
confusion, or lost votes.
Internet Voting (i-Voting): Internet voting allows citizens to cast their votes online via secure
websites or apps. This system is used in some countries for absentee voting or national
elections.
Disadvantages:
Identity Verification Issues: Ensuring that the person voting is the actual voter (without
fraud)can be challenging in an online environment.
Dept.of CSE,KIT,Tiptur 2024-2025 9
Decentralized Voting Application Using blockchain
Mail-In Voting: Voters receive ballots through the mail, complete them, and return them to the
election authorities. This system is often used in absentee voting for citizens who cannot
physically be present at polling stations.
Disadvantages:
Delays and Errors: The process can be slow, leading to delays in vote counting.
Additionally,errors like missing signatures or improper handling can invalidate ballots.
Voter Fraud: While rare, mail-in voting is susceptible to fraud, including ballot
tampering, forgery, and coercion.
Biometric Voting Systems Biometric voting systems use unique biological identifiers
(fingerprints, facial recognition, iris scans, etc.) to authenticate voters. The system aims to
ensure voter identification and prevent impersonation.
Disadvantages:
Privacy Concerns: Biometric data is highly sensitive, and its collection and storage raise
significant privacy concerns. A breach could lead to identity theft or misuse of personal
data.
Exclusion of Certain Populations: Some individuals may have biometric features that are
difficult to capture, such as those with disabilities, certain age groups, or those with
damaged fingerprints.
High Costs: The infrastructure required for biometric voting, including scanners and
secure storage, is expensive to implement and maintain.
3.5 Summary
The proposed system is a decentralized voting application built using Web3 and blockchain
technologies. It leverages smart contracts to automate the voting process, ensuring
transparency and immutability of votes. Voter authentication is achieved through
cryptographic wallets, maintaining security and privacy. The blockchain ledger records all
votes, providing real-time visibility and enabling public auditing of results. The system
uses decentralized governance (DAO) for decision-making, promoting community
participation and transparency. Layer 2 solutions and sharding ensure the system can scale
for large elections while reducing costs. The system guarantees efficient, secure, and cost-
effective elections accessible remotely to global voters. By removing intermediaries, it
fosters a more inclusive and trustworthy electoral process. Ultimately, the system enhances
voter trust and eliminates the risks of fraud and manipulation. This methodology offers a
revolutionary approach to secure, transparent, and decentralized voting.
CHAPTER 4
We utilized MetaMask, a browser extension, to securely manage private keys for our
decentralized application. MetaMask provides a user-friendly interface to interact with
blockchain networks while ensuring the security of sensitive credentials.
After running the program, users are prompted to unlock MetaMask by entering their password.
Once unlocked, the application connects to MetaMask through a secure connection at
localhost:3000. This step establishes a link between the web application and the blockchain
network.
Users can copy their account address from MetaMask and paste it during the execution process
for seamless interactions with smart contracts or blockchain transactions.
Domain: Blockchain
1.Next JS
Next.js is a React framework designed to build modern web applications efficiently. Here are
its key highlights:
Offers thousands of extensions for debugging, linting, version control, and integrating with
frameworks, databases, and cloud services.
A free, open-source code editor developed by Microsoft that is lightweight yet powerful,
supporting a wide range of programming languages.
ncludes seamless Git support for version control, enabling staging, committing, and
branching directly from the editor.
Highly customizable with themes, settings, and keyboard shortcuts, and runs on Windows,
macOS, and Linux.
3.HardHat
A versatile tool for compiling, deploying, testing, and debugging smart contracts in
Ethereum-based projects.
Provides a built-in local Ethereum network (Hardhat Network) for testing smart contracts
efficiently.
4.NodeJs
5.Scripts
1. dev: Runs the Next.js development server (next dev).
6.Dependencies
These libraries are essential for the functionality of the application:
1. @openzeppelin/contracts (v4.7.0):
Provides secure, community-audited smart contract templates for Ethereum, such as ERC-
20 and ERC-721 tokens.
2. axios (v0.27.2):
A promise-based HTTP client for making API requests to interact with external services.
3. dotenv (v16.0.1):
Allows you to securely manage environment variables by storing them in a .env file.
4. ethers (v5.6.9):
A library for interacting with the Ethereum blockchain, handling tasks like connecting to
nodes, deploying contracts, and managing wallets.
5. next (v12.2.1):
A React-based framework with support for SSR, SSG, and APIs for building modern web
applications.
Core libraries for building user interfaces and managing component rendering.
7. react-countdown (v2.3.2):
Provides countdown timers, useful for timed events like voting deadlines.
8. react-dropzone (v14.2.2):
9. react-icons (v4.4.0):
7.DevDepencies
These tools are used during development :
1. @nomicfoundation/hardhat-toolbox (v1.0.1):
A plugin suite that integrates Hardhat with popular tools like Ethers.js, Waffle, and
Mocha for Ethereum development.
2. hardhat (v2.10.0):
4.5 Summary:
The functional and non-functional requirements were successfully listed The modules
and tools required for implementing the project has been identified. Based on the
defined problem statement and the scope of our solution, we have realized the
CHAPTER 5
SYSTEM DESIGN
5.2 Summary:
The system architecture for our proposed solution has been segmented into the
algorithm different aspects of the system. The system development includes library of
the code.
CHAPTER 6
IMPLEMENTATION
Inputs: We begin the process by the coding of the process and they performing the
include library.
Pre-processing: Then we can run any of the two VS Code scripts based on the user’s
Exercise. Initially, it also use many of the program and suggests the appropriate code. In
blockchain development using JavaScript, Next.js, and CSS, preprocessors help streamline
and optimize workflows. JavaScript preprocessors like Webpack and Babel handle code
bundling, transpiling, and compatibility, ensuring that blockchain interactions via libraries like
Web3.js and Ethers.js are efficient and cross-platform. Next.js serves as the framework for
building both frontend and backend, using API routes for interacting with blockchain nodes
or smart contracts, supporting static site generation (SSG) and server-side rendering (SSR)
for fast data fetching. CSS preprocessors like Sass simplify styling with features such as
variables, mixins, and nesting, helping manage complex UI elements in decentralized
applications (dApps). Together, these tools enable seamless blockchain interaction, optimized
performance, and maintainable code for dApp development.
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.9;
import "@openzeppelin/contracts/utils/Counters.sol";
import "hardhat/console.sol";
contract Create {
using Counters for Counters.Counter;
event CandidateCreate(
uint256 indexed candidateId,
string age,
string name,
string image,
uint256 voteCount,
address _address,
string ipfs
);
/////////////END
////////////VOTERS////////////////////////
struct Voter {
uint256 voter_voterId;
string voter_name;
string voter_image;
address voter_address;
uint256 voter_allowed;
bool voter_voted;
uint256 voter_vote;
string voter_ipfs;
}
event VoterCreated(
uint256 indexed voter_voterId,
string voter_name,
string voter_image,
address voter_address,
uint256 voter_allowed,
bool voter_voted,
uint256 voter_vote,
string voter_ipfs
);
////////////VOTERS////////////////////////
constructor() {
votingOrganizer = msg.sender;
}
function setCandidate(
address _address,
string memory _age,
string memory _name,
string memory _image,
string memory _ipfs
) public {
require(
votingOrganizer == msg.sender,
"You have no azuthorization to set Candidate"
);
_candidateId.increment();
candidate.age = _age;
candidate.name = _name;
candidate.candidateId = idNumber;
candidate.image = _image;
candidate.voteCount = 0;
candidate._address = _address;
candidate.ipfs = _ipfs;
candidateAddress.push(_address);
emit CandidateCreate(
candidate.candidateId,
_age,
_name,
_image,
candidate.voteCount,
candidate._address,
candidate.ipfs
);
}
///////////////////VOTER/////////////////
function voterRight(
address _address,
string memory _name,
string memory _image,
string memory _ipfs
) public {
require(
votingOrganizer == msg.sender,
"You have no right to provide authorization for vote"
);
_voterId.increment();
require(voter.voter_allowed == 0);
voter.voter_allowed = 1;
voter.voter_name = _name;
voter.voter_image = _image;
voter.voter_address = _address;
voter.voter_voterId = idNumber;
voter.voter_vote = 1000;
voter.voter_voted = false;
voter.voter_ipfs = _ipfs;
votersAddress.push(_address);
emit VoterCreated(
voter.voter_voterId,
_name,
_image,
_address,
voter.voter_allowed,
voter.voter_voted,
voter.voter_vote,
voter.voter_ipfs
);
// }
}
voter.voter_voted = true;
voter.voter_vote = _candidateVoteId;
votedVoters.push(msg.sender);
candidates[_candidateAddress].voteCount += voter.voter_allowed;
}
6.2 Summary
CHAPTER 7
CONCLUSION
In conclusion, implementing a decentralized voting application using blockchain technology
demonstrates the transformative potential of modern cryptographic and distributed ledger
technologies in enhancing electoral processes. Blockchain offers unparalleled transparency,
immutability, and security, making it an ideal solution to mitigate traditional voting challenges
such as fraud, tampering, and lack of trust.
By leveraging features like cryptographic hashing and consensus algorithms, this application
ensures the integrity and confidentiality of voter data while maintaining anonymity. Moreover,
decentralization eliminates the need for intermediaries, reducing costs and fostering trust
among stakeholders.
While blockchain-based voting shows immense promise, it also presents challenges such as
scalability, accessibility for all demographics, and potential vulnerabilities to cyberattacks.
Addressing these issues requires collaborative efforts between governments, technologists, and
policymakers.
Ultimately, a decentralized voting application paves the way for more inclusive, secure, and
efficient democratic processes, making it a significant step forward in the evolution of modern
governance.
Despite challenges such as scalability, accessibility, and regulatory hurdles, blockchain holds
significant promise in reshaping how democratic elections are conducted. As the technology
matures and further solutions to these challenges are developed, blockchain-based voting
systems could become a cornerstone for secure, efficient, and trustworthy elections worldwide.
CHAPTER 8
FUTURE ENHANCEMENT
Future enhancements to a decentralized voting application using blockchain could focus on
improving scalability, security, and user accessibility. One key area for improvement is
scalability, where the integration of Layer 2 solutions like Optimistic Rollups or zk-SNARKs
can enable the system to handle larger volumes of transactions, ensuring that high-turnout
elections can be processed efficiently. Additionally, the use of sharding can allow the
blockchain to manage multiple transactions simultaneously, reducing bottlenecks and
improving overall performance. Enhancing security is another crucial aspect, where multi-
factor authentication (MFA) and biometric verification methods, such as facial recognition or
fingerprints, could be implemented to ensure only legitimate voters can cast their ballots.
Furthermore, integrating decentralized identity management systems could enhance voter
privacy by enabling secure and private identity verification.
User accessibility could also be improved by ensuring the application has a user-friendly
interface, making it intuitive for all citizens, including those with limited technical expertise.
Mobile accessibility would be vital to allow voters to participate from various devices, further
ensuring inclusivity. Additionally, the integration of hybrid voting models, where blockchain
voting is combined with traditional methods as a backup, could help build trust during the early
stages of adoption. On the operational side, incorporating real-time vote tracking and
transparent auditing systems could provide live updates on voting progress, improving trust
and accountability throughout the election process. AI-based fraud detection mechanisms could
also be employed to automatically detect suspicious behavior and ensure the system’s integrity.
CHAPTER 9
The Candidate Registration process allows users to register as candidates by entering their
personal information, including their name and age, while the system automatically pulls their
address from MetaMask. This integration ensures that each candidate is uniquely identified,
utilizing their wallet address as a secure, verifiable identifier on the blockchain. The MetaMask
integration eliminates the need for traditional identification methods, offering a more secure
and efficient registration process. After entering their details, the candidate selects their
position, which is recorded as part of their registration. Once the form is completed, the
candidate clicks on the “Authorize Candidate” button to initiate the blockchain transaction.
Upon clicking the button, MetaMask prompts the user to confirm the transaction. This
interaction is essential for ensuring that the candidate's data is securely recorded on the
blockchain. When the user approves the transaction, it triggers a smart contract, recording the
candidate’s data—name, address, age, and position—on the decentralized ledger. The
blockchain ensures that this data cannot be altered or deleted once recorded, providing an
immutable and tamper-proof record. If the transaction is rejected or fails, the candidate’s
registration is not processed, ensuring the integrity of the election process. Upon successful
completion of the transaction, the system updates in real-time to reflect the newly registered
candidate on the Voter List.
The system enhances security by leveraging blockchain's decentralized nature, reducing the
risk of fraud or data manipulation. Blockchain ensures that candidate information is verifiable
and auditable, building trust among election participants. MetaMask integration guarantees that
only authorized users can interact with the system, preventing unauthorized registrations.
SNAPSHOTS
Fig 10.1 :web page prompting users to connect their digital wallet for
blockch ain-based voting.
Fig 10.2 : prompting the user to connect their digital wallet for interaction
Fig 10.3 : web page of voting app dashboard with navigation and count details.
Fig 10.5 : Candidate registration form with profile picture upload and transaction
confirmation.
Fig 10.10 : Voter profile page with "You already Voted" status.
REFERENCES