New Report mini

Download as pdf or txt
Download as pdf or txt
You are on page 1of 42

VISVESVARAYA TECHNOLOGICAL UNIVERSITY

Jnana Sangama, Belagavi-590018

A MINI-PROJECT (BCS586) REPORT


ON
“DECENTRALIZED VOTING SYSTEM USING WEB3 AND BLOCKCHAIN ”

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

Under the Guidance of


Prof. Anusha K B.E.,M.Tech.
Assistant Professor

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING


KALPATARU INSTITUTE OF TECHNOLOGY
NBA Accredited 2022-25 & NAAC Accredited

NH-206, TIPTUR-572201
AY : 2024 - 2025
KALPATARU INSTITUTE OF TECHNOLOGY
NH-206, TIPTUR-572201

Department of Computer Science & Engineering


NBA Accredited 2022-25 & NAAC Accredited

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

INIJA A NATARAJ 1KI22CS051


SAPNA 1KI22CS100
TEJASWINI R 1KI22CS112
VIDYA P B 1KI22CS120

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.

Signature of the guide Signature of HOD

Prof. Anusha K Dr. Maithri C


Assistant Proffesor Professor & HOD
Dept. of CSE, KIT Dept. of CSE,KIT

Internal Viva
Name of Examiners Signature with date

1.

2.
KALPATARU INSTITUTE OF TECHNOLOGY
NH -206, TIPTUR-572201

Department of Computer Science & Engineering


NBA Accredited 2022-25 & NAAC Accredited

DECLARATION

We, the student of Fifth semester Bachelor of Engineering, Department of Computer


Science and Engineering, Kalpataru Institute of Technology, Tiptur, would hereby declare
that the Mini - Project(BCS586) program titled “Decentralized Voting Application Built
on Web3 and Blockchain” has been carried out by me at Kalpataru Institute of Technology
, in partial fulfillment of the course requirement for the award of degree of Bachelor of
Engineering in Computer Science and Engineering of Visvesvaraya Technological
University, Belagavi, during the academic year 2024 - 2025. I further declare that the work
embodied in this report has not been submitted to any other universityor institution for the
award of any other degree.

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. G D Gurumurthy, Principal, Kalpataru Institute of Technology,


Tiptur for his continuous support and encouragement throughout the course of the 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

The evolution of decentralized technology presents a transformative opportunity to


revolutionize traditional systems, particularly in the domain of voting. A Decentralized Voting
Application (DApp) built on Web3 and blockchain technologies have the potential to address
longstanding issues in electoral systems, such as transparency, security, and immutability. By
leveraging decentralized technologies, such a system can ensure a more robust, trustworthy, and
inclusive voting process, ultimately empowering individuals and institutions with greater
confidence in democratic practices.At the core of this decentralized voting system is the use of
blockchain technology, which provides an immutable ledger for recording votes. Blockchain,
being a distributed ledger, ensures that every vote is recorded transparently and securely,making
it nearly impossible to alter or manipulate the results. This eradicates issues such asvote
tampering, fraud, and data breaches, which have historically undermined the integrity of
traditional voting systems.The Decentralized Voting Application (DApp) would utilize Web3,
a suite of protocols that enables decentralized applications to interact with blockchain networks.
Web3 provides the interface for users to interact with the application seamlessly. Built with
React.js, the front-end interface of the DApp offers an intuitive, user-friendly platform for voters
to cast their votes. React.js, with its component-based architecture, ensures that the application is
scalable, responsive, and easy to maintain. Through this interface, voters can securely
authenticate their identities and cast votes in real time, all while having full visibility into the
voting process.

II
TABLEOFCONTENTS
ACKNOWLEDGEMENT I
ABSTRACT II

Chapter Chapter Name Page


