Artificial intelligence‐powered decentralized framework for Internet of Things in Healthcare 4.0

Remote patient monitoring and data management have gained much popularity in recent years because of their enhanced access to low‐cost healthcare services. A cloud‐based healthcare system provides numerous solutions for collecting patient data and offers on‐demand well‐managed reports to patients and healthcare providers. However, it equally suffers from single‐point failure, security, privacy, and non‐transparency issues with the data, impacting the continuity of the system. To resolve such concerns, this article proposes an artificial intelligence (AI)‐enabled decentralized healthcare framework that accesses and authenticates Internet of Things (IoT) devices and create trust and transparency in patient healthcare records (PHR). The mechanism is based on the AI‐enabled smart contracts and the conceptualization of the public blockchain network. Alongside this, the framework identifies the malicious IoT nodes in the system. The experimental analyses are performed on the real‐time test environment, and significant improvements are suggested in terms of device energy consumption, data request time, throughput, average latency, and transaction fee.

to data breaches with enormous repercussions. 5In 2018, there were 13,020,821 data breaches 6 as recorded by the department of health and human services Office for Civil Rights (OCR).Another paramount concern in the healthcare system is transparency in the patient health record (PHR).These are the significant issues that can cause severe consequences and must be resolved.Usually, the information is exchanged between the medical sensors and healthcare providers via a third party or centralized server, which also leads to transparency issues.Blockchain technology can address these concerns in the traditional healthcare system due to its immutable nature.Basically, blockchain technology 7,8 is a fusion of two traditional technologies like peer-to-peer communication and cryptography and was proposed by Satoshi Nakamoto. 9he operative principle behind blockchain technology is to accumulate the information in a ledger that is distributed all across the numerous nodes, and every node can see and verify the information without any third party or central authority verification. 10Moreover, blockchain technology provides a secure and reliable storage capacity due to the consensus mechanism and digital signatures. 3As a result of these features, blockchain technology facilitates several services that include security, traceability, trust, and transparency that store information in the decentralized public network securely. 11t also get rid of the central database requirement that acts as an intermediate among all the nodes.In the central server, a single point of failure is one of the acute problems because if the server faces insignificant issues or failures, the entire network is influenced.Besides, these servers consume more network bandwidth toward managing network traffic in high volume. 12,13Blockchain technology overcome these issues through its decentralized architecture and also addresses the security and privacy concerns as it can store every sensitive information of nodes across the entire network.Security and transparency regarding the patient data form the most significant element in the healthcare industry.Although some bitcoin-based solutions have been proposed for the healthcare domain, 14,15 there are issues such as high-power consumption, less throughput, and latency that still exists in these networks.These issues also need to be addressed at the time of developing the healthcare system with blockchain technology.Hence, to ensure security, privacy, accuracy, efficiency, and trust, smart contracts are more reliable.Smart contracts 16 may be referred to as a line of codes stored in the blockchain network and are executed in a situation where some predefined terms and conditions are met.Furthermore, this study integrates rule-based AI with a smart contract to make more reliable and intelligent decisions.In this article, the smart contracts are used and are deployed on the Ethereum network to devise the security and privacy of the healthcare system.Ethereum 17 is a public blockchain network based on the cryptocurrency called "Ether" that is used for the financial transaction or application proceeding fee.The main contributions of this article are as follows: • A lightweight access and authentication system for the healthcare system is proposed.
• Rule-based AI is integrated with smart contracts to enhance security and detect malicious nodes.
• Real-time IoT sensor nodes are used to monitor body temperature(BT), blood pressure(BP), and blood glucose(BG) level.
• The performance of the proposed framework is evaluated in terms of time consumption, energy consumption, throughput, average latency, and gas consumption.
The rest of this article is organized as follows: Section 2 details the related work regarding the centralized and decentralized healthcare system.Section 3 describes the proposed framework for the healthcare system.Section 4 illustrates the result and discussion for the proposed framework.Section 5 presents the conclusion of the study.

RELATED WORK
In this section, the existing research solutions regarding the centralized and decentralized healthcare system is illustrated.Initially, the demerits of the centralized healthcare system and decentralized healthcare system are highlighted.Finally, the proposed work is compared with the existing solutions.

