A Blockchain-Based Smart Contract System for Healthcare Management

: Blockchain is evolving to be a secure and reliable platform for secure data sharing in application areas such as the ﬁnancial sector, supply chain management, food industry, energy sector, internet of things and healthcare. In this paper, we review existing literature and applications available for the healthcare system using blockchain technology. Besides, this work also proposes multiple workﬂows involved in the healthcare ecosystem using blockchain technology for better data management. Di ﬀ erent medical workﬂows have been designed and implemented using the ethereum blockchain platform which involves complex medical procedures like surgery and clinical trials. This also includes accessing and managing a large amount of medical data. Within the implementation of the workﬂows of the medical smart contract system for healthcare management, the associated cost has been estimated for this system in terms of a feasibility study which has been comprehensively presented in this paper. This work would facilitate multiple stakeholders who are involved within the medical system to deliver better healthcare services and optimize cost.


Introduction
Blockchain technology has emerged as a key technology recently in the digital revolution of the healthcare sector and several research studies [1][2][3] have identified blockchain potential for the healthcare ecosystem.It is ready to transform the way traditional medical systems and businesses have been engaged in the healthcare sector for the last several decades [4].Information and Communication Technologies (ICTs) and blockchain are key enabling technologies for the decentralization and digitalization of healthcare institutions and provides modern and digitilized healthcare ecosystem to patients as well as service providers [5,6].Blockchain applications for healthcare data management create utilities for patient, doctors and healthcare institutes in the directions of patient record access and control, claims and payments management, management of medical IoT security [7] and research data verification and exchange for financial auditing [8] and transparency.In these applications, real-time updates to an encrypted, decentralized blockchain ledger are done to understand, monitor, and control medical information [9,10].This also facilitates the healthcare institutions to restrict the unauthorized person to access sensitive information.
Healthcare management involves many processes such as managing finances, staff, patients, legal issues, logistics, inventory, etc. Medical workflows often involve repetitive tasks related to the actual patient treatment that can be plotted out as a series of conditional steps.These are designed to provide better internal controls and improved efficiency, compliance, productivity, and reduce risk, work cycles and overhead within hospitals and other healthcare service providers.In this paper, multiple medical workflows are designed for different healthcare management application domains.This work presents a healthcare smart contract system for medical data management and to streamline complex medical procedures.We discussed the state-of-the-art blockchain research in the healthcare field and implemented ethereum based solution for the healthcare management.The purpose of this paper is also to indicate the potential use of blockchain in healthcare and to show blockchain research's challenges and possible directions.This systematic review includes only research that introduces a new healthcare solution, algorithm, method, methodology, or architecture.Review type research, discussion of potential blockchain uses and applications, and other non-relevant publications are excluded.Using realistic clinical databases, the paper then studies the blockchain applicability to these healthcare workflows and the feasibility of current adoption of blockchain in different use cases.
This paper is organized as follows: Section 2 describes the background concept on blockchain technology, Section 3 reviews the related work.Section 4 states the potential benefits of blockchain technology.Section 5 presents the System design and development.The cost estimation method and the experiment results are discussed in Section 6. Validation of the workflows with real healthcare data sets are described in Section 7. Section 8 highlights the overall discussion and summary of the paper.Lastly, Section 9 concludes the paper.

Background Concepts on Blockchain Technology
Blockchain is a distributed ledger technology that is managed by different peers on a peer-to-peer network [11,12].This technology operates without any central administrator or centralized data storage management [13].Data is widely spread across several nodes and the quality of data is maintained by replication and encryption [14,15].On 31st October 2008, the concept of blockchain came into existence via a white paper, written by Nakamoto [16].He came up with the idea of bitcoin transactions on a platform where the online payments could be sent directly from one peer to another peer without going through a financial institution.His main idea was to develop a trustless [17] system that solves the double-spending problem using a peer-to-peer distributed ledger technology through a computational proof of the chronological order of transactions [18].The term, blockchain refers to a chain of blocks where each block stores a group of information about its past, present and future [19,20].Each block plays a key role in connecting with the previous block, and with the following block, as soon as it comes into the system to be a part of the chain [21].The main role of each block is to record, validate and distribute the transactions among other blocks [22].This means that a block in the chain cannot be removed or altered as this would change every subsequent block [23,24].
The blockchain network is, therefore, a decentralized information system [25,26] that contains information about all past transactions and operates on a pre-selected protocol which defines the direction of performing and validating the transactions, as well as the functioning of the entire network and its members [27].Moreover, this network is usually referred to as a distributed registry, as data is stored on each node operating in each of the individual networks [28,29].
A transaction group in blockchain networks is combined into blocks of transactions connected in the chain using the hash of the previous block's record [30].Therefore, as a property of immutability, the basic security feature of blockchain networks is enforced [31].The further the block is along the chain (the older it is), the more the data included in it is protected from changes [32].If an attacker tries to change any of the keys, the local register will immediately cease to be valid because the hash values inside the next blocks headers will be completely different depending on the hash function mechanism [33,34].

