0% found this document useful (0 votes)
2 views

Electronic Voting System using Blockchain (1)

This project report presents the development of an electronic voting system utilizing blockchain technology to enhance security, transparency, and integrity in elections. The proposed system leverages blockchain's decentralized nature to create an immutable ledger of votes, ensuring voter anonymity and preventing unauthorized access. The report outlines the system's architecture, methodology, and the expected contributions to knowledge in the field of electronic voting.

Uploaded by

victorseriki1
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

Electronic Voting System using Blockchain (1)

This project report presents the development of an electronic voting system utilizing blockchain technology to enhance security, transparency, and integrity in elections. The proposed system leverages blockchain's decentralized nature to create an immutable ledger of votes, ensuring voter anonymity and preventing unauthorized access. The report outlines the system's architecture, methodology, and the expected contributions to knowledge in the field of electronic voting.

Uploaded by

victorseriki1
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 76

A PROJECT REPORT ON THE DEVELOPMENT OF AN

ELECTRONIC VOTING SYSTEM USING BLOCKCHAIN

BY

ADEYEYE OMOKOREDE ELISHA (CSC/17/2154)

AND

DARE-OWONIBI SAMUEL (CSC/17/2176)

SUBMITTED TO THE DEPARTMENT OF COMPUTER SCIENCE IN PARTIAL

FULFILMENT OF THE REQUIREMENT FOR THE AWARD OF BACHELOR OF

TECHNOLOGY (B. TECH) DEGREE IN COMPUTER SCIENCE OF THE

FEDERAL UNIVERSITY OF TECHNOLOGY, AKURE, NIGERIA

DECEMBER, 2023

SUPERVISOR: DR. OSUOLALE FESTUS


CERTIFICATION

I hereby certify that this research project was undertaken and written by ADEYEYE

OMOKOREDE ELISHA with matriculation number CSC/17/2154 of the department of

Computer Science, School of Computing, Federal University of Technology, Akure, Nigeria.

________________________________ _____________________

ADEYEYE OMOKOREDE ELISHA DATE

CSC/17/2154

This is to certify that this project report was written by ADEYEYE OMOKOREDE

ELISHA (CSC/17/2154)

________________________________ _____________________

DR. OSUOLALE FESTUS DATE

SUPERVISOR

1
DEDICATION

In profound gratitude, I dedicate this work to the Almighty, whose grace has illuminated my

path and granted me the strength to embark on this academic journey. To those whose

unwavering support and encouragement fueled the journey of this paper, I extend my

heartfelt gratitude. To my family, whose love provided the foundation for my endeavors, and

whose understanding and patience sustained me through the countless hours spent in pursuit

of knowledge. To my Supervisor and lecturers, whose guidance illuminated the path of

intellectual discovery and fostered a passion for learning that transcends the boundaries of the

classroom. To my friends, whose camaraderie and shared enthusiasm added joy to the

challenging moments and transformed the process of writing into a collaborative adventure.

This project stands as a tribute to the collective spirit of those who believe in the power of

knowledge and the transformative potential of dedicated inquiry. May the insights contained

within these pages serve as a testament to the collaborative pursuit of understanding and the

shared commitment to the pursuit of knowledge.

2
ACKNOWLEDGEMENT

I would like to express my sincere appreciation to all those who contributed to the completion

of this paper.

First and foremost, I extend my deepest gratitude to my supervisor, Dr. Osulale Festus, whose

guidance and expertise were invaluable throughout every stage of this research. Your

supervision has been instrumental in shaping both the content and structure of this project.

My heartfelt thanks go to Samuel Dare-Owonibi, whose collaboration and shared insights

enhanced the depth and breadth of this study. The synergy of our efforts has truly made this

project a collaborative success.

To my colleagues and peers who provided a stimulating intellectual environment, I am

grateful for the valuable discussions and exchange of ideas that have undoubtedly shaped the

outcome of this paper.

Last but not least, I want to express my appreciation to my family and friends for their

unwavering support, encouragement, and understanding during the challenging moments of

this academic endeavor.

Each of you has played a vital role in the realization of this work, and for that, I am truly

thankful.

3
ABSTRACT

The increasing reliance on electronic voting systems to facilitate democratic processes has

raised concerns about the security, transparency, and integrity of election results. This project

introduces an innovative electronic voting system built on blockchain technology to address

these challenges. Leveraging the decentralised and tamper-resistant nature of blockchain, the

proposed system ensures a secure and transparent voting process.

The architecture of the electronic voting system integrates blockchain to create an immutable

and transparent ledger of votes. Each vote is cryptographically secured and recorded as a

transaction on the blockchain, preventing unauthorised access and tampering. Smart contracts

are employed to automate the execution of election rules, enhancing the efficiency of the

voting process and reducing the risk of human error.

Furthermore, the decentralised nature of the blockchain ensures that no single entity has

control over the entire system, mitigating the risk of central points of failure or manipulation.

The use of cryptographic techniques guarantees the anonymity of voters, preserving the

confidentiality of their choices while still allowing for verifiable and auditable results.

4
TABLE OF CONTENTS

TABLE OF CONTENTS 2

CHAPTER ONE 4

INTRODUCTION 5

1.1 Introduction 5

1.2 Background to the Study 5

1.3 Motivation 7

1.4 Objectives 7

1.5 Methodology 8

Structure and Design of Blockchain 9

Blocks 9

Block Time 10

Decentralisation 10

Smart Contract 11

Benefits Of Smart Contracts 11

Voting and Blockchain Implementation of Smart Contracts 12

The Election Process 12

Front End System Architecture 15

1.6 Expected Contribution to knowledge 17

1.7 Organisation of the project

18

5
CHAPTER TWO 19

LITERATURE REVIEW 19

2.1 Security 21

2.2 Privacy 25

2.3 Regulatory Framework 27

2.4 Acceptance 29

CHAPTER THREE 31

SYSTEM DESIGN 31

3.1 Introduction 31

3.2 Detailed Description Of The Layered Approach 33

3.3 Requirement Analysis 36

3.3.1 The Registration System 36

3.3.2 The Election Process 40

CHAPTER FOUR 47

SYSTEM IMPLEMENTATION, RESULTS AND EVALUATION 47

4.1 The Election Process 47

4.1.1 The Frontend 47

4.1.2 The Backend 52

4.2 The Smart Contract and BlockChain 56

4.3 Performance Evaluation

64

6
CHAPTER FIVE 66

SUMMARY, CONCLUSION AND RECOMMENDATION 66

5.1 Summary 66

5.2 Conclusion 66

5.3 Recommendation 67

5.4 Contribution to knowledge 67

7
LIST OF FIGURES

Figure 1.0: Election process flow chart

Figure 1.1 System Architecture

Figure 3.1: Architecture of a Blockchain based Electronic Voting system

Figure 3.2: A Simple Smart Contract

Figure 4.1: React Project Setup

Figure 4.2: Frontend project folder structure using React

Figure 4.3: Frontend code snippets

Figure 4.4: Users Authentication Page

Figure 4.5: User Dashboard Page

Figure 4.6: Backend Project Initialisation.

Figure 4.7: JWT Authentication Services

Figure 4.8: Authentication Services and Routes Controller

Figure 4.9: Node project Initialization

Figure 4.10 Installing Hardhat

Figure 4.11: Initializing Hardhat

Figure 4.12: File Structure

Figure 4.13: Contract creation and Candidate definition

Figure 4.14 Candidate Constructor

Figure 4.15: AddCandidate and Vote Functions

Figure 4.16: Utility Functions

Figure 4.17: Artifacts

Figure 4.18 Deploy.js file

Figure 4.19 Hardhat.config File

Figure 4.20: Usage Statistics of the election contract deployed using Alchemy

8
Figure 4.21: Transactional Statistics for Alchemy

Figure 4.22: Success rate of voting

9
CHAPTER ONE

INTRODUCTION

1.1 Introduction

Electronic voting systems (EVS) have emerged as a promising solution to modernise the

voting process, offering increased convenience, accessibility, and efficiency. However,

traditional EVS have been plagued by security concerns, raising doubts about the integrity

and fairness of elections. Blockchain technology, renowned for its decentralised and

tamper-proof nature, has emerged as a potential game-changer in addressing these concerns.

By leveraging blockchain's inherent security and transparency, electronic voting systems can

be transformed into more secure, auditable, and trustworthy platforms.

1.2 Background to the study

The introduction of the internet has started to transform how routine tasks are now carried

out. In the early 2000s, voting procedures were entirely manual and relied on hard-coded

physical databases in addition to paper ballots. Electronic Voting Management (EVM) was

introduced to address this. Electronic voter registration databases, BVERs for biometric

authentication, and paper ballots for voting are the main characteristics of this new approach.

Although the EVM offers a solution to the issues posed by the conventional voting

mechanism, because it cannot address some security vulnerabilities, it still faces challenges