Centralized healthcare system
Data management in the healthcare system represents a predominant process used to store and manage patient health information, which leads to providing medical details for the development of the vaccine, on-time, and an effective treatment plan.Nowadays, electronic healthcare records (EHR) are prevalent in hospitals and clinics to handle the PHR through a cloud-based architecture.Several architectures and frameworks have been proposed to secure the PHR.
In one of the studies, 18 the authors proposed a framework for PHR's secure sharing on the semi-trusted server.The attribute-based encryption (ABE) method is also applied to encrypt every PHR for more scalable medical information.
In another work, the authors 19 presented a new approach for the secure sharing of PHR in cloud computing called "CP-ABSC" that integrates the goodness of the digital signature and encryption technique.However, the article 20 highlighted the demerits of the CP-ABSC and proposed a new scheme to overcome the public ciphertext verification issue in this study.Some studies [21][22][23][24] also introduced the mutual authentication protocol for the healthcare system to enhance the security of the patient data and mobile devices.Moreover, the authors introduced the privacy preserving framework 25,26 and re-encrypted the secure data sharing technique 27 in the E-healthcare services.Although they are trying to improve the security and privacy in cloud-based healthcare data management and as hospitals are the primary guardian of the data in these kinds of management systems, this can create hurdles for the doctors, especially at the time of emergency, to access the patient information stored in database of the different hospitals.To overcome this concern, academicians and industries have developed smart devices 28,29 for personal health monitoring.Still, it suffers from a single point failure that makes the system more vulnerable and easier to lose the collected data.

Decentralized healthcare system
Some researchers have proposed innumerable blockchain-based solutions to address the concerns of the traditional healthcare system.To address the security and privacy concern, cloud data hash 30,31 is stored in the blockchain network.Although these studies are endangered from the single point failure due to the server-client architecture, many studies are employed to accumulate the patient medical data in the distributed leader for addressing the single point failure issue.
A blockchain-based secure mechanism has been presented in study. 32This mechanism is designed for data accessibility in the healthcare system, especially for patients and doctors.Khatoon 33 presented multiple workflows for the healthcare system involve complex surgeries and clinical trials based on blockchain technology for better data management.To attain privacy in the PHR, Omar 34 illustrated a framework that helps to store the patient's personal information, as well as the patient, can control its personal information.Wearable devices or remote patient monitoring are highly vulnerable as compare to EHR because it relies on the third parties that maintain the PHR.Moreover, it is also difficult to trace malicious and faulty devices in the network.Some studies have been proposed to address these issues.The authors 35 designed a real-time patient monitoring system based on the smart contract.The primary motive behind this system is to record smart contract events and provide notifications to healthcare professionals.It also resolves the vulnerabilities issues in remote monitoring.In other studies, [36][37][38] the smart contract-based patient remote monitoring has been developed to create a transparent, trusted, and central serverless network for preventing frauds, data breaches in the PHR and also maintain security and privacy.Differentiating from the existing works, the proposed framework in this article is designed for IoT-based health monitoring and maintains PHR records in the blockchain network.Moreover, a rule-based AI layer is integrated with a smart contract for the identification of the malicious nodes.Five different parameters are used to evaluate the proposed framework.Table 1 highlights the merits and demerits of the decentralized healthcare system in comparison with the proposed work.

PROPOSED FRAMEWORK
The proposed framework is categorized into four different layers, namely, the rule-based AI system, main hospital, clinics, and remote patients layer (see in Figure 1).
• Rule-based AI system: This layer is integrated with the smart contract between the remote sensor nodes and blockchain network, clinic node and blockchain network, hospital node, and blockchain network.The rule-based AI system's main motive is to make a smart decision and find security breach and malicious data in the system (discussed in Section 3.1).
• Remote sensor nodes: Medical sensors such as BP, BG, 41 as well as BT are used to monitor the elderly patient's health condition on the routine basis and transfer their data through the integrated approach of IoT and blockchain technology (discussed in Section 3.2) • Clinic layer: The clinic layer works as an additional layer between the remote patients and the hospital.Clinics are used to update the medical data in the blockchain network as well as for providing medical emergency services to critically ill patients (discussed in Section 3.3) • Hospital layer: In this layer, the main hospital is worked as an information centre that stored every information of the patients such as patient's unique ID, name, medical history, and prescribed medicines.The clinics are synchronized with the main hospital to share the communication between them regarding the patient data.Blockchain allows creating trust, security, and privacy regarding the patient data (discussed in Section 3.4).