A Review on Blockchain Healthcare Applications
Legacy systems typically only share healthcare resources internally in the medical and healthcare field and are not fully compatible with external systems.Nonetheless, evidence indicates numerous benefits from integrating these networks for interconnected and better healthcare, calling for interconnection between different organizations for health informatics researchers [35].One of the most critical issues is multi-organizational data exchange, which demands that medical data obtained by a healthcare provider be easily available to other organizations, such as a physician or research institute.In many healthcare implementations, blockchain technology redefines data processing and governance.This is to its adaptability and unprecedented segmentation, secure and sharing of medical data and services.In the healthcare industry, blockchain technology is at the forefront of many current developments.
With advances in electronic data related to health, cloud data storage and patient data protection regulations, new opportunities are opening up for the management of health data, as well as convenience for patients to access and share their health data [36].Ensuring data security, storing, transactions, and managing their smooth integration is tremendously valuable to any data-driven organization, particularly in health care where blockchain technology has the potential to solve these critical issues in a robust and effective manner.In this section, blockchain-based applications including data sharing, data management, data storage and EHR, discussed in details.
Emerging blockchain-based healthcare innovations, including data sources, blockchain technology, healthcare applications, and stakeholders, are conceptually divided into several layers.Gordon and Catalini [37] published a review on healthcare blockchain where they concluded their discussion on how blockchain technology can enable patient-centric control of healthcare data sharing over institution centric control.In their study they examined how blockchain technology transforms the healthcare sector by enabling digital access rights, patient identification across the network, handling a large volume of healthcare data and data immutability.
Daisuke et al. [38] worked on medical records using the Hyperledger fabric blockchain platform where they were sending medical data to the hyper ledger blockchain network.They have collected those medical records using smartphones.In their work, they were trying to make sure that healthcare data is registered to the Blockchain.
Anuraag et al. [39] studied blockchain as a way to manage healthcare information efficiently.In their study, they included various types of studies and most of the work among this study was discussing potential benefits and limitations of blockchain technology for healthcare without being provided any proof or system evaluation.They have concluded their discussion on how blockchain could be a better fit for managing health care records on the cloud system while maintaining security and privacy of data.
Rouhani et al. [40] came up with an approach to address limitations of permission and permissionless blockchain.They have used an instance of Hyperledger platform for patient-controlled healthcare data management.
Wu and Tsai [41] did a literature review on healthcare management systems and proposed two algorithms for providing network security.They also suggested using a distributed system for healthcare data management and establishing regulations for the healthcare data.
Shen et al. [42] proposes a mechanism for sharing medical data using blockchain and peer to peer networks known as MedChain.They have designed this system for healthcare data generated via medical examination and the patient data collected from IoT sensors and other mobile apps.
Khezr et al. [43] discussed various issues of the healthcare management system and how it could be resolved using blockchain technology.They have presented the current research on healthcare using distributed ledger technology with some possible medical use cases where blockchain technology can play a significant role to make the process efficient.They have also proposed the IoMT delivery system using networking protocols.
Litchfield et al. [44] have discussed issues regarding healthcare data security and privacy and suggested blockchain to overcome these issues besides doing a survey on healthcare issues.
Vora et al. [45] discussed breaching of patient information such as name, address etc. on a regular basis.They proposed blockchain mechanism to handle electronic health records.The main goal of their paper was to analyze their system performance to see how their proposed framework handles the needs of a patient, doctors and third parties.
Zhang et al. [46] wrote a book chapter proposal where they have discussed different use cases of healthcare blockchain.They have highlighted the importance of the blockchain-based system for healthcare and how blockchain technology provides effective healthcare design.
Siyal et al. [47] discussed how blockchain technology and smart contracts are beneficial for the healthcare sector by streamlining the overall process.In their work, they have stated that managing healthcare record are crucial and blockchain has the potential to reduce the loss and to prevent fabrication of data by securing the information on the ledger.
Jamil et al. discussed the issues regarding drug regulations and how to standardized drugs using blockchain.In their work, they have highlighted the difficulties to detect falsified drugs and proposed blockchain as a way to detect counterfeits [48].
Lee and Yang worked on the fingernail analysis management system using blockchain and microscopy sensor.Human nails are very unique and reflects the physiological nature of the human being.In their work, they have used microscopic sensors to capture the nail images and used image pre-processing techniques to get the clear images.A deep neural network was utilized for performance monitoring of a feature extraction algorithm.Blockchain technology was used as a means to protect user data and provide security and privacy so any change in the system can be tracked and recorded via the ledger [49].
Agbo et al. [50] did a systematic review of current research of blockchain applications for healthcare.They have selected 65 papers to address their research question.Their study shows that blockchain could be a potential technology for different healthcare use cases which includes drugs supply chain, biomedical research, managing electronic healthcare records.However, they have also analyzed the fact that there is still needs to develop more understanding of blockchain technology and how it could be a best fit for different healthcare related challenges.
Innovation has been slowed down in healthcare because of inefficiencies and heavy regulations.Azaria et al. discussed these regulation issues causing inefficiencies in EMR system [51].They have proposed blockchain based solution known as MedRec for managing huge amount of medical data in EMR system.They have demonstrated a unique and innovative approach for accessing of healthcare records, which provides fair audit access log system.MedRec enabled patients and doctors to share the medical data among different parties using distributed ledger technology.They give incentives to the people such as researchers, other health individuals to participate in the mining process.MedRec enables anonymity of data and accessibility of that data to the miners as a reward to participate in the network.
Zhang et al. [52] discussed about blockchain and smart contracts how blockchain based smart contracts has the potential to address different healthcare issues.In their work they took some initial steps to adopt blockchain technology for different healthcare use cases and pointed towards different challenges in the implementation of blockchain technology.They have elaborated that developing blockchain based apps can address healthcare issues in more efficient ways.
Kumar et al. [53] discussed different applications of blockchain for healthcare system.They have highlighted issues and challenges in adoption of blockchain technology and introduced smart contract for blockchain based medical system.
Philippe et al. [54] presented consent management in the E-health environments and proposed blockchain as a secure and most reliable solution to handle healthcare data.Access to personal data has become a concern in this era of digital world, with challenging aspects of security and privacy.Digital security is a major challenge due to hacking motives and violations of privacy.This is possible in the eHealth area where patient's health information management system must comply with many legislation while remaining accessible to healthcare professionals who are duly authorized.Because of its most popular use-Bitcoin-most will have heard of blockchain in the payment region.Nonetheless, the features of blockchain make it possible to meet the consent management criteria as demonstrated in an application within a case for use in a health domain.
There are many advantages to the distributed ledger system as discussed by Nofer et al. [55] including security to the personal data, sensitive information handling, eliminating third parties, identity management.Unlike centralized networks, the network's functionality continues even if individual nodes break down.It increases faith as the trustworthiness of the intermediary or other network members is not judged by individuals.It's enough if people build confidence in the system itself.Data security is also facilitated by the lack of intermediaries.As there is a possibility of security breaches in the current practice of third parties gathering personal data.Third parties may become redundant by using the blockchain, effectively increasing the protection of the user.
A report by MIT Media Lab [56] presented about security and privacy aspects of data and personal information handling underlining all of the blockchain technology implementations.It is the value of the secure processing of data-in the sense that it cannot be manipulated.Another dimension of data security is data protection and privacy.For example, Enigma is a decentralized, privacy-guaranteed computing platform and an advancement on blockchain technology.The goal of Enigma is to enable developers to build an end-to-end decentralized application that is' privacy by design' without a trusted third party.Enigma is an expansion of blockchain technology since processing and data storage are not achieved within the blockchain, instead the blockchain is an "operating system" for secure multiparty computations performed by network-participating storage and computation nodes.Information is split between different nodes, and different nodes are working together to measure functions without leaking information to the other nodes.In summary, "no single party has access to data in its entirety; rather, each party has a piece of it that is meaningless (i.e., apparently arbitrary).
Blockchain holds the promise to create the new data deal, a greater degree of individual ownership, control and content distribution of personal data, within a system that allows community to benefit from the aggregation of data.The traffic congestion information inside Google Maps is a clear example of the benefits of data aggregation: by adding location, travel speed and other essential personal information, drivers benefit from the common data pool to achieve shorter traffic time and avoid traffic jams.To do this, however, Google needs to combine driver personal location information.
BlockVerify, on the other side, is an instance of a start-up using blockchain to claim intellectual property by checking the origin of luxury items, physical items and addressing the problem of counterfeiting goods by verifying the legal status of pharmaceutical products, diamonds and electronics.This kind of security occurs because blockchain is decentralized so that for its maintenance it does not rely on a single authority, and therefore a single case of mishandling causing a point of failure does not affect the consistency of records.
Another article [57] decribes blockchain and Ethereum as secure platform for handling all kind of sensitive information.It states blockchain as a system that's decentralized.To solve business problems, it has extensive strength.In a blockchain transaction, encryption secures the records and each transaction is connected to previous transactions or a record.Blockchain transactions are validated on the nodes using algorithms.It is impossible for a single person to make a transaction.Eventually, blockchains have transparency, allowing each user at any time to track the transactions.Smart contract is a secure process that helps prevent interruption by third parties.Ethereum is a distributed network running smart contracts.This helps developers to create markets to move funds according to instructions given in the past for a long time.Blockchain's main features are Decentralization, Immutability, quick transfers, Payment and confirmation within no time.
Xueping Liang et al. [58] uses the cloud services scenario and select the cloud record as a data unit to quickly identify user activities to gather data from the source.By embedding the provenance data into blockchain transactions, they design and implement ProvChain, an architecture for the collection and verification of cloud data provenance.ProvChain primarily works in three phases such as data collection from provenance, data storage from provenance, and data validation from provenance.Performance evaluation results show that ProvChain offers security features for cloud storage applications, including deceptive provenance, consumer privacy, and low overhead reliability.Mackey et al. [59] discussed how blockchain is being widely explored in healthcare sector by different business stakeholder to optimize their business operations.It can help in improving patient outcomes, lower costs and standardized the overall process.They have conducted survey from different practitioners about blockchain conceptualization and deployment of blockchain infrastructure in the healthcare institutions.

