Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 59

MEDBLOCK: A Blockchain Based EHT

Project Report Submitted

In Partial Fulfillment of the Requirements For the Degree of

BACHELOR OF ENGINEERING IN

COMPUTER SCIENCE AND ENGINEERING

Submitted by

Mohammed Ishtiaq (1604-19-733-115)


Ahmed
Raj Mohammed (1604-19-733-116)

Shaik Abdul Azeem (1604-19-733- 312)

COMPUTER SCIENCE AND ENGINEERING DEPARTMENT


MUFFAKHAM JAH COLLEGE OF ENGINEERING &
TECHNOLOGY
(Affiliated to Osmania University)
Mount Pleasant, 8-2-249, Road No.3, Banjara Hills, Hyderabad-34 2022
DECLARATION

This is to certify that the work reported in the major project entitled “MEDBLOCK: A

Blockchain Based EHR” is a record of the bonafide work done by us in the Department

of Computer Science and Engineering, Muffakham Jah College of Engineering and

Technology, Osmania University. The results embodied in this report are based on the

project work done entirely by us and not copied from any other source.

Mohammed Ishtiaq Ahmed (1604-19-733-115)

Raj Mohammed (1604-19-733-116)

Shaik Abdul Azeem (1604-19-733- 312)

ii
ACKNOWLEDGEMENT

Our hearts are filled with gratitude to the Almighty for empowering us with courage,
wisdom and strength to complete this project successfully. We give him all the glory,
honor and praise.

We thank our Parents for having sacrificed a lot in their lives to impart the best education
to us and make us promising professionals for tomorrow.

We would like to express our sincere gratitude and indebtedness to our project supervisor
Dr Maniza Hijab for her valuable suggestions and interest throughout the course of this
project.

We are happy to express our profound sense of gratitude and indebtedness to Prof. Dr
Syed Shabbeer Ahmed, Head of the Computer Science and Engineering Department, for
his valuable and intellectual suggestions apart from educating guidance, constant
encouragement right throughout our work and making us successful.

We are pleased to acknowledge our indebtedness to all those who devoted themselves
directly or indirectly to make this project work a total success.

MOHAMMED ISHTIAQ AHMED

RAJ MOHAMMED

SHAIK ABDUL AZEEM

i
Abstract

Any developments, simple or complex, that lead to improvements in health outcomes and
patient experiences are healthcare innovations. Right now, the healthcare sector is facing
many large challenges, such as stringent regulations, privacy concerns and steeply rising
costs. Many leaders and healthcare professionals are turning to new technologies and
informatics to develop smarter and secure types of healthcare delivery. These innovations
are important because as networks of people and technology become more interconnected,
healthcare organizations are going to need better tools for solving health challenges at larger
scales. The COVID-19 pandemic in particular has demonstrated there is a strong need for
better data systems and information exchange. healthcare innovations will give clinicians and
healthcare organizations the tools they need to focus more on the needs of their patients and to
help people improve their lives.

With increasing digitilization of healthcare sectors, more-and-more aspects of life are


becoming computerized. This likewise applies to medical services, where an assortment of
medical related data is produced by facilities, emergency services and diverse e-health
applications. During their lifetime, individuals connect with countless clinical subject matter
experts, every one of them keeps information in their respective IT Systems, prompting a
divided system and databases those are not interconnected.

The privacy and security of the patient’s data is at risk as there is no authority of patient over
the data collected by medical institutions leaving the data prone to transgression.

Blockchain is an innovation that provides the ability to make contemporary models of


business and settles trust concerns in a more proficient manner. It can prompt many research
and business opportunities. The academic realm and industry proposed numerous blockchain-
based programming arrangements inside a broad scope of areas. This project work presents a
framework proposing blockchain innovations for use in health services, where the vital data
with respect to the medical analysis are shared among medical Institutions, clinical facilities
and research details dependent on access approaches categorized by the patients.

i
This system was developed using the Ethereum network using Ganache, as well as
programming languages, tools, and techniques such as Solidity and web3.js. The measured
approach suggested in this paper uses this platform to store patients’ data and execute
functions in a decentralized system using blockchain smart contracts. Transactions are
communicated through the smart contract once it has been launched, providing security and
privacy features.

v
CONTENTS

TITLE

CERTIFICATE i

DECLARATION ii

ACKNOWLEDGEMENT iii

ABSTRACT iv

LIST OF FIGURES viii

1. IINTRODUCTION
1
1.1 OVERVIEW 1
1.2 PROBLEM STATEMENT 2
OBJECTIVE 3
2. LITERATURE SURVEY
4
2.1 INTRODUCTION 4
2.2 DISADVANTAGES OF TRADITIONAL EHR 4
2.2.1 PRIVACY CONCERN 4
2.2.2 INTEROPERABILITY CHALLENGE 4
2.2.3 COST OF IMPLEMENTATION CHALLEANGE 4
2.2.4 DATA INTEGRITY AND SECURITY 5

2.3 EXISTING APPROACHES FOR IMPLEMENTING EHR 5