with widespread acceptance. Its shortcomings include the need for manual work to count

votes, authenticate legitimate or invalid votes, and record the total number of votes into the

database using BVERs. Voter anonymity and privacy are always major concerns in the

electoral process.

10
In the context of information security, the term "privacy" refers to the idea that personal

information will be gathered, exchanged, and used in such a way that only the system and

those parties directly involved in the process will have access to it. Additionally, anonymity

means that during any data or information transaction in the system, the user will remain

anonymous. Although voting methods are said to be secure, these two crucial terms are

largely lacking today.

If a voting system is built to securely store votes, it offers the maximum level of security. No

one may be able to manipulate or tamper with the votes in the system. But they may not

ensure voter privacy and anonymity at all. In this type of system, every candidate and the

authorities can identify the voters who have voted for each candidate. It violates the two

major factors of information security: Anonymity and Privacy. The systems may be secured

to store the votes, but somehow they fail to provide the voters anonymity and privacy (Bosri

et al., 2023).

Election is the process by which voters choose their representative from a field of contenders;

it is the most common means for voters to express their opinions. A fair election is a must for

a country to be democratic since it offers the populace a chance to approve of how the

democratic government has been operating. Only through holding fair elections will

authorised bodies be able to maintain the public's faith in democracy. One weakness of the

current method is that there is only one point of control or failure. The Authority may be

dishonest or corrupt. Adopting a decentralised, distributed system that assesses transactions,

votes, and data per user and peer consensus is the solution (Spanos & Kantzavelou 2021).

11
The Ethereum Blockchain network is proposed in this paper as the foundation for a secure

electronic voting system that places a strong emphasis on the identification of qualified

voters.

Without any servers or databases run by a central authority, the suggested method will fully

rely on Blockchain, enhancing election costs, security, and privacy. To make the suggested

electronic voting system perfect and prepared for usage in national elections, limitations,

issues, and solutions are examined.

1.3 Motivation

With the increase in the electoral malpractice and the non-transparence of the current

electoral system, it is imperative to design and develop a transparent and accountable

software system of elections that will feature a decentralised system that leverages the shared

ledger feature of the blockchain network to promote accountability and increase transparency

and also increase voter turnout as it is more convenient for people to vote especially those in

rural areas.

1.4 Objectives

The objectives of this research are to:

a. design a system of voting based on the Ethereum blockchain method that facilitates a

decentralised form of election free from threats and all forms of electoral malpractice.

b. implement the model designed in (a); and

c. evaluate the performance of the developed model based on standard performance

metrics.

12
1.5 Methodology

The proposed system comprises three major components, which are:

a. The Blockchain

b. Smart Contracts

c. The Election Process

Blockchain is a technique for storing data that makes it difficult or impossible for the system

to be altered, hacked, or otherwise abused. A blockchain is a type of distributed ledger that

distributes and copies transactions among the network of computers involved.

Blockchain technology is an organisational framework that maintains public transactional

information, also known as the "block," in several databases, also known as the "chain," in a

network connected by peer-to-peer nodes. This type of storage is frequently referred to as a

"digital ledger."

Every transaction in this ledger is validated and protected against fraud by the owner's digital

signature, which also serves to authenticate the transaction. As a result, the data in the digital

ledger is quite safe.

The digital ledger can be described as a network of computers sharing a Google spreadsheet

where transactional data is kept according to actual purchases. The intriguing aspect is that

while everyone may view the data, it cannot be altered.

Blockchain technology is an emerging technology in the digital world, and some of its

advantages include:

a. High-Security Structure: It employs a digital signature feature to execute fraud-free

transactions and makes it hard for other users to corrupt or edit a person's data without

that user having a specific digital signature.

13
b. Decentralised System: In the past, transactions required the approval of regulatory

bodies like a government or bank; but, with Blockchain, transactions are completed

by user consensus, resulting in smoother, safer, and faster transactions.

c. Automation Capability: It is programmable and can generate systematic actions,

events, and payments automatically when the criteria of the trigger are met.

(Ravikiran, 2023)

Structure and Design of Blockchain

At its heart, a blockchain is a chain of immutable, distributed, and decentralised blocks,

where each block has a collection of data. The blocks are connected using cryptographic

methods to create a logical chain of information. The consensus mechanism of a blockchain,

which features a network of nodes that concur on the authenticity of transactions before

adding them to the blockchain, is built to secure the security of data. Major key features and

components of the blockchain include:

Blocks

In a blockchain, a block is made up of three primary parts:

a. The header: Made up of four components or main headers, which are:

i. Previous Hash: The preceding block can be found at this hash address.

ii. Transaction Details: Information about each transaction that must take place

iii. Nonce: An arbitrary number given in cryptography to differentiate the block’s

hash address.

iv. Hash Address of the Block: A hashing algorithm is used to transfer the

information mentioned above (preceding hash, transaction information, and nonce).

14
This produces an output that is the distinct "hash address," which is a 256-bit number

with 64 characters in length. As a result, it is referred to as the block hash.

b. The major and actual information, such as transactions and smart contracts that are

recorded in the block, is contained in the data portion.

c. The hash, which is the final cryptographic value, serves as a unique representation of the

entire block and is used for verification.

Block Time

Block time in a blockchain refers to how long it takes to add a new block. Depending on the

blockchain, the time between blocks might range from a few seconds to several minutes or

even hours. The timing for transaction confirmations may be extended with longer blocks

while the risk of conflicts is reduced. Faster confirmation of transactions might be possible

with shorter block periods, although conflicts are more likely to occur.

Decentralisation

The main characteristic of blockchain technology is decentralisation. No single central

authority can rule the network on a decentralised blockchain. A network of nodes that jointly

validate and approve the transactions to be added to the blockchain constitutes the

decentralised decision-making system. Blockchain technology's decentralised nature aids in

fostering security, trust, and transparency. Additionally, it decreases the hazards associated

with data manipulation and lessens the risk of relying on a single point of failure (Ravikiran,

2023).

15
Smart Contract

Smart contracts are computer programs or protocols that automate transactions that are kept

on a blockchain and executed in response to certain criteria being met. In other words, smart

contracts automate the execution of agreements so that all players can know the outcome as

quickly as feasible, without the need for a middleman or a time delay.

Smart contracts are self-executing contracts in which the buyer-seller agreement is written

directly into lines of code.

Smart contracts, according to Nick Szabo, an American computer scientist who invented a

virtual currency called "Bit Gold" in 1998, are computerised transaction protocols that carry

out contract terms.

It makes transactions traceable, transparent, and irrevocable when used. (Arora, 2023)

Benefits Of Smart Contracts

a. Accuracy, speed, and efficiency: When a condition is satisfied, the contract is

promptly executed. There is no paperwork to deal with, and no time is wasted fixing

mistakes that can happen when filling out papers by hand because smart contracts are

digital and automated.

b. Trust and openness: Since no third party is involved and participants share encrypted

transaction logs, there is no need to worry about data being altered for personal

advantage.

c. Security: Blockchain transaction records are very hard to compromise since they are

encrypted. Additionally, hackers would need to alter the entire chain to alter a single

record on a distributed ledger because each entry is connected to the entries that came

before and after it.

d. Cost-Effective: Smart contracts do away with the need for middlemen and all

associated costs and delays associated with them (Arora, 2023).

16
Voting and Blockchain Implementation of Smart Contracts

Common issues can be resolved by implementing Blockchain in the voting process. When it

comes to counting votes, a centralised voting system has problems due to voter bias, identity

fraud, and miscounts. Certain specified terms and conditions are pre-set in the contract when

using a smart contract.

No voter may cast a ballot using a digital identity other than their own. The calculations are

error-free. Each vote is recorded on a blockchain network, and the results are automatically

tallied without the need for a third party to intervene or rely on a manual process. One vote is

assigned to each ID. The users of the blockchain network itself carry out validation.

As a result, each vote is noted in the ledger, and the data is unchangeable. That ledger is open

to audit and scrutiny by anyone.

Smart contracts enable the creation of voting systems in which members can be added and

removed, voting rules can be changed, debating periods can be changed, and the majority rule

can be altered. Within a decentralised autonomous organisation, for example, a vote of

decision can be created. Rather than a decision being made by a central authority, a voting

mechanism within the organisation can determine whether the proposal is approved or

rejected.

The Election Process

The election process would consist of service calls from the smart contract triggered by event

calls from the frontend.

The Smart Contract would consist of the following components:

1. Initialise a new contract: Election contract {}

2. Create an Election struct

3. Create a Poll struct

4. From Election contract: initialise a constructor so ‘msg.sender == owner’.

17
5. Create Vote Event

6. Create Vote function

7. Create a Vote Counter function

8. Emit Vote Event

9. Create additional modifiers to enhance security

Figure 1.0: Election process flow chart

18
Front End System Architecture

Designing an electronic voting system for a web application requires careful consideration of