Potential Benefits of Blockchain in the Healthcare Industry
Blockchain technology provides numerous benefits to medical researchers, health care providers, and individuals [60,61].It would serve research as well as personalized medicine to create a single storage location for all health data, track personalized data in real-time and set data access permissions at a granular level [62].
Health researchers need comprehensive data sets to advance understanding of disease, accelerate biomedical discovery, track the development of drugs quickly, and design individual treatment plans based on genetics, lifecycle, and environment [63].By including patients of different ethnic and socio-economic backgrounds and from different geographic areas, the shared data system of Blockchain would provide a wide range of data set [64,65].It provides perfect information for longitudinal studies because blockchain collects health data over the lifetime of a person [66].
A health care blockchain will extend the collection of health data to include data from groups of people currently under-served by the medical community or not typically involved in science [67,68].The shared data environment of blockchain makes it easier for "hard-to-reach" audiences to be interested and for the general public to produce results more reflective [69,70].
A health care blockchain will likely encourage the development of a new breed of "smart" health care provider apps that would circumvent the latest medical research and develop customized treatment pathways [71,72].The health care provider and patient would have access to the same information and could be involved in a cooperative, educated discussion of research-based treatment options rather than intuition-based best case [73,74].

System Design and Development-Ethereum
The framework implementation will be a decentralized application (DApp) that supports a private blockchain network with a back-end distributed file system (DFS).Ethereum has been used for the implementation of the healthcare blockchain smart contract system.This is an open-source network and currently one of the largest public blockchain networks with an active community and a large public DApp repository.Currently, the platform uses a proof-of-work (PoW) consensus algorithm called Ethash, but developers are working towards changing it to a proof-of-stake (PoS) scalability algorithm in the near future.Ideally, a Delegated Proof-of-Stake (DPoS) or a Practical Byzantine Fault Tolerance (PBFT) consensus algorithm is suitable for the design of distributed applications.By comparing DFS content with ledger records, the DApp would have the ability to detect anomalies, unauthorized data insertions and missing entities.Each step is marked with a timeline for auditing.The main elements of the smart contracts are functions, events, state variables, and modifiers and been written in the high-level programming language known as solidity.Remix and Kovan test network has been used to deploy smart contracts on the testnet and testnet ethers for paying the transaction fee.In smart contract creation, three stages are involved, which are writing, compiling, and announcing by using Solidity programming.The bytecode is generated by Solidity real time compiler.For announcing smart contracts to the blockchain, Ethereum Wallet has been utilized.Figure 1 illustrates the operation of smart contracts with Ethereum, where the mining process is excluded for simplification.This smart contract is compiled into byte code at the machine level where each byte represents an operation and then uploaded to the blockchain as an EVM-1 transaction.It is picked up by a miner and confirms Block-1.Once a user sends the request through the web interface, the EVM-2 queries the web-based data and embeds it into Transaction tx and deploys it to the blockchain.The status of transaction tx is updated in Block-2.If node 3 wants to check the states that are stored in the contract, later on, it must synchronize up to at least Block -2 to see the changes that tx causes.

Blockchain Based Smart Contracts for Healthcare
We use smart contracts from Ethereum to create smart representations of existing medical records that are stored on the network within individual nodes.We build contracts to contain record ownership metadata, permissions, and data integrity.Our system's blockchain transactions carry cryptographically signed instructions for managing these properties.State-transition functions of the contract carry out policies, only by legitimate transactions enforcing data alternation.These regulations can be structured to enforce any set of rules regulating a specific medical record as long as it can be computationally represented.For example, a policy may impose sending separate consent transactions from both patients and healthcare professionals before granting a third party viewing permission.We designed a system based on blockchain smart contracts for complex healthcare workflows.Smart contracts have been designed for different medical workflows and then managing data access permission between different entities in the healthcare ecosystem.
A smart contract, stored on blockchain technology, could be designed which can have all the conditions from managing different permissions to accessing of data as shown in Figure 2 and it can be seen that a number of stakeholders are involved in this scheme carrying out different activities.This will help in creating better interaction between doctors and patients.Data authorization rules are embedded in smart contracts.It can also help in tracking all the activities with unique id from its origin to its surrender.Different scenarios have been designed and explained alongside all the functions and processes are well described embedded in the smart contracts.There will be no need to have a centralised entity to manage and approve the operation as it can be directly managed through the smart contract which will significantly reduce the administration cost of managing process.All of the medical record data is stored in local database storage to maintain the performance and economic viability and the hash of the data is the data element of the block committed to the chain.
The data transactions are signed with the owner's private key (patient or doctor).The block content for the system represents data ownership and viewership permissions shared by members of

Blockchain Based Smart Contracts for Healthcare
We use smart contracts from Ethereum to create smart representations of existing medical records that are stored on the network within individual nodes.We build contracts to contain record ownership metadata, permissions, and data integrity.Our system's blockchain transactions carry cryptographically signed instructions for managing these properties.State-transition functions of the contract carry out policies, only by legitimate transactions enforcing data alternation.These regulations can be structured to enforce any set of rules regulating a specific medical record as long as it can be computationally represented.For example, a policy may impose sending separate consent transactions from both patients and healthcare professionals before granting a third party viewing permission.We designed a system based on blockchain smart contracts for complex healthcare workflows.Smart contracts have been designed for different medical workflows and then managing data access permission between different entities in the healthcare ecosystem.
A smart contract, stored on blockchain technology, could be designed which can have all the conditions from managing different permissions to accessing of data as shown in Figure 2 and it can be seen that a number of stakeholders are involved in this scheme carrying out different activities.This will help in creating better interaction between doctors and patients.Data authorization rules are embedded in smart contracts.It can also help in tracking all the activities with unique id from its origin to its surrender.Different scenarios have been designed and explained alongside all the functions and processes are well described embedded in the smart contracts.There will be no need to have a centralised entity to manage and approve the operation as it can be directly managed through the smart contract which will significantly reduce the administration cost of managing process.All of the medical record data is stored in local database storage to maintain the performance and economic viability and the hash of the data is the data element of the block committed to the chain.
The data transactions are signed with the owner's private key (patient or doctor).The block content for the system represents data ownership and viewership permissions shared by members of a peer-to-peer private network.Blockchain technology supports the use of smart contracts that enable us to automate and track certain state transitions (such as a change in viewing rights or the birth of a new system record).We log patient-provider relationships via smart contracts on an Ethereum blockchain that associate a medical record with viewing permissions and data retrieval instructions (essentially information pointers) for external server execution to ensure against tampering, we include a cryptographic hash of the record on the blockchain, thus ensuring data integrity.
Providers can add a new record associated with a specific patient, and patients can allow record sharing between providers.The party receiving new information receives an automated notification in both cases and can verify the proposed record before the data is accepted or rejected.This keeps participants in the evolution of their records informed and engaged.This system prioritizes usability by also offering a designated contract that aggregates references to all patient-provider relationships of a user, thus providing a single point of reference to check for any medical history updates.We use public key cryptography to manage identity verification and use a DNS-like implementation that maps an already existing and widely accepted form of ID such as name or social security number to the Ethereum address of the user.After referring the blockchain to confirm permissions via our database authentication server, a syncing algorithm handles "off-chain" data exchange between a patient database and a provider database.
Electronics 2020, 9, x FOR PEER REVIEW 8 of 23 a peer-to-peer private network.Blockchain technology supports the use of smart contracts that enable us to automate and track certain state transitions (such as a change in viewing rights or the birth of a new system record).We log patient-provider relationships via smart contracts on an Ethereum blockchain that associate a medical record with viewing permissions and data retrieval instructions (essentially information pointers) for external server execution to ensure against tampering, we include a cryptographic hash of the record on the blockchain, thus ensuring data integrity.Providers can add a new record associated with a specific patient, and patients can allow record sharing between providers.The party receiving new information receives an automated notification in both cases and can verify the proposed record before the data is accepted or rejected.This keeps participants in the evolution of their records informed and engaged.This system prioritizes usability by also offering a designated contract that aggregates references to all patient-provider relationships of a user, thus providing a single point of reference to check for any medical history updates.We use public key cryptography to manage identity verification and use a DNS-like implementation that maps an already existing and widely accepted form of ID such as name or social security number to the Ethereum address of the user.After referring the blockchain to confirm permissions via our database authentication server, a syncing algorithm handles "off-chain" data exchange between a patient database and a provider database.