2.3.1 EPIC EHR 5
2.3.2 CERNER EHR 6
2.3.3 ALLSCRIPTS EHR 6
2.3.4 MEDITECH EHR 7
2.3.5 NEXTGEN EHR 7
2.3.6 ECLINICWORKS EHR 8
2.3.7 GREENWAY EHR 8
2.3.8 KAREO EHR 9
2.3.9 PRACTICE FUSION EHR 9

v
3. SYSTEM ANALYSIS
10
3.1 PROBLEMS WITH EXISTING SYSTEM 10
3.2 PROPOSED SYSTEM 11
3.3 FEASIBILITY STUDY 12
3.3.1 TYPES OF FEASIBILITY 12
3.3.1.1 TECHNICAL FEASIBILITY 12
3.3.1.2 OPERATIONAL FEASIBILITY 13
3.3.1.3 ECONOMICA FEASIBILITY 13

3.4 SOFTWARE AND PLATFORMS USED 14


3.4.1 GANACHE 14
3.4.2 METAMASK 14
3.4.3 WEB3 14
3.4.4 TRUFFLE 15
3.4.5 VS CODE 15
3.4.6 LANGUAGES 15

4. SYSTEM DESIGN
16
4.1 GENERAL ARCHITECTURE 16
4.2 SYSTEM ARCHITECTURE 17
4.3 PROTOCOL LAYOUT 18
4.4 SYSTEM WORKING 20
4.4.1 ETHERIUM 20
4.4.2 SMART CONTRACTS 20
4.4.3 IPFS 21
4.5 FLOWCHART 21
4.6 USECASE DIAGRAM 22
4.7 WORKFLOW DIAGRAM 23
4.8 SWIMLANE DIAGRAM 23

v
5. IMPLEMENTATION
24
5.1 BACKEND 24
5.1.1 DEPLOYING ETHERIUM BLOCKCHAIN 24
5.1.2 SMART CONTRACT CONNECTION 25
5.1.3 ACCOUNT CREATION THROUGH SMART
CONTRACTS 26
5.1.4 INSTALLING DEPENDENCIES 28
5.1.5 COMPLING AND DEPLOYING SMART CONTRACTS 29
5.2 CODE FOR QUICK SUMMARY 31
6. TESTING
38
6.1 UNIT TESTING 38
6.2 TESTING FRAMEWORKS 38
6.3 SOLIDITY FOR TESTING 39
6.4 TEST STRUCTURE 39
6.4.1 ASSERTIONS 39
6.4.2 DEPLOYED ADDRESSES 39
6.5 TESTING ETHER TRANSACTIONS 40
6.6 SOLIDITY RESTING RESULTS 40

7. SCREENSHOTS
41
8. CONCLUSION
45
9. FUTURE ENHANCEMENTS
46
10. REFERENCE
47

v
LIST OF FIGURES

Figure Description Page


No. No.
Fig 4.1 GENERAL ARCHITECTURE 16
Fig 4.2 SYSTEM ARCHITECTURE 17
Fig 4.3 PROTOCOL LAYOUT 18
Fig 4.5 FLOWCHART 21
Fig 4.6 USECASE DIAGRAM 22
Fig 4.7 WORKFLOW DIAGRAM 23
Fig 4.8 SWIMLANE DIAGRAM 23
Fig 5.1.1 DEPLOYED TRANSACTION LOG 24
Fig 5.1.2 CONNECTING METAMASK 25
Fig 5.1.3 ACCOUNT CREATION 18
Fig 5.1.4 METAMASK ACCOUNT IMPORT 27
Fig 5.1.5 ACCOUNT INFORMATION 28
Fig 5.1.6 INSTALLING DEPENDENCIES 28
Fig 5.1.7 TRUFFLE MIGRATION 30
Fig 6.4.2 DEPLOYED ADDRESS 39
Fig 6.6 SOLIDITY TESTING RESULTS 40
Fig 7.1 REGISTRATION PANEL 41
Fig 7.2 LOGIN PANEL 42
Fig 7.3 ACCESS CONTROL PANEL 43
Fig 7.4 DIAGNOSTIC’S PANEL 44

v
1. INTRODUCTION

1.1 OVERVIEW
Blockchain technology is a massive scale tagging system for distributed electronic
database secured by cryptography in which it could prove the time, integrity and identity
for people and machines without relying on traditional systems. In traditional databases,
access authority is governed by the centralized authentication system. Hence, it is difficult
for many people to access the database at the same time due to limited right credentials
given by this centralized authenification system and the limited capacity. In Blockchain
like a distributed ledger, individual transactions (unique blocks) are encrypted into blocks
by the relevant encryption, added to the ledger (the chain) and never removed. The data in
Blockchain is secured primarily by a linked list of encrypted transactions that uses a hash
rather than a pointer. Hash function can create a hash value by encryption of input data in
Blockchain technology. These components, incorporating the applicable criteria that
follow.

The main benefit of Blockchain technology is that there is no central authority to control
the database, yet the database can still represent a single source of truth. Its technical
design has evolved through a number of iterations by using hash functions like human
fingerprints and a mathematical operation which creates a trace or digest of the transaction.
Hash functions are the one way to verify that fingerprint matches a specific person, but
without the ability to create the person from the fingerprint. Equivalently, a hash value
uniquely identifies data and has the ability to recreate it. Moreover, the power of network is
that it can spread the processing of the database is valid by verifying valid information over
different nodes, or processing units and trust maintained through encryption