No Number
1 INTRODUCTION 1-5
1.1 Overview 1
1.2 Blockchain 1-2
1.3 Web3 3
1.4 Benefits of using Daap 4
1.5 Summary 5
2 LITERATURE SURVEY 6-8
3 METHODOLOGY AND PROPOSED SYSTEM 9-12
3.1 Existing System 9-10
3.2 Proposed System 11
3.3 Problem Statement 11
3.4 Proposed Methodology 12
3.5 Summary 12
4 SYSTEM REQUIREMENTS SPECIFICATION 13-16
4.1 Functional requirement 13
4.2 Hardware requirement 13
4.3 Software requirement 13
4.4 Tools and Technologies 14-16
4.5 Summary 16
5 SYSTEM DESIGN 17-18
5.1 System architecture 17
5.1.1 Architecture Overview
5.2 Summary 18
6 IMPLEMENTATION 19-26
6.1 sample code 19
6.2 summary 19-26

7 CONCLUSION 27

8 FUTURE ENHANCEMENT 28

9 RESULT AND SNAPSHOTS 28-34

REFERENCES 34-36
Decentralized Voting Application Using blockchain

CHAPTER 1
INTRODUCTION
1.1 Overview

A Decentralized Voting Application built on Web 3 and blockchain leverages blockchain


technology to enable transparent, secure, and tamper-proof voting systems. Using smart
contracts, the application ensures that votes are recorded immutably eliminating concerns about
fraud or manipulation. Voters authenticate via digital wallets, ensuring identity privacy and
secure access. The decentralized nature means no central authority controls the voting process,
reducing the risk of censorship. Blockchain's transparency allows real-time monitoring of the
voting process without revealing individual votes, preserving anonymity. The applicationcan be
built on various blockchains like Ethereum or Solana, ensuring scalability and efficiency. It
promotes inclusivity by allowing participation from any location, eliminating barriers like
geographic constraints. This system offers verifiable and auditable results, with every vote
traceable to its origin without compromising voter privacy. Web 3 principles, like
decentralization and user control, empower individuals, giving them ownership of their voting
data. Overall, this decentralized voting system enhances democracy, ensuring fairness,
accessibility, and trust.

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.

Dept.of CSE,KIT,Tiptur 2024-2025 1


Decentralized Voting Application Using blockchain

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.

Blockchain’s transparency is another major benefit. All transactions recorded on the


blockchain are publicly accessible, allowing anyone to view the history of data and verify its
authenticity. This is particularly useful in applications like supply chain management, where
customers and stakeholders can track the movement of goods from origin to destination.
Additionally, blockchain’s ability to provide secure and verifiable records has made it a popular
solution for digital currencies like Bitcoin and Ethereum, enabling peer-to-peer transactions
without the need for a trusted intermediary.

Dept.of CSE,KIT,Tiptur 2024-2025 2


Decentralized Voting Application Using blockchain

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.

In Web 3, cryptocurrencies and tokens enable peer-to-peer financial transactions without


intermediaries like banks. Users can engage in decentralized finance (DeFi), lending,
borrowing, and trading directly on blockchain networks. Smart contracts, self-executing
agreements stored on the blockchain, remove the need for third-party intermediaries in various
applications.

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.

 Decentralization: Web 3 is built on decentralized networks, where control is


distributed across multiple participants rather than a central authority. This reduces
reliance on intermediaries like corporations or governments.
 Blockchain Technology: Web 3 leverages blockchain as the underlying technology to
ensure transparency, security, and immutability in data storage and transactions.
 Decentralized Finance (DeFi): Web 3 enables decentralized financial systems, where
users can lend, borrow, and trade assets without traditional financial institutions, using
blockchain-based protocols.
 Decentralized Autonomous Organizations (DAOs): DAOs are organizations
governed by smart contracts where decision-making is done collectively by token
holders, providing more democratic control.
 Security: With blockchain's cryptographic features and decentralization, Web 3 offers
improved security and reduced risks of hacking, as there is no single point of failure.
 Privacy: Web 3 enhances user privacy through decentralized identity management,
allowing users to interact online without relying on centralized platforms that collect
and control personal data.

Dept.of CSE,KIT,Tiptur 2024-2025 3


Decentralized Voting Application Using blockchain

1.3 Benefits of Using Daap

 Decentralization: DApps are built on decentralized networks like blockchain, reducing