Implementation Details
Different medical workflows involving specific medical procedures have been designed and implemented via blockchain smart contract system.These includes issuing basic medical prescription to the treatment of complex diseases and their procedure like treatment procedure for the surgery patients.The purpose of designing these medical smart contracts is to facilitate the patients, doctors and the healthcare organization to overcome the administrative inefficiencies.This system will help in medical data retrieval, analysis and management of complex healthcare data and procedures.

Implementation Details
Different medical workflows involving specific medical procedures have been designed and implemented via blockchain smart contract system.These includes issuing basic medical prescription Electronics 2020, 9, 94 9 of 23 to the treatment of complex diseases and their procedure like treatment procedure for the surgery patients.The purpose of designing these medical smart contracts is to facilitate the patients, doctors and the healthcare organization to overcome the administrative inefficiencies.This system will help in medical data retrieval, analysis and management of complex healthcare data and procedures.

The Process for Issuing and Filling of Medical Prescriptions
The main goal is to streamline the medical prescription handling process by eliminating the long waiting time process, removing the fraud element from the system and reducing the error rate made by doctor misinterpretations.A doctor writes a prescription for the patient and puts it to the patient's healthcare records via a smart contract.The pharmacy then accesses this prescription through the smart contract on the Ethereum blockchain via permission granted by primary doctor and a patient.After accessing the prescription, pharmacy then issues the medicine along its expiry date and dosage use posted on to the patient healthcare records via smart contracts and then the medicine is ready for the collection by the patient.The smart contract features generally organize medicine satisfaction among doctors and drug stores.Doctors spend fewer times the time in explaining medicines requests or generally speaking with drug stores following a patient's visit.
Data flow for issuing a medical prescription involves patient, primary doctor (GP) and pharmacy as shown in Figure 3.It also contains the details of prescription which include medicine id, expiry date, patient id etc.The main goal is to streamline the medical prescription handling process by eliminating the long waiting time process, removing the fraud element from the system and reducing the error rate made by doctor misinterpretations.A doctor writes a prescription for the patient and puts it to the patient's healthcare records via a smart contract.The pharmacy then accesses this prescription through the smart contract on the Ethereum blockchain via permission granted by primary doctor and a patient.After accessing the prescription, pharmacy then issues the medicine along its expiry date and dosage use posted on to the patient healthcare records via smart contracts and then the medicine is ready for the collection by the patient.The smart contract features generally organize medicine satisfaction among doctors and drug stores.Doctors spend fewer times the time in explaining medicines requests or generally speaking with drug stores following a patient's visit.
Data flow for issuing a medical prescription involves patient, primary doctor (GP) and pharmacy as shown in Figure 3.It also contains the details of prescription which include medicine id, expiry date, patient id etc.

Sharing Laboratory Test/Results Data
The main objective is to share the information via blockchain smart contracts by permitting labs, doctors, emergency clinics, and different partners to effectively access and share a patient's therapeutic information among different stakeholders as it can be seen in Figure 4.
Consider a use case where a patient visits a lab for a blood test.After being processed, the lab will put the results into the patient records, the patient gets these notifications via Ethereum blockchain, a notice that the processed results of the test are accessible, and can pick whether to enable the lab to encode the information and put them on Ethereum blockchain.The patient grants permission for the information to be posted on the blockchain.If there is an emergency with the patient and he is unresponsive, the emergency department would be able to access patient information quickly via Ethereum blockchain and would be able to provide customized treatment.
By allowing patient's medical records to be posted on healthcare blockchain, a patient avoids having to carry the results of the laboratory on their own or arrange for records to be faxed to different care providers.He also ensures that all of his health care providers have the necessary information to provide the best possible care.Laboratories reduce the regulatory expenses of printing and mail

Sharing Laboratory Test/Results Data
The main objective is to share the information via blockchain smart contracts by permitting labs, doctors, emergency clinics, and different partners to effectively access and share a patient's therapeutic information among different stakeholders as it can be seen in Figure 4.
Consider a use case where a patient visits a lab for a blood test.After being processed, the lab will put the results into the patient records, the patient gets these notifications via Ethereum blockchain, a notice that the processed results of the test are accessible, and can pick whether to enable the lab to encode the information and put them on Ethereum blockchain.The patient grants permission for the information to be posted on the blockchain.If there is an emergency with the patient and he is unresponsive, the emergency department would be able to access patient information quickly via Ethereum blockchain and would be able to provide customized treatment.
By allowing patient's medical records to be posted on healthcare blockchain, a patient avoids having to carry the results of the laboratory on their own or arrange for records to be faxed to different care providers.He also ensures that all of his health care providers have the necessary information to provide the best possible care.Laboratories reduce the regulatory expenses of printing and mail or fax each test result to singular suppliers.Furthermore, labs and patients access the healthcare blockchain, where they may get installments from protection firms that counsel the transferred information to process claims or from pharmaceutical organizations that select the information for use in contemplates.Specialists and emergency clinics get access to brought together restorative information on their patients at no cost, decreasing authoritative work and costs.