F I G U R E 1
An exemplary overview of the proposed model

Rule-based artificial intelligence
Rule-based AI systems are the smart systems that accomplish AI knowledge through rule-based models. 42,43These systems are deterministic and do not require a lot of data compared to other machine learning and deep learning systems.Rule-based AI system works as the middle layer between blockchain technology and different connected layers such as IoT sensors, clinics, and hospital layers.There are two utmost important modules in the rule-based AI system, "a set of rules" and "a set of facts."These system layers help to set up the agreement between the peers on the basics of the designed rules and facts.Consider u is the hypothesis, and v are the conclusions of the input variable.u follows v is referred to as a conditional statement and denoted as: If the initial part u and conclusion part v are considered, then u results in v.This represents that if u is the favorable condition and v also is the favorable condition as per the law of detachment and denoted as: As per the law of syllogism, 44 if u results in v and v results in x, then also u results in x and denoted as:

Developed IoT sensor node
Remote patient monitoring is a kind of health caregiving service that uses upgrade information technology to gather the patient's real-time data as well as provide medical services for critically ill patients. 450][51] In this study, the developed IoT nodes, which are equipped with the BG, BT, and BP sensor share and store collected medical data in the blockchain network instead of the cloud.IoT nodes 52 are the small processor units integrated with sensors that serve the motive of data processing and collection as well as transfer to the peers or server via a centralized or decentralized way.Cloud computing can be used but blockchain technology 53,54 allows to create transparency and trust in the healthcare system.There is a tool used to monitor the blood glucose level called "blood glucose meter."Many solutions 55,56 have been proposed to develop monitoring systems for the BG.An IoT based BG meter 57 is considered for allowing the remote connection between patients and healthcare providers.Glucose strip is the way to collect the BG and measured through the chemical reaction between the blood sample and enzyme available on the strip.The strip is further connected to the Raspberry-Pi via operation amplifier (OPA2134).OPA2134 58 that worked in two different ways first is to convert the current into voltage as per the reaction generated, and in the second step, it amplifies the voltage up to Raspberry-Pi's detectable input signal.BT is the degree of heat maintained by the body or balance degree of heat between the body tissues and the environment. 59Researchers 60,61 have proposed many solutions to measure BT via IoT.Although in this study, DS18B20 sensors are used to measure human BT.DS18b20 62 is a digital one-wire protocol sensor that can measure the temperature between the -67 • F to +257 • F or -55 • C to +125 • C with the variation accuracy of ±5%.This sensor resolution can be user-configurable from 9 to 12 bits as per the temperature increment of 0.5 • C to 0.0625 • C, respectively.There is a T command to initiate temperature measurement and analog to digital conversion.After the successful conversion of data, it is stored in the two bytes of temperature register that are located in the scratchpad memory.Before using this sensor with an IoT node, a calibration is required.Afterward, the sensor connects to the Raspberry-Pi module.A BP meter is based on the non-invasive sensor that is significantly developed to measure the human body BP. 63 In References 64 and 65, IoT based blood monitoring systems are illustrated to measure human blood pressure; although these systems are based on theoretical and conceptual work.To measure BP, a module is developed in this study.In this module, a pump helps to inflate the cuff with the pressure that leads to blocking the flow of blood via arteries.Afterward, the cuff deflated pressure, and blood allowed to flow in the artery again.This leads to creating a bunch of vibrations in the arteries and measured through the pressure sensor.The pressure values are difficult for the processor to read, so an LM358 operation amplifier is used to amplify the pressure values and is readable for the processor.MPS20N0040D-D 67 is an air pressure sensor that is based on MEMS pressure technology and the ability to  2 represents the calibration of the medical sensors for the IoT nodes.To set up a bi-directional connection between the IoT devices and blockchain network, an operating system based small-scale processor is required, the Raspberry-Pi helps to address this concern because it supports the Linux operating system.Raspberry-Pi 68-70 is a low cost, credit card-sized shaped computer that executes open-source OS and offers general purpose input-output pins (GPIO) that help to interact with electronics interfacings such as home applications devices and sensors.The 40 pin GPIO allows us to connect healthcare sensors such as BG, BT, and BP, and process the fetch data from the sensors.Device registration, data access, and authentication are discussed in Section 3.4.Algorithm 1 represents a rule-based AI smart contract for the remote sensor nodes.The deployed smart contracts are categorized into three different layers: (1) Identify the registered IoT node and malicious node.In the first step, the IoT device sends a request which includes contract address and application binary interface (ABI) observation, if there is no acknowledgement from the blockchain network.So, it needs to re-check the contract address and ABI.In the next request, the device sends Device ID (D id ) and public key (P b ) to the blockchain network, if one of the parameters is not matched with the existing parameters in the blockchain network, it will consider as malicious node.(2) Smart decision in the data processing: v blood , v temp , v glu are the voltage variations generated from the BP, BT, and BG sensors calibrations, respectively.There are some specific conditions for every sensor to consider it under normal health conditions and generate the alert for the healthcare facility.The conditions of a normal person in the terms of BG, BT, and BP are less than 140 mg/dL (glucose tolerance test), 71 36.1-37.2• C, 72 and less than 80 diastolic-120 systolic mm/hg, respectively. 71In the case of BG, the patients are classified into normal, Prediabetes, and diabetes and the values of BG are different in each patient.Similarly in case of BP, the values are different in the patients.The values of BP and BG modifies as it depends on the patient health condition.(3) Identify the NaN, unfilled, and zero values: this layer helps to identify the problem in the sensor node.