1
1.2 Problem Statement
The healthcare industry generates and manages vast amounts of sensitive and personal
data, including patient records, clinical trial data, and medical research. However, this data
is often fragmented and siloed across various systems, making it difficult to access and
share securely. Furthermore, existing methods of storing and sharing healthcare data, such
as electronic health records (EHRs) and health information exchanges (HIEs), are often
prone to security breaches, data manipulation, and unauthorized access.

These issues highlight the need for a secure and transparent method of storing and sharing
healthcare data. Blockchain technology has the potential to address these challenges by
creating a secure, tamper-proof, and decentralized network for storing and accessing
healthcare data. However, implementing blockchain in healthcare data access presents its
own set of challenges, such as regulatory compliance, standardization, interoperability, and
user adoption.

Therefore, the problem statement for blockchain in healthcare data access is how to design
and implement a blockchain-based solution that ensures the secure and transparent sharing
of healthcare data, while also addressing the challenges of regulatory compliance,

standardization, interoperability, and user adoption. Every Medical Institution keep the

patient’s data in their respective IT Systems, prompting a divided system and databases
that are not interconnected.

The privacy and security of the patient’s data is at risk as there is no authority of the patient
over the data collected by medical institutions.

2
1.3 Objective
The objective of this study is to develop a blockchain-based system that helps in the
security and management of patient data. This system uses blockchain technology with
smart contracts to establish an iterative, secure, accessible, and decentralized healthcare
ecosystem. People will be able to freely and securely share their medical records with
doctors, hospitals, research institutions, and other groups while having complete control
over their medical data privacy.

3
2. LITERATURE SURVEY

2.1 Introduction
The literary survey of existing electronic health record (EHR) management systems
highlighted some of the most commonly used systems in the healthcare industry. However,
while these systems offer many benefits, they also have some disadvantages that may limit
their effectiveness. In recent years, blockchain technology has emerged as a potential
solution to many of the challenges faced by traditional EHR systems. This paper will
explore the disadvantages of traditional EHR systems and how blockchain technology can
address these challenges.

2.2 Disadvantages of Traditional EHR Systems Security

2.2.1 Privacy Concern

One of the most significant challenges facing traditional EHR systems is security and privacy
concerns. Traditional EHR systems store patient information in centralized databases that can
be vulnerable to cyber-attacks. Hackers can gain access to patient data, which can be used for
identity theft or fraud. Traditional EHR systems also raise concerns about patient privacy, as
healthcare providers have access to sensitive patient information that can be misused.

2.2.2 Interoperability Challenges

Traditional EHR systems often face interoperability challenges, as they are designed to
operate within their own closed ecosystems. This means that it can be challenging to share
patient data between different healthcare providers and systems. This can result in delays in
care delivery and can lead to medical errors, as healthcare providers may not have access to a
patient's complete medical history.

2.2.3 Cost and Implementation Challenges

Traditional EHR systems can be expensive to implement, as they require significant upfront
costs for hardware, software, and training. Smaller healthcare providers may not have the
resources to invest in these systems, which can limit their ability to provide quality patient
4
care. Additionally, traditional EHR systems can be complex and challenging to implement,
which can lead to delays and disruptions in care delivery.

2.2.4 Data Integrity and Accuracy

Traditional EHR systems may have data integrity and accuracy issues, as they rely on a
centralized database that is prone to errors. Healthcare providers may accidentally enter
incorrect data, which can lead to medical errors and harm patients. Additionally, traditional
EHR systems do not provide patients with full control over their data, which can lead to
concerns about data accuracy and completeness.

2.3 Existing Approaches for Implementing EHR

2.3.1 Epic EHR

Epic is one of the most widely used EHR management systems in the United States. It is a
comprehensive system that includes modules for patient scheduling, medical billing, and
clinical documentation. Epic is also highly customizable, allowing healthcare providers to
tailor the system to their specific needs. However, Epic can be expensive to implement, and
some users report that the system can be difficult to use.

5
2.3.2 Cerner EHR

Cerner is another popular EHR management system that is widely used in the healthcare
industry. Like Epic, Cerner is a comprehensive system that includes modules for patient
scheduling, medical billing, and clinical documentation. Cerner is also highly customizable
and has a user-friendly interface. However, some users have reported that the system can be
slow and prone to errors.

2.3.3 Allscripts EHR

Allscripts is a cloud-based EHR management system that is designed to be easy to use. It


includes modules for patient scheduling, medical billing, and clinical documentation.
Allscripts also has a mobile app that allows healthcare providers to access patient records on
the go. However, some users have reported that the system can be slow and that customer
support can be slow to respond to issues.

6
2.3.4 Meditech EHR

Meditech is a comprehensive EHR management system that includes modules for patient
scheduling, medical billing, and clinical documentation. It is also highly customizable and has
a user-friendly interface. Meditech is also known for its excellent customer support. However,
some users have reported that the system can be slow and that it can be difficult to learn.