reliance on central authorities, and making them more resistant to censorship and single
points of failure.
 Transparency: Transactions and data on DApps are publicly recorded on the
blockchain, ensuring full transparency and allowing users to verify all actions taken
within the app.
 Security: DApps use cryptographic techniques, ensuring secure data storage and
communication, making them less vulnerable to hacks or data breaches compared to
centralized systems.
 User Control: Users retain control over their data and digital identity, reducing the risk
of personal data exploitation by centralized entities.
 Lower Costs: DApps eliminate the need for intermediaries (like banks or brokers),
reducing transaction fees and other operational costs.
 Censorship Resistance: Due to the decentralized nature of DApps, no single entity can
easily shut down or control them, offering protection from censorship or government
interference.
 Ownership of Assets: Users can directly own digital assets, such as tokens, NFTs, and
cryptocurrencies, which are managed securely through their private keys.
 Improved Privacy: DApps enhance user privacy by allowing anonymous interactions
and ensuring that sensitive personal information is not stored in a centralized database.
 Global Accessibility: DApps can be accessed globally, enabling individuals in
restricted or underserved regions to participate in decentralized networks without
geographical limitations.
 Incentive Systems: DApps often include built-in incentive mechanisms, such as token
rewards, to encourage active participation,
fostering growth and sustainability of the
ecosystem.

Dept.of CSE,KIT,Tiptur 2024-2025 4


Decentralized Voting Application Using blockchain

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.

Dept.of CSE,KIT,Tiptur 2024-2025 5


Decentralized Voting Application Using blockchain

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.

Dept.of CSE,KIT,Tiptur 2024-2025 6


Decentralized Voting Application Using blockchain

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.

Vijayakumar V , M. A. A. Choudhury , and R. C. Bansal [4] in their work they discussed


the evolution of e-voting systems and presents blockchain as a solution to existing challenges.
The authors note how blockchain’s core features—immutability, transparency, and
decentralization—are ideal for mitigating the vulnerabilities of traditional voting systems. They
also discuss how blockchain ensures end-to-end verifiability, allowing voters to verify their
votes while maintaining privacy. Importantly, the paper points out that while blockchain can
provide significant security improvements, challenges remain in terms of scalability for larger
elections. This paper emphasizes the need for layered blockchain solutions to ensure that the
system can handle large volumes of voters and candidates efficiently.

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.

Dept.of CSE,KIT,Tiptur 2024-2025 7


Decentralized Voting Application Using blockchain

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.

Dept.of CSE,KIT,Tiptur 2024-2025 8


Decentralized Voting Application Using blockchain

CHAPTER 3

METHODOLOGY AND PROPOSED SYSTEM

3.1 Existing System

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:

 Vulnerability to Fraud: Centralized systems are more prone to tampering, data


manipulation, and hacking due to their single point of control.

 Lack of Transparency: Voter data, election results, and processes are often not
transparent, leading to a lack of trust among voters.

 Voter Suppression: Centralized control can lead to discriminatory practices, such as


disenfranchising certain groups of 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:

 Cybersecurity Threats: Internet voting systems are highly vulnerable to cyberattacks,


includinghacking, DDoS (Distributed Denial of Service) attacks, and malware, which
can disrupt the process or alter results.

 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.

Dept.of CSE,KIT,Tiptur 2024-2025 10


Decentralized Voting Application Using blockchain

3.2 Proposed System

The proposed system is a blockchain-based decentralized voting application that aims


to ensure secure, transparent, and efficient elections. It leverages Web3 technologies to
remove intermediaries, allowing voters to cast their ballots directly through smart
contracts. By using blockchain, the system guarantees immutability and auditability of
votes, reducing the risk of fraud or manipulation. Cryptographic security ensures voter
privacy while maintaining the integrity of the voting process. Voters authenticate via digital
wallets, and the process is decentralized, eliminating the need for central authorities.
Results are recorded on the blockchain, offering real-time transparency and enabling
public verification. The system can be accessed remotely, allowing for greater inclusivity
and global participation. Token rewards or incentives can encourage higher voter
turnout. Additionally, the application ensures cost efficiency, reducing the resources
required for traditional election methods. Lastly, the system supports smart contract
automation, making the entire voting process faster and more reliable.