security, scalability, and usability. Below is an architectural outline for an electronic voting

system:

The frontend is the user interface through which voters interact with the system. It is designed

to be intuitive, accessible, and responsive to work across different devices and screen sizes.

Technologies like HTML5, CSS, and JavaScript frameworks (e.g., React, Angular, or Vue.js)

can be used for frontend development. However, for the scope of this project, we will be

considering React.

The backend is responsible for processing requests from the frontend, handling business

logic, and interacting with the database. It is built with a robust server-side programming

language like Python, Java, Ruby, or Node.js. APIs (Application Programming Interfaces)

should be designed to handle various operations like user authentication, vote casting, and

result retrieval. However, for the case of this project, we will be considering Node.js and

surrounding libraries and dependencies

The database stores all the necessary information, including user data, candidate information,

and voting records. For this project, we will be considering restricting MongoDB access to

the database to enable access security and prevent unauthorised access.

Implement a secure authentication system to verify voter identities using national

Identification Numbers or voter card numbers. Additionally, traditional methods like

username and password or more modern approaches like multi-factor authentication would

also be implemented. Authorization mechanisms would be in place to restrict access to

certain functionalities based on user roles (voter, administrator, etc.).

19
Security is of utmost importance in a voting system. Use of SSL/TLS encryption to secure

communication between the client and server. Implementation of measures to prevent

common vulnerabilities like Cross-Site Scripting (XSS), Cross-Site Request Forgery (CSRF),

and SQL injection Regular updates and patches for all software components are needed to

protect against known vulnerabilities.

Designing the voting process to be simple, clear, and tamper-resistant also means providing

voters with a list of candidates or options and allowing them to cast their votes securely,

ensuring that each voter can only cast one vote in a particular election.

Maintaining comprehensive audit logs to track user activities and system events. Logs could

be useful for post-election audits and investigating any suspicious activities.

Plan for scalability to handle a large number of voters during peak times by using vertical and

horizontal scaling of the server and implementing load balancers using Nginx and

auto-scaling mechanisms to distribute the load across multiple servers.

Rigorous testing of the system is needed to identify and fix any bugs or vulnerabilities.

Conducting penetration testing and security assessments to ensure the system's resilience

against attacks

20
Figure 1.1 System Architecture

21
1.6 Expected Contribution to knowledge

At the end of this work, a blockchain based election system that leverages on the principles of

decentralisation and shared ledger systems would have been developed.

1.7 Organisation of the project

This project is organised as follows: In Chapter Two, an in-depth examination of comparable

works and current literature is carried out in order to identify potential gaps and establish the

rationale for performing this research. The third chapter looks into the methodology used for

system design and extensive analysis. The following chapter, Chapter Four, describes the

implementation procedure and displays the results and evaluations gained. The conclusion of

this study is embodied in Chapter Five, where recommendations emerge from newly

discovered insights, contributing to the advancement of knowledge.

22
CHAPTER TWO

LITERATURE REVIEW

Electronic voting (e-voting) is the use of electronic means to cast and count votes. It has the

potential to increase voter turnout, make voting more convenient, and reduce the cost of

elections. However, e-voting also raises a number of security and privacy concerns.

Blockchain is a distributed ledger technology that can be used to create a secure and

transparent voting system. A blockchain is a tamper-proof database that is shared across a

network of computers. This makes it very difficult to hack or manipulate the data.

Advantages of Blockchain for E-voting

The use of blockchain for e-voting can offer a number of advantages, including:

1. Security: Blockchain is a very secure technology. The data in a blockchain is

encrypted and distributed across a network of computers, making it very difficult to

hack or manipulate.

2. Transparency: The data in a blockchain is transparent, meaning that anyone can view

it. This can help increase trust in the voting system.

3. Accuracy: Blockchain is a very accurate technology. The data in a blockchain cannot

be changed once it is added, which helps to ensure that the results of an election are

accurate.

4. Cost-effectiveness: Blockchain can be a cost-effective way to run elections. It can

eliminate the need for paper ballots and other voting infrastructure, which can save

money.

5. Accessibility: Blockchain can make voting more accessible to people who are unable

to vote in person, such as those who live overseas or who have disabilities.

23
Challenges of Blockchain for E-voting

Despite the advantages of blockchain, there are also a number of challenges that need to be

addressed before it can be widely adopted for e-voting. These challenges include:

1. Complexity: Blockchain is a complex technology, and it can be difficult to develop

and implement a secure and reliable blockchain-based voting system.

2. Regulation: The use of blockchain for e-voting is still in its early stages, and there is

no clear regulatory framework in place. This can make it difficult to deploy and use

blockchain-based voting systems.

3. Acceptance: There is still some public scepticism about the use of blockchain for

e-voting. This is due to concerns about security and privacy.

Blockchain has the potential to revolutionise e-voting by making it more secure, transparent,

and accurate. However, there are still a number of challenges that need to be addressed before

blockchain can be widely adopted for e-voting.

The following areas are to be considered in the research on blockchain for e-voting:

1. Security: How can the safety of blockchain-based voting systems be further

improved?

2. Privacy: How can the privacy of voters be protected in blockchain-based voting

systems?

3. Regulation: What is the best regulatory framework for blockchain-based voting

systems?

4. Acceptance: How can public acceptance of blockchain-based voting systems be

improved?

24
2.1 Security

Here are some ways to improve security on a blockchain-based e-voting system:

i. Use a private blockchain: A private blockchain is a blockchain that is only accessible to

authorised users. This can help protect the security of the system by preventing unauthorised

access to the data.

ii. Use strong encryption: The data in a blockchain-based voting system should be

encrypted using strong encryption algorithms. This can help protect the data from being

accessed or modified by unauthorised users.

iii. Use a secure voting protocol: The voting protocol should be designed to be secure and

tamper-proof. This can help prevent fraud and errors in the voting process.

iv. Use a trusted voting authority: A trusted voting authority can help verify the identity of

voters and ensure that the voting process is conducted fairly.

v. Audit the system regularly: The system should be audited regularly to ensure that it is

secure and functioning properly. This can help identify and address any security

vulnerabilities.

In addition to these measures, it is important to educate voters about the security risks of

blockchain-based voting systems and how to protect themselves from fraud.

Some additional considerations for improving security on a blockchain-based e-voting

system:

Use a distributed ledger: A distributed ledger is a database that is shared across a network of

computers. This can help protect the data from being tampered with or deleted by a single

entity.

Use a consensus mechanism: A consensus mechanism is a way to agree on the state of the

blockchain. This can help prevent fraud and errors in the voting process.

25
Use a secure hardware wallet: A secure hardware wallet is a physical device that can be

used to store cryptocurrency keys. This can help protect the keys from being stolen or

hacked.

A study was conducted to compare the efficacy of the EVM system to that of the

Blockchain-based voting method. Given recent charges of identity theft, forged ballots, and

corruption, a trustworthy voting system is critical. Transportation costs, infrastructure

expenditures, and security fees must all be cut. To address the difficulties raised above, a plan

to build a blockchain-based electronic voting system has been put in place. Blockchain is a

distributed ledger that ensures trust and transparency. Cryptographic security also assures that

each voter's ballot is secure. (Pankaj et al., 2023).

Electronic voting has emerged over time as a replacement for paper-based voting in order to

eliminate redundancy and inconsistency. According to the historical perspective offered

during the last two decades, it has not been as effective due to security and privacy problems

discovered throughout time. This paper proposes a system for ensuring data security by

utilising effective hashing techniques. The concept of creating and sealing blocks is

presented. The implementation of a block-sealing idea aids in the adaptation of the

blockchain to fit the needs of the polling process.

It is recommended to use consortium blockchain, which assures that the blockchain is held by

a governing body (e.g., the election commission) and that no unauthorised access may be

made from outside. (Basit 2019).

By following these measures, it is possible to improve the security of the system. However, it

is important to note that no system is completely secure. It is important to continuously

monitor and improve the security of any blockchain-based voting system.

26
Another way to ensure efficient security and ensure data integrity is in the usage of

cryptographic encryptions. There are a number of encryption algorithms that can be used to

protect sensitive

data on the blockchain. Some of the most common algorithms include:

Advanced Encryption Standard (AES): AES is a symmetric-key encryption technique used

to encrypt and decrypt data. AES is a highly secure algorithm that is widely utilised in a wide

range of applications, including blockchain technology.

Rivest-Shamir-Adleman(RSA): RSA is a public-key encryption technique for encrypting

and decrypting data. RSA is less secure than AES, but it is faster to compute. RSA is

frequently combined with symmetric-key encryption methods such as AES.

Elliptic curve cryptography (ECC): ECC is a public-key encryption algorithm based on

elliptic curve mathematical features. ECC is a very safe algorithm that is also faster to

compute than RSA. ECC is often used in blockchain technology, as it is well-suited for use in

resource-constrained environments.

The ECC encryption algorithm is utilised in the process of development of the electronic