2.3.5 NextGen EHR

NextGen is a cloud-based EHR management system that is designed to be easy to use. It


includes modules for patient scheduling, medical billing, and clinical documentation.
NextGen also includes a patient portal that allows patients to access their health records
online. However, some users have reported that the system can be slow and that customer
support can be slow to respond to issues.

2.3.6 eClinicalWorks EHR


7
eClinicalWorks is a comprehensive EHR management system that includes modules for
patient scheduling, medical billing, and clinical documentation. It is also highly customizable
and has a user-friendly interface. eClinicalWorks is also known for its excellent customer
support. However, some users have reported that the system can be slow and that it can be
difficult to learn.

2.3.7 Greenway EHR

Greenway is a cloud-based EHR management system that is designed to be easy to use. It


includes modules for patient scheduling, medical billing, and clinical documentation.
Greenway also includes a patient portal that allows patients to access their health records
online. However, some users have reported that the system can be slow and that customer
support can be slow to respond to issues.

8
2.3.8 Kareo EHR

Kareo is a comprehensive EHR management system that includes modules for patient
scheduling, medical billing, and clinical documentation. It is also highly customizable and has
a user-friendly interface. Kareo is also known for its excellent customer support. However,
some users have reported that the system can be slow and that it can be difficult to learn.

2.3.9 Practice Fusion EHR

Practice Fusion is a cloud-based EHR management system that is designed to be easy to use.
It includes modules for patient scheduling, medical billing, and clinical documentation.
Practice Fusion also includes a patient portal that allows patients to access their

3. SYSTEM ANALYSIS
9
3.1 Problems with existing system:
Healthcare data is highly sensitive and confidential, and its access and storage have always
been challenging. Traditional systems for healthcare data access often lack the security and
transparency that is required to protect sensitive information. These systems also suffer
from several other problems.

One of the main problems with traditional systems for healthcare data access is the lack of
interoperability. Different healthcare providers use different systems and technologies,
which makes it difficult to share information seamlessly. This can lead to delays in
diagnosis and treatment, as well as errors in medication and dosage.

Another problem with traditional systems is the risk of data breaches and cyber attacks.
Healthcare data is a valuable target for hackers, and traditional systems often lack the
security measures required to protect against these threats. This can lead to the theft of
sensitive information, which can be used for fraudulent activities.

Moreover, traditional systems often lack transparency, and patients may not have complete
control over their data. This can lead to a lack of trust between patients and healthcare
providers, which can hinder the delivery of effective healthcare.

Overall, these problems highlight the urgent need for a more secure, transparent, and
interoperable system for healthcare data access, which could be provided by blockchain
technology.

3.2 Proposed system:


1
A proposed system for providing healthcare data access using blockchain technology has
the potential to significantly improve the way healthcare data is stored and accessed.
Blockchain technology is a distributed ledger that provides secure, transparent, and tamper-
proof storage of data. This makes it ideal for storing sensitive healthcare data, such as
medical records and patient information.

The proposed system would allow patients to have complete control over their healthcare
data, including who has access to it. The data would be encrypted and stored in a
decentralized manner on the blockchain, ensuring that it is secure and cannot be altered
without the patient's permission. Patients would be able to grant access to doctors,
hospitals, and other healthcare providers as needed, which would streamline the process of
sharing medical records and other important healthcare data.

Furthermore, blockchain technology allows for the creation of smart contracts, which are
self-executing contracts that automatically enforce the terms of an agreement. This could
be used in the proposed system to create contracts between patients and healthcare
providers, ensuring that the terms of data access and usage are clearly defined and
enforced.

The system would use a blockchain network to store encrypted healthcare data in a secure
and tamper-proof manner. Patients would have complete control over their data and could
grant access to doctors, hospitals, and other healthcare providers as needed. The use of
blockchain technology would ensure that patient data is not altered, deleted, or accessed
without the patient's consent.

Ganache, a personal blockchain for Ethereum development, could be used as the


development environment for building and testing the system. IPFS, a peer-to-peer
distributed file system, would be used to store and retrieve healthcare data in a
decentralized manner, ensuring that data is always available even if a server goes down.

Finally, MetaMask, a browser extension that enables users to interact with Ethereum
dApps, would provide an easy-to-use interface for patients to manage their healthcare data.
Patients would be able to control who has access to their data and could revoke access at
any time.
1
3.3 Feasibility Study:

The feasibility study is the test of a system proposal according to its workability, impact on
the organization, ability to meet user needs, and effective use of resources. It focuses on
the evaluation of existing systems and procedures analysis of alternative candidate system
cost estimates. A feasibility analysis was done to determine whether the system would be
feasible.
The development of a computer-based system or a product is more likely plagued by
resources and delivery dates. The feasibility study helps the analyst to decide whether
or not to proceed, amend, postpone or cancel the project, particularly important when the
project is large, complex, and costly.
Once the analysis of the user requirement is complemented, the system has to check for
the compatibility and feasibility of the software package that is
aimed. An important outcome of the preliminary investigation is the determination that the
system requested is feasible.

3.3.1 Types of Feasibility

1. Technical Feasibility
2. Operational Feasibility
3. Economical Feasibility