3.3 Problem Statement

 Traditional voting systems, whether electronic or paper-based, face significant


challenges including voter fraud, lack of transparency, manipulation of results,
security vulnerabilities, and limited accessibility. These issues undermine trust in
electoral processes and make it difficult to ensure fair, accurate, and secure elections.
 Additionally, traditional systems struggle to provide remote accessibility, leaving out
voters in remote areas or those unable to vote in person due to health or mobility issues.
Furthermore, privacy concerns and the complexity of authentication create barriers
to voter participation and undermine confidence in election outcomes.
 There is a clear need for an innovative, decentralized solution that can address these
limitations, providing a secure, transparent, cost-effective, and accessible voting
systemthat can be trusted by voters and officials alike. This proposed Decentralized
Voting Application using Web3 and Blockchain aims to overcome these challenges,
offering a tamper-proof, transparent, and efficient voting process that ensures voter
privacy and integrity while allowing for global participation.

Dept.of CSE,KIT,Tiptur 2024-2025 11


Decentralized Voting Application Using blockchain

3.4 Proposed Methodology


 Blockchain and Smart Contract Integration: The voting process is secured using
blockchain technology, where votes are recorded on a public ledger, ensuring
immutability and transparency. Smart contracts automate the voting process, from
registration to vote tallying, ensuring rules are followed without intermediaries.
 Voter Authentication and Privacy: Voter identity is verified using cryptographic
techniques and digital wallets, ensuring only eligible participants can vote. Votes are
encrypted to maintain voter privacy, while the blockchain ensures transparency and
integrity of the results.
 Real-Time Transparency: The voting process is fully transparent, with results publicly
accessible on the blockchain. This allows for independent verification and public
auditing of votes to ensure accuracy and eliminate fraud.
 Decentralized Governance: The system uses Decentralized Autonomous Organization
(DAO) for decision-making, allowing participants to vote on system upgrades and
election rules, enhancing democracy and community governance.
 Scalability and Security: The system is designed to scale with Layer 2 solutions and
sharding to handle large voter volumes, ensuring fast and secure transactions while
maintaining low costs.

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.

Dept.of CSE,KIT,Tiptur 2024-2025 12


Decentralized Voting Application Using blockchain

CHAPTER 4

SYSTEM REQUIRMENTS SPECIFICATION

4.1 Functional Requirements:

 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.

4.2 Hardware Requirements:


 Processor: Intel Core i5

 RAM Size: 8/16GB

 Keyboard Standard QWERTY serial

 Mouse: Standard serial or PS/2 mouse

 Hard disk: 256GB+

4.3 Software Requirements:

 Operating System: Windows

 Platform: VS Code Editor

 Framework Used: NextJs

 Domain: Blockchain

Dept.of CSE,KIT,Tiptur 2024-2025 13


Decentralized Voting Application Using blockchain

4.4 Tools and Technologies:

1.Next JS
Next.js is a React framework designed to build modern web applications efficiently. Here are
its key highlights:

 Renders pages on the server for better performance and SEO.

 Pre-renders static HTML at build time for faster page loads.

 Build server-side APIs directly within the application.

 Uses the pages folder to define routes automatically.

 Easily use CSS Modules or global styles for styling.

 Update static pages without a full site rebuild.

2.VS Code Editor

 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.

 Supports numerous plugins, such as Hardhat-deploy, Hardhat-gas-reporter, and Hardhat-


ethers, to extend its functionality.

Dept.of CSE,KIT,Tiptur 2024-2025 14


Decentralized Voting Application Using blockchain

4.NodeJs

Node.js is a JavaScript runtime built on Chrome's V8 engine, enabling developers to build


server-side and network applications. Although version 8.19.2 is quite old and no longer
supported, it provides foundational features like event-driven architecture, non-blocking I/O,
and support for npm (Node Package Manager).