Enabling Effective Communication between Patients and Service Providers
In this scenario, the patient submits a request for a medical condition as shown in Figure 5.It automatically sends this request to the primary doctor through the smart contract system.A doctor must consider the request and reply with a recommendation and refer the patients to the specialist for further care where appropriate.Any patient information about the history of treatment should be reported on the EHR.Please note that patient record is maintained by a local database where there are specific rules who can have access to the record to what extent and these rules are govern by the smart contracts on Ethereum blockchain.
Another case where the patient submits a request for a specific medical treatment.Consequently, it sends this application to the appropriate specialist through the strict structure of the agreement.A doctor understands the demand and responds with a recommendation and where patients are simply traded for further care with the specialist.Any patient data regarding the history of treatment must be reported on the EHR.Note that a nearby database keeps patient records where there are explicit principles that can approach the record to what degree and these guidelines are administered through the knowledgeable contracts on Ethereum blockchain.
Patients seeking health information on a specific subject receive a recommendation that is far more personalized than those provided by a web search.Senior physicians gain a new way of monetizing their expertise without having to overbook their schedules, while junior physicians can access a new potential patient market and build their brand within their specialty.Payments encourage patients to receive recommendations from junior doctors.

Enabling Effective Communication between Patients and Service Providers
In this scenario, the patient submits a request for a medical condition as shown in Figure 5.It automatically sends this request to the primary doctor through the smart contract system.A doctor must consider the request and reply with a recommendation and refer the patients to the specialist for further care where appropriate.Any patient information about the history of treatment should be reported on the EHR.Please note that patient record is maintained by a local database where there are specific rules who can have access to the record to what extent and these rules are govern by the smart contracts on Ethereum blockchain.
Another case where the patient submits a request for a specific medical treatment.Consequently, it sends this application to the appropriate specialist through the strict structure of the agreement.A doctor understands the demand and responds with a recommendation and where patients are simply traded for further care with the specialist.Any patient data regarding the history of treatment must be reported on the EHR.Note that a nearby database keeps patient records where there are explicit principles that can approach the record to what degree and these guidelines are administered through the knowledgeable contracts on Ethereum blockchain.
Patients seeking health information on a specific subject receive a recommendation that is far more personalized than those provided by a web search.Senior physicians gain a new way of monetizing their expertise without having to overbook their schedules, while junior physicians can access a new potential patient market and build their brand within their specialty.Payments encourage patients to receive recommendations from junior doctors.

Data Flow for Healthcare Reimbursement
The main objective is to speed up the process of reimbursement for the health care system.In this, physicians will be able to proceed quickly with care instead of having to put on hold the treatment of their patient while waiting for the payer to respond.The execution of automated smart contracts will monitor the whole process.Reducing-and ultimately eliminating-the error-laden human effort to manually review and respond to requests for prior authorization, and reducing appeals triggered by incorrect interpretation of manually written prior authorization forms.
Health Insurance Company posts their policies via blockchain smart contracts containing the policies used to determine authorization.A supplier then submits to the blockchain an application for prior authorization for a specialist appointment, treatment or prescription.The smart contract for a medical policy of the payer determines automatically authorization using the medical information of the patient stored via Ethereum blockchain and the information in the request.Authorization data will then be returned to the provider immediately.Also, the patient-as well as any laboratories, pharmacies, specialists and other stakeholders to whom the patient has delegated access-could verify the insurance authorization in real-time.The whole process can be seen in Figure 6.

Data Flow for Healthcare Reimbursement
The main objective is to speed up the process of reimbursement for the health care system.In this, physicians will be able to proceed quickly with care instead of having to put on hold the treatment of their patient while waiting for the payer to respond.The execution of automated smart contracts will monitor the whole process.Reducing-and ultimately eliminating-the error-laden human effort to manually review and respond to requests for prior authorization, and reducing appeals triggered by incorrect interpretation of manually written prior authorization forms.
Health Insurance Company posts their policies via blockchain smart contracts containing the policies used to determine authorization.A supplier then submits to the blockchain an application for prior authorization for a specialist appointment, treatment or prescription.The smart contract for a medical policy of the payer determines automatically authorization using the medical information of the patient stored via Ethereum blockchain and the information in the request.Authorization data will then be returned to the provider immediately.Also, the patient-as well as any laboratories, pharmacies, specialists and other stakeholders to whom the patient has delegated access-could verify the insurance authorization in real-time.The whole process can be seen in Figure 6.
The automated process of prior authorization would result in significant cost savings for payers, which currently spends substantial amounts on manually reviewing and responding to requests.Doctors will be able to proceed quickly with treatment instead of having to stop the care of their patient while waiting for the payer's response.Furthermore, patients will be spared concerned as to whether their insurance will cover the treatment recommended by their doctor.With immediately available prior authorization information, doctors and patients can work together easily with a care plan tailored specifically to the needs of the patient and the appropriate insurance coverage.
for prior authorization for a specialist appointment, treatment or prescription.The smart contract for a medical policy of the payer determines automatically authorization using the medical information of the patient stored via Ethereum blockchain and the information in the request.Authorization data will then be returned to the provider immediately.Also, the patient-as well as any laboratories, pharmacies, specialists and other stakeholders to whom the patient has delegated access-could verify the insurance authorization in real-time.The whole process can be seen in Figure 6.

Ethereum-Based Smart Contracts for Clinical Trials
Providing drug and medical device manufacturers with a simpler and more cost-effective alternative to the current recruitment of clinical trials, which often requires considerable expenses to buy patient contact information from independent data providers and to execute comprehensive pull-marketing campaigns.
The main goal is to allow users to run clinical trial-related smart contracts on an Ethereum network resulting in safer medicines and increased public interest in medical research.In this process, we will handle metadata, including protocol registration, preset study details, screening and enrollment logs via smart contracts.
A pharmaceutical company looks for metadata stored on the Ethereum blockchain to identify potential patients for inclusion in clinical trials as shown in Figure 7.The organization then sends a message to selected patients, including an application to read access to their medical records, including any relevant results from the laboratory study.If the patient allows access, a pharmaceutical company bill would be processed via smart contracts, awarding part of the received fee to the patient, and another section to the labs that reported the appropriate test results for the patient.The automated process of prior authorization would result in significant cost savings for payers, which currently spends substantial amounts on manually reviewing and responding to requests.Doctors will be able to proceed quickly with treatment instead of having to stop the care of their patient while waiting for the payer's response.Furthermore, patients will be spared concerned as to whether their insurance will cover the treatment recommended by their doctor.With immediately available prior authorization information, doctors and patients can work together easily with a care plan tailored specifically to the needs of the patient and the appropriate insurance coverage.

Ethereum-Based Smart Contracts for Clinical Trials
Providing drug and medical device manufacturers with a simpler and more cost-effective alternative to the current recruitment of clinical trials, which often requires considerable expenses to buy patient contact information from independent data providers and to execute comprehensive pull-marketing campaigns.
The main goal is to allow users to run clinical trial-related smart contracts on an Ethereum network resulting in safer medicines and increased public interest in medical research.In this process, we will handle metadata, including protocol registration, preset study details, screening and enrollment logs via smart contracts.
A pharmaceutical company looks for metadata stored on the Ethereum blockchain to identify potential patients for inclusion in clinical trials as shown in Figure 7.The organization then sends a message to selected patients, including an application to read access to their medical records, including any relevant results from the laboratory study.If the patient allows access, a pharmaceutical company bill would be processed via smart contracts, awarding part of the received fee to the patient, and another section to the labs that reported the appropriate test results for the patient.
Through directly targeting qualifying customers, drug and medical device manufacturers will significantly reduce spending on data purchases and marketing efforts.Patients, meanwhile, in addition to receiving compensation for participating in trials, would gain access to new treatment options.Laboratories that were involved in posting results would have a new way of monetizing their data.Through directly targeting qualifying customers, drug and medical device manufacturers will significantly reduce spending on data purchases and marketing efforts.Patients, meanwhile, in addition to receiving compensation for participating in trials, would gain access to new treatment options.Laboratories that were involved in posting results would have a new way of monetizing their data.