voting system. A mathematical representation of the encryption process for key exchange is

depicted.

1. Key Generation:

i. An Elliptic curve E is chosen and defined over a field Fp.

ii. A base point G is selected on the elliptic curve, and a large prime number of order

n is specified for the base point.

iii. A private key d is randomly chosen from the interval [1, n - 1].

iv. The public key is computed as:

27
Q=d*G 1

where: Q = public key, d = private key

2. Key Exchange

i. Two parties A and B (Voter and Election Contract) each generate a pair of ECC key

pairs.

ii. A computes: PA = dA * G 2

and sends PA to B

iii B computes: PB = dB * G 3

and sends PB to B

iv. Both parties computes a shared secret S using the received public key and their

own private key:

S = dA * PB = dB * PB 4

The shared secret S can be used directly as a symmetric encryption key or to derive such a

key. It's important to note that ECC provides the same level of security as traditional

public-key algorithms (like RSA) with much shorter key lengths, making it more efficient for

many applications, hence the reason it is considered for use in this project.

28
2.2 Privacy

(Kantharaju et al., 2022) addressed the drawbacks of using blockchain technology in voting

systems. These constraints are primarily focused on privacy protection and transaction speed.

For a sustainable blockchain-based electronic voting system, the security of remote

participation must be realistic, and transaction speed must be addressed for scalability. As a

result of these concerns, it was decided that the existing frameworks needed to be improved

before being used in the voting system.

Cryptographic encryption systems such as homomorphic encryption and oblivious

transmission, as defined by Adnan & Avi (2019), can be employed to ensure voter

anonymity during the election process.

Homomorphic Encryptions

Homomorphic encryption is a type of encryption that allows computations to be performed

on encrypted data without decrypting it first. This can be useful for a variety of applications,

such as voting, healthcare, and finance.

In blockchain, homomorphic encryption can be used to improve the security and privacy of

transactions. For example, it can be used to encrypt votes so that they cannot be tampered

with, or to encrypt medical records so that only authorised users can access them.

There are two main types of homomorphic encryption: partially homomorphic encryption and

fully homomorphic encryption. Partially homomorphic encryption can only perform a limited

number of computations on encrypted data, while fully homomorphic encryption can perform

any computation.

The BGV (Brakerski et al., 2014) encryption scheme technique was used, which requires the

input of a ciphertext and a secret key with significant noise. It produces the same data in an

unencrypted form along with a predetermined quantity of noise. Additionally, it made use of

29
a key-switching technique that enables the conversion of ciphertext that has been encrypted

using a secret key. In order to share the model and data securely through the distributed

blockchain network, we use homomorphic encryption. The encrypted model from the earlier

research was uploaded to a centralised server. A decentralised blockchain network was not

taken into consideration. It is important to note how affordable the blockchain database is.

For this reason, we encrypt the model using homomorphic encryption, which also aids in

aggregating the whole model ( Rajesh et al 2022).

Oblivious Transmission

Oblivious transfer (OT) can be used to protect voters' privacy in an e-voting system by

allowing voters to cast their votes without revealing their identities or the candidates they

voted for.

In an OT-based e-voting system, the voter would first generate two encrypted ballots, one for

each candidate. The voter would then send one of the encrypted ballots to the voting server,

and the other encrypted ballot would be kept by the voter.

The voting server would not be able to tell which encrypted ballot was sent by the voter, and

the voter would not be able to tell whether the voting server received the encrypted ballot for

the candidate they voted for or the encrypted ballot for the other candidate.

This way, the voter's privacy is protected because the voting server cannot learn who the

voter voted for, and the voter cannot prove to anyone else how they voted

30
2.3 Regulatory Framework

The best regulatory framework for blockchain-based voting systems is still being debated, but

there are a few key principles that should be considered.

First, the framework should ensure the security and integrity of the voting system. This

means that the system should be resistant to fraud and manipulation and that the results of

elections should be verifiable. Second, the framework should protect the privacy of voters.

This means that voters should not be able to be identified by their votes and that their votes

should not be able to be traced back to them. Third, the framework should be accessible to all

voters. This means that the system should be easy to use and should be available to all voters,

regardless of their technical skills or access to technology. Fourth, the framework should be

transparent. This means that the system should be open to public scrutiny and that voters

should be able to understand how it works. Fifth, the framework should be accountable. This

means that there should be mechanisms in place to hold those responsible for the voting

system accountable for any errors or irregularities.

These are just some of the key principles that should be considered when developing a

regulatory framework for blockchain-based voting systems. The specific requirements of any

given framework will vary depending on the specific context and the specific needs of the

jurisdiction.

Here are some of the specific regulatory considerations for blockchain-based voting systems:

1. Security: The system should be designed to be resistant to fraud and manipulation.

This could include measures such as using strong cryptography, ensuring the integrity

of the data, and preventing unauthorised access to the system.

2. Privacy: The system should protect the privacy of voters. This could include

measures such as using anonymous voting or encrypting voter data.

31
3. Accessibility: The system should be accessible to all voters. This could include

measures such as providing voter education and assistance and making the system

available in multiple languages.

4. Transparency: The system should be open to public scrutiny. This could include

measures such as publishing the source code of the system and allowing independent

audits.

5. Accountability: There should be mechanisms in place to hold those responsible for

the voting system accountable for any errors or irregularities. This could include

measures such as establishing an independent oversight body or requiring regular

audits.

The development of a regulatory framework for blockchain-based voting systems is a

complex and challenging task. However, it is an important one, as these systems have the

potential to revolutionise the way we vote. By carefully considering the key principles

outlined above, we can create a regulatory framework that will help to ensure the security,

privacy, accessibility, transparency, and accountability of these systems.

With advancements in blockchain technology, researchers have begun to emphasise the

fundamental principle of decentralisation. This study introduces a decentralised electronic

voting and auction mechanism based on a blockchain and smart contract. To strengthen

privacy protection, cryptographic approaches such as oblivious transmission and

homomorphic encryption are applied. The suggested solutions enable voters and bidders to

engage in the initial phase while improving participant anonymity, data transmission privacy,

and data dependability and verifiability. (Raylin et al., 2019)

32
2.4 Acceptance

Public acceptance of blockchain-based e-voting systems can be improved in a number of

ways, including:

1. Education and awareness: Many people are not familiar with blockchain technology

or how it could be used for e-voting. It is important to educate the public about the

benefits of blockchain-based e-voting, such as its security, transparency, and

auditability. This can be done through public awareness campaigns, educational

materials, and workshops.

2. Pilot projects and trials: Conducting pilot projects and trials of blockchain-based

e-voting systems can help to build public trust and confidence in the technology. This

can also help to identify and address any potential challenges with the technology

before it is deployed on a larger scale.

3. Independent audits and reviews: Having independent audits and reviews of

blockchain-based e-voting systems can help to ensure that they are secure and

reliable. This can also help to identify any areas where the systems can be improved.

4. Transparency and accountability: It is important to ensure that blockchain-based

e-voting systems are transparent and accountable. This means that voters should be

able to understand how the system works and how their votes are counted. It also

means that there should be mechanisms in place to ensure that the system is not

tampered with.

5. Public engagement: It is important to involve the public in the development and

implementation of blockchain-based e-voting systems. This can be done through

public consultations, surveys, and other forms of engagement.

Here are some specific steps that can be taken to improve public acceptance of

blockchain-based e-voting systems:

33
1. Develop educational materials and resources for the public. This could include

brochures, websites, and videos that explain what blockchain technology is and how it

can be used for e-voting. These materials should be written in clear and concise

language that is easy for the general public to understand.

2. Conduct pilot projects and trials of blockchain-based e-voting systems. This could be

done in small communities or for specific groups of voters, such as students or

military personnel. The results of these pilot projects and trials should be published

and made available to the public.

3. Have independent audits and reviews of blockchain-based e-voting systems

conducted by reputable organisations. The results of these audits and reviews should

be published and made available to the public.

4. Design blockchain-based e-voting systems to be transparent and accountable. This

could involve using open source software and making the source code available for

public review. It could also involve using public ledgers to record and store voting

data.

5. Engage the public in the development and implementation of blockchain-based

e-voting systems. This could be done through public consultations, surveys, and other

forms of engagement.

By taking these steps, it is possible to improve public acceptance of blockchain-based

e-voting systems and pave the way for their widespread adoption.

34
CHAPTER THREE

SYSTEM DESIGN

3.1 Introduction

Elections are to be conducted on a safe, transparent, and auditable platform through the use of

blockchain technology in an electronic voting system. The voting data security and

tamper-proof results are guaranteed by the system, which utilises the immutability and

decentralisation inherent in blockchain technology.

Blockchain technology works by creating a safe and transparent environment for financial

transactions involving virtual currencies such as bitcoin. Each block's hash code keeps

records safe in the blockchain. This is mostly due to the fact that, regardless of the size of the