Clinic layer
The clinic node works as a medium layer between the hospitals and IoT nodes.It synchronizes with the hospitals for the patient's information and registers new patients in the blockchain network.The main function of blockchain technology in the clinics is to create trust and transparency in the system.Many solutions [73][74][75] have been proposed to maintain medical health records via blockchain technology.However, the traditional medical system has some limitations as follows: • A patient often visits numerous hospitals for a health checkup.So, it is necessary to maintain and keep medical records.But usually, patients have not maintained their medical records and hospitals are not willing to share their PHR.
• Every time patients need to do a laboratory test due to the unavailability of medical history.Especially, in the situation of emergency, the patient needs to wait until the result of their medical report.• The medical record of the patient is sensitive and the hospital management is cumbersome.Till now, there is no security management system in the clinics and hospitals that can help to manage the health records efficiently.
• Sharing a medical record from clinic to clinic, clinic to hospital, and hospital to hospital need a lot of exertion as well as it is a time-consuming act.
The combined integration of blockchain technology with the medical healthcare system helps to overcome these listed issues.Moreover, clinics also know about the medical history of the patients via distributed ledger at the time of Error; end if medical treatment.In this study, clinic nodes connects to the hospital node and retrieves the PHR.Clinics can check the health condition of remote patient and can provide the required medical aid.Moreover, the clinic node smart contract is synchronized with the remote sensor node and hospital node.If remote sensor node generates an alert signal, it will be acknowledged by the clinic node which will help in providing the emergency health services at the right time.
Algorithm 2 represents a rule-based AI smart contract for the clinics.A clinical smart contract is being deployed to set up a connection with the IoT sensor node, main hospital, and blockchain network.Before joining the blockchain network, it is mandatory to verify some information such as public key (P b ), contract address as well as ABI.There are three major functions in the smart contract: (1) Clinic node authentication: To join the blockchain network, authentication is done using parameters such as D id , P b , contract address, and ABI.If the D id is not matched, it means either the device is not registered or its malicious node.P b combined with D id helps to validate the transaction in the blockchain network.(2) Retrieve patient medical record: To check the visiting patient's medical history, the clinic node sends Patient ID (P id ) with the P b to the blockchain network.Afterward, the clinic node accesses the medical history of the patient if the parameters are matched.(3) Update patient data: To update the patient's health condition, the clinic node sends P id , P b with the information to be updated.Deployed contract and ABI are the initial conditions to verify the contract address and ABI.