3.3.1.1 Technical Feasibility:

The application can be developed with the current equipment and has the technical
capacity to hold the data required by the system.

• This technology supports the modern trends of technology.


• Easily accessible, more secure technologies.

1
3.3.1.2 Operational Feasibility:

This proposed system can easily be used on any device i.e, it will adapt to devices of any
screen resolution like pc, tablets, mobile, etc. The user with the knowledge of using mobile
phones or laptops can easily use the application as the user interface is very user-friendly.

3.3.1.3 Economical Feasibility:

If benefits outweigh costs, then the decision is made to design and implement the system.
An entrepreneur must accurately weigh the cost versus benefits before taking an action.
This system is more economically feasible and budget-friendly, so it is economically a
good project.

1
3.4 Software and platforms used:

3.4.1 Ganache

It is a local Ethereum blockchain for the rapid creation of decentralized programs. Ganache
can be used to deploy, develop, and test in a predictable and secure environment
throughout the development cycle. It works both ways: as a desktop program and as a
command-line tool (Ethereum).

3.4.2 MetaMask

It is an entry point that allows you to view the decentralized web of the future in your
browser right now. It allows you to execute Ethereum decentralized applications without
having to run a full Ethereum node in your browser.

3.4.3 Web3
Verification of transactions should be done in the chain in order to interact with the
modules in the chain. To generate and verify a transaction, a participant in the network of
another offline framework must relay it to the peer-to-peer (p2p) connection, which is an
actual network. It also includes a library collection that makes it easier for Ethereum nodes
and in-chain components to communicate. It is utilized on the server side for Node.js.

Web3 uses the Hypertext Transfer Protocol (HTTP) connection to connect to the Ethereum
network via an Ethereum node. This could be a node in ETH wallets from the local system.
MetaMask is an in-browser extension that allows you to operate from Ethereum accounts
and can be used to integrate Ethereum with the website. MetaMask is a browser-based
Ethereum wallet that connects the browser to a Web3 provider class. A Web3 provider is a
data structure that provides a link to Ethereum nodes that are publicly available. A user can
utilize, save, and maintain public and private keys that are unique to their account with the
use of MetaMask. The combination of Ethereum, MetaMask, and web3.js, as well as a web
interface, allows for back-end–front-end communication.

3.4.4 Truffle

It is a strong Ethereum Virtual Machine development environment that uses blockchains,

1
as well as an asset pipeline and a test framework for the same. It has some features, such as
computation, implementation, and maintenance of smart contracts, as well as binary
dependency management. It also has an environment for testing smart contracts that is
fully automated and a deployment and migration framework that can be scripted and
expanded. It can create direct communication with the contract and a pipeline with tight
integration. The Truffle environment is used to run programs.

3.4.5 VS Code

Microsoft’s Visual Studio Code is an editor for Windows, Linux, and macOS.
Troubleshooting, Git management, GitHub, syntax underlining, smart code completion,
samples, and bug fixes are all available.

3.4.6  Languages

The front-end design of our website has been created using HTML (Hypertext Markup
Language), CSS (Cascading Style Sheets), and React.js. The server and back-end of the
website are controlled using the Solidity programming language and Node.js. There are
two tools, Truffle and Ganache, which are used for generating local Ethereum blockchains
to build the system. The Ethereum virtual interface, MetaMask (as a wallet), Truffle (as an
IDE), Yarn (command-line interface), Ganache (account creation), and Local Web3 (web
interface) are used to establish the blockchain and access or use the system.

1
4. SYSTEM DESIGN

4.1 General Architecture

Fig 4.1 General Architecture

1
4.2 System Architecture

Fig 4.2 System Architecture

1
4.3 Protocol layout

Fig 4.3 Protocol layout

Explanation:

Figure 1 demonstrates the layout of the system whenever a patient chooses to view the
medical records using MetaMask or the healthcare system’s decentralized website. By
accessing the private key from the Ethereum wallet, the user is automatically logged in. The
Ethereum wallet is a cold storage wallet. As a result, when compared to other hot wallets, the
danger of compromise is quite low. Furthermore, if the gadget is misplaced, the patients can
simply be given a new one without being penalized for losing their medical records. The
wallet can be used in the same way to sign any document or for any verification needs. This
wallet can also be used to perform multiparty patient verification. It can be used to build a
role-based access control system for records as well as a blockchain-based distributed

1
property identification system. In the event of a medical emergency, a similar multiple-party
permission mechanism can be implemented to gain access to the patient’s records.

1
4.4 System working

 4.4.1 Ethereum

Ethereum is a decentralized network that is built on blockchain technology. It was first


deployed on the popular cryptocurrency Blockchain. Ethereum was created with the goal
of creating an open-source and smart contract platform with blockchain functionalities.
This technology also uses peer-to-peer networking to distribute itself. This network also
uses Ethers, which are its own cryptocurrency. Ethereum also enables programmers with a
language called Solidity that allows them to design their own blockchain. It was created for
Ethereum’s smart contracts, which are the final feature.