5.Scripts
1. dev: Runs the Next.js development server (next dev).

2. build: Compiles the project for production (next build).

3. start: Starts the compiled production build (next start).

4. lint: Lints the codebase for errors (next lint).

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.

6. react & react-dom (v18.2.0):


Dept.of CSE,KIT,Tiptur 2024-2025 15
Decentralized Voting Application Using blockchain

 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):

 A component for implementing drag-and-drop file uploads.

9. react-icons (v4.4.0):

 A library for using popular icons in React applications.

10. web3modal (v1.9.8):

 Simplifies connecting users' wallets (e.g., MetaMask) to the blockchain in DApps.

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):

 A development environment for deploying, testing, and debugging smart contracts


locally or on testnets.

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

functional requirements. By examining the existing search systems in various domains,

certain distinctness regarding our approach has gotten clearer.

Dept.of CSE,KIT,Tiptur 2024-2025 16


Decentralized Voting Application Using blockchain

CHAPTER 5

SYSTEM DESIGN

5.1 System Architecture

5.1.1 Architecture Overview


Figure 5.1 shows the system architecture of the proposed system. The structure of the
Workout monitoring system consists of four components –
NextJS,uploadData,web3Strorage IPFS, Smart contract Blockchain. This output will be
in the form of frames.

Figure 5.1: System Architecture

Dept.of CSE,KIT,Tiptur 2024-2025 17


Decentralized Voting Application Using blockchain

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.

Dept.of CSE,KIT,Tiptur 2024-2025 18


Decentralized Voting Application Using blockchain

CHAPTER 6

IMPLEMENTATION

6.1 Implementation Modules

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.

6.1 Sample Code

// 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;

Counters.Counter public _voterId;


Counters.Counter public _candidateId;
Dept.of CSE,KIT,Tiptur 2024-2025 19
Decentralized Voting Application Using blockchain

address public votingOrganizer;

///CANDIDATE FOR VOTING


struct Candidate {
uint256 candidateId;
string age;
string name;
string image;
uint256 voteCount;
address _address;
string ipfs;
}

event CandidateCreate(
uint256 indexed candidateId,
string age,
string name,
string image,
uint256 voteCount,
address _address,
string ipfs
);

address[] public candidateAddress;

mapping(address => Candidate) public candidates;

/////////////END
////////////VOTERS////////////////////////

address[] public votedVoters;

address[] public votersAddress;


mapping(address => Voter) public voters;

struct Voter {

Dept.of CSE,KIT,Tiptur 2024-2025 20


Decentralized Voting Application Using blockchain

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"

Dept.of CSE,KIT,Tiptur 2024-2025 21


Decentralized Voting Application Using blockchain

);

_candidateId.increment();

uint256 idNumber = _candidateId.current();

Candidate storage candidate = candidates[_address];

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
);
}

function getCandidate() public view returns (address[] memory) {


return candidateAddress;
}

function getCandidateLength() public view returns (uint256) {


return candidateAddress.length;
}

Dept.of CSE,KIT,Tiptur 2024-2025 22


Decentralized Voting Application Using blockchain

function getCandidateData(address _address)


public
view
returns (
string memory,
string memory,
uint256,
string memory,
uint256,
string memory,
address
)
{
return (
candidates[_address].age,
candidates[_address].name,
candidates[_address].candidateId,
candidates[_address].image,
candidates[_address].voteCount,
candidates[_address].ipfs,
candidates[_address]._address
);
}

///////////////////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"
);

Dept.of CSE,KIT,Tiptur 2024-2025 23


Decentralized Voting Application Using blockchain

_voterId.increment();

uint256 idNumber = _voterId.current();

Voter storage voter = voters[_address];

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
);
// }
}

function vote(address _candidateAddress, uint256 _candidateVoteId)


external
{
Voter storage voter = voters[msg.sender];

Dept.of CSE,KIT,Tiptur 2024-2025 24


Decentralized Voting Application Using blockchain

require(!voter.voter_voted, "You have already voted");


require(voter.voter_allowed != 0, "You have no right to vote");

voter.voter_voted = true;
voter.voter_vote = _candidateVoteId;

votedVoters.push(msg.sender);

candidates[_candidateAddress].voteCount += voter.voter_allowed;
}