Hospital layer
The hospitals usually managed to visit patient's healthcare data as well as provide healthcare services at the time of emergency and routine check-up.Although, hospitals do not share or exchange their patient information with others due to the trust, non-transparent, or some personal motive issue.Especially in an emergency, the patients' medical history is the highest priority for the right treatment at the right time and to save a life.Besides, the patients are usually preferred to visit the clinics as compared to the hospital.So, it highly important that the hospitals should be synchronized with the clinics.To overcome these issues, blockchain technology allows creating the trust, transparency, and security of data between the hospitals and clinics.Error; end if the ack "True" For the P id , the healthcare worker sends the patient information (such as name, father name, address, city, mobile number, and pin code), which is stored at the blockchain.If this information or parameter is not matched with the existing information, a unique P id will be generated.( 2) Create D id :To register the IoT device, the healthcare worker submits device information such as mac address, manufacturer name, and sensor detail in the blockchain network via smart contract.In the verification process, the blockchain network confirms the device parameters with the existing parameters, and D id is generated if the parameters are unique.(3) Patient and device data update: The first step toward the updating of patient information is to send the unique P id with the deployed contract address and ABI, Match P id with the existing database in the blockchain network; if ID's are matched, the network sends back "P id matched."Hospital node sends "update command" attached with changed data that help to update the patient's existing data and received ack about "information updated."(4) Update patient data: Afterward, successfully P id matched, hospital node uploads new patient information to the blockchain network.The completion of uploading generates the ack "Info updated."

Registration patient ID and device ID
Merkle tree is used to encrypt the blockchain data efficiently and safely which also accelerate verification of the data.
In the blockchain network, every executed transaction is linked with hash.Although, in the blocks, these hashes are not aligned in a particular order, these hashes are typically cached in a tree-like structure and are connected with their parents in the shape of tree as well as represents filial relation.A single block can hold a numerous transactions, and every transaction available in the block can also be hashed.Merkle root is the subsequent outcome of these hashes.In this study, P id is registered through the Merkle root with a combination of patient name, unique identification, contact number, and home address.Every parameter is hashed to generate the hash value.P id is the combination of these parameters' hashed value.The device details and MAC address are the hashed value that becomes a Merkle root in the case of the D id .These parameters are saved in the network without revealing their identity.At the time of validation, D id with other parameters such as P b , deployed contract address, and ABI.

Data authentication
There are mainly two steps for data authentication: (1) generating signature and (2) validation of message.
• Generating signature: Cryptographic signatures are the main component of the blockchain network that is used to show validate ownership address without revealing its private key.In this study, the elliptic curve digital signature algorithm (ECDSA) 76 is applied to generate the digital signature from the two input parameters, namely, input message and private key (P r ).The digital signature is a mathematical method used to validate the IoT device authentication and integrity of data transferred from the devices.In this article, ECDSA algorithm is used to generate the digital signature for the IoT devices.
• Validation: In the validation, the public key is retrieved from the elliptic curve recover via input message, and a digital signature comes with the message.If D id and P b , are matched, then blockchain networks allow the message to authenticate.

Workflow of the system
The workflow of the system (see Figure 2) is as follows: • Create patient ID (P id ).
Step 1: Hospital node sends the patient information (P inf ) that includes patient name, unique identification, contact number, and home address and attached with the deployed smart contract and ABI.The blockchain network identifies the P inf to see if it is matched with the existing one or not.
Step 2: If the information is not matched, it generates the P id , otherwise generates the error in the system.
• Create device ID (D id ).The process to generate the D id is quite similar to the P id .The hospital node sends the device information that includes device details and MAC address to the blockchain for the verifications.Afterward, a new D id is generated if the details are unique.
Step 1: For the authentication of the remote IoT node, the device sends the request to the blockchain and this request includes the D id , deployed contract address, and ABI.If the D id is not matched with the existing ID stored in the blockchain network, it generates the error about the device, that is, not registered or malicious.
Step 2: After the successful verification of the D id , the blockchain network allows to access the data through another request from the remote IoT node.There is an additional layer in the smart contract which helps to make smart decisions as per Algorithm 1.

• Clinic IoT node.
Step 1: To retrieve the patient medical history, the clinic node sends the authentication request to the blockchain network which consists of P id , contract address, and ABI.A rule-based AI system is integrated to take the fast decision for authentication.
Step 2: Clinic IoT nodes allow to access the patient data after the successful authentication of the clinic node.The AI rules layer is integrated into the smart contract to create obstacles for the malicious node and takes the rapid decision for the IoT devices.For updating the patient information, P id is used with P b of the blockchain network.