Transactions are the means by which external entities connect with Ethereum. External
users can use it to change the status of a document or set of data on the Ethereum
blockchain network. There are some pieces that make up an Ethereum transaction, such as
the sender–author, with a 20-byte address, and the receiver, who also has a 20-byte
address. Even though there is a cost (the quantity of money transferred from the source to
the destination and gas), each transaction on the blockchain network necessitates the
payment of a cost by the author. Gas is the name given to this cost. The gas limitations and
costs are included in every transaction, and the price of gas is the amount of money that the
author of the transaction is willing to pay for gas. There is a lot of gas that can be spent on
this transaction.

4.4.2. The Smart Contract

A smart contract is a set of commands that can be used to carry out any transaction on the
blockchain. When users send transactions, this piece of code is run. They operate directly
on the blockchain, rendering them impervious to manipulation and modification. Smart
contracts deploy the Solidity programming language to program any form of activity on the
blockchain. The programmers can compile the required operations after they have been
programmed. They could then be run and deployed on the Ethereum blockchain after being
compiled. JavaScript is a programming language that implements Ethereum’s Solidity
language for writing the smart contract code.

2
4.4.3. Interplanetary File System (IPFS)

IPFS is a distributed data storage technology with a peer-to-peer network. Because IPFS
data is safe from alteration and assures secure data storage, any attempt to alter data saved
on IPFS can only be performed by changing the identifier. Hence, it provides a
cryptographic identity to protect data from manipulation. Every data file stored on IPFS
contains a cryptographically generated hash value. It only has one value and is used to
identify data files stored on IPFS. The IPFS protocol makes use of a peer-to-peer (P2P)
connection that includes an IPFS object, which contains data and linkages. The data is an
array of disorganized binary values, while the link is a disorderly binary value. The IPFS
protocol functions as follows:(i)IPFS files have a unique cryptographic hash allocated to
them(ii)On the IPFS network, duplicate files are not permitted

4.5 Flow chart for proposed system:

The Ethereum transaction is the next stage. Ganache is required for Ethereum transactions
since it provides addresses and private keys. The addresses are kept on file, and the
transactions are visible to all. To carry out a transaction, the private keys are utilized to unlock
these addresses. The Ethereum Virtual Machine (EVM) is used to process Ethereum
transactions. The EVM is primarily used to conduct smart contract interactions, in which all
nodes must agree that the transaction occurred every time someone interacts with the contract.
2
After that, the EVM executes an immediate post contract in accordance with the transaction’s
rules.

Ethereum retains a record of all previous transactions and the blockchain’s history, which is
kept and confirmed through consent. Ethereum’s node operators, on the other hand, keep track
of all smart contract interactions that take place on the Ethereum network. In this situation, the
miner will be turned into a bot that will process transactions automatically whenever a
transaction is received.

4.6 Use case diagram:

2
4.7 Work Flow diagram:

4.8 SwimLane diagram:

2
5. IMPLEMENTATION
To implement the application, we have designed all the components required
physically on paper fist then implemented the same using Etherium.

5.1 PROCESS TO GET ACCESS TO THE PROPOSED SYSTEM (Back-End


Part)
5.1.1 Deploying Transaction Using Ethereum Blockchain

Figure 20 illustrates the personal Ethereum blockchain, represented by Ganache. It has been


used for testing and deployment of the system. For testing and local development, Ganache
offers some virtual accounts with 100 ETH. It provides a comparable capability to Ganache
when deployed on the Ethereum main net. Some of the fake transactions are executed by
virtual accounts on the application, together with transaction hashes and the contract address
to which they were deployed. Each transaction’s currency value is also displayed in a column.

Figure 5.1.1 

Deployment of the transaction log.

The first step on the back-end is to download and install Ganache Ethereum from the Truffle
Suite. The Truffle Suite is a world-class development environment for decentralized
applications (dapps) and smart contracts on the blockchain. After completing the Ganache
2
installation, you must establish a new workspace named the ehr_project. Then, in the project
directory, add the Truffle from truffle-config.js. After that, this will show secure unique
addresses, the index, balance, and corresponding private keys to create accounts for accessing
the system. The Ganache will keep the accounts’ privacy and serial numbers safe.

5.1.2 Connection to the Server Using Smart Contract

Figure 21 depicts the system’s connection via smart contracts. MetaMask is utilized as a smart
contract to connect to the system. Contracts are created that provide metadata about record
titles, access, and data integrity. Cryptographically signed instructions for controlling these
characteristics are included in this system’s blockchain transactions. Only legal transactions
ensuring data alternation are used by the contract’s state-transition functionalities to carry out
policies. As long as a medical record can be stored electronically, these laws can be built to
enforce any set of rules controlling it.

2
Figure 5.1.2 

The MetaMask wallet connection.

This smart contract, which is run on blockchain technology, might be designed to include all
of the conditions such as handling various permits and data access. It can be observed that a
number of stakeholders are involved in this scheme, each performing different tasks. This will
make it easier for doctors and patients to communicate. Smart contracts include data
authorization rules. It can also assist in tracing all activities associated with a unique ID from
the point of origin to the point of submission. Different situations have been created and
explained, as well as all of the functions and procedures that are included in the smart
contracts.