Basic Outpatient Surgical Procedure
The process associated with surgery can be a huge burden in a busy clinic.The EHR Surgical Workflow System meets the needs of busy practices and turns a complex process into an all-in-one step-by-step, streamlined workflow.The practice can be made fully integrated via Ethereum blockchain smart contracts EHR Surgical Workflow system.This allows administrators, billing, front desk and other tasks to complete tasks to support the workflow from pre-operative patient management to post-operative patient management.The details are then inserted seamlessly into the prior surgical record of the patient.Through the smart contract features it would be possible to record patient consent and initial assessment of the patient.Our workflow consists of various activities that are involved throughout the surgical patient process.This includes pre-approvals, medical clearance, surgery scheduling, pre-operative testing and recording consent.Throughout the process, the visit is recorded, treatment is reported and paid.This would be useful to review past surgical cases or surgeries that have been canceled.Algorithmic workflow and the solidity smart contract components can be seen in Figures 8 and 9  The process associated with surgery can be a huge burden in a busy clinic.The EHR Surgical Workflow System meets the needs of busy practices and turns a complex process into an all-in-one step-by-step, streamlined workflow.The practice can be made fully integrated via Ethereum blockchain smart contracts EHR Surgical Workflow system.This allows administrators, billing, front desk and other tasks to complete tasks to support the workflow from pre-operative patient management to post-operative patient management.The details are then inserted seamlessly into the prior surgical record of the patient.Through the smart contract features it would be possible to record patient consent and initial assessment of the patient.Our workflow consists of various activities that are involved throughout the surgical patient process.This includes pre-approvals, medical clearance, surgery scheduling, pre-operative testing and recording consent.Throughout the process, the visit is recorded, treatment is reported and paid.This would be useful to review past surgical cases or surgeries that have been canceled.Algorithmic workflow and the solidity smart contract components can be seen in Figure 8 and Figure 9 respectively.

Cost Estimation Method
In terms of deploying medical blockchain, there is a need to make estimation of the cost associated with deploying healthcare smart contracts.The ultimate goal is to propose a system which can give a feasible medical health system with all the benefits of blockchain.All programmable calculations in Ethereum blockchian cost some fees to avoid the abuse of network and overcome other computational related issues.The fee in Ethereum blockchain is specified as gas to run all sort of transactions.Gas refers to the payment or price value required for a successful transaction or execution of a contract on the Ethereum blockchain platform.The exact price of gas is determined by the network miners who may refuse to process a transaction if their limit is not met by the gas price.Hence all the operations, computations, message call, creation/deployment of smart contracts and storage on Ethereum vitual machine (EVM) needs gas to perform all these tasks.If someone wants to do any sort of operation on EVM, they must have specific amount of gas in their account to execute transactions on Ethereum virtual machine.There is a gas limit for every transactions, so if there is any unused gas it will return to the user account after the execution of transactions.If a user doesn't have valid balance account, he can't carry on any kind of operation and hence considered as invalid transaction.In EVM Ethers are used to purchase gas and the users who are running the transactions can set their account gas limit for the specific transaction.But again it's on the miner if they tend to approve the transaction or not.If a sender chooses higher gas price, it will cost them high price to pay for the gas and miners will get great value for the transactions.A miner then executes the computation in order to add this transaction to a block.After the successful execution of transactions, a miner can then broadcast the new block into the network.

Validating Workflows with Real Healthcare Datasets
We used our developed smart contract workflows to estimate the deployment cost using real healthcare datasets.Blockchain transaction details in ethereum can be seen in Figure 10.Description of the datasets is provided in section A. In section B using the real datasets, the deployment cost are estimated and plotted for various factors.