• Hospital IoT node.
Step 1: To create, P id and D id are generated as discussed in the earlier section.Step 2: To update the new information for the patient, the hospital node sends P id with contract address, P b , and ABI to the blockchain through AI rule-based smart contract.Devices are allowed to update information, after the favorable authentication of the device.

RESULTS AND DISCUSSION
In this section, the results are presented for the outcomes from the proposed framework.Initial discussions involve the experiment setup followed by the performance with different parameters.

Evaluation testbed
To evaluate the proposed approach, five different parameters are used such as time consumption, energy consumption, throughput, average latency, and gas consumption during the transactions.Four end nodes are deployed in this experiment that include, two Raspberry Pi's acting as IoT devices, one laptop acting as a clinic node, and one desktop acting as a Hospital node.Desktop acts as an RPC server, others act as a follower and remote monitoring devices.Table 3 represents the details of evaluation testbed for the proposed approach In this experiment, the Ethereum platform works as a blockchain, and a smart contract helps to deploy the proposed work in the blockchain network.Solidity is a high-level language that supports writing the proposed algorithm in the smart contract.In addition, Ganache 77 is used in the study represented in this article, which provides Ethereum toolkit for testing and deploying the proposed approach and also acts as a dummy public Ethereum blockchain.Web3 library 78 helps to connect the RPC server node with other IoT nodes.In the distributed computing RPC server stands for the remote procedure call that allows one computer node to use the services from another computer node without acquiring the network knowledge.The web3.py library is considered to implement the proposed approach.Figure 3 represents numerous transaction mined at the Ganache with the proposed framework.

F I G U R E 3
Transactions in the proposed framework with Ganache 77

Evaluation outcomes
The experimentation of the proposed model is performed as follows:

Time consumption
Time consumption refers to the minimum amount of time necessary by the IoT node to generate the request for the association with the network.After the successful association, the device sends data and is registered at the blockchain network.Table 4 represents the calculated time consumption for data registering IoT devices.Time consumption of devices is measured at four different transaction points, first, 50th, 100th, and 200th transaction and the average transaction time is calculated.Device 1 and Device 2 have average transaction time, 356.495 and 433.773, respectively.Device 2 consumes more time because of its low computation power as compared to Device 1. Table 5 gives the time consumption for data requests for the clinic and hospital node.Similar to Table 4, time consumption for data requests is measured at four different transaction points.Device 4 takes 1.73 ms less time compared to Device 3 which takes 3.55 ms.The reason behind less time consumption is the difference in computation power.In both cases, device computational power is directly dependent on the time consumption for data requests or data registered at the blockchain network.