information or document, the mathematical hash function generates a hash code of the same

length for each block. Attempting to modify a block of data would result in a whole different

hash value (Haque & Mahbubur, 2020).

A network that is available to all while maintaining user anonymity generates trust concerns

among participants. To create confidence, participants must go through numerous consensus

methods, such as Proof of Work and Proof of Stake. The digital cryptocurrency Bitcoin

makes use of the world's first blockchain technology (Ahram et al., 2017). It is a digital

currency that allows peer-to-peer transactions via the internet without the involvement of a

third party. The blockchain network is a decentralised system made up of dispersed nodes

(computers) that audit and confirm the legitimacy of any new transactions that seek to take

place. The mining method achieves this combined agreement using many consensus models.

The mining process demonstrates that any node attempting to add a new transaction has gone

through and solved the complicated computational problem through extensive work and

deserves to be compensated for their efforts. The suggested e-voting system is based on

Ryan's (2008) well-established Prêt à Voter e-voting technique. The system has been created

35
to support a voting application in a real-world context while taking specific needs like

privacy, eligibility, ease, and verifiability into account. The proposed solution tries to offer

safe digital voting while remaining usable. In this context, the system is developed with a

web-based interface to enhance user involvement with features such as fingerprinting to

prevent double voting. With an obvious need to administer voters, constituencies, and

candidates for constituencies, a user-friendly administrator interface is built to facilitate

access. Furthermore, the system provides equal participation rights to all voters and fosters

fair and healthy competition among all candidates while maintaining voters' anonymity.

36
3.2 Detailed Description Of The Layered Approach

Figure. 3.1 depicts the suggested e-voting system architecture, which has been separated into

many layers to achieve modular design. These layers are described below;

Figure 3.1: Architecture of a Blockchain based Electronic Voting system

37
User Interaction and Front-end Security layer: Just as it is in Figure 3.1 above, is

responsible for interfacing with both the voter (to support vote casting tasks) and the

administrator (to support election administration duties). It includes two fundamental

functions: authentication and authorization of users (voters and administrators) to ensure that

system access is restricted to valid users in compliance with preset access control policies.

This function can be accomplished using a variety of methods, ranging from simple

username/password to more complex techniques such as fingerprinting or iris recognition. As

a result, these are tailored to each individual implementation of the suggested architecture.

Overall, this layer is the first point of contact for users and is in charge of authenticating user

credentials in accordance with system-specific policies (Kashif et al., 2018).

The Access Control Management layer is intended to assist layers 1 and 3 by providing

services required for these layers to perform their expected functions. These services provide

role definition, access control regulations, and voting transaction definitions. Layer 1's access

control functions are supported by role definition and management, whereas layer 3's

blockchain-based transaction mapping and mining is supported by voting transaction

definitions. Overall, this layer ensures a coherent function of the proposed system by

supplying the foundations required by individual levels.

The e-Voting Transaction Management layer is the architecture's core layer, where the

e-voting transaction built at the Role Management / Transactions layer is mapped onto the

blockchain transaction to be mined. This mapped transaction additionally includes the

authentication credentials provided by a voter at layer 1. A voter's fingerprint is an example

of such data. This information is subsequently utilised to generate the cryptographic hash,

which contributes to the creation of the transaction ID. Such credentials are expected to be

38
validated at the User Interaction and Front-end Security layer (layer 1). To get this transaction

onto the chain, a number of virtual instances of nodes are involved in the mining process.

The Ledger Synchronisation layer uses one of the existing database technologies to

synchronise the Multichain ledger with the local application specific database. Votes are

recorded in the database's data tables at the backend. Voters can trace their votes using the

unique identification that is assigned to them whenever their vote is mined and published to

the blockchain ledger. The votes' security considerations are based on block-chain

technology, which uses cryptographic hashes to secure end-to-end communication. Voting

results are also saved in the application's database to allow auditing and other activities in the

future.

39
3.3 Requirement Analysis

The requirement analysis is mainly broken down into two section namely: The registration

system and the election process

3.3.1 The Registration System

The system is developed using JavaScript frameworks called ReactJS and NodeJs.

ReactJS is used to design the front end of the application, React is a framework that employs

Webpack to automatically compile React, JSX, and ES6 code while handling CSS file

prefixes. React is a javascript based UI development library. Although React is a library

rather than a language, it is widely used in web development. The library first appeared in

May 2013 and is now one of the most commonly used frontend libraries for web

development.

React comes with a package for managing the installation and building the UI development,

this package is called NPM (Node Package Manager). Just like other common packages like

pip in python, npm is used for installing other javascript packages or dependencies that are

required in the UI development. These package managers as well as React itself come in

different versions. For the development of this project, React version 18 and npm version

10.2.3 was used. The node package manager also specifies the version of each dependencies

that are to be installed and compatible with the React versions installed and used for the

development of the project. In setting up the frontend development environment the

following steps were taken accordingly; Installation of npm which comes along with nodejs

once nodejs has been installed, Installation of the webpack or Reactjs itself this is done with

the following commands in the terminal npm install -g create-react-app, finally a project is

initiated with the following command on the terminal window, create-react-app voters-app.

A complete React boiler-plate code is generated along with the starter kits. All the packages

to be used or dependencies of the project are added into the node_modules folder.

40
After the setup of the project is made, the first step taken is to install other dependencies,

which in this case is a React UI library that enables development of components faster and

quicker, it also comes with customizable and modern design templates that makes

development faster and with a smoother user experience. For the sake of this project, Material

UI library was used. MUI is a strong React library that comes with in-built React components

and icons that makes development faster and with preference to the modern look of the

interface.

The React library was used to create UI pages which includes Authentication & Onboarding

pages, User profile pages, Voters pages, Report pages and the User / Admin dashboards.

First the user or voter is taken to the Registration page and is demanded to register with the

following credentials; First Name, Last Name, Voters ID, Age, Email & Password.

Users are demanded to fill in the mentioned details during registration. Afterwards the user is

demanded to login when voting is about to take place, with their votersID and fingerprint /

faceID. The fingerprint and faceID is used based on the device fingerprint API in android

devices and faceID in iOS devices depending on which device the user uses in carrying out

the voting exercise. During the voting process the user is demanded to enter the ID of the

person he/she wants to vote for. After this the user can no longer vote. A report of the votes

made per person is displayed on the reports page. And the user can finally logout of the

system.

Activities such as validation of votersID and other registration services are handled in the

backend or server side. The backend is implemented using Nodejs, a server-side scripting

language written in JavaScript that is used to write server-side applications that can run as a

standalone application.

As an asynchronous event-driven JavaScript runtime, Node.js is designed to build scalable

network applications. (React, n.d.)

41
Nodejs is downloaded from the official website www.nodejs.org, the latest version being

nodejs 21.0.0 as at the point of implementing this application. Once the setup is downloaded

the installation begins with a click on the executable package, follow the installation wizard

to complete the installation. (About Node.js® | Node.js, n.d.)

The Server Side or Backend is written with nodejs, just like in React we also use the npm

package to install other dependencies of development, which includes Express an http library

for building APIs and managing request and routes from the frontend.

For the Registration process a routing system is developed based on the Express library, the

server listens to the request passed through the route /users/register. Once data is sent from

the frontend the data is then parsed and accessed through this endpoint / route using

body-parser package (This package called body-parser enables handling form data from the

frontend and parsing them from the body and meta-data send via the headers from the

frontend, the response is then processed in form of json, JavaScript object Notation).

Each input field is validated using a custom middleware service to check and verify the

details before saving them on the database. The database used in this case is MongoDB, a

document based database that supports JavaScript as the base programming language and

ODM (Object Document Model) as Mongoose. Mongoose is a javascript package installed

using npm to connect with the MongoDB database and also handle writing and reading

operations on the database.

After the users are registered, the next step is the verification system, which is also

implemented as a middleware. The endpoint of this middleware is: /users/authenticate. The

authentication of users is done using jwt, Javascript Web Tokens. This is a package that is

used for authenticating users and identifying them based on their available data on the

database, such as their email and password. Users are signed using jwt and a token is returned

back to the frontend this token is encrypted with data such as userID and email. This

42
encrypted data is sent via the headers when a request for some protected resource such as

casting votes, is to be made. The jwt methods used during the process of authentication

includes; jwt.sign() and jwt.verify(). The jwt.sign() method comes with a configuration

which helps in specifying the duration in which the token remains valid. This is used in

maintaining security as well as protection of resources such as users' personal data.

As a means of authentication users are demanded to identify themselves using the biometrics

technology provided on their devices or ATMs as the case may be. Technology such as

fingerprint or faceId is used in this case. Android devices with support for this technology are

versions above android 9.

Face Id is another means of authentication as no two people can have the same fingerprint

and as well the same face. This is important in the electoral process as no one person can

generate more than one vote or create more than one account or generate fake accounts or

voters. Face ID uses a recognition system to validate users.