The function can be supervised and approved directly through the smart contract. There is no
need for a centralized authority to do so, which decreases the cost of the administration
significantly. To enhance efficiency, all medical record data are saved in a local database
storage.

5.1.3 Creating Account through Smart Contract


Figure 22 shows the process of creating an account step-by-step, where Figure 22(a) shows
account information from Ganache Ethereum, which allows users to use a browser to access a
decentralized system without having a full node of the blockchain. Figure 22(b) shows the
importing of private keys through MetaMask that eliminates the requirement for a multiparty
and ensures that contracts can be implemented quickly. This MetaMask, an Ethereum wallet,
is to solve the issue of misusing crypto keys. A password-protected Ethereum wallet is a piece
of software that may be used to store secret keys and to sign, authorize, and manage
transactions using electronic health records. The secret keys of the admin, doctor, and patient
will be stored in the MetaMask wallet, which may be used anywhere private key permission is
required. Figure 22(c) shows the account ID from Ganache to the Ethereum wallet where the
full MetaMask wallet will then connect to the system and function in accordance with the
ehr_project, and the admin will get instant access to enter the system through this account.

2
Figure 5.1.3

Figure 5.1.4

2
Figure 5.1.5

Figure 5.1.

(3) Ganache Ethereum (account address), (4) addition of the private key, and (5) account creation.

5.1.4 Installation Dependencies to Run the System on the Local Server

Figure 23 illustrates the package installation and execution process of the system using Yarn
dependencies. Yarn package management is used to run the system from the command line. It
is simple to use and share. Yarn handles this procedure fast, safely, and consistently. It will
complete the process of connecting the system to the server at a local level.

Figure 5.1.6 

2
Yarn package installation.

5.1.5 Truffle Migration and Deployment to Compile and Execute the Contracts

Figure 24 illustrates a snapshot of the implementation in which a Truffle migrates and deploys


on a blockchain with a smart contract, as well as the execution on the Ethereum network.
Truffle migrations allow you to upload smart contracts to the Ethereum blockchain (local) and
set up the essential procedures for integrating transactions with other transactions and
providing contracts with initial data.

2
Figure 5.1.7 

Truffle migration and deployment and smart contract execution.

Users also need to require the new contract and add a deployer statement inside the function if
they want to deploy another contract from the same migration file. Two different smart
contracts will be deployed as a result of this migration. Moreover, this process executes the
smart contract for the system

3
5.2 CODE FOR QUICK SUMMARY

1)

Smart Contracts written in Soldity

2)

3
MIGRATION

3)

3
CSS

4)

3
Global Login Page
5)

Patient Login

3
6)

Registration Window
7)

3
Truffle Code

3
8)

Truffle Configuration Code


9)

Ganache Setup

3
6. Testing

The purpose of testing is to discover errors. Testing is the process of trying to discover
every conceivable fault or weakness in a work product. It provides a way to check the
functionality of components, sub-assemblies, assemblies and /or a finished product.

6.1 Unit Testing


Unit testing involves the design of test cases that validate that the internal program logic is
functioning properly, and that program inputs produce valid outputs. Unit tests perform
basic tests at component level and test a specific business process, application, and/or
system configuration. Unit tests endure that each unique path of a business process
performs accurately to the documented specifications and contains clearly defined inputs
and expected results.

Test Cases: A test case is a set of conditions or variables under which a tester will
determine whether an application, software system or one of its features is working as it
was originally established for it to do.

6.2 Testing Framework Used

Truffle comes standard with an automated testing framework to make testing your
contracts a breeze. This framework lets you write simple and manageable tests in two
different ways:

 In Javascript and TypeScript, for exercising your contracts from the outside world, just
like your application.
 In Solidity, for exercising your contracts in advanced, bare-to-the-metal scenarios.
 Both styles of tests have their advantages and drawbacks. See the next two sections for a
discussion of each one.

3
6.3 Solidity for testing

Solidity test contracts live alongside Javascript tests as .sol files. When truffle test is run,
they will be included as a separate test suite per test contract. These contracts maintain all
the benefits of the Javascript tests: namely a clean-room environment per test suite, direct
access to your deployed contracts and the ability to import any contract dependency. In
addition to these features, Truffle's Solidity testing framework was built with the following
issues in mind:

Solidity tests shouldn't extend from any contract (like a Test contract). This makes your
tests as minimal as possible and gives you complete control over the contracts you write.
Solidity tests shouldn't be beholden to any assertion library. Truffle provides a default
assertion library for you, but you can change this library at any time to fit your needs.
You should be able to run your Solidity tests against any Ethereum client.

6.4 Test Structure

6.4.1 Assertions

Assertion functions looks like Assert.equal() are provided to you by the truffle/Assert.sol
library. This is the default assertion library, however you can include your own assertion
library so long as the library loosely integrates with Truffle's test runner by triggering the
correct assertion events. You can find all available assertion functions in Assert.sol.

6.4.2 Deployed addresses

The addresses of deployed contracts (i.e., contracts that were deployed as part of your
migrations) are available through the truffle/DeployedAddresses.sol library. This is
provided by Truffle and is recompiled and relinked before each suite is run to provide your
tests with Truffle's a clean room environment. This library provides functions for all of
your deployed contracts, in the form of:

3
This will return an address that you can then use to access that contract. See the example
test above for usage.

In order to use the deployed contract, you'll have to import the contract code into your test
suite. Notice import "../contracts/MetaCoin.sol"; in the example. This import is relative to
the test contract, which exists in the ./test directory, and it goes outside of the test directory
in order to find the MetaCoin contract. It then uses that contract to cast the address to the
MetaCoin type.

6.5 Testing ether transactions

Test how your contracts react to receiving Ether, and script that interaction within Solidity.
To do so, your Solidity test has a public function that returns a uint, called initialBalance.
This can be written directly as a function or a public variable, as shown below. When a test
contract is deployed to the network, Truffle will send that amount of Ether from your test
account to your test contract. Your test contract can then use that Ether to script Ether
interactions within your contract under test. Note that initialBalance is optional and not
required.

6.6 Solidity Testing Results

4
7. SCREENSHORTS
7.1 Registration Panel

Registration Panel

4
7.2 Login Panel

Login Panel

4
7.3 Access Control Panel

Patient giving access to doctor

Doctor’s Dashboard
(Accessing Patient’s Records)

4
7.4 Diagnostics Panel

Doctor Diagnosing A Patient

Diagnosis Submitted

4
8. Conclusion

In conclusion, blockchain technology has the potential to transform the way


medical records are stored and accessed. By providing a secure, decentralized,
and interoperable system, blockchain can address many of the challenges faced
by the current system, including security breaches, privacy concerns, and lack of
interoperability.

The data in prior systems was unstructured, making it impossible to transmit


information. Because of the massive volume of data produced by the
healthcare industry, we need to start thinking about improving our data
management methods without risking the data’s security and privacy. Because
of the confidentiality data, there will be additional changes. This change
brings many issues that need to be addressed, and blockchain successfully
addresses the fundamental issues.

4
9. Future Enhancements

● Cloud services can be used to up-scale the projects to make it accessable to wider
masses.

● Diverese formats of medical records can be used to better represent and share the
medical conditions of patients.

● Another possibility is that the payment module will eventually be integrated into the
existing architecture.

● With the introduction of Ganache, we now have the opportunity to experiment with a
similar technique utilizing a private blockchain.

● Inclusion of supply chain methods for tracing the drugs flow and delivery. This will
enable the government body to keep track of medicines and drugs from point of production
to the farthest end point i.e., till it reaches the patient.

4
10. References

1 K. Tiwari, S. Kumar, and R. K. Tiwari, “SURAKSHIT: a blockchain enabled


healthcare model for privacy assurance and data security,” Journal of Critical Reviews,
vol. 7, no. 13, pp. 2493–2511, 2020.
View at: Google Scholar
2 L. Academy, “Consensus protocols,” 2019, https://lisk.io/academy/blockchain-
basics/how-does-blockchain-work/consensus-protocols.
View at: Google Scholar
3 J. Yli-Huumo, D. Ko, S. Choi, S. Park, and K. Smolander, “Where is current research
on blockchain technology-a systematic review,” Plos One, vol. 11, no. 10, 2016.
View at: Google Scholar
4 P. A. Laplante, M. Kassab, N. L. Laplante, and J. M. Voas, “Building caring
healthcare systems in the Internet of Things,” Systems Journal, vol. 12, no. 3, pp. 3030–
3037, 2018.
View at: Publisher Site | Google Scholar
5 A. Gharat, P. Aher, P. Chaudhari, and B. Alte, “A framework for secure storage and
sharing of electronic health records using blockchain technology,” ITM Web of
Conferences, vol. 40, article 03037, 2021.
View at: Publisher Site | Google Scholar
6 R. Sreeraj, A. Singh, and V. Anbarasu, “Preserving EMR records using
blockchain,” Annals of Romanian Society for cell Biology, vol. 25, no. 6, pp. 5344–5350,
2021.
View at: Google Scholar
7 R. Harika and B. ThirumalaRao, “Survey on smart healthcare using
blockchain,” Journal of Critical Reviews, vol. 7, no. 14, pp. 615–621, 2020.
View at: Google Scholar
8 G. Rathee, A. Sharma, H. Saini, R. Kumar, and R. Iqbal, “A hybrid framework for
multimedia data processing in IoT-healthcare using blockchain technology,” Multimedia
Tools and Applications, vol. 79, no. 15-16, pp. 9711–9733, 2020.
View at: Publisher Site | Google Scholar
9 A. Sharma, Sarishma, R. Tomar, N. Chilamkurti, and B. G. Kim, “Blockchain based
smart contracts for internet of medical things in e-Healthcare,” Electronics, vol. 9, no. 10,
p. 1609, 2020.
View at: Publisher Site | Google Scholar
10 R. Poorni, M. Lakshmanan, and S. Bhuvaneswari, “DIGICERT: a secured digital
certificate application using blockchain through smart contracts,” in 2019 International

4
Conference on Communication and Electronics Systems (ICCES), pp. 215–219,
Coimbatore, India, 2019.
View at: Google Scholar

4
4

You might also like