Dataset Description
Datasets are taken from HSE from its different archives (https://data.ehealthireland.ie/)[75].The Health Service Executive is responsible for providing health and personal social services with public funds for all people living in Ireland.All the outpatients, Inpatients waiting list across different departments/Hospital in Ireland has considered to be used in this work.The Outpatient, Inpatient and Day case waiting lists are managed by (NTPF) the National Treatment Purchase Fund from collection of data to its validation phase.The Waiting List report for OP states the total number of patients who are waiting, across the various time bands, for a first appointment at a consultant-led Outpatient clinic.Every individual report consists of the numbers waiting per Hospital in each

Cost Estimation Method
In terms of deploying medical blockchain, there is a need to make estimation of the cost associated with deploying healthcare smart contracts.The ultimate goal is to propose a system which can give a feasible medical health system with all the benefits of blockchain.All programmable calculations in Ethereum blockchian cost some fees to avoid the abuse of network and overcome other computational related issues.The fee in Ethereum blockchain is specified as gas to run all sort of transactions.Gas refers to the payment or price value required for a successful transaction or execution of a contract on the Ethereum blockchain platform.The exact price of gas is determined by the network miners who may refuse to process a transaction if their limit is not met by the gas price.Hence all the operations, computations, message call, creation/deployment of smart contracts and storage on Ethereum vitual machine (EVM) needs gas to perform all these tasks.If someone wants to do any sort of operation on EVM, they must have specific amount of gas in their account to execute transactions on Ethereum virtual machine.There is a gas limit for every transactions, so if there is any unused gas it will return to the user account after the execution of transactions.If a user doesn't have valid balance account, he can't carry on any kind of operation and hence considered as invalid transaction.In EVM Ethers are used to purchase gas and the users who are running the transactions can set their account gas limit for the specific transaction.But again it's on the miner if they tend to approve the transaction or not.If a sender chooses higher gas price, it will cost them high price to pay for the gas and miners will get great value for the transactions.A miner then executes the computation in order to add this transaction to a block.After the successful execution of transactions, a miner can then broadcast the new block into the network.

Validating Workflows with Real Healthcare Datasets
We used our developed smart contract workflows to estimate the deployment cost using real healthcare datasets.Blockchain transaction details in ethereum can be seen in Figure 10.Description of the datasets is provided in section A. In section B using the real datasets, the deployment cost are estimated and plotted for various factors.

Dataset Description
Datasets are taken from HSE from its different archives (https://data.ehealthireland.ie/)[75].The Health Service Executive is responsible for providing health and personal social services with public funds for all people living in Ireland.All the outpatients, Inpatients waiting list across different departments/Hospital in Ireland has considered to be used in this work.The Outpatient, Inpatient and Day case waiting lists are managed by (NTPF) the National Treatment Purchase Fund from collection of data to its validation phase.The Waiting List report for OP states the total number of patients who are waiting, across the various time bands, for a first appointment at a consultant-led Outpatient clinic.Every individual report consists of the numbers waiting per Hospital in each specialty.To protect individuals confidentiality, where there are <5 patients waiting in a particular specialty/hospital, the numbers have been aggregated under a 'Small Volume' heading.All report consists of data on a monthly basis over a year.
Electronics 2020, 9, x FOR PEER REVIEW 15 of 23 specialty.To protect individuals confidentiality, where there are <5 patients waiting in a particular specialty/hospital, the numbers have been aggregated under a 'Small Volume' heading.All report consists of data on a monthly basis over a year.

Cost Estimation Using Real Data
In terms of deploying healthcare blockchain, the cost associated with implementing smart contracts for healthcare needs to be calculated.The ultimate goal is to implement a system that can provide all the advantages of blockchain to a viable medical health system.In Ethereum blockchain, all programmable calculations cost some fees to avoid network abuse and to overcome other computational related issues.Therefore all operations, computations, message calls, smart contract creation/deployment and storage on EVM require gas to perform all these tasks.
The cost has been compiled for deploying smart contracts for healthcare management system.In order to run an operation on the Ethereum blockchain, there is cost known as Gas.All the transactions needs 21,000 gas as the basic need to run the operation.If a user is interacting with Ethereum smart contract, it takes 21,000 of gas with additional gas associated with running of that specific smart contract.For contract deployment to interaction with the different contracts, the gas has been compiled for medical smart contracts.More complex the functions/operations involved in the smart contracts consumes more gas resulting in more fee.As from the feasibility point of view, it is clear from the results that the smart contract deployment cost for healthcare management system is very low.In terms of medical system, this cost is very economical and everyone would like to pay this minor fee to gain control over their EHR and maintain their medical data for life time.Figure 13 shows the cost of deployment of smart contracts for each pharmacy as estimated by our system.

Cost Estimation Using Real Data
In terms of deploying healthcare blockchain, the cost associated with implementing smart contracts for healthcare needs to be calculated.The ultimate goal is to implement a system that can provide all the advantages of blockchain to a viable medical health system.In Ethereum blockchain, all programmable calculations cost some fees to avoid network abuse and to overcome other computational related issues.Therefore all operations, computations, message calls, smart contract creation/deployment and storage on EVM require gas to perform all these tasks.
The cost has been compiled for deploying smart contracts for healthcare management system.In order to run an operation on the Ethereum blockchain, there is cost known as Gas.All the transactions needs 21,000 gas as the basic need to run the operation.If a user is interacting with Ethereum smart contract, it takes 21,000 of gas with additional gas associated with running of that specific smart contract.For contract deployment to interaction with the different contracts, the gas has been compiled for medical smart contracts.More complex the functions/operations involved in the smart contracts consumes more gas resulting in more fee.As from the feasibility point of view, it is clear from the results that the smart contract deployment cost for healthcare management system is very low.In terms of medical system, this cost is very economical and everyone would like to pay this minor fee to gain control over their EHR and maintain their medical data for life time.Figure 13 shows the cost of deployment of smart contracts for each pharmacy as estimated by our system.

Cost Estimation Using Real Data
In terms of deploying healthcare blockchain, the cost associated with implementing smart contracts for healthcare needs to be calculated.The ultimate goal is to implement a system that can provide all the advantages of blockchain to a viable medical health system.In Ethereum blockchain, all programmable calculations cost some fees to avoid network abuse and to overcome other computational related issues.Therefore all operations, computations, message calls, smart contract creation/deployment and storage on EVM require gas to perform all these tasks.
The cost has been compiled for deploying smart contracts for healthcare management system.In order to run an operation on the Ethereum blockchain, there is cost known as Gas.All the transactions needs 21,000 gas as the basic need to run the operation.If a user is interacting with Ethereum smart contract, it takes 21,000 of gas with additional gas associated with running of that specific smart contract.For contract deployment to interaction with the different contracts, the gas has been compiled for medical smart contracts.More complex the functions/operations involved in the smart contracts consumes more gas resulting in more fee.As from the feasibility point of view, it is clear from the results that the smart contract deployment cost for healthcare management system is very low.In terms of medical system, this cost is very economical and everyone would like to pay this minor fee to gain control over their EHR and maintain their medical data for life time.Figure 13 shows the cost of deployment of smart contracts for each pharmacy as estimated by our system.
We have estimated the cost for general outpatients, paediactric department patients and surgery patients.The number of transactions for each of these cases and their associated costs as estimated by our system are plotted below in Figures 13-19.
Electronics 2020, 9, x FOR PEER REVIEW 17 of 23 We have estimated the cost for general outpatients, paediactric department patients and surgery patients.The number of transactions for each of these cases and their associated costs as estimated by our system are plotted below in Figures 13-19.We have estimated the cost for general outpatients, paediactric department patients and surgery patients.The number of transactions for each of these cases and their associated costs as estimated by our system are plotted below in Figures 13-19.We have estimated the cost for general outpatients, paediactric department patients and surgery patients.The number of transactions for each of these cases and their associated costs as estimated by our system are plotted below in Figures 13-19.

Discussion
It is well known that all patient data are stored in different formats in traditional healthcare delivery models, providers, laboratories, payers (i.e., insurance companies) and drug companies, and there is no standardization of record keeping.This has led to infringements of data and the disarray we see today in the exchange of health records.Poor infrastructure for data sharing has also impeded the progress of drug discovery and research into public health.Efforts to address this issue have focused largely on forcing a new shared standard throughout the ecosystem.These attempts were unsuccessful because regulation, lobbying, and patient apathy quickly rejected them.Due to the lack of effective processing and exchange of health data has prevented the widespread adoption of the practice of adjusting medical treatment to the attributes, desires and expectations of a patient.Personalized medicine-or precision -has long been recognized as the future of health care, and industry operators have devoted substantial resources to the development of personalized health care options, only to be stymied by the current system.
In this article, we discussed the current needs of the healthcare industry, the shortcomings of the current system, and proposed Ethereum-based solutions for healthcare management.Giving an overview of the state of personalized medicine, detailing concerns with the current healthcare system that hinder the implementation of personalized medicine and demonstrating how our designed system offers solutions to these problems.We also analysed the practical cost of deploying smart contracts for different health care scenarios and found that the cost increases linearly with outpatient numbers.For these reasons, health care departments like paediatrics and general surgery costs are higher than others.However, quantitatively it is seen that the cost of deployment of smart contracts is quite reasonable and therefore such an Ethereum-based system for maintenance of health records is feasible in realistic scenarios.

Conclusions
Using blockchain technology, our smart contract based healthcare management system has shown how decentralization principles can be applied in medical ecosystem for large-scale data management and to streamline complex medical procedures.We demonstrate an innovative approach to medical record handling, providing auditability, interoperability and accessibility using smart contracts.Designed to record flexibility and granularity, this system enables the sharing of patient data and incentives to support the system for medical researchers.We have proposed

Discussion
It is well known that all patient data are stored in different formats in traditional healthcare delivery models, providers, laboratories, payers (i.e., insurance companies) and drug companies, and there is no standardization of record keeping.This has led to infringements of data and the disarray we see today in the exchange of health records.Poor infrastructure for data sharing has also impeded the progress of drug discovery and research into public health.Efforts to address this issue have focused largely on forcing a new shared standard throughout the ecosystem.These attempts were unsuccessful because regulation, lobbying, and patient apathy quickly rejected them.Due to the lack of effective processing and exchange of health data has prevented the widespread adoption of the practice of adjusting medical treatment to the attributes, desires and expectations of a patient.Personalized medicine-or precision -has long been recognized as the future of health care, and industry operators have devoted substantial resources to the development of personalized health care options, only to be stymied by the current system.
In this article, we discussed the current needs of the healthcare industry, the shortcomings of the current system, and proposed Ethereum-based solutions for healthcare management.Giving an overview of the state of personalized medicine, detailing concerns with the current healthcare system that hinder the implementation of personalized medicine and demonstrating how our designed system offers solutions to these problems.We also analysed the practical cost of deploying smart contracts for different health care scenarios and found that the cost increases linearly with outpatient numbers.For these reasons, health care departments like paediatrics and general surgery costs are higher than others.However, quantitatively it is seen that the cost of deployment of smart contracts is quite reasonable and therefore such an Ethereum-based system for maintenance of health records is feasible in realistic scenarios.

Conclusions
Using blockchain technology, our smart contract based healthcare management system has shown how decentralization principles can be applied in medical ecosystem for large-scale data management and to streamline complex medical procedures.We demonstrate an innovative approach to medical record handling, providing auditability, interoperability and accessibility using smart contracts.Designed to record flexibility and granularity, this system enables the sharing of patient data and incentives to support the system for medical researchers.We have proposed potential applications of blockchain technology in the management of health data.We implemented a system for data management and sharing based on the requirements from a medical perspective.Using blockchain technology, privacy, security, availability and fine-grained control of access to EHR data can be ensured.The ultimate goal of using blockchain the way outlined in this paper is to improve healthcare processes and thus patient outcomes.Blockchain can help in many ways; reducing transaction costs by using smart contracts which are embedded general purpose protocols to simplify procedures, reduce administrative burdens and remove intermediaries.Other blockchain efforts are aimed at improving the collection, use and sharing of health data from patients, researchers and sub-processors of data.Our proposed system uses blockchain technology to create a healthcare ecosystem that is iterative, scalable, secure, accessible and decentralized.This would allow patients to exchange their medical records freely and safely with doctors, hospitals, research organizations and other stakeholders-all while maintaining full control over the privacy of their medical data.This will solve many of the current healthcare system's issues, including data siloing, legacy network incongruity, unstructured data collection difficulties, prohibitively high administrative costs, lack of data security, and unaddressed privacy concerns.

Figure 2 .
Figure 2. System workflow with smart contract controlled access.

Figure 2 .
Figure 2. System workflow with smart contract controlled access.

Electronics 2020, 9 , 23 5. 2 . 1 .
x FOR PEER REVIEW 9 of The Process for Issuing and Filling of Medical Prescriptions

Figure 3 .
Figure 3. Smart contract for issuing and filing of medical prescriptions.

Figure 3 .
Figure 3. Smart contract for issuing and filing of medical prescriptions.

Electronics 2020, 9 ,
x FOR PEER REVIEW 10 of 23 information to process claims or from pharmaceutical organizations that select the information for use in contemplates.Specialists and emergency clinics get access to brought together restorative information on their patients at no cost, decreasing authoritative work and costs.

Figure 4 .
Figure 4. Smart contract for sharing lab results.

Figure 4 .
Figure 4. Smart contract for sharing lab results.

Electronics 2020, 9 , 23 Figure 5 .
Figure 5. Smart contract for enabling communication between patient and service provider.

Figure 5 .
Figure 5. Smart contract for enabling communication between patient and service provider.

Figure 6 .
Figure 6.Smart contracts for healthcare reimbursement.Figure 6. Smart contracts for healthcare reimbursement.

Figure 6 .
Figure 6.Smart contracts for healthcare reimbursement.Figure 6. Smart contracts for healthcare reimbursement.

Figure 7 .
Figure 7. Smart contracts for conducting clinical trials.Figure 7. Smart contracts for conducting clinical trials.

Figure 7 .
Figure 7. Smart contracts for conducting clinical trials.Figure 7. Smart contracts for conducting clinical trials.

Figure 8 .
Figure 8. Algorithmic workflow for a smart contract with surgery patients.

Figure 8 .
Figure 8. Algorithmic workflow for a smart contract with surgery patients.

Figure 11
Figure 11  below shows the county wise number of pharmacies, Figure12shows the number of transactions for different departments.

Figure 11
Figure 11  below shows the county wise number of pharmacies, Figure12shows the number of transactions for different departments.

Figure 11 .
Figure 11.Plot showing county wise pharmacy list from Ireland.

Figure 12 .
Figure 12.Number of IPDC and their transaction across different departments/speciality.

Figure 11 . 23 Figure 11 .
Figure 11.Plot showing county wise pharmacy list from Ireland.

Figure 12 .
Figure 12.Number of IPDC and their transaction across different departments/speciality.

Figure 12 .
Figure 12.Number of IPDC and their transaction across different departments/speciality.

Figure 13 .
Figure 13.Plot showing smart contract deployment cost for countywise pharmacies in Ireland.

Figure 14 .
Figure 14.Cost comparison among different smart contracts and entities.

Figure 15 .
Figure 15.Cost comparison among different smart contracts and entities.

Figure 13 .
Figure 13.Plot showing smart contract deployment cost for countywise pharmacies in Ireland.

Figure 13 .
Figure 13.Plot showing smart contract deployment cost for countywise pharmacies in Ireland.

Figure 14 .
Figure 14.Cost comparison among different smart contracts and entities.

Figure 15 .
Figure 15.Cost comparison among different smart contracts and entities.

Figure 14 .
Figure 14.Cost comparison among different smart contracts and entities.

Figure 13 .
Figure 13.Plot showing smart contract deployment cost for countywise pharmacies in Ireland.

Figure 14 .
Figure 14.Cost comparison among different smart contracts and entities.

Figure 15 .
Figure 15.Cost comparison among different smart contracts and entities.Figure 15.Cost comparison among different smart contracts and entities.

Figure 15 .
Figure 15.Cost comparison among different smart contracts and entities.Figure 15.Cost comparison among different smart contracts and entities.

Figure 16 .
Figure 16.Cost comparison among different smart contracts and entities.

Figure 17 .
Figure 17.Cost comparison among different smart contracts and entities.

Figure 18 .
Figure 18.Smart contract deployment cost for Inpatients and Day cases (IDPC surgery) across different departments/specialities.

Figure 16 . 23 Figure 16 .
Figure 16.Cost comparison among different smart contracts and entities.

Figure 17 .
Figure 17.Cost comparison among different smart contracts and entities.

Figure 18 .
Figure 18.Smart contract deployment cost for Inpatients and Day cases (IDPC surgery) across different departments/specialities.

Figure 17 . 23 Figure 16 .
Figure 17.Cost comparison among different smart contracts and entities.

Figure 17 .
Figure 17.Cost comparison among different smart contracts and entities.

Figure 18 .
Figure 18.Smart contract deployment cost for Inpatients and Day cases (IDPC surgery) across different departments/specialities.

Figure 18 .
Figure 18.Smart contract deployment cost for Inpatients and Day cases (IDPC surgery) across different departments/specialities.

Figure 19 .
Figure 19.Smart contract deployment cost for Inpatients and Day cases (surgery) across different departments/specialty.

19 .
Smart contract deployment cost for Inpatients and Day cases (surgery) across different departments/specialty.