function getVoterLength() public view returns (uint256) {


return votersAddress.length;
}

function getVoterData(address _address)


public
view
returns (
uint256,
string memory,
string memory,
address,
string memory,
uint256,
bool
)
{
return (
voters[_address].voter_voterId,
voters[_address].voter_name,
voters[_address].voter_image,
voters[_address].voter_address,
voters[_address].voter_ipfs,
voters[_address].voter_allowed,
voters[_address].voter_voted
);

Dept.of CSE,KIT,Tiptur 2024-2025 25


Decentralized Voting Application Using blockchain

function getVotedVotersList() public view returns (address[] memory) {


return votedVoters;
}

function getVoterList() public view returns (address[] memory) {


return votersAddress;
}

6.2 Summary

A decentralized voting application uses blockchain to ensure secure, transparent, and


immutable voting. Smart contracts, often written in Solidity, manage the election process,
including candidate registration and vote counting. Voters interact with the system via a web
interface, signing transactions with a wallet like MetaMask. Blockchain stores votes,
preventing tampering and ensuring transparency. The results are automatically calculated and
publicly verifiable, enhancing election integrity.

Dept.of CSE,KIT,Tiptur 2024-2025 26


Decentralized Voting Application Using blockchain

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.

the decentralized voting application utilizing blockchain technology presents a transformative


approach to modern elections. By leveraging blockchain’s core attributes—transparency,
immutability, decentralization, and security—this system can enhance the integrity of voting
processes, reduce fraud, and eliminate the risks of vote tampering. It ensures that every vote is
securely recorded and verifiable while maintaining voter anonymity.

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.

Dept.of CSE,KIT,Tiptur 2024-2025 27


Decentralized Voting Application Using blockchain

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.

Lastly, expanding the application’s global reach by ensuring it supports cross-chain


compatibility, multiple languages, and different governance models could make it suitable for
international elections. Integrating these enhancements could significantly improve the
decentralized voting system, making it more efficient, secure, and accessible to a wider range
of users and jurisdictions.

Dept.of CSE,KIT,Tiptur 2024-2025 28


Decentralized Voting Application Using blockchain

CHAPTER 9

RESULTS AND SNAPSHOTS


Our project “The decentralized voting application using blockchain” integrated with MetaMask
has proven to be an efficient and secure method for managing candidate registrations in a
blockchain-based election system. The application, consisting of four primary pages—Home,
Candidate Registration, Voter Registration, and Voter List—utilizes the MetaMask wallet to
facilitate secure interactions with the blockchain.

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.

Dept.of CSE,KIT,Tiptur 2024-2025 29


Decentralized Voting Application Using blockchain

SNAPSHOTS

Fig 10.1 :web page prompting users to connect their digital wallet for
blockch ain-based voting.

Dept.of CSE,KIT,Tiptur 2024-2025 30


Decentralized Voting Application Using blockchain

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.4 : Candidate registration form.

Dept.of CSE,KIT,Tiptur 2024-2025 31


Decentralized Voting Application Using blockchain

Fig 10.5 : Candidate registration form with profile picture upload and transaction
confirmation.

Fig 10.6 : Candidate profile page with voting option.

Dept.of CSE,KIT,Tiptur 2024-2025 32


Decentralized Voting Application Using blockchain

Fig 10.7 : Creation of new voter registration form

Fig 10.8 : Voter profile page with "Not Voted" status.

Dept.of CSE,KIT,Tiptur 2024-2025 33


Decentralized Voting Application Using blockchain

Fig 10.9 : Web page where the voter can vote

Fig 10.10 : Voter profile page with "You already Voted" status.

Dept.of CSE,KIT,Tiptur 2024-2025 34


Decentralized Voting Application Using blockchain

REFERENCES

Dept.of CSE,KIT,Tiptur 2024-2025 35

You might also like