3.3.2 The Election Process

The voting system can be thought of as a replacement for EVMs. It is a decentralised app

with a ReactJs front-end and a Blockchain back-end. The smart contract is written in Solidity

(Benny et al., 2020).

Solidity is a strong programming language developed for creating smart contracts on the

Ethereum network. Developers can use Solidity to specify the rules and behaviour of

decentralised applications (DApps).

Smart contracts are programmes that are executed within a peer-to-peer network where no

one has specific authority over the execution, allowing tokens of value, ownership, voting,

and other types of logic to be implemented.

43
When deploying contracts, it is important to utilise the most recent Solidity release. This is

due to the frequency with which breaking updates, new features, and bug fixes are

introduced.

Solidity was initially publicly previewed in November 2014 at Devcon0. It is an open-source,

community-driven project overseen by a core team (Solidityy, 2023).

A smart contract is the logic component of the entire voting system. An example of a simple

smart contract is shown in Figure 3.2.

Figure 3.2: A Simple Smart Contract

The first line indicates that the source code is released under the GPL version 3.0 licence. In a

situation where publishing the source code is the default, machine-readable licence specifiers

are essential.

The following line states that the source code is developed for Solidity version 0.4.16 or a

later version of the language, up to but not including version 0.9.0. This is done to ensure that

the contract cannot be compiled with a new (breaking) compiler version that would cause it

to function differently. Pragmas are frequent instructions for compilers on how to handle

source code (for example, pragma once).

A Solidity contract is a collection of code (its functions) and data (its state) that is stored at a

specific address on the Ethereum blockchain. The line uint storedData; declares a state

variable of type uint (256-bit unsigned integer). It can be considered a single slot in a
44
database that can be queried and changed by using functions in the database's management

code. The contract in this example defines the functions set and get, which may be used to

edit or obtain the value of the variable. The smart contract is the logic component of the

entire voting system.

Every change made to a blockchain is referred to as a Transaction. Transactions are the

means by which the Ethereum network communicates with the outside world. When a change

or a status update is to be made on the Ethereum network, transactions are used. A

transaction fee or service charge is required for each transaction. The local currency, Ether,

flows within an Ethereum network. Ether is mostly used as a transaction cost or service price,

often known as a petrol fee. This expedites the process of establishing a private network, and

transactions are mined nearly instantly. MetaMask is a bridge that allows visits to the

dispersed web in the browser. It ensures that Ethereum dApps can be directly accessed in a

web browser without the need for a full Ethereum node.

During the course of development, Hardhat would be used for compilation and testing of the

smart contract. Hardhat is a powerful Ethereum development environment that can be used

to build, test, and deploy smart contracts. It provides a number of features that make it a good

choice for web3 development, including:

Support for multiple blockchains: Hardhat supports a variety of blockchains, including

Ethereum, Polygon, and Arbitrum. This makes it easy to develop and deploy smart contracts

to different blockchains without having to switch tools.

Integrated testing framework: Hardhat includes a built-in testing framework that makes it

easy to write and run tests for smart contracts. This can help to identify and fix bugs early on

in the development process.

45
Deployment system: Hardhat provides a simple and efficient way to deploy smart contracts

to different blockchain networks. This can be done with a single command, making it easy to

get smart contracts up and running quickly.

Web3 integration: Hardhat integrates with the Web3.js library, which makes it easy to

interact with smart contracts from web applications.

Here are some specific examples of how Hardhat can be used for web3 development:

Developing and testing smart contracts for a decentralised exchange: Hardhat can be

used to develop and test smart contracts for a decentralised exchange, such as Uniswap or

SushiSwap. The Hardhat testing framework can be used to test the functionality of the smart

contracts before they are deployed to a production blockchain network.

Building a web application that interacts with a smart contract: Hardhat can be used to

build a web application that interacts with a smart contract. The Hardhat web3 integration can

be used to connect the web application to the smart contract and perform transactions.

Deploying a smart contract to a production blockchain network: Hardhat can be used to

deploy a smart contract to a production blockchain network, such as Ethereum mainnet or

Polygon. The Hardhat deployment system makes it easy to deploy the smart contract with a

single command.

Overall, Hardhat is a powerful and versatile tool for web3 development. It can be used to

build, test, and deploy smart contracts to a variety of blockchain networks.

The Smart Contract will be deployed on Alchemy. Alchemy is a Web3 development platform

that provides developers with the tools and infrastructure they need to build scalable, reliable,

and secure decentralised applications (dApps). Alchemy's platform includes:

46
Infrastructure: Alchemy provides a global network of nodes that are highly scalable and

reliable. This allows developers to focus on building their dApps, without having to worry

about the underlying infrastructure.

Tooling: Alchemy provides a suite of tools that help developers to build, test, and deploy

dApps more efficiently. This includes tools for debugging, monitoring, and managing

blockchain data.

APIs: Alchemy provides a set of APIs that allow developers to interact with blockchains in a

simple and efficient way. This includes APIs for sending transactions, querying blockchain

data, and managing wallets.

Alchemy's platform is used by some of the largest and most popular Web3 companies,

including OpenSea, Uniswap, and Coinbase. It is also used by many smaller dApp teams and

individual developers.

Here are some of the key benefits of using Alchemy for Web3 development:

Scalability: Alchemy's global network of nodes can handle large volumes of traffic, making

it ideal for developing high-traffic dApps.

Reliability: Alchemy's platform is highly reliable, with uptime of over 99%. This is

important for dApps, which need to be available to users 24/7.

Security: Alchemy's platform is designed with security in mind. It uses a variety of security

measures to protect user data and prevent attacks.

Ease of use: Alchemy's platform is easy to use, even for developers who are new to Web3.

47
Alchemy also offers a number of features that are specifically designed for Web3

development, such as:

Smart Transaction Platform: Alchemy's Smart Transaction Platform allows developers to

create, simulate, monitor, and send transactions with confidence. It also provides features

such as transaction previews and self-custody without a seed phrase.

Account Abstraction: Alchemy's Account Abstraction feature makes it easier for developers

to acquire, activate, and convert users. It also unlocks sponsored transactions, which can be

used to simplify user onboarding and cover user gas costs.

The Voting Process

The entire voting process can be subdivided into the following categories:

1. Contract Creation: The electoral commission creates the election contract and

registers the candidates within it. At this point, the unique number of each candidate

to be used for aggregation must be registered. The Election contracts generate

homomorphic cryptographic asymmetric keys, store them in a system, and deliver

them to the Election Commission.

2. Granting Voting Rights to Individual Wallet: On successful completion of the

authentication process, i.e., inputting the individual Voter ID and completing the

fingerprint or facial recognition, the voter's wallet is given permission to interact with

the contract and vote for their preferred candidate.

3. Voting: After successfully logging into the system by supplying the VoterID and

thumb or face imprint, if a match is found, the voter is provided with a list of

available candidates and the option to vote against them. On the contrary, if the match

fails, further access will be blocked. This purpose is accomplished by the proper

implementation of the authentication technique (in this example, fingerprinting) and

48
established role-based access control management. Furthermore, it is envisioned that a

voter is assigned to a specific constituency, and that this information is utilised to

build a list of candidates for whom a voter can vote (Kashif et al., 2018). The election

contract mitigated double voting by scrapping the voting rights of a voter after a

successful vote was completed.

4. Validation and Tallying of Votes: After a successful vote is cast, it is validated by

numerous miners, and valid and verified votes are added to the public ledger. The

votes' security is based on blockchain technology, which employs cryptographic

hashes to ensure end-to-end verification. To that purpose, a valid vote is recorded as a

transaction on the voting application's blockchain. As a result, a vote cast is uploaded

to the blockchain as a new block (after successful mining) and is also stored in data

tables in the database's backend. The mechanism assures that voting systems only

have one individual, one vote (democracy). This is accomplished by matching the

voter's unique thumbprint at the start of each voting attempt to avoid double voting.

49
CHAPTER FOUR

SYSTEM IMPLEMENTATION, RESULTS AND EVALUATION

4.1 Introduction

The methodology utilised in this work can be categorised into three broad parts: the

blockchain, the smart contract, and the election process.

4.1 The Election Process

The Election process consists of all processes and components involved in the voting process.

It consists of the following major components:

i. The Frontend

ii. The Backend

4.1.1 The Frontend

The frontend is the interface in which the users interact in order to participate in the electoral

process. The frontend encompasses the onboarding screens, the authentication screen, the

voting or dashboard screen. Each screen is rendered as a component in react using the React

functional component.

At first the project structure is set up using the npm command to bootstrap a webpack for the

react project and install the base dependencies like React and ReactDOM (React Document

Object Module). The following command is entered on the terminal “npm create-react-app

voters-app ”.

50
Figure 4.1: React Project Setup.

The project is bootstrapped using create-react-app template and a folder structure is set up