Energy consumption
Energy consumption or power consumption in the IoT nodes (Raspberry Pi's), clinic, and hospital node, are considered at the time of generation of the data requests.Energy consumption of the device is also measured at the four different  6).Energy consumption of the Device 1 and Device 2 is measured through the USB Tester 79 and RAPL measurement tool. 80Power consumption of Device 3 and Device 4 is measured through IPPET 81 and RAPL. 80To calculate the power consumption in the IoT devices, the difference between the power consumed by the IoT device at the time of data request and power consumed by the IoT node in the ideal state is considered.

Throughput and average latency
Throughput and latency are two important parameters that help to evaluate the blockchain network more precisely.In this study, these parameters are calculated for the IoT devices (Raspberry-Pi).Transaction throughput is the number of successful transactions committed by the blockchain network.The rate of the transaction is defined as transactions per second (TPS) (see Equation ( 4)).

TransactionThroughput(TPS) = Total Number of Successful Transaction Seconds (4)
Latency is defined as the time difference between the successful transaction and transaction deployment time.In each transaction, latency is the difference between the successful transaction time (k2) and transaction deployed time (k1) (see Equation ( 5)).

AverageLatency = Successful Transaction time(k2) − Deployed Transaction Time(k1)
(5) The scalability is directly dependent on the throughput and latency of the network.Any kind of variation in hardware configuration, network speed, and size directly impacts the scalability.
In this study, only the IoT devices throughput and latency is calculated because the RPC server is deployed in Device 4 so there is no lagging data in the same machine.There are four rounds of the transaction to calculate both throughput

Transaction fee analysis
In this study, the IoT node contains three sensors such as BG, BT, and BP sensor, and every sensor consumes gas for mining their value at the blockchain network.Moreover, the clinic and hospital node also consume gas for mining their request at the network.Gas refers to the fees that are required to execute a transaction in the Ethereum blockchain network.This experiment sends the medical values in two ways: single transaction and multi-transaction.In a single transaction, the values of medical parameters include BG, BT, and BP which are combined in a and are sent to the blockchain network.The multi-transactions send the values of the medical parameters separately and serially in the form of an integer.Total Ethereum transaction fee is calculated as the product of the gas limit and gas used in the transaction.Figure 6 represents the transaction fee in single and multi-transactions.Single transaction consumes less amount of gas as compared to the multi-transaction in first, 50th, 100th, 150th, and 200th transaction.Multi-transaction consumes 72 471 gas at first transaction while a single transaction only consumes 29 263 gas.At 200th transaction, single transaction used approximately three times less gas compared with the multi-transaction.

CONCLUSION
Decentralized healthcare management has rapidly acquired attention as it can provide transparency, trust, security, and privacy in the patient's healthcare data.Furthermore, blockchain's distributed and shared nature save the network from a single point of failure.This article proposes a decentralized framework for healthcare data management that collects the remote patient medical data and maintain PHR leveraging on the blockchain technology.An additional rule-based AI layer is integrated with smart contracts to recognize the malicious nodes and make intelligent decisions.The proposed framework is tested on the real-time setup and the performance is evaluated in terms of time consumption of requests generated and registered, the energy consumption of the device, transaction throughput, average latency, and gas consumption.In the future, investigation on trustworthy AI with the proposed framework can be done to make the system more reliable and design more lightweight algorithms for the reduction of energy and gas consumption.

F I G U R E 2 A
generalized workflow of the proposed framework

TA B L E 1 Comparison of the proposed work with the existing works Work and year IoT based remote monitoring Hospital EHR Clinics EHR Smart contract Identify malicious IoT nodes Evaluation parameters
Calibration of medical sensors for the IoT node measure the 0 ≈ 40kPa air pressure that is perfectly suitable for our system.The sensors' calibration is done as per the sensor's datasheet and generated voltage is measured through a digital signal oscilloscope (DSO).The measurement of BG, BT, and BP sensors generates a voltage due to variations in blood glucose samples, patient body temperature, and blood pressure respectively.The measurement units for the BG, BP, and BT sensor are milligram per deciliter (mg/dL), millimeters of mercury (mm/hg), and degree Celsius ( • C) respectively.Table

Algorithm 1 .
Smart contract for remote sensor node Results: Device authenticate, data access, identify the normal and malicious node Parameters: mg/dL, • C, mm/hg, D id , P b , contract address, ABI C > 28 && • C < 45 then ⊳ Checking Conditions for Patient Body Temperature v con = (v temp *500)/1024; else if • C < 36.1 && • C > 37.2 then

Algorithm 2 .
Smart contract for the clinic node Results: Retrieve remote patient data, normal data, and update of the patient data Parameters: D id , P b , P updation check the clinic node authentication if D id , P b , contract address && ABI == true then ⊳ Verification contract address, ABI, Device ID and Public Key Create P id :Hospital node sends a login request that includes deployed contract address and ABI.The verification of this information is done at the blockchain network.If the parameters are successfully matched; it generates Algorithm 3. Smart contract for the hospital node Results: Create P id , D id , P updation , D updation Parameters: registered new D id , P id and retrieve patient data device authentication if D id , P b , contract address && ABI == true then ⊳ Verification contract address, ABI, Device ID and Public Key device authenticate; Patient information updation and device information updation if P id or D id , P b , contract address and ABI == true then information ready to update; ⊳ Verification contract address, ABI, Device ID or Patient ID and Public Key Algorithm 3 represents a rule-based AI smart contract for the hospital.Smart contract node is categorized into four different parts:(1) Details of the evaluation testbed for the proposed approach Time consumption for data registered (IoT nodes) Energy consumption for the generation of the requests TA B L E 4 transaction points, first, 50th, 100th, and 200th transactions and the average transaction power for Device 1, Device 2, Device 3, and Device 4 is 26.52, 35.19, 10.07, and 6.25 mW, respectively (see Table