0% found this document useful (0 votes)
7 views9 pages

Voting Assignement

voting System

Uploaded by

Asad Dawood Aziz
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views9 pages

Voting Assignement

voting System

Uploaded by

Asad Dawood Aziz
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 9

Blockchain Assignment: Due 26/6/2024

Please implement either of the following systems (using AI tools if you want)
that showcase the Blockchain problem solution:

1. Secure Voting System using Blockchain


2. Medicine authentication application Blockchain system
3. Bank Frauds prevention with Blockchain Technology
4. Property registration/transfer management
5. Academic Credentials Verification using Blockchain Technology
Your assignment should contain the following:

1. Problem Description with existing systems


2. Design of Blockchain solution
3. Simulation of the nodes, and process
4. Conclusions.

Please look at this paper for reference:

https://www.mdpi.com/2076-3417/11/22/10917

NAME : AQIB HUSSAIN


REG NO: FA20-BCE-024

1. Secure Voting System using Blockchain


assignment should contain the following:

1. Problem Description with existing systems


2. Design of Blockchain solution
3. Simulation of the nodes, and process
4. Conclusions.

Problem Description with existing systems


Current Challenges in Voting Systems:
Security: Traditional voting systems, including electronic
and paper-based, are vulnerable to tampering, fraud, and
cyberattacks. Transparency: Ensuring that votes are
counted accurately and that the process is transparent can
be challenging.
Trust: Voters need to trust that their votes are accurately
recorded and tallied.
Accessibility: Voting systems must be accessible to all
eligible voters, including those with disabilities.
Scalability: As populations grow, voting systems need to
handle an increasing number of voters without sacrificing
performance.
Existing Systems:
Paper Ballots: Traditional but prone to human error,
manipulation, and challenges in secure storage and
transportation.
Electronic Voting Machines: Offer quick vote counting
but are susceptible to hacking and software bugs.
Online Voting Systems: Convenient but often criticized for
potential security vulnerabilities and privacy concerns.

Design of Blockchain solution

Key Requirements for Blockchain Voting System:


Decentralization: Eliminate single points of failure and
reduce the risk of tampering.
Immutability: Ensure that once a vote is cast, it cannot be
altered or deleted.
Transparency: Allow for public verification of the voting
process while maintaining voter privacy.
Security: Protect against unauthorized access and
tampering.
Privacy: Ensure voter anonymity while allowing for the
verification of vote legitimacy.
Scalability: Efficiently handle large numbers of voters and
transactions.

Components of the Blockchain Voting System:

Blockchain Network: A network of nodes that maintain


and validate the blockchain ledger.
Smart Contracts: Programs that automate the voting
process, ensuring rules are followed without the need for
intermediaries.
Digital Identity Verification: Secure methods for voter
identification and authentication.
Voting Interface: User-friendly application for voters to
cast their ballots.
Audit and Verification Tools: Tools for verifying the
integrity of the voting process and results.

System Architecture:

Voter Registration: Voters are registered and issued a


unique digital identity on the blockchain.
Vote Casting: Voters cast their votes using a secure
application. Each vote is recorded as a transaction on the
blockchain.
Vote Counting: Votes are automatically tallied by smart
contracts. Verification: The blockchain allows public
verification of the voting process without compromising
voter privacy.
Results Publication: Final results are published on the
blockchain and can be audited by anyone.
Flow Diagram:
Simulation of the Nodes and Process Simulation
Environment:
To simulate this system, we will use a blockchain framework like Ethereum
for smart contracts and a test network such as Ganache for local blockchain
deployment.

Steps:
Setup Local Blockchain: Use Ganache to create a local Ethereum
blockchain with multiple nodes.
Smart Contract Development: Develop a smart contract in Solidity that
manages the voting process (registration, vote casting, and tallying).
Node Simulation: Simulate multiple nodes (validators) to demonstrate the
decentralized validation of votes.
Voting Process Simulation: Deploy the smart contract and simulate the
entire voting process, from registration to result publication.
CODE SCREENSHOT:

CODE:

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

contract Voting {
struct Voter {
bool registered;
bool voted;
uint vote;
}

struct Candidate {
string name;
uint voteCount;
}

address public admin;


mapping(address => Voter) public voters;
Candidate[] public candidates;

enum Phase {Reg, Vote, Done}


Phase public state = Phase.Reg;

constructor(string[] memory candidateNames) {


admin = msg.sender;
for (uint i = 0; i < candidateNames.length; i++) {
candidates.push(Candidate({
name: candidateNames[i],
voteCount: 0
}));
}
}

modifier onlyAdmin() {
require(msg.sender == admin, "Only admin can call this.");
_;
}

modifier inState(Phase _state) {


require(state == _state, "Invalid phase.");
_;
}

function registerVoter(address voter) public onlyAdmin


inState(Phase.Reg) {
require(!voters[voter].registered, "Already registered.");
voters[voter].registered = true;
}
function startVote() public onlyAdmin inState(Phase.Reg) {
state = Phase.Vote;
}

function vote(uint candidateIndex) public inState(Phase.Vote) {


Voter storage sender = voters[msg.sender];
require(sender.registered, "Not registered.");
require(!sender.voted, "Already voted.");
require(candidateIndex < candidates.length, "Invalid candidate.");

sender.voted = true;
sender.vote = candidateIndex;
candidates[candidateIndex].voteCount += 1;
}

function endVote() public onlyAdmin inState(Phase.Vote) {


state = Phase.Done;
}

function getWinner() public view inState(Phase.Done) returns (string


memory winnerName) {
uint maxVotes = 0;
uint winnerIndex = 0;
for (uint i = 0; i < candidates.length; i++) {
if (candidates[i].voteCount > maxVotes) {
maxVotes = candidates[i].voteCount;
winnerIndex = i;
}
}
winnerName = candidates[winnerIndex].name;
}
Conclusions
Benefits of Blockchain in Voting:
Enhanced Security: Decentralized nature and cryptographic mechanisms protect
against tampering and fraud.
Transparency and Trust: Publicly verifiable transactions increase transparency
and trust in the electoral process.
Immutable Record: Once votes are recorded, they cannot be altered, ensuring the
integrity of the election results.
Cost Efficiency: Reduces the need for intermediaries and manual verification
processes.
Accessibility and Convenience: Enables remote and secure voting for all eligible
voters.

Challenges:
Scalability: Managing a large number of transactions in a short time can be
challenging for blockchain networks.
Complexity: Developing and maintaining blockchain-based systems requires
specialized knowledge.
Voter Privacy: Balancing transparency with voter anonymity is crucial. Adoption:
Legal, regulatory, and public acceptance barriers need to be addressed.
Prospects: Blockchain-based voting systems have the potential to revolutionize
electoral processes by making them more secure, transparent, and efficient.
Continued advancements in blockchain technology and increasing trust in
decentralized systems could pave the way for widespread adoption in future
elections.

You might also like