with pre-installed packages like react-dom, react and react-scripts just as in Figure 4.1 above.

The app renders a root html file on the webpage and react-dom enables re-rendering each

component on the web-browser without having to refresh the webpage. Each component is

re-used on each page where there is a repetition that allows for proper code management

throughout the app, React offers the possibility of creating a single page web application,

where components are built and isolated to handle the changes through state management.

React uses a simple project structure, files that are used in the creation of components are

stored in the src folder, the public folder is used to store the assets and other third party media

such as fonts, images and other files as such. Other files are used for configuration of the

project such as package.json and package-lock.json files, these files help to manage the

dependencies and version of the project as well. The node_modules folder houses the

51
installed packages and dependencies available in the package.json file.The App.js file handles

the routing of the application using the react-router-dom package, There are three main route

paths, namely: root route “/”, auth route “/auth” and the “/vote” route. Each of these routes

renders some components that are combined in a screen or pages as the case may be.

Figure 4.2: Frontend project folder structure using React

Each page based on the routes that were mentioned is created. The root route “/” and “/auth”

renders the login screen and the login or authentication screen renders the form component

containing the input field for the Voters ID. The route “/vote” renders the vote screen which

also contains the available vote polls and selects elements for each of the polls and

candidates. The user or voter selects which of the candidates to vote for and he places his

vote by clicking on the vote button.

52
After the voting is completed a success modal notification pops up indicating a successful

completion of the voting process. Requests are sent to the backend via an npm package called

axios, axios is used to send requests from the frontend to the backend and for API

consumption via the https network protocol. Axios package is installed using the following

command within the directory of the project. The command npm install axios. The package is

then added to the node_modules and imported in places or screens where requests are being

sent.

Figure 4.3: Frontend code snippets

53
The frontend follows the basic responsive design principles for good user aesthetics and User

Experience. This is enabled by using styled components for styling, styled-component is a

dependency in React used for writing css styles in javascript. The choice of using

styled-component is to maintain a unique codebase and language throughout the application

and as well enable fast compilation and reduce latency time for effective and light weight

application.

The colour codes includes green (#078a2a), white (#FFFFFF) and black (#000000). The

choice of this colour code as well has to do with the domain of users and user case of the

application, since the consideration is localised to nigeria and nigerian voting, hence the

colour green and white seemed proper. Figure 4.4 shows the cross sectional page of the

E-voters auth page and Figure 4.5 features the Voters’ Dashboard.

Figure 4.4: Voter’s Authentication Page.

54
Figure 4.5: Voter Dashboard

55
4.1.2 The Backend

The backend implementation of the system is done using nodejs, a runtime environment for

javascript, first nodejs is installed and then a backend project is bootstrapped using the

following commands npm init just as in Figure 4.5 below. The configuration of the backend

server is then manually inputted.

Figure 4.6: Backend Project Initialisation.

Using npm init a boiler plate start kit is bootstrapped and afterwards installation of

dependencies for the project is done, dependencies such as express for handling http requests

from the frontend, jsonwebtoken for authenticating and managing user sessions, mongoose

56
for writing into the database as an ODM (Object Document Module) and creating schemas of

objects or collections stored in the MongoDB database, cors for handling cross-origin request

services to prevent error occurrence during request sending, body-parser package for

handling and parsing body data sent from the frontend in the body of the request and also any

other relevant information sent via the request headers, . The following command is used to

install the packages from the root directory of the project, npm install express mongoose

body-parser cors jsonwebtoken.

After installation is complete, the server is initiated to listen to requests at a predefined port

or the port number from the default system environment using the process.environment

package; this package comes with the node js default DOM packages referred to as the inbuilt

packages or modules. This approach is done to enable port identification for host servers

during deployment to production so as to help use the dynamic port number allocated by the

host server network.

An instance of the express module is created and named app, which wraps around the server

and listens at port number 8089. After this a routing system is created to listen to specific

route endpoints from the frontend and serves specific functions at each instance. The first

endpoints to be handled by the routing system powered by the express router is “/auth”. At

this stage requests to this endpoint validates the parameters sent from the frontend which

includes the votersID. A Middleware is created to validate the votersID sent from the

frontend if it is a complete set of ID.

The image in Figure 4.6 shows the codes snippet for implementing jsonwebtoken

authentication

57
Figure 4.7: JWT Authentication Services

If not, the server responds with a bad request whose header is set to 400 and an error message

saying “wrong voter ID, please check again!”. This response is sent even before further

processing of the voter's ID is done. If the votersID is verified successfully the server

proceeds to the next middleware using the next() method of the router. The router uses

primarily three built- in methods to handle processing of request, these methods include the

req,res and next methods. Req method is used to handle requests sent from the client side or

frontend and through this method parameters such as body, params and headers can be

accessed from the http request sent from the frontend. The res method is used to send back a

response from the server or backend to the frontend with information regarding the request, it

could be an error response or success response, this type of response could be specified using

58
the response header configuration codes. 100, 200, 300, 400 and 500, each with different

meanings and use cases. In the course of this project two response codes were used: 200 for

success response and 400 for error response.

At the end of the votersID verification, the details of the user being authenticated is then

returned back to the frontend with a token signed with the user’s voters ID and first name

using encryption provided by the jsonwebtoken package. This token is used for all other

requests sent to the server as a means of authentication. Figure 4.7 shows the structure for

controllers and routes

Figure 4.8: Authentication Services and Routes Controller

59
The second endpoint in the routing system is the “/vote” endpoint. At this stage a middleware

for verification of users or voters by means of the token is used, a method json.verify() is

used to verify the token if it is expired or correct if correct, the details of the user is returned

via the req header globally in the server. Hence the details of the user are accessible via the

req.user variable anywhere on the endpoint pipeline. After this stage a check is done if this

user has already voted for this role before, if yes an error response is returned indicating that

user has already casted a vote. If not the vote is then created and a response is sent back to the

frontend or client side indicating a successful casting of vote. The record of the vote casted is

stored in the database first under the votes collection specific to the candidate being voted.

60
4.2 The Smart Contract and BlockChain

The smart contract is an integral part of this project as it hosts the core functionality of the

proposed system. It is tasked with communication with the blockchain and executing the laid

out and predefined transactions. The transactions are in the form of functional components

that are called when certain conditions are met. In order to begin writing the smart contract, a

new node project has to be initialised. According to the convention to initialise a new node

project, the command “ npm init ” is called using any command line interface of choice. The

windows power shell and VS code command prompt will be used during the course of this

project. The power shell will be used in initialising the node project as well as installing the

compiler of choice. The power shell is used in place of the conventional command prompt

because the latter has a higher permissions level as compared to the former. Figure 4.9 shows

how the node project is initialised.

Figure 4.9: Node project Initialization

61
After the node project has been initialised, the development environment is installed. As

discussed in the system design phase, the development environment of choice is Hardhat. The

hardhat compiler is installed as an npm package using the command “npm install --save-dev

hardhat” and other important packages are installed as shown in Figure 4.10.

Figure 4.10 Installing Hardhat

After installation of the required packages and module, hardhat is initialised and a javascript

project is created as shown in Figure 4.11, then code editor is started.

Figure 4.11: Initializing Hardhat

62
Firstly the default contract is cleared and the new contract defined and the deploy.js file is

edited to meet the new contract deployment conditions. The new contract is named as

Voting.sol. The pragma solidity version as well as licences are defined. FIgure 4.13 shows the

file structure of the project.

Figure 4.12: File Structure

After all dependencies have been installed and the project initialised, the smart contract is

written and all the functions and events are properly defined.

In a smart contract, the very first function or class to be defined is the Contract class. The

Contract class encapsulates the entire codebase and its main function is to define the structure

and behaviour of the smart contract. It also enables the interaction between the contract and

other external entities.

The Contract for this project is defined as shown in Figure 4.12 and the contract name is

“Voting”. After the contract definition, a struct is defined to hold and store candidate data

and a mapping is made to map each candidate to an array called candidates.

63
This is shown in Figure 4.13. Also the address of the contract owner is defined as well as a

mapping of voter addresses to a bool data structure to track if the registered voter has voted

or not.

Figure 4.13: Contract creation and Candidate definition

A constructor is then defined as shown in Figure 4.14 to add a new candidate to the

candidates array as well as define the start and end times of the voting period. The owner of

the smart contract instance is also defined as the address that deploys the contract instance.

And also a function modifier is created to ensure that “msg.sender” === owner.

Figure 4.14 Candidate Constructor

64
The Candidate created using the constructor is then pushed into the candidate array as shown

in Figure 4.15. The function to enable the Voters’ vote is also defined, and additional

measures are added to prevent double voting. This is done by using the require statement to

define additional constraints, such as the require statement that checks if the candidate index

selected by the voter is less than condidateIndex.length.

Figure 4.15: AddCandidate and Vote Functions

After the vote function is defined, other utility functions such as getAllVotesOfCandidiate(),

getVotingStatus() and getRemainingTime() are defined. The getAllVotesOfCandidiate

function returns a uint256 variable showing how many votes each candidate has. The

getVotingStatus function returns both the start and end time of the election and the

getRemainingTime function shows how much time is left in minutes for the election process

to last. This is shown in Figure 4.16.

65
Figure 4.16: Utility Functions

After the contract is completed, it is compiled using the hardhat compiler and then the

artefact and bytecode is generated as shown in Figure 4.17.

Figure 4.17: Artifacts

After a successful compilation, the code is deployed on the ethereum network using

Alchemy. For the course of the project, the sepolia testnet was utilised as it is free to use and

charges less gas for transactions. The deploy.js code is featured in Figures 4.18 and the

credentials for network and accounts are defined in the hardhat.config file as shown in Figure

4.19.

66
Figure 4.18: Deploy.js file

The candidate names, party and duration are defined as parameters when the contract is

deployed.

Figure 4.19: Hardhat.config File

67
After the smart contract has been sucessfuly deployed, a javascript library known as web3.js

is installed in order to create interactivity between the frontend, backend, smart contract and

blockchain. After the module is imported in the program, an instance of web3.js is created

using the “new” constructor taking the alchemy apikey as parameters, inorder to connect to

the ethereum network. Afterwards, the Smart Contract ABI and address are defined and a

method is created to interact with the functions and events in the smart contract. In the React

application, the state variables are updated based on data retrieved from the smart contract.

Event handlers are also created to listen for events emmited by the smart contract.

Figure 4.20 gives the general overview of the smart contract deployed using Alchemy as

well as its usage statistics.

Figure 4.20: Usage Statistics of the election contract deployed using Alchemy

68
4.3 Performance Evaluation

Figure 4.21: Transactional Statistics for Alchemy

Figure 4.21 shows a representation of transaction statistics from the blockchain as well as the

State, HTTP Request, Response time and Time sent. It can be seen that it takes an average of

35ms for a transaction to be signed and sent. Taking into consideration the time to complete

verification and authentications, it is estimated that a voter will require 15 seconds to

complete the whole voting process taking into consideration no break in internet access. This

will go a long way in cutting down excessive queues at polling booth with an added

advantage of ease in access as voters can complete the entire process from the comfort of

their homes. Figure 4.14 depicts the success rate of performing 17 vote request each taking an

average of 30ms to be completed.

69
Figure 4.22: Success rate of voting

70
CHAPTER FIVE

SUMMARY, CONCLUSION AND RECOMMENDATION

5.1 Summary

The implementation of an electronic voting system using blockchain represents a

transformative step in the evolution of democratic processes. By leveraging the decentralised

and secure nature of blockchain technology, electronic voting systems can address various

challenges associated with traditional voting methods. The system provides transparency,

integrity, and immutability to the voting process, ensuring that each vote is accurately

recorded and verifiable by participants. Through the use of smart contracts, the need for

intermediaries is diminished, reducing the risk of fraud and enhancing the overall efficiency

of the electoral process.

5.2 Conclusion

The electronic voting system using blockchain offers a robust solution to longstanding issues

in traditional voting systems. The inherent features of blockchain, such as decentralisation

and cryptographic security, contribute to building trust among voters. The immutability of the

blockchain ensures that once a vote is cast, it cannot be altered or tampered with,

guaranteeing the integrity of the election results. Additionally, the transparency provided by

blockchain allows for real-time verification by concerned parties, fostering confidence in the

electoral outcome. While challenges such as accessibility and user education need to be

addressed, the potential benefits make the adoption of blockchain-based electronic voting

systems a compelling avenue for the future of democratic processes.

71
5.3 Recommendation

The developed system has proven to work and its level of efficiency ascertained, but it is

imperative that future works coexist along with constant security upgrades and continuous

collaborations with cybersecurity and blockchain experts in order to identify and mitigate

vulnerabilities. Also, comprehensive user education programmes should be implemented to

familiarise voters with the electronic voting system. Address accessibility concerns to ensure

that all eligible voters, including those with disabilities, can participate in the process

seamlessly. And lastly, endless possibilities for integrating blockchain-based electronic voting

systems with existing electoral infrastructure should be explored in order to ensure seamless

compatibility to facilitate a smooth transition and minimise disruptions during the adoption

phase.

5.4 Contribution to knowledge

The issue of malpractice and non-transparency in the electoral system has always been a

concern to the general populace as it always leads to mistrust in the body of governance. The

introduction of an Electronic Voting System using Blockchain significantly advances

knowledge in blockchain technology, governance, security, and the practical challenges

associated with adopting innovative systems in critical domains. The insights gained

contribute to ongoing discussions on the future of secure and transparent electoral processes.

This research has done two things to alleviate these concerns: Firstly, the development of a

decentralised system that advocates transparency and accountability, and lastly, the

development of a portable system that is easy to use thereby increasing voter turnout.

72
References

About Node.js® | Node.js. (2023) Available at: https://nodejs.org/en/about

About Solidity (2023) Solidity. Retrieved November 10, 2023, Available at:

https://soliditylang.org/about

Adnan, H., & Avi, P. (2019, July). Voting System based on Blockchain. , vol 1(1).

Ahram, T., Sargolzaei, A., Daniels, J., & Amaba, B. (2017, June). Blockchain Technology

Innovations. IEEE Technology & Engineering Management Conference (TEMSCON).

Available at: https://ieeexplore.ieee.org/abstract/document/7998367

Arora, S. (2023, July 19). What is a Smart Contract in Blockchain and How Does it Work?

Simplilearn.com. Retrieved July 30, 2023, Available at:

https://www.simplilearn.com/tutorials/blockchain-tutorial/what-is-smart-contract

Basit, S. (2019, March). Trustworthy Electronic Voting Using Adjusted Blockchain

Technology. IEEE Access, 7(1), 1. Available at:

https://www.researchgate.net/publication/331731568

Benny, A., Kumar, A. A., Basit,, A., Cherian, B., & Kharat, A. (2020, August). Blockchain

based E-voting System. Social Science Research Network (SSRN). Available at:

https://papers.ssrn.com/sol3/papers.cfm?abstract_id=3648870

Bosri, R., Razzak, A. U., & Al Oma, A. (2023). Towards A Privacy-Preserving Voting

System Through Blockchain Technologies. Towards A Privacy-Preserving Voting

System Through Blockchain Technologies, 1(1), 3-4. Available at:

https://www.researchgate.net/publication/335470295

Brakerski, Z., Gentry, C., & Vaikuntanathan, V. (2014). (Leveled) fully homomorphic

encryption without bootstrapping. ACM Trans. Compute. Theory (TOCT), 6(13), 1 -

36.

73
Haque, B., & Mahbubur, R. (2020, July). Blockchain Technology: Methodology, Application

and Security Issues. Available at: https://arxiv.org/abs/2012.13366

Kantharaju, V., Dhanalakshmi, M., & Nidhi, V. (2022, June). Secure Digital Voting System

Based on Blockchain Technology -A Survey. International Journal of Scientific

Research in Science, Engineering and Technology, 9(3), 58 - 62. Available at:

https://www.researchgate.net/publication/367608953

Kashif, K., Arshad, J., & Khan, M. M. (2018, May). Secure Digital Voting System based on

Blockchain Technology. NED University of Engineering and Technology, Pakistan.

Available at: https://core.ac.uk/download/pdf/155779036.pdf

Pankaj, R., Wanjari, S., Ansari, M., & Sonwane, S. (2023). MyVote -Blockchain Based

Online Voting System. International Research Journal of Innovations in Engineering

and Technology, vol 1(1), 2.Available at:

https://www.researchgate.net/publication/370692053

React (2023). Available at https://react.dev/

Rajesh, K., Jay, K., & Aman, K. (2022). Blockchain and homomorphic encryption based

privacy-preserving model aggregation for medical images, Computerised Medical

Imaging and Graphics,., 102, 22 - 33.

Ravikiran, A.S. (2023, July 21). What is Blockchain Technology? How Does Blockchain

Work? [Updated]. Simplilearn.com. Retrieved July 30, 2023, Available at:

https://www.simplilearn.com/tutorials/blockchain-tutorial/blockchain-technology

Raylin, T., Zi-Yuan, L., & Jen-Ho, H. (2019, April). Distributed E-Voting and E-Bidding

Systems Based on Smart Contract. IEEE ACCESS, 8(4), 2. Available at:

https://www.researchgate.net/publication/332373069

74
Ryan, P.Y.A. (2008). Prêt à Voter with Paillier Encryption, in the Mathematical and Computer

Modelling.

Spanos, A., & Kantzavelou, I. (n.d.). A Blockchain-based Electronic Voting System:

EtherVote. International Research Journal of Innovations in Engineering and

Technology, 1(1), 4-5. Available at:

https://www.researchgate.net/publication/372487716

75

You might also like