Next Article in Journal
Infrared Thermography and Deep Learning Prototype for Early Arthritis and Arthrosis Diagnosis: Design, Clinical Validation, and Comparative Analysis
Previous Article in Journal
Evaluating Generative AI for HTML Development
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Technical Note

EMR-Chain: Decentralized Electronic Medical Record Exchange System

Department of Computer Science, National Yang Ming Chiao Tung University, Hsinchu City 300093, Taiwan
*
Author to whom correspondence should be addressed.
Technologies 2025, 13(10), 446; https://doi.org/10.3390/technologies13100446
Submission received: 5 June 2025 / Revised: 15 September 2025 / Accepted: 17 September 2025 / Published: 1 October 2025

Abstract

Current systems for exchanging medical records struggle with efficiency and privacy issues. While establishing the Electronic Medical Record Exchange Center (EEC) in 2012 was intended to alleviate these issues, its centralized structure has brought about new attack vectors, such as performance bottlenecks, single points of failure, and an absence of patient consent over their data. Methods: This paper describes a novel EMR Gateway system that uses blockchain technology to exchange electronic medical records electronically, overcome the limitations of current centralized systems for sharing EMR, and leverage decentralization to enhance resilience, data privacy, and patient autonomy. Our proposed system is built on two interconnected blockchains: a Decentralized Identity Blockchain (DID-Chain) based on Ethereum for managing user identities via smart contracts, and an Electronic Medical Record Blockchain (EMR-Chain) implemented on Hyperledger Fabric to handle medical record indexes and fine-grained access control. To address the dual requirements of cross-platform data exchange and patient privacy, the system was developed based on the Fast Healthcare Interoperability Resources (FHIR) standard, incorporating stringent de-identification protocols. Our system is built using the FHIR standard. Think of it as a common language that lets different healthcare systems talk to each other without confusion. Plus, we are very serious about patient privacy and remove all personal details from the data to keep it confidential. When we tested its performance, the system handled things well. It can take in about 40 transactions every second and pull out data faster, at around 49 per second. To give you some perspective, this is far more than what the average hospital in Taiwan dealt with back in 2018. This shows our system is very solid and more than ready to handle even bigger workloads in the future.

1. Introduction

Taiwan handles nearly 1.2 million patient referrals annually, with each case involving a transferring and a receiving hospital. According to a National Health Insurance Administration report [1], the receiving hospital often requires the patient’s medical records from the transferring facility for an accurate diagnosis.
Historically, this process was challenging. Patients were required to obtain and physically deliver printed copies of their medical records, a practice that was inefficient, wasteful, and costly. Taiwan launched the Electronic Medical Record Exchange Center (EEC) to address these issues in 2012. The EEC enables doctors to access a patient’s medical records from the past six months, provided they have the patient’s authorization. This system has significantly reduced resource waste and financial burdens.
Figure 1 shows that the EEC’s architecture requires participating hospitals to establish a dedicated gateway [2,3]. As described by Li et al., this gateway operates independently from the hospital’s internal systems and databases. Hospitals upload designated medical records to the gateway, and the EEC server indexes these records across all participating facilities.
The EEC server creates a comprehensive index of all medical records in the gateways and provides search and retrieval services to hospitals. For a doctor to access a patient’s records, the patient must insert their National Health Insurance IC card, and the doctor must use their medical certificate IC card. After the patient submits a consent form, the hospital connects to the EEC server via its gateway. The EEC server then provides the index for the requested medical records and facilitates retrieval by connecting to the hospital’s gateway for holding the records.
This current system architecture, however, faces several challenges. First, each medical record review relies on an index provided by the centralized EEC server, making it a potential performance bottleneck. Second, with nearly 1.2 million referrals annually (averaging about 2.28 referrals per minute), hospitals must store records in two locations—their internal database and the EEC gateway—which leads to significant storage inefficiencies. Furthermore, the system limits patients’ ability to manage access to their medical records. Once a patient submits a consent form, doctors access all of the patient’s records from the past six months. This all-or-nothing approach deprives patients of the ability to share records selectively and falls short of modern data access control standards, such as those found in GDPR [4].
To address these issues, this study proposes a decentralized electronic medical record exchange system that leverages two blockchains and medical record databases maintained by individual hospitals. The first blockchain, the Decentralized Identity Blockchain (DID-Chain), provides users with a decentralized identity, allowing them to manage their data across various applications. The second blockchain, the Electronic Medical Record Blockchain (EMR-Chain), records relevant medical data and indexes. During record retrieval, the EMR-Chain provides the corresponding index and enforces access controls via smart contracts, which authorize doctors to access records based on patient-defined permissions. Readers can refer to Appendix B for detailed explanations of key technical terms.
The EMR-Chain incorporates a regional identity management system to facilitate the involvement of various roles in the medical record exchange process. The system ensures data privacy and strengthens on-chain data protection in multi-role scenarios by employing role-based access regulations through smart contracts. Furthermore, the EMR-Chain provides an audit trail function, enabling patients to monitor access logs for their medical records at any time.
This decentralized system resolves existing challenges by eliminating the centralized bottleneck of the EEC server, reducing storage redundancies, and enabling patients to grant selective access to their medical records. Integrating enhanced access controls through smart contracts significantly improves the privacy and security of medical records. In contrast, providing access logs ensures transparency and facilitates investigations in disputes.
This paper is structured as follows. Section 2 reviews the current state of electronic medical record exchange, sharing, authorization, and blockchain-based access control. Section 3 introduces the proposed system model. Section 4 describes the system implementation and demonstration, while Section 5 presents the evaluation results. Finally, Section 6 concludes the study and discusses directions for future work.

2. Background and Related Works

This section comprehensively reviews two pivotal technological domains pertinent to the present investigation: the historical trajectory and contemporary significance of Electronic Medical Records (EMRs) within modern healthcare ecosystems, and the transformative potential inherent in blockchain technology for ameliorating the intrinsic challenges pervasive in extant EMR infrastructures.

2.1. The Evolution and Current State of Electronic Medical Records (EMR)

EMRs have undergone a transformative journey, evolving from a foundational concept into a critical infrastructure within contemporary healthcare settings.
This is not just about new tech; it is also tied to significant changes in how we think about medical safety and the rules around it. We can split their development into three main phases based on the tech’s maturity and what drove the changes.
The first phase, from the 1960s to the 1980s, was about getting started and trying things out. Back then, universities mostly pushed EMRs to see if computers could help manage medical records. We saw some groundbreaking systems pop up, like the Problem-Oriented Medical Information System (PROMIS) from the University of Vermont. This one was a game-changer because it introduced a problem-oriented way of recording things, shaping how medical records were designed later [5]. Other notable systems included COSTAR, developed at Massachusetts General Hospital, which focused on outpatient medical records, and the HELP system at LDS Hospital, recognized for its early implementation of clinical decision support for physicians. However, these early systems were expensive, hard to use, and the tech was not ready for prime time. They mostly stayed in academic labs and did not make it into everyday clinical use.
The second phase, the 1990s, was a turning point with major tech breakthroughs and many more practical uses. The explosion of personal computers (PCs), user-friendly Graphical User Interfaces (GUIs), and the internet taking off were huge factors in making EMRs work in the real world. The HealthConnect project was a big win during this time, a joint effort between IBM and Kaiser Permanente. They digitized medical records on a massive scale across a huge healthcare network [6]. This project proved, without a doubt, that EMRs were possible and beneficial in actual clinical settings, moving them from theory to practice.
From the early 2000s until now, we have been in the third phase, which is all about policies pushing things forward, a strong focus on safety, and EMRs becoming super common. A serious look at medical safety drove development in this phase. The super important 1999 report from the Institute of Medicine (IOM), called “To Err Is Human,” showed how many people died each year from preventable medical errors. It also highlighted how bad traditional paper records were regarding accuracy and information sharing [7]. This report completely changed how we viewed EMRs—they were not just about making things efficient anymore; they became crucial for patient safety. Because of this, the U.S. government passed the Health Information Technology for Economic and Clinical Health (HITECH) Act in 2009. Through its “Meaningful Use” program, this act poured billions of dollars into encouraging EMR adoption, which sped up their spread across the United States [8]. Today, EMRs are the go-to information hubs in modern healthcare. Nevertheless, it is important to acknowledge that these systems also present several significant challenges, particularly in terms of system interoperability, data security, and data ownership. These issues have become increasingly prominent and critical in recent years.

2.2. The Application and Potential of Blockchain Technology in EMR Systems

The EIP solution provider for blockchain networks, introducing a decentralized NoSQL database integration, recently built an enterprise data solution that extends beyond transactional and information management to rich-client communication, rating services, and resource scheduling across firewall boundaries. It has been widely acknowledged that the transformative power of blockchain springs from its intrinsic properties, such as decentralization, cryptographic security, and immutability, many of which serve to be alternative robust architectural solutions for these critical limitations. While not a direct competitor to existing EMRs, it is better viewed as an additional layer of decentralized trust that works in tandem with them. At its core, we have identified its principal offers:

2.2.1. Patient-Centric Data Governance and Autonomy

Blockchain Architectures: Enabling a Revolution Around Data Ownership. Blockchain architectures facilitate an illustrious modification in conventional practices, allowing patients to manage their medical records. Patients control access permissions on-chain using private keys, while primary clinical data remains securely off-chain. Using smart contracts, granular access rules defined by the patient execute and provide a hitherto unseen level of control over personal health information.

2.2.2. Immutable Auditability and Data Provenance

It delivers a transparent, non-repudiable audit trail. Even the most sensitive steps of data access and modification that require authorizing rights are timestamped as an immutable transaction and stored forever.

2.2.3. A Shared Metadata Layer for Interoperability

Blockchain can serve as a universal, shared index of medical record metadata, connecting disparate healthcare institutions without mandating an overhaul of their internal systems. By registering pointers to records on the blockchain, providers can utilize it as a trusted medium to verify identity and confirm access rights before initiating a secure, peer-to-peer data exchange with the source institution, thus reducing friction and integration costs.

2.2.4. Real-World Implementations and Future Outlook

The feasibility of these applications is supported by global pilot projects, such as MIT’s MedRec and Estonia’s national health record system secured by KSI blockchain technology. While significant barriers related to scalability, legacy system integration, and regulatory clarity must still be overcome, the potential of blockchain to re-engineer trust and collaboration within the healthcare ecosystem is widely acknowledged by researchers and industry practitioners.

2.3. Related Research

The issue of medical record standards is a critical area of research, with [6] highlighting the importance of unified standards, such as Fast Health Interoperability Resources (FHIR), for achieving robust interoperability. Accessibility is another crucial aspect, as discussed in [9], which examines how systems regulate access to electronic health records (EHRs) through access control rules and patient authorizations. Building on these principles, Rosar and Chuang [10] proposed an EMR exchange system that leverages FHIR for enhanced interoperability.
Smart contracts offer an innovative approach to managing EMR systems, as proposed by Mishra et al. [11]. These contracts automatically execute when predetermined conditions are met, ensuring transparency and reducing administrative overhead for authorizations. Furthermore, smart contracts facilitate collaboration among participants within the EMR system. For instance, Lax et al. [12] introduces a blockchain-based architecture where patients maintain full control over authorizations. In this model, medical records are stored off-chain, with their storage addresses indexed on the blockchain. An Identity Provider (IdP) verifies patient identities and issues assertions for authorization, which requesters can use to access the medical records.
To address data ownership and control, Bach et al. [13] employed multi-signature contracts. This method requires the patient and the hospital to use their private keys to sign a transaction for authentication. While this prevents the patient from unilaterally altering a record, it ensures that the patient retains control over who can access their data.
Several hybrid approaches combining cryptographic mechanisms with smart contracts have been proposed to enhance security. For instance, Yang et al. [14] introduced a system that leverages proxy re-encryption (PRE), enabling authorized physicians to access electronic medical records (EMRs) with their private keys. This method mitigates the risks associated with private key leakage and reduces computational overhead.
Alternative cryptographic strategies have also been explored. Velmurugan et al. [15] proposed a method using Modified Key-Policy Attribute-Based Encryption (MKP-ABE) to secure EMRs stored in cloud databases, requiring a Hashed Access Code for retrieval. Their experimental analysis demonstrated that MKP-ABE provides superior security to conventional algorithms such as KP-ABE, ECC, RSA, and AES.
Vidhya and Kalaivani [16] also designed a framework utilizing multiple Certificate Authorities (CAs) to address vulnerabilities associated with single points of failure in trust management. By requiring each organization to maintain one or two intermediate CAs, this model ensures operational continuity even if a single CA is compromised, underscoring the enhanced security afforded by a decentralized trust architecture.
Privacy-preserving EMR management was explored by Jakhar et al. [17], which incorporates role-based access control to maintain privacy and security within a multi-participant blockchain network. Fine-grained access control was further achieved by Kaur et al. [18] and Cui and Chen [19] through Ciphertext Policy Attribute-Based Encryption (CP-ABE). This method shifts from a role-based to an attribute-based access model, requiring requesters to meet specific attributes defined by data owners to access records, thereby significantly enhancing access granularity.
In summary, blockchain-based EMR architectures typically store records externally while using the blockchain as an indexing server to maintain data integrity via hash values. Access control mechanisms vary from encryption algorithms to token- or assertion-based authorizations. While identity management is crucial for system access and key pair generation, few studies explore its integration with smart contracts for fine-grained access control. Furthermore, the concept of sub-authorization remains underexplored, and a unified data-sharing format is rarely emphasized. Incorporating sub-authorization could significantly enhance patient privacy, while unified standards would improve hospital interoperability.
Table 1 compares the features of our proposed research with related works, with a V denoting clearly stated properties and an X indicating properties that are not explicitly mentioned in the literature. The interoperability (Int.) and privacy (Pri.) features are critical for modern EMR systems (see Appendix C for abbreviation definitions).

3. System Design

This paper introduces an improved electronic medical record (EMR) exchange system, specifically designed to tackle the shortcomings of Taiwan’s current setup. Our system uses a layered architecture with three main parts: a decentralized identity blockchain (DID-chain), an application blockchain (EMR-chain), and distributed FHIR servers at each hospital. This design is all about giving patients more control over their data, making sure different systems can talk smoothly, and boosting the security of the whole exchange process.

3.1. High-Level System

The system’s architecture, illustrated in Figure 2, is composed of the following key elements:
  • Decentralized Identity (DID) Chain: Adapted from the architecture presented by Hsieh et al. [20], the DID-chain provides a self-sovereign identity management system. It operates independently of any central authority, granting users complete control over their personal identity data and mitigating the risks of centralized data breaches.
  • Application (EMR) Chain: This Hyperledger Fabric-based blockchain governs access control, data authorization, and maintains an immutable audit trail of all transactions. Any personally identifiable information on the EMR-chain undergoes de-identification to protect user privacy.
  • Hospital FHIR Servers: Each participating hospital operates its own FHIR server, a distributed, interoperable repository for patient medical records. Adherence to the FHIR standard ensures a unified data exchange format across disparate healthcare institutions.
The subsequent sections provide a detailed exposition of each component.

3.2. DID-Chain: A Global Identity Management System

The DID-chain (Figure 3) is the system’s global identity layer. It is implemented on the Ethereum blockchain to leverage its mature ecosystem of digital wallets. Identities on this chain, termed “Main Identities,” are managed by two core smart contracts:
IdentityManager: This contract is responsible for creating and managing user identities after verification by a trusted authority (e.g., a government agency).
Personal: A dedicated contract created for each user that serves as a secure, user-controlled vault for personal information, such as encrypted private keys for other application chains.
This architecture facilitates a global identity system where a single, government-endorsed Main Identity can be used to authenticate and interact with multiple, independent application networks.
The DID-chain serves as the system’s global identity layer, implemented on the Ethereum blockchain to leverage its mature ecosystem of digital wallets. On this chain, user identities are called ‘Main Identities’ and are primarily managed by two core smart contracts: IdentityManager and Personal. The IdentityManager contract is responsible for creating and managing user identities after verification by a trusted authority, such as a government agency. Conversely, the Personal contract is a dedicated contract created for each user, serving as a secure, user-controlled vault for personal information, such as encrypted private keys for other application chains. For a detailed design of the IdentityManager and Personal smart contracts, including their pseudocode and functional descriptions, please refer to Appendix A.1.

3.3. EMR-Chain: The Application-Specific Governance Layer

The EMR-chain is implemented on Hyperledger Fabric and was selected for its permissioned nature, multi-channel capabilities, and superior transactional throughput compared to public blockchains. It segregates functionalities into three distinct channels to enforce modularity and granular control.

3.3.1. The IdentityManagement Channel

This channel (Figure 4) establishes an application-specific identity system on top of the global DID-chain. It manages roles within the EMR ecosystem, which is essential for enforcing fine-grained access control.
Role Management: The channel supports three primary roles: Patient, Doctor, and Supervisor. Users onboarded by participating hospitals are initially assigned the Patient role. The Healthcare Certificate Authority (HCA) and the Ministry of Health and Welfare (MOHW) verify credentials and elevate users to Doctor and Supervisor roles, respectively.
Accountability Link: To ensure accountability while preserving privacy through on-chain de-identification, this channel records a mapping between a user’s EMR-chain identity and their Main Identity’s public key. This link allows for unambiguous user identification in disputes or security incidents.

3.3.2. The AccessControl Channel

This channel manages permissions for accessing medical records. A distinct data instance is created on this channel for each patient-hospital relationship. Each instance contains three key components:
Access Control List (ACL): Defines the rules governing access to the EMRs stored at that hospital. The default ACL implements a hierarchical policy based on Taiwan’s graded medical care system [21], permitting access only by hospitals of an equal or higher level. This policy is adjustable by the patient, who can grant more lenient permissions as needed.
Hash Value: The cryptographic hash of the off-chain medical record, serving as an immutable reference to ensure data integrity.
Address: The network location of the off-chain FHIR resource, enabling retrieval after successful authorization.
The smart contract on this channel provides the following core functions:
Authorization (): Evaluates access requests against the patient’s ACL and, if approved, generates a time-limited JSON Web Token (JWT) for the Data Requester.
updateInstance()/updateHash(): Allows a user with the Doctor role to upload a new instance or update the hash value of an existing record.
consentAccess()/revokeAccess(): Enables a user with the Patient role to dynamically modify the ACL rules for their records at a specific hospital.
validateHash(): A provider can compare a locally held hash against the on-chain hash to detect if a record is outdated.

3.3.3. The TransactionRecord Channel

This channel (Figure 5) provides an immutable and non-repudiable audit trail of all data access requests.
Purpose: Its primary functions are to allow patients to monitor access to their records and to serve as conclusive evidence in the event of a dispute.
Security and Scalability: To ensure the integrity of the audit logs, write access is restricted to identities with the Supervisor role. Older logs are periodically archived to external storage to maintain node performance, with their collective hash value recorded on-chain to preserve the integrity of the complete audit history.

3.4. FHIR Server: The Interoperable Data Layer

To ensure interoperability and align with Taiwan’s national healthcare strategy, the system mandates that each participating hospital operate a server compliant with the Fast Healthcare Interoperability Resources (FHIR) standard [22]. These servers act as the distributed, off-chain repositories for EMR data, utilizing a “resource”-based data model for granular and standardized data exchange.
Two primary mechanisms fortify the security of these servers:
  • Read-Only Access: The FHIR server endpoints are configured for read-only operations to prevent any unauthorized modification of the source medical records.
  • Token-Based Authentication: A mandatory Token Validator module is integrated into the server’s access layer. This module intercepts every request to validate the associated JSON Web Token (JWT), confirming its signature, expiration, and the holder’s authorization. Access to medical records is granted only upon successful validation; all other requests are denied.
This two-tiered security model ensures that data is accessed only by authenticated and authorized parties in a secure, non-destructive manner.

3.5. Smart Contract Design

The system’s core logic and governance are implemented through smart contracts and chaincodes distributed across the DID-chain and the EMR-chain. This section provides an overview of their design and core responsibilities.

3.5.1. Smart Contracts on the DID-Chain

The DID-chain’s architecture (Figure 6) is composed of two primary smart contracts that work in tandem to manage global identities:
  • IdentityManager Contract: This contract functions as a public, on-chain registry. Its primary responsibilities are to record verified Main Identities and to provide a universal authentication interface for external applications.
  • Personal Contract: In contrast, the Personal Contract serves as a private, user-specific data vault. It is programmatically linked to the user’s primary identity but remains under their exclusive control. It is used for storing sensitive information such as encrypted private keys for other applications.
For a comprehensive breakdown of the detailed design and pseudocode for both the IdentityManager and Personal smart contracts, please refer to Appendix A.1.

3.5.2. Chaincodes on the EMR-Chain

The EMR-chain’s governance is implemented through three distinct chaincodes deployed on a dedicated channel to ensure functional segregation and modularity (Figure 7).
  • IDM Chaincode: Governs application-specific identity and role management.
  • ACL Chaincode: Manages fine-grained access control policies for medical records.
  • TSR Chaincode: Maintains a non-repudiable audit trail of all access events.
The specific functions and operations of these chaincodes are detailed in the subsequent sections.

3.6. Role-to-Function Permission Mapping

The system’s security model is enforced through a strict Role-Based Access Control (RBAC) mechanism. Table 2, Table 3, Table 4 and Table 5 delineate this model by providing a detailed permissions matrix that explicitly maps the smart contract functions each defined role is authorized to execute.

4. Implementation and Demonstration

4.1. DID-Chain Network

4.1.1. MainIdentity Create

Figure 8 illustrates creating a MainIdentity, while Figure 9 shows the enrollment page. As previously mentioned, the MainIdentity is endorsed by the government. Therefore, users are required to upload their identification numbers and personal information to the relevant government department. After verifying the user’s identification number and personal details, the government department will use its authority to submit a request to the IdentityManager contract to create a MainIdentity for the user. The IdentityManager contract will create a MainIdentity and use the hashed identification number as the unique identifier for the MainIdentity. Once the transaction is completed, the DID-chain will return the hash value of the transaction, and the government department will return the hashed identification number to the user. Below is a demonstration of the MainIdentity creation process.

4.1.2. Binding Wallet to MainIdentity

Figure 10 illustrates the BindingWallet process. After creating the MainIdentity, it is necessary to bind the user’s digital wallet to the MainIdentity to enable the management of the MainIdentity through the wallet. To do this, users must submit their wallet address along with the unique identifier of their MainIdentity to the relevant government department. The government department will then send a binding request to the IdentityManager contract. The IdentityManager contract will bind the wallet to the user’s MainIdentity and create a new Personal contract for the user, allowing them to interact with the Personal contract. Below is a demonstration of the wallet binding process.
After binding is complete, users can obtain information related to their MainIdentity and the address of their Personal contract through the dashboard page. Figure 11 shows the dashboard page.

4.1.3. App-Chain Private Key Upload

After binding the digital wallet to the MainIdentity, users can interact with the Personal contract via the wallet. Figure 12 illustrates the storage of the app-chain’s private key in the personal contract. Initially, the user joins any desired App-chain. Upon joining, the user is provided with the private key for that application. This private key is essential for signing transactions on the App-chain, indicating endorsement of the transaction. To protect the private key from unauthorized access, the user must encrypt it before uploading it to the Personal contract. When needed, the user can retrieve the encrypted key from the Personal contract, decrypt it, and use it to sign transactions.

4.2. EMR-Chain Network

4.2.1. EMR-Chain Network Architecture

We have constructed the architecture of the EMR-chain network based on the three functions it provides. As illustrated in Figure 13, the network consists of three entities: the Ministry of Health and Welfare (MOHW), the Healthcare Certification Authority (HCA), and the Ordering Service organization. Each entity will have its own Certificate Authority to issue certificates, enabling users to access the respective channels they manage.
The AccessControl channel is represented by c1, the TransactionRecord channel by c2, and the IdentityManagement channel by c3.
We have designed the network so that each hospital is a peer under the MOHW. All hospitals participating in the EMR-chain network will jointly maintain the AccessControl and TransactionRecord channels. The IdentityManagement channel, which involves various identity management functions, will be jointly maintained by MOHW and HCA. As a result, hospitals will maintain ledgers and smart contracts for all three channels, while HCA peers will only maintain the ledger and smart contracts for the IdentityManagement channel.
Figure 13. EMR-chain Network. The detailed color specifications for the nodes and lines are provided in Table 6.
Figure 13. EMR-chain Network. The detailed color specifications for the nodes and lines are provided in Table 6.
Technologies 13 00446 g013
Table 6. Detailed Color Table for EMR-chain Network.
Table 6. Detailed Color Table for EMR-chain Network.
Color/ShapeElement TypeMeaning/Label Example
Blue oval/rectangleChannelAccessControl channel (c1, cc1)
Red oval/rectangleChannelTransactionRecord channel (c2, cc2)
Green oval/rectangleChannelIdentityManagement channel (c3, cc3)
Yellow squareOrganizationorg1
Blue squareOrganizationorg2(Healthcare Certification Authority)
Green squareOrganizationorg3
Orange squareCertificate AuthorityCA1, CA2, CA3
Light orange rectangleHCA Peerp1, p2
Gray squareOrdering ServiceO
Small red rectangleSmart ContractSC
Small green rectangleLedgerL1, L2, L3
Beige rectangleApplicationA1, A2
Gray rectangle (bottom)Legend blockUsed for symbol explanation

4.2.2. EMR-Chain Identity Create and ACL Instance Create

Figure 14 illustrates the process of creating an EMR-chain identity and instance. Users apply for EMR-chain identity registration by submitting their signature, wallet address, and hashed ID to the service provider. The service provider verifies the user’s identity through the digital signature verification function on the DID-chain. Once the verification is successful, indicating that the government endorses the user’s identity, the service provider registers the identity with the MOHW’s Certificate Authority (CA).
Since Hyperledger Fabric is a permissioned blockchain, any transaction submitter must include a signature and an X.509 certificate when submitting a transaction. This demonstrates that the organization’s CA authorizes them to join the blockchain network. In the context of EMR exchange systems, patients may use EMR exchange services at different hospitals. This necessitates allowing patients to log in and access the EMR exchange services across multiple hospitals.
To address this, the service provider will encrypt the private key and X.509 certificate (collectively referred to as X.509 identity) required for transaction submission using a user-defined key. While creating the identity for the patient in the IdentityManagement channel, the service provider will store the encrypted X.509 identity in a designated field of the patient’s identity information within the IdentityManagement channel. This enables patients to retrieve their X.509 identity using their user-defined key when interacting with the IdentityManagement channel, allowing them to commit transactions to the EMR-chain.
After the identity registration, the service provider will create an instance for the patient in the AccessControl channel.

4.2.3. EMR-Chain Login and Logout Process

Figure 15 illustrates the login process for users at various hospitals. Users submit their signature to log in, and the login() function on the IdentityManagement channel verifies if the claimed role of the user is registered and whether the user holds the claimed identity through signature verification. Upon successful verification, the IdentityManagement channel returns the user’s encrypted X.509 Identity, indicating a successful login.
Due to browser compatibility issues, the Hyperledger Fabric SDK does not currently support running in a browser. Users rely on service providers to set up the SDK environment and provide web services for users to submit transactions. In this EMR exchange system, each hospital will also act as a service provider. We trust hospitals as reliable organizations, so users can input the user-defined key and signature to log in at each hospital. After the signature is successfully verified, the encrypted X.509 identity is returned and decrypted using the user-defined key. The decrypted X.509 identity will be temporarily stored with the service provider, allowing users to submit transaction requests through the web services provided.
Upon receiving a request, the service provider will submit the transaction using the user’s X.509 identity. After completing the transaction submission, a logout will be performed. The user will be logged out, and the service provider will ensure the deletion of the user’s X.509 identity. This guarantees that no transactions occur without the user’s consent. The logout process is illustrated in Figure 16.

4.2.4. Consent/Revoke Identity

Figure 17 illustrates the process for healthcare providers and hospital administrative units to obtain the “doctor” or “supervisor” roles. Healthcare providers and hospital administrative units submit credentials that can verify their identities to the respective authorities (HCA or MOHW). The authorities will update the applicants’ roles in the IdentityManagement channel after verifying the valid credentials.

4.2.5. Transaction Submission

Figure 18 illustrates the process of users submitting transactions. This includes operations like patients modifying the ACL (consent/revoke access), healthcare providers uploading patient instances or updating medical record hash values (upload instance/hash), and healthcare providers comparing held medical record hash values with on-chain hash values (validate hash). All types of users submit transaction requests through the web services provided by the service provider. Before submitting transactions, users must log in to ensure the service provider can submit transactions using the user’s X.509 identity.
As mentioned earlier, to enhance the access control of smart contracts, after a transaction is submitted, the AccessControl channel first verifies the submitter’s role through the IdentityManagement channel before executing the transaction. Only after confirming that the submitter’s role meets the access control requirements for the called function will the AccessControl channel execute the submitted transaction.
In this context, update_instance() and validate_hash() serve as representatives of transaction submissions. Figure 19, Figure 20, Figure 21 and Figure 22 show the web page interfaces for healthcare providers performing update_instance() and validate_hash().

4.2.6. Authorization

Figure 23 illustrates how a Data Requester obtains authorization from a Data Owner to access medical records. The Data Requester must submit a signature to verify their identity as a healthcare provider, while the patient also submits their signature. The patient’s signature verifies their identity and signifies consent for the Data Requester to access their electronic medical records.
After submitting the request to the AccessControl channel, the authenticate_identity() function on the IdentityManagement channel first verifies the signatures and roles of both the Data Owner and the Data Requester. It then checks if the Data Requester meets the ACL access rules. Upon successful verification, the smart contract randomly generates a token key pair and uses the private key of the token key pair to create a JWT. The public key of the token key pair is recorded in the ledger to help the Data Controller verify the JWT. The token and the address of the electronic medical records are then returned to the Data Requester, indicating successful authorization.

4.2.7. Authorization Verification and Audit Logging

Figure 24 illustrates the process of verification and audit logging by the Data Controller after receiving an access request. Upon receiving a token from the Data Requester, the Data Controller first uses the Token Validator to verify the token’s validity.
To verify the token, the Token Validator retrieves the public key of the token key pair from the AccessControl channel. It is used to decrypt the signature part of the token. Once decrypted, it compares the decrypted Signature with the hash value of the Header and Payload parts of the JWT to ensure that the token has not been tampered with after issuance.
Next, the Token Validator checks the expiration time, token holder, and token issuer in the Payload part to ensure the token is within its valid period and that the holder and issuer match the Data Requester and the EMR exchange system, respectively. Regardless of whether the token verification is successful, the access request is recorded in the TransactionRecord channel.
If the verification is successful, the Data Controller returns the requested medical records to the Data Requester. In this study, the “FHIR Taiwan Public Test Server” [23] is used as the FHIR server acting as the Data Controller. Any request to access medical data is first sent to the implemented Token Validator, and only requests that successfully pass verification are forwarded to the FHIR Taiwan Public Test Server.

5. Experimental Evaluations

5.1. Environment Setup

The experimental environment consisted of two distinct blockchain networks. The DID-chain was implemented on an Ethereum-based blockchain simulated using Ganache, with its network configuration detailed in Table 7. The EMR-chain was built on Hyperledger Fabric, provisioned using Fablo [24], and its network configuration is outlined in Table 8. The overall system setup is summarized in Table 9. The complete source code is available in the Supplementary Materials.
System performance, specifically throughput, was quantified using Apache JMeter [25]. For the Ethereum-based DID-chain, transaction costs (gas fees) associated with smart contract deployment and function execution were measured using the Truffle suite [26].

5.2. Gas Fee Consumption

Figure 25 analyzes the gas fees required for key contract functions. The deployment of the IdentityManager contract incurred the highest gas cost. This is attributable to the contract’s complexity, which includes extensive data structures and functions required for robust identity management. However, as this contract is deployed only once during the initial setup of the DID-chain, this one-time cost is amortized over the system’s lifecycle.
Among transactional functions, bindWallet() exhibited significant gas consumption. This is because the function triggers the on-chain creation of a new Personal contract for the user, which is a resource-intensive operation. The gas cost of the set_app_private() function was observed to be directly proportional to the size of the input data, as larger encrypted payloads require more on-chain storage.

5.3. Function Throughput

To validate the system’s real-world viability, we benchmarked its performance against Taiwan’s national EMR exchange statistics (2018–2020), as detailed in Table 9. Our evaluation utilized the peak recorded figures to establish a conservative performance baseline.
As illustrated in Figure 26, the throughput of all tested functions increases with the client send rate until reaching a saturation point, beyond which performance stabilizes. Functions performing read-only operations, such as login(), getACL(), and validateHash(), demonstrated superior throughput. The computational overhead of digital signature verification in the login() function was found to have a negligible impact on its overall performance.
Figure 26. Function Throughput. Since the trend lines in this figure are too close to each other, the corresponding data are instead presented in Table 10 for clarity.
Figure 26. Function Throughput. Since the trend lines in this figure are too close to each other, the corresponding data are instead presented in Table 10 for clarity.
Technologies 13 00446 g026
Table 10. Detailed Data Table for Function Throughput.
Table 10. Detailed Data Table for Function Throughput.
Send Rate (Requests/Sec)LoginValidate HashUpdate InstanceValidate HashAuthorization
10109.99.99.910
1514.614.314.314.614.4
2019.21918.919.819.4
2524.123.923.72424.4
To validate the system’s real-world viability, we benchmarked its performance against Taiwan’s national EMR exchange statistics (2018–2020), as detailed in Table 11. Our evaluation utilized the peak recorded figures to establish a conservative performance baseline.
As illustrated in Figure 26, the throughput of all tested functions increases with the client send rate until reaching a saturation point, beyond which performance stabilizes. Functions performing read-only operations, such as login(), getACL(), and validateHash(), demonstrated superior throughput. The computational overhead of digital signature verification in the login() function was found to have a negligible impact on its overall performance.
Index Upload Performance: The highest recorded national load was 211,438,234 index uploads in 2018, averaging a continuous load of approximately 6.7 transactions per second (TPS). As shown in Figure 26, our system’s updateInstance() function achieved a stable throughput of approximately 40 TPS (at a send rate of 50). This demonstrates a capacity nearly six times greater than the required peak load.
Medical Record Query Performance: The peak national query load was 2,465,295 in 2018, averaging approximately 4.7 queries per minute, or 0.08 TPS. The authorization() function, which orchestrates the query process, sustained a throughput of approximately 49 TPS (at a send rate 50). This performance exceeds the required real-world demand by several orders of magnitude, confirming the system’s capability to handle query loads with substantial headroom.

5.4. Security Analysis

This section analyzes the security posture of the EMR-Chain system against key attack vectors, including Distributed Denial-of-Service (DDoS) attacks, 51% attacks, smart contract vulnerabilities, and time-based manipulation.

5.4.1. Distributed Denial-of-Service (DDoS) Attack

Centralized architectures, such as traditional Electronic Exchange Centers (EECs), present a single point of failure, rendering them highly susceptible to DDoS attacks. The decentralized architecture of the EMR-Chain inherently mitigates this vulnerability. By distributing data processing and transaction validation across numerous participating nodes (hospitals and authorities), the system eliminates the central chokepoint that is the primary target of DDoS attacks. This distribution of workload and responsibility ensures that the failure or compromise of a single node does not disrupt the entire network, significantly enhancing system resilience and robustness.

5.4.2. 51% Attack

The threat of a 51% attack, common in public, proof-of-work blockchains, is fundamentally neutralized by the EMR-Chain’s design as a permissioned network on Hyperledger Fabric. In this model, network participants are not anonymous miners but known, credentialed entities (e.g., Ministry of Health and Welfare (MOHW), Healthcare Certificate Authority (HCA), and hospitals).
Consensus is achieved not through a hash rate majority but through an endorsement policy requiring agreement among these trusted institutions. The IdentityManagement channel, for instance, is jointly governed by the MOHW and HCA, while the collective of participating hospitals maintains the AccessControl and TransactionRecord channels. Consequently, a successful attack would require the collusion or compromise of most of these legally and operationally distinct organizations, a threat model considered practically infeasible.

5.4.3. Smart Contract Vulnerabilities

To fortify the system against smart contract vulnerabilities, a multi-layered security strategy is implemented:
Role-Based Access Control (RBAC): The system enforces strict RBAC via its smart contracts. For example, the update_instance() function can only be executed by an identity with the “doctor” role, while consent_access() is restricted to the “patient” role. This principle of least privilege ensures that the potential impact of a compromised account is confined to its designated permissions.
Mandatory Identity Authentication: No function can be executed without prior identity and role verification. The authenticate_identity() function validates a user’s digital signature against their on-chain public key and confirms their role, preventing unauthorized or anonymous interactions with the smart contracts.
Data Confidentiality Measures: User privacy is protected through de-identifying on-chain data, and client-side encryption of sensitive information (e.g., application private keys) is required before it is stored in the Personal contract. This ensures that even on-chain data remains confidential.
Data Integrity Assurance: The immutability of the blockchain is leveraged to guarantee data integrity. The validate_hash() function allows a data requester to verify the hash of a medical record against its on-chain counterpart, enabling the detection of any unauthorized modifications and preventing undetected data tampering.
Immutable Audit Trail: The dedicated TransactionRecord channel provides an immutable and non-repudiable audit trail of all query requests. Access to write to this log is restricted to “supervisor” roles, ensuring the integrity of the audit data, which can serve as conclusive evidence in the event of a dispute.

5.4.4. Defense Against Token Replay and Time-Based Attacks

The system mitigates time-based attacks, such as token replay, using short-lived JSON Web Tokens (JWTs) with embedded expiration timestamps. When a data exchange is authorized, the authorization function generates a JWT valid for a limited period.
The Token Validator module, which processes incoming requests, is responsible for rigorously validating each token’s signature, issuer, holder, and, critically, its exp (expiration) claim before granting access. This mechanism ensures that even if a token is compromised, its utility is strictly time-bound, rendering it useless after expiration and effectively neutralizing this attack vector. Furthermore, all access attempts, whether successful or failed, are logged, providing an additional layer of security monitoring.

5.5. Detailed Performance Evaluation Table

To assess the practical viability of the EMR-Chain, we benchmarked the throughput of its two core smart contract functions against peak real-world usage data from Taiwan’s national EMR system (2018). The evaluation was performed under a simulated load of 50 requests per second (rps) to test the system’s performance under stress (see Table 12, Summary of Performance Evaluation Results).
  • Index Upload Throughput (updateInstance()): The function responsible for medical record index uploads sustained a stable throughput of approximately 40 transactions per second (TPS). When compared against the peak national demand of 6.7 TPS, our system demonstrates a capacity that exceeds the required benchmark by a factor of nearly six. This confirms its capability to handle high-volume index uploads with significant headroom.
  • Query Authorization Throughput (authorization()): The authorization() function, which orchestrates the complex process of medical record queries, achieved an even higher throughput of approximately 49 TPS. This performance was benchmarked against the national peak query load of 4.7 requests per minute (≈0.08 TPS). The system’s query-handling capacity is therefore several orders of magnitude greater than the observed real-world requirement. This substantial performance margin ensures high responsiveness and low latency, even during periods of high concurrency.
In conclusion, the empirical results validate that the EMR-Chain’s architecture not only meets but substantially exceeds the performance demands of a national-scale electronic medical record exchange system. This confirms the system’s scalability and readiness for practical, real-world deployment. However, in practical applications, there have not yet been cases of large hospitals exchanging data with multiple medical centers. Therefore, we look forward to further testing the system’s performance and stability in a real-world environment in future research.

5.6. Practical Significance and Impact of Numerical Results

The numerical results of the EMR-Chain, a decentralized electronic medical record exchange system proposed in the manuscript, are primarily demonstrated in terms of Throughput and Gas Fee Consumption.
1. Throughput:
Practical Significance: Throughput is a key metric for measuring the number of transactions or requests a system can process per unit of time. The manuscript benchmarks its system’s performance against real-world statistics from Taiwan’s national electronic medical record exchange (2018–2020), using the highest recorded data from 2018 as a conservative performance baseline.
Medical Record Index Upload (updateInstance()) Performance: The highest national record in 2018 was approximately 6.7 transactions per second (TPS). The EMR-Chain’s updateInstance() function achieved a stable throughput of about 40 TPS.
Medical Record Query (authorization()) Performance: The highest national query volume in 2018 was approximately 0.08 TPS. The EMR-Chain’s authorization() function achieved a throughput of about 49 TPS.
Impact on Users and Industry Stakeholders:
Significantly Exceeds Current Demand: The system’s throughput for uploads is nearly six times the highest national demand (40 TPS vs. 6.7 TPS), and its query throughput surpasses it by several orders of magnitude (49 TPS vs. 0.08 TPS). This indicates that the system’s performance far exceeds the practical needs of the current national electronic medical record exchange, demonstrating extremely high processing capacity and stability.
High Responsiveness and Low Latency: The excellent throughput ensures that the system maintains high responsiveness and low latency, even under high concurrency. This means doctors can access patient records faster, and patients can grant authorization and query records more quickly, significantly improving the efficiency of medical services and the user experience.
Prepared for Future Expansion: The system’s robust performance proves its capability to handle much larger future workloads, providing a solid technical foundation for the scalability and practical deployment of national-level EMR exchange systems in Taiwan and other regions. This is a significant promise for industry stakeholders looking to introduce blockchain technology to enhance the reliability and efficiency of medical information systems.
Enhanced System Resilience: High throughput also indirectly enhances the system’s resistance to Distributed Denial of Service (DDoS) attacks, as the decentralized architecture distributes data processing and transaction validation across multiple nodes, eliminating single points of failure.
2. Gas Fee Consumption:
Practical Significance: The gas fee is a metric for measuring the transaction cost required to deploy smart contracts and execute functions on the Ethereum-based decentralized identity blockchain (DID-Chain).
The deployment cost of the IdentityManager contract is the highest, but this is a one-time fee that is amortized over the system’s lifecycle.
The bindWallet() function has significant gas consumption because it triggers the on-chain creation of a new Personal contract for the user, which is a resource-intensive operation.
The gas cost of the set_app_private() function is proportional to the size of the input data, as larger encrypted data requires more on-chain storage space.
Impact on Users and Industry Stakeholders:
Cost–Benefit Analysis: Although certain operations (like contract deployment and wallet binding) incur higher initial or specific costs, these costs are acceptable when weighed against the core values the system provides, such as decentralization, high security, and privacy protection. The one-time deployment cost is negligible over time, while the costs of specific resource-intensive operations reflect the inherent overhead of on-chain operations.
Encourages Efficient Design: The transparency of gas fees incentivizes developers to consider efficiency when designing smart contracts, minimizing unnecessary on-chain storage and computation to reduce user costs.
Long-Term Stability: Compared to centralized systems that may face single points of failure and data breach risks, blockchain, despite its inherent transaction costs, offers greater value and long-term stability through its immutability and transparent audit trails, which are crucial for highly sensitive information like medical data.

6. Conclusions and Future Work

6.1. Conclusions

The decentralized electronic medical record (EMR) exchange system we have put together in this study offers a solid answer to some challenging healthcare problems. With a decentralized setup, we sidestepped those annoying performance bottlenecks that often pop up. At the same time, we seriously beefed up data privacy and who gets to see what. How did we do it? It is all thanks to de-identification tricks and building a special identity management system for secure EMR sharing.
The system is designed to enhance patient autonomy, giving individuals the liberty and agency to make informed decisions about their own medical treatment. They get precise control over their data, which means their privacy is locked down. Plus, using a standardized EMR exchange format makes it easier for different healthcare providers to share information smoothly. Moreover, here is a crucial point: this system is designed to play by the rules, fully complying with all the current Taiwanese regulations governing EMR exchange.
Looking ahead, our vision for this system is to hook it up with global decentralized identity (DID) management frameworks. This would open up a new world of possibilities, letting it work in other areas like financial services, managing physiological data, or even keeping track of learning histories. Imagine users using their DIDs across many different services—that would expand what this system can do and how much impact it can have across various fields.

6.2. Future Work

For our next steps, we will focus on making the EMR-chain system even better by adding more fine-grained authorization controls. It is mostly about hospital-level permissions, but we want to go way beyond that. The goal is to give patients more precise control over their medical data and improve privacy protection. The following provides an overview of the improvements we are planning and the hurdles we expect to face.
Proposed Enhancements for Fine-Grained Authorization:
1. Department-Specific Access Control: We want patients to be able to set different access permissions for various medical departments within the same hospital. So, for example, a cardiologist would only see heart-related records, while an orthopedist would stick to musculoskeletal data. This approach boosts patient autonomy by ensuring that only the relevant specialists within a hospital can access specific data.
2. Resource Type-Based Authorization: This idea is about getting super granular access based on specific FHIR resource types, like DiagnosticReport, MedicationRequest, or Observation. Hospitals could decide which types of resources are available for exchange. Then patients could permit specific categories of their medical data—say, lab results or surgical notes—while keeping others private. This offers a much more nuanced way to share data.
Challenges in Implementation:
1. Lack of Standardization in Department Classification: This presents a practical challenge: there is no standard for classifying medical departments across different healthcare institutions. If one hospital calls something “Cardiology” and another has a slightly different definition or scope, it will make enforcing consistent access policies a significant challenge. This lack of standardization could easily confuse patients when setting permissions and lead to system errors when interpreting access rules across different organizational structures.
2. Data Overlap in FHIR: Applying authorization at the FHIR resource level becomes complex because data often overlaps between different resources. For instance, a diagnosis in a Condition resource might also be hinted at in a MedicationRequest or ServiceRequest. This overlap makes it extremely difficult to separate data segments cleanly. You have not stopped the information from leaking if you deny access to a MedicationRequest, but the underlying diagnosis is still visible through the Condition resource. This means we will need seriously smart policy enforcement to manage these data dependencies and prevent accidental disclosures.
Overcoming these complexities will take a concerted effort, with industry-wide standardization being key, along with developing sophisticated models for data dependencies. However, getting past these challenges is vital to unlock the full potential of fine-grained access control. Ultimately, it is all about maximizing patient privacy while ensuring that necessary medical information can be exchanged smoothly and securely.

Supplementary Materials

To ensure the transparency and reproducibility of our research, the full implementation of the proposed system, “EMR-Chain: Decentralized Electronic Medical Record Exchange System,” has been released as open-source software. The complete source code, encompassing smart contracts, the front-end interface, and deployment scripts, is publicly available on GitHub at: https://github.com/nctu-dcs-lab/EMR_Chain-Decentralized_Electronic_Medical_Record_Exchange_System (accessed on 31 July 2024). This open-source release is intended to foster transparency within the research community and encourage future extensions or applications of the system in related domains.

Author Contributions

Conceptualization, S.-M.Y. and C.-H.T.; methodology, H.-Y.L.; validation, H.-Y.L. and S.-M.Y.; formal analysis, Y.-H.H. and C.-H.T.; writing—original draft preparation Y.-H.H. and C.-H.T., writing—review and editing S.-M.Y. and H.-Y.L.; visualization, Y.-H.H.; supervision, S.-M.Y. and H.-Y.L.; funding acquisition, S.-M.Y. All authors have read and agreed to the published version of the manuscript.

Funding

This research was partially supported by the Ministry of Science and Technology of Taiwan under grant number 113-2410-H-A49-053.

Institutional Review Board Statement

Not applicable.

Informed Consent Statement

Not applicable.

Data Availability Statement

Not applicable.

Acknowledgments

While preparing this manuscript, the author(s) used the https://app.grammarly.com/online (accessed on 31 July 2024) student version (2025) for Grammar Check for English Translation. The authors have reviewed and edited the output and take full responsibility for the content of this publication.

Conflicts of Interest

The authors declare no conflict of interest.

Appendix A

Appendix A.1. Smart Contracts Detail Design on the DID-Chain

Appendix A.1.1. IdentityManager

The pseudocode for the IdentityManager smart contract is presented in Algorithm A1. This contract is central to managing user identities within the DID-Chain.
The addUser() function initiates the creation of a unique Main Identity for a user, which is derived from their hashed ID (DID). Following successful identity creation, the bindWallet() function performs a crucial validation step. It verifies the authenticity and integrity of both the DID and the associated digital wallet. Upon successful verification, the user’s digital wallet is securely bound to their newly established Main Identity, enabling subsequent identity verification processes through the digital wallet.
For application providers requiring user authentication, the authentication() function is provided. This function facilitates the verification of a user’s digital signature against their claimed identity. Users are required to furnish their DID and digital signature, which the authentication() function then rigorously validates to confirm the signature’s correspondence to the asserted identity.
Furthermore, the IdentityManager contract offers several accessor functions for retrieving user-specific information. These include getId(), which retrieves the user’s DID; getUserType(), which identifies the user’s classification; and getPersonalAddress(), which provides the address of the user’s associated Personal contract.
Algorithm A1 IdentityManager contract
1:  function addUser(DID)   ▷DID: Decentralized Identifier
2:   if DID is not enrolled then
3:    Mark this DID as enrolled.
4:    Create an Identity for the user.
5:   else
6:    Reject the enrollment request.
7:   end if
8:  end function
9:
10:  function bindWallet(DID, walletAddress, userType)   ▷Ensure DID and wallet are unique
11:   Check if the DID is registered.
12:   Check if the wallet address is already bound.
13:   Check if the DID is already bound.
14:   Bind the DID and wallet address.
15:   Create a personalIdentity contract for the user.
16:   Record the personalIdentity contract address in IdentityInfo.
17:  end function
18:
19:  function authentication(DID, hashedmessage, signature)   ▷ECDSA: Elliptic Curve Digital Signature Algorithm
20:   Verify signer using ECDSA.recover()
21:   if Verification successful then
22:    result ← true
23:   else
24:    result ← false
25:   end if
26:   return result
27:  end function
28:
29:  function getId()   ▷Retrieve user’s decentralized identifier
30:   Return the user DID
31:  end function
32:
33:  function getUserType()   ▷Retrieve type of user
34:   Return the user type of the user
35:  end function
36:
37:  function getPersonalAddress(address)   ▷Retrieve user’s personal contract address
38:   Return the personal contract address of the user
39:  end function

Appendix A.1.2. Personal

Algorithm A2 presents the pseudocode for the Personal smart contract, which functions as a secure repository for user-specific data.
The set_app_private() function facilitates the storage of sensitive information, such as app-chain private keys, within the user’s Personal contract. To maintain data confidentiality, users are required to encrypt the data locally before uploading the resultant ciphertext to the contract. A complementary function enables the retrieval of this stored ciphertext, which must subsequently be decrypted by the user.
Algorithm A2 Personal contract
1:  function set-app-private(app, encryptedData)   ▷ Store encrypted application-specific data
/Store encrypted application data
2:   Record the app→encryptedData mapping to appPrivate
3:  end function
4:
5:  function get-app-private()   ▷ Retrieve encrypted user data/Retrieve encrypted application data
6:   Return the encryptedData of user
7:  end function

Appendix A.2. Smart Contracts Detail Design on the EMR-Chain

Appendix A.2.1. IDM Chaincode

Algorithm A3 illustrates the pseudocode for the IDM chaincode, a critical component of the EMR-chain responsible for identity management and access control.
Algorithm A3 IDM chaincode
1:  function beforeTransaction()
2:   commit_id ← user id on the x509credential   ▷ Extract user identity from credential
3:   msp_id ← organization id on the x509credential
4:   func ← function name of the user call
5:   Check if commit_id and msp_id match the access control of the function.
6:  end function
7:
8:  function verify_role(appId)
9:   return the appId’s role
10:  end function
11:
12:  function create_identity(ctx, p_key, app_id, did, x509Cipher)   ▷ Create a new identity
13:   Create an identity for user.
14:  end function
15:
16:  function authenticate_identity(ctx, p_key, signature, patientId)   ▷ Verify user identity and role
17:   buffer ← await ctx.stub.getState(p_key)
18:   if (!buffer or !buffer.length) return { error: "Please register first!!" }
19:   isVerified ← Verify the signature.   ▷ Check if patient registered
20:   if (isVerified) and (User’s role == "patient" or "doctor")
21:    return User’s role
22:   else
23:    return "Authenticate Fail!!!"
24:   end if
25: end function
26:
27:  function login(ctx, p_key, signature, message)   ▷ Login using signature verification
28:   isVerified ← Verify the signature.
29:   if (isVerified) return User’s x509Cipher
30:   else return { error: "Verify Failed! You are not the user!!" }
31:  end function
  • beforeTransaction(): This function is invoked prior to any other function call within the chaincode. Diverging from conventional implementations, its primary role here is to verify the transaction submitter’s authorization to access the requested function.
  • verify_role(): This function returns the role of the transaction submitter. It is integral to the chaincodes of both the AccessControl and Transaction channels, where it is used to validate whether a submitter possesses the requisite authority to execute a specific function.
  • create_identity(): This function establishes a new identity on the EMR-chain and stores the user’s X.509Cipher. This X.509Cipher is generated by encrypting the user’s X.509 credential and the identity’s private key with a user-defined key. The resulting cipher serves as the primary credential for logging into the EMR exchange system.
  • Role Management Functions: Role management is handled by a set of dedicated functions. The consent_doc_role() and consent_sup_role() functions are used to grant the “doctor” and “supervisor” roles to healthcare providers and hospital administrative units, respectively. Conversely, the revoke_doc_role() and revoke_sup_role() functions enable designated authorities, namely the HCA (Healthcare Authority) and MOHW (Ministry of Health and Welfare), to revoke these roles.
  • authenticate_identity(): This function is crucial for verifying the identities of both patients and healthcare providers during EMR exchanges. Leveraging the user’s public key, which is recorded on the IdentityManagement channel, this function performs digital signature verification. This process validates that a signature originates from the claimed submitter and confirms that the identity holds a valid role (i.e., “doctor” or “patient”) for participation in the exchange.
  • login(): Finally, the login() function validates two conditions: first, that the submitted signature corresponds to the caller’s identity, and second, that this identity is registered on the EMR-chain. If the user’s identity is not found, the system requires them to complete the registration process before granting access.

Appendix A.2.2. ACL Chaincode

In Algorithm A4, the ACL (Access Control List) chaincode governs access to medical record instances within the EMR-chain. Analogous to the IDM chaincode, its beforeTransaction() function serves as a critical access control gateway. It invokes the verify_role() function from the IDM chaincode to validate whether the caller possesses the requisite authority for the requested function. If authorization is insufficient, the request is denied.
The core functions of the ACL chaincode are as follows:
  • create_patient_instance(): Invoked upon a user’s initial registration with the EMR-chain, this function provisions an empty record instance for that user on the ledger.
  • update_instance() and update_hash(): These functions facilitate the uploading of new medical record instances and their corresponding hash values to the ledger.
  • consent_access() and revoke_access(): These functions are employed to dynamically grant or revoke a healthcare provider’s access to a patient’s medical record by modifying the on-chain ACL.
Algorithm A4 ACL chaincode
1:  function beforeTransaction(ctx)
2:    input ← ctx.stub.getFunctionAndParameters()   ▷ Parse function and parameters
3:    commit_id ← ctx.clientIdentity.getAttributeValue("user_id")
4:    Check if commit_id matches the access control of the function.
5:  end function
6:
7:  function create_patient_instance(ctx, patient_id)   ▷ Initialize empty ACL instance
8:   New an empty ACL instance for patient_id
9:  end function
10:
11:  function update_instance(ctx, patient_id, hospital_id, pointer, hash)   ▷ Update ACL attributes
12:   Setup the level, open_access, pointer, hash attribute for patient
13:   Update patient’s instance
14:  end function
15:
16:  function update_hash(ctx, patient_id, hospital_id, new_hash)   ▷ Update medical record hash
17:   Update the medical record hash value
18:  end function
19:
20:  function consent_access(ctx, patient_id, hospital_id)   ▷ Relax access control rules
21:   Change ACL to less stringent rules   ▷ Update patient’s medical record reference
22:  end function
23:
24:  function revoke_access(ctx, patient_id, hospital_id)   ▷ Tighten access control rules
25:   Change ACL to more stringent rules
26:  end function
27:
28:  function authorization(ctx, patient_id, patient_p_key, doctor_p_key, patient_signature, doctor_signature, self_level, request_id, hospitalDID)   ▷ Authorize doctor with JWT token
29:   Authenticate signature and role via IDM.authenticate_identity
30:   Randomly create token key pair
31:   Setup JWT Header and Payload
32:   Use patient’s ACL to check doctor access rights
33:   if doctor has access right then
34:    Sign JWT with private key of token key pair
35:    Record public key of token key pair for validation
36:    return token and address
37:   else
38:    return "Reject Access!!!"
39:   end if   ▷ Generate JWT token if doctor authorized
40:  end function
41:
42:  function validate_hash(ctx, patient_id, hash_obj)   ▷ Validate consistency of hashes
43:   Compare hash values of chain and holders
44:   if different, return "UPDATE"
45:  end function
The chaincode employs a hash-based mechanism to ensure data integrity and synchronization. When a medical record is updated at a hospital, the provider invokes update_hash() to update the record’s hash on the AccessControl channel. This on-chain hash serves as the authoritative reference for the latest version of the record. Before retrieving a record, a Data Requester (e.g., another hospital) uses the validate_hash() function to compare its locally stored hash with the on-chain hash. A discrepancy between these hashes indicates that the local record is outdated, thereby necessitating a data exchange to acquire the most recent version.
The authorization() function orchestrates the entire secure access process. In alignment with Taiwanese EMR exchange protocols, the function first performs rigorous identity verification for both the patient and the healthcare provider using digital signatures. It achieves this by invoking the authenticate_identity() function from the IDM chaincode, which uses the on-chain public keys to validate the signatures and confirm that the participants hold valid “doctor” or “patient” roles.
Upon successful verification, the function evaluates the patient’s configured ACL to determine if the requesting provider meets the access criteria. If the criteria are satisfied, the authorization() function proceeds to generate a temporary public–private key pair (the token key pair). It then constructs a JSON Web Token (JWT) by populating its Header and Payload with session-specific details, such as expiration time, holder (the provider), and issuer. The token is subsequently signed using the private key of the newly generated token key pair.
Finally, the public key of the token is recorded on the ledger for future validation by the token recipient. The function returns the generated JWT and the data access address to the Data Requester, enabling secure retrieval of the patient’s medical records.

Appendix A.2.3. TSR Chaincode

In Algorithm A5, the TSR (Timestamp-based Secure Record) chaincode is responsible for maintaining a comprehensive and immutable audit trail of all access requests within the EMR-chain.
Algorithm A5 TSR chaincode
1:   function beforeTransaction(ctx)
2:    input ← ctx.stub.getFunctionAndParameters()
3:    commit_id ← ctx.clientIdentity.getAttributeValue("user_id")
4:    Check if commit_id matches the access control of the function.
5:  end function
6:
7:  function record(ctx, patient_id, dp, dc, resource, purpose, status)
8:   Record the purpose and status of access request.
9:   Record the access request log by patient id.
10:  end function
Following the processing of an access request by a hospital’s FHIR server, the record() function is invoked to log the event. This logging occurs regardless of the request’s outcome (i.e., approval or denial), ensuring a complete transactional history.
As with the ACL chaincode, TSR implements a beforeTransaction() function that acts as a security gateway. This function leverages verify_role() to validate that the caller—typically a hospital’s system—possesses the requisite authority to write to the audit log.

Appendix B

Explanation of Technical Terms and Abbreviations

To accurately describe the system, the manuscript introduces several technical terms and abbreviations. Their explanations are as follows:
EEC (Electronic Medical Record Exchange Center): A centralized system launched in Taiwan in 2012 to address the inefficiencies of paper-based medical record exchange. However, its centralized architecture led to performance bottlenecks, single points of failure, and a lack of patient consent over their data.
FHIR (Fast Healthcare Interoperability Resources): A standard for fast healthcare interoperability. The system is developed based on this standard, making it a common language for communication between different medical systems, enabling cross-platform data exchange and protecting patient privacy.
DID-Chain (Decentralized Identity Blockchain): One of the two main blockchains in this system. Implemented on Ethereum, it is primarily used for managing user identities through smart contracts, providing Self-Sovereign Identity and giving users full control over their personal identity data, thereby reducing the risk of centralized data breaches. Its core smart contracts include IdentityManager and Personal.
EMR-Chain (Electronic Medical Record Blockchain): The other main blockchain in this system. Implemented on Hyperledger Fabric, it is used to handle medical record indices and fine-grained access control. Its functionality is divided into three separate channels:
  • IdentityManagement Channel: Establishes an application-specific identity system to manage roles (patient, doctor, supervisor) within the EMR ecosystem.
  • AccessControl Channel: Manages access permissions for medical records, creating an independent data instance for each patient-hospital relationship. It contains the Access Control List (ACL), the cryptographic hash of the off-chain medical record, and the network address of the off-chain FHIR resource.
  • TransactionRecord Channel: Provides an immutable and non-repudiable audit trail of all data access requests, used for patient monitoring of record access and as evidence in case of disputes.
Smart Contracts: Self-executing, digitized protocols that automatically execute when preset conditions are met, ensuring transparency and reducing administrative overhead for authorization. On the DID-Chain, these include the IdentityManager and Personal contracts. On the EMR-Chain, smart contracts are called “chaincode.”
Chaincode: On the Hyperledger Fabric platform, smart contracts are referred to as chaincode. The EMR-Chain includes three chaincodes:
  • IDM Chaincode: Manages application-specific identities and roles.
  • ACL Chaincode: Manages fine-grained access control policies for medical records.
  • TSR Chaincode: Maintains a non-repudiable audit trail of all access events.
RBAC (Role-Based Access Control): A security model that restricts user access to system resources by assigning roles. This system strictly implements RBAC; for example, the update_instance() function can only be executed by the “doctor” role, while consent_access() is restricted to the “patient” role.
JWT (JSON Web Token): An open standard for securely transmitting information between parties as a JSON object. This system uses short-lived JWTs with embedded expiration timestamps. The Token Validator module rigorously verifies the signature, issuer, holder, and expiration of each token, ensuring that even if a token is compromised, its utility is limited to its validity period.
Throughput: As mentioned above, a standard metric for evaluating the performance of distributed systems by measuring the number of transactions or requests processed per unit of time.
Gas Fee: As mentioned above, a measure of the computational resource cost required to execute smart contracts on the Ethereum blockchain, priced in units of “Gas.”
Chaincode: On the Hyperledger Fabric platform (i.e., the EMR-Chain), smart contracts are called chaincode. The EMR-Chain includes three chaincodes: IDM Chaincode (for identity and role management), ACL Chaincode (for fine-grained access control policies), and TSR Chaincode (for a non-repudiable audit trail).
RBAC (Role-Based Access Control): A security model that restricts user access to system resources by assigning roles. This system strictly implements RBAC; for example, the update_instance() function can only be executed by the “doctor” role, while consent_access() is restricted to the “patient” role.
JWT (JSON Web Token): An open standard for securely transmitting information between parties as a JSON object. This system uses short-lived JWTs with embedded expiration timestamps. The Token Validator module rigorously verifies the signature, issuer, holder, and expiration of each token, ensuring that even if a token is compromised, its utility is limited to its validity period.
Throughput: A standard metric for evaluating the performance of distributed systems by measuring the number of transactions or requests processed per unit of time. The manuscript states that this system’s throughput far exceeds the practical demand of Taiwan’s national electronic medical record exchange.
Gas Fee Consumption: A measure of the transaction cost required to deploy smart contracts and execute functions on the Ethereum-based blockchain (DID-Chain). The manuscript notes that the gas cost of the set_app_private() function is proportional to the size of the input data.
Main Identity: On the DID-Chain, a unique identity created for a user after verification by a government department, which can manage the user’s authentication and interactions across multiple independent application networks.
IdentityManager Contract: The core public contract on the DID-Chain, responsible for creating and managing user identities after verification by a trusted authority (such as a government agency) and providing a universal identity verification interface for external applications.
Personal Contract: A dedicated contract created for each user on the DID-Chain, serving as a secure data vault controlled by the user. It is used to securely store sensitive information, such as encrypted private keys for other application chains.
Hyperledger Fabric: A permissioned blockchain framework for enterprise-grade applications. The EMR-Chain is implemented based on this framework, leveraging its advantages such as multi-channel capability, superior transaction throughput, and controllable participant identities.
Ethereum: An open-source, public blockchain platform known for its smart contract functionality. The DID-Chain is implemented based on it.
HCA (Healthcare Certification Authority): In the IdentityManagement Channel, the authority responsible for verifying the credentials of medical personnel and promoting their role to “doctor”.
MOHW (Ministry of Health and Welfare): In the IdentityManagement Channel, the authority responsible for verifying hospital credentials and promoting their role to “supervisor”.
DDoS (Distributed Denial-of-Service) Attack: A type of cyber attack that overwhelms a target system with a massive amount of malicious traffic, causing service disruption. The decentralized architecture of this system can effectively mitigate such attacks.
51% Attack: A potential attack on a public blockchain where an attacker controls more than 50% of the network’s computing power or nodes, thereby being able to manipulate transactions. As this system is a permissioned network where participants are known and certified entities and consensus is not based on computing power, such an attack is practically infeasible.
It is important to note that, as discussed in our previous conversation, this system is not a machine learning model. Therefore, metrics such as precision, recall, F1-score, Root Mean Square Error (RMSE), or Mean Absolute Error (MAE) are not applicable for evaluating the performance of this type of system. The metrics adopted in the manuscript, such as throughput and gas fees, are consistent with its nature as a decentralized medical record exchange system.

Appendix C

Table 1: Abbreviation Legend

To ensure a comprehensive understanding of Table 1, “Summary of related work of HER/EMR systems”, the following abbreviations used in the table are explained:
  • IM (Identity Management): Refers to systems that manage user identities, typically via smart contracts on a Decentralized Identity Blockchain (DID-Chain). The proposed EMR-Chain system, for instance, includes an IdentityManagement channel that establishes an application-specific identity system to manage roles within the EMR ecosystem.
  • SE (Security): Pertains to measures and architectures to enhance system resilience, data protection, and overall security. This includes cryptographic security, immutability, and de-identification protocols to keep personal details confidential. The EMR-Chain’s security posture is analyzed against various attack vectors, including DDoS attacks and smart contract vulnerabilities.
  • Aut. (Authorization): Denotes the process of managing access permissions to medical records. The proposed system achieves this through fine-grained access control via smart contracts, which authorize doctors to access records based on patient-defined permissions. For example, the Authorization () function evaluates access requests against a patient’s Access Control List (ACL).
  • Int. (Interoperability): Highlights the capability of different healthcare systems to exchange data seamlessly. The proposed system is developed based on the Fast Healthcare Interoperability Resources (FHIR) standard, which acts as a common language for cross-platform data exchange. Blockchain can also serve as a shared metadata layer to connect disparate institutions.
  • Pri. (Privacy): Refers to the protection of patients’ personal medical data. This is achieved through stringent de-identification protocols, fine-grained access controls, and enabling patients to maintain control over their data. The system aims to improve privacy significantly through enhanced access controls.
  • S-Aut. (Sub-authorization): Represents the concept of more granular Authorization controls that extend beyond general access, such as department-specific access or resource type-based authorization. This feature aims to give patients more precise control over their medical data and enhance privacy protection.
  • SC.-AC. (Smart Contract Access Control): Utilizes smart contracts to define and enforce granular access rules for medical records. The EMR-Chain, for instance, implements Role-Based Access Control (RBAC) via its chaincodes (smart contracts) to ensure only authorized roles can execute specific functions.
  • St.-For. (Standardized Format): Indicates adopting a unified standard for data exchange to ensure consistency and smooth communication between different medical systems. The system mandates the use of the FHIR standard for this purpose.
  • Cen. (Centralized): Describes architectural models, such as the existing Electronic Medical Record Exchange Center (EEC) in Taiwan, which rely on a central server. Such architectures are noted for potential performance bottlenecks, single points of failure, and limited patient consent over data.
  • Dcen. (Decentralized): Refers to the architecture leveraged by the proposed system, built on two interconnected blockchains (DID-Chain and EMR-Chain). This design aims to overcome the limitations of centralized systems by enhancing resilience, data privacy, and patient autonomy.

References

  1. National Health Insurance Administration, Ministry of Health and Welfare, Taiwan. Tracking Report on the Overall Effectiveness of the Phased Medical Care System in 2023. 2023. Available online: https://www.nhi.gov.tw/english/Content_List.aspx?n=C885175F6D559A83&topn=C885175F6D559A83 (accessed on 31 July 2024).
  2. Electronic Medical Record Exchange Center, Ministry of Health and Welfare, Taiwan. Introduction to the Electronic Medical Records Exchange Center. 2024. Available online: https://eec.mohw.gov.tw/new/Home/Brief (accessed on 31 July 2024).
  3. Li, Y.-C.J.; Yen, J.-C.; Chiu, W.-T.; Jian, W.-S.; Syed-Abdul, S.; Hsu, M.-H. Building a national electronic medical record exchange system–experiences in Taiwan. Comput. Methods Programs Biomed. 2015, 121, 14–20. [Google Scholar] [CrossRef] [PubMed]
  4. Voigt, P.; von dem Bussche, A. The EU general data protection regulation (GDPR). In A Practical Guide; Springer International Publishing: Cham, Switzerland, 2017; pp. 1–55. [Google Scholar] [CrossRef]
  5. Weed, L.L. Medical records that guide and teach. N. Engl. J. Med. 1968, 278, 652–657. [Google Scholar] [CrossRef] [PubMed]
  6. Permanente, K. About KP HealthConnect®. Available online: https://healthy.kaiserpermanente.org/content/dam/kporg/final/documents/community-providers/national/ever/ola-complete-user-registration-guide-en.pdf (accessed on 23 August 2024).
  7. Kohn, L.T.; Corrigan, J.M.; Donaldson, M.S. (Eds.) To Err Is Human: Building a Safer Health System; National Academies Press: Washington, DC, USA, 2000. [Google Scholar]
  8. Blumenthal, D.; Tavenner, M. The ‘meaningful use’ regulation for electronic health records. N. Engl. J. Med. 2010, 363, 501–504. [Google Scholar] [CrossRef] [PubMed]
  9. Al Mamun, A.; Azam, S.; Gritti, C. Blockchain-based electronic health records management: A comprehensive review and future research direction. IEEE Access 2022, 10, 5768–5789. [Google Scholar] [CrossRef]
  10. Rosar, M.; Chuang, K.-T. Using Blockchain for Incentive-Driven FHIR-based Health Record Exchange. In Proceedings of the 39th ACM/SIGAPP Symposium on Applied Computing, Ávila, Spain, 8–12 April 2024; pp. 298–299. [Google Scholar] [CrossRef]
  11. Mishra, A.K.; Sharma, R.; Singh, J.; Singh, P.; Diwakar, M.; Tiwari, M. Smart Contract-Enabled Blockchain Framework for Electronic Medical Health Records. In Proceedings of the 2024 14th International Conference on Cloud Computing, Data Science & Engineering (Confluence), Noida, India, 18–19 January 2024; pp. 124–129. [Google Scholar] [CrossRef]
  12. Lax, G.; Nardone, R.; Russo, A. Enabling secure health information sharing among healthcare organizations by public blockchain. Multimed. Tools Appl. 2024, 83, 64795–64811. [Google Scholar] [CrossRef]
  13. Bach, T.; Aravazhi, A.; Konovalenko, A. Blockchain Technology for Electronic Health Records: Challenges & Opportunities. SINTEF Rep. 2020, 2020, 01250. Available online: https://hdl.handle.net/11250/2722951 (accessed on 31 July 2024).
  14. Yang, X.; Zhang, K.; Jia, K.; Zhao, P. A personalized and efficient EMR sharing and management scheme based on smart contracts. Peer-to-Peer Netw. Appl. 2024, 17, 1569–1587. [Google Scholar] [CrossRef]
  15. Velmurugan, S.; Prakash, M.; Neelakandan, S.; Martinson, E.O.; El Kafhali, S. An Efficient Secure Sharing of Electronic Health Records Using IoT-Based Hyperledger Blockchain. Int. J. Intell. Syst. 2024, 2024, 6995202. [Google Scholar] [CrossRef]
  16. Ali, A.; Rahim, H.A.; Ali, J.; Pasha, M.F.; Masud, M.; Rehman, A.U.; Chen, C.; Baz, M. A novel secure blockchain framework for accessing electronic health records using multiple certificate authority. Appl. Sci. 2021, 11, 9999. [Google Scholar] [CrossRef]
  17. Jakhar, A.K.; Singh, M.; Sharma, R.; Viriyasitavat, W.; Dhiman, G.; Goel, S. A blockchain-based privacy-preserving and access-control framework for electronic health records management. Multimed. Tools Appl. 2024, 83, 84195–84229. [Google Scholar] [CrossRef]
  18. Kaur, J.; Rani, R.; Kalra, N. Attribute-based access control scheme for secure storage and sharing of EHRs using blockchain and IPFS. Clust. Comput. 2024, 27, 1047–1061. [Google Scholar] [CrossRef]
  19. Cui, B.; Chen, Z. Research on Fine-grained Security Sharing Model of Medical Information Based on Blockchain. In Proceedings of 2023 IEEE 29th International Conference on Parallel and Distributed Systems (ICPADS), Ocean Flower Island, China, 17–21 December 2023; pp. 2840–2841. [Google Scholar] [CrossRef]
  20. Hsieh, Y.-H.; Guan, X.-Q.; Liao, C.-H.; Yuan, S.-M. Physiological-chain: A privacy preserving physiological data sharing ecosystem. Inf. Process. Manag. 2024, 61, 103761. [Google Scholar] [CrossRef]
  21. National Health Insurance Administration, Ministry of Health and Welfare. Why Promote the Phased Medical Care System? 2018. Available online: https://www.nhi.gov.tw/english/Content_List.aspx?n=8447881E9A47533E&topn=C885175F6D559A83 (accessed on 23 August 2024).
  22. iThome. Medical IT Will Undergo Two Major Changes! The Ministry of Health and Welfare Announced That the Electronic Medical Records Exchange Center Will Transition to an FHIR Framework and Will Also Submit a Draft Proposal to Move Electronic Medical Records to the Cloud. 2021. Available online: https://www.ithome.com.tw/news/144262 (accessed on 23 August 2024).
  23. FHIR Taiwan Community. FHIR Taiwan Public Test Server. Available online: https://hapi.fhir.tw/ (accessed on 23 August 2024).
  24. Hyperledger Labs. Fablo. Available online: https://github.com/hyperledger-labs/fablo (accessed on 31 July 2024).
  25. The Apache Software Foundation. Apache JMeter. Available online: https://jmeter.apache.org/ (accessed on 31 July 2024).
  26. Truffle Suite. Truffle. Available online: https://trufflesuite.com/docs/truffle/ (accessed on 31 July 2024).
Figure 1. This figure illustrates the architecture of the Electronic Health Record Exchange Center (EEC). Launched by Taiwan in 2012, the EEC system was designed to address the longstanding challenges of exchanging medical records between hospitals. Specifically, it aimed to overcome the inefficiencies of paper-based record exchange, significantly reducing resource waste and financial burden. With patient authorization, the EEC allows physicians to access patients’ medical records from the past six months.
Figure 1. This figure illustrates the architecture of the Electronic Health Record Exchange Center (EEC). Launched by Taiwan in 2012, the EEC system was designed to address the longstanding challenges of exchanging medical records between hospitals. Specifically, it aimed to overcome the inefficiencies of paper-based record exchange, significantly reducing resource waste and financial burden. With patient authorization, the EEC allows physicians to access patients’ medical records from the past six months.
Technologies 13 00446 g001
Figure 2. This figure illustrates the high-level system architecture, showcasing the enhanced electronic medical record (EMR) exchange system proposed in this study. The system comprises three key components: a decentralized identity blockchain (DID-chain), an application-layer blockchain (EMR-chain), and FHIR servers provided by individual hospitals.
Figure 2. This figure illustrates the high-level system architecture, showcasing the enhanced electronic medical record (EMR) exchange system proposed in this study. The system comprises three key components: a decentralized identity blockchain (DID-chain), an application-layer blockchain (EMR-chain), and FHIR servers provided by individual hospitals.
Technologies 13 00446 g002
Figure 3. This figure presents the DID-chain, which is designed to serve as a global identity management system. In this system, identities are referred to as Main Identities. At its core, the system comprises two smart contracts: IdentityManager and Personal.
Figure 3. This figure presents the DID-chain, which is designed to serve as a global identity management system. In this system, identities are referred to as Main Identities. At its core, the system comprises two smart contracts: IdentityManager and Personal.
Technologies 13 00446 g003
Figure 4. This figure depicts the architecture of the Identity Management channel. This channel is the foundation for the application-specific identity management system within the EMR-chain. It ensures secure management and authentication of multiple roles within the EMR-chain.
Figure 4. This figure depicts the architecture of the Identity Management channel. This channel is the foundation for the application-specific identity management system within the EMR-chain. It ensures secure management and authentication of multiple roles within the EMR-chain.
Technologies 13 00446 g004
Figure 5. Illustrates the TransactionRecord channel. This channel is designed specifically to record query requests. The TransactionRecord channel serves two primary purposes: To provide patients with a reference for monitoring access to their medical records. Moreover, it serves as evidence in the event of disputes.
Figure 5. Illustrates the TransactionRecord channel. This channel is designed specifically to record query requests. The TransactionRecord channel serves two primary purposes: To provide patients with a reference for monitoring access to their medical records. Moreover, it serves as evidence in the event of disputes.
Technologies 13 00446 g005
Figure 6. This figure depicts the smart contract architecture of the DID-chain. This architecture primarily consists of two smart contracts: the IdentityManager contract and the Personal contract.
Figure 6. This figure depicts the smart contract architecture of the DID-chain. This architecture primarily consists of two smart contracts: the IdentityManager contract and the Personal contract.
Technologies 13 00446 g006
Figure 7. Chaincode architecture on the EMR-chain demonstrates functional segregation across the IDM, ACL, and TSR channels.
Figure 7. Chaincode architecture on the EMR-chain demonstrates functional segregation across the IDM, ACL, and TSR channels.
Technologies 13 00446 g007
Figure 8. Create MainIdentity Workflow.
Figure 8. Create MainIdentity Workflow.
Technologies 13 00446 g008
Figure 9. Enrollment Page.
Figure 9. Enrollment Page.
Technologies 13 00446 g009
Figure 10. Wallet Workflow.
Figure 10. Wallet Workflow.
Technologies 13 00446 g010
Figure 11. Dashboard Page.
Figure 11. Dashboard Page.
Technologies 13 00446 g011
Figure 12. App-chain Private Key Upload Workflow.
Figure 12. App-chain Private Key Upload Workflow.
Technologies 13 00446 g012
Figure 14. EMR-chain Identity and Instance Create Workflow.
Figure 14. EMR-chain Identity and Instance Create Workflow.
Technologies 13 00446 g014
Figure 15. Login Workflow.
Figure 15. Login Workflow.
Technologies 13 00446 g015
Figure 16. Logout Workflow.
Figure 16. Logout Workflow.
Technologies 13 00446 g016
Figure 17. Consent Identity Workflow.
Figure 17. Consent Identity Workflow.
Technologies 13 00446 g017
Figure 18. Transaction Submission Workflow.
Figure 18. Transaction Submission Workflow.
Technologies 13 00446 g018
Figure 19. Before Update Instance Page.
Figure 19. Before Update Instance Page.
Technologies 13 00446 g019
Figure 20. Updating Instance Page.
Figure 20. Updating Instance Page.
Technologies 13 00446 g020
Figure 21. Update Instance Results Page.
Figure 21. Update Instance Results Page.
Technologies 13 00446 g021
Figure 22. Validate Hash Page.
Figure 22. Validate Hash Page.
Technologies 13 00446 g022
Figure 23. Authorization Workflow.
Figure 23. Authorization Workflow.
Technologies 13 00446 g023
Figure 24. Audit Logging and Token Validator Workflow.
Figure 24. Audit Logging and Token Validator Workflow.
Technologies 13 00446 g024
Figure 25. Gas Fee Consumption.
Figure 25. Gas Fee Consumption.
Technologies 13 00446 g025
Table 1. Summary of related work of HER/EMR systems.
Table 1. Summary of related work of HER/EMR systems.
AuthorIMSEAut.Int.Pri.S-Aut.SC.-AC.St.-For.
M. Rosar and K.-T. Chuang [10]XVVVVXXV
A. K. Mishra et al. [11]Cen.XVVXXXV
G. Lax et al. [12]Cen.VVVVXXV
T. Bach et al. [13]Dcen.VXVVXXV
X. Yang et al. [14]Dcen.VVVVXVV
Velmurugan et al. [15]Dcen.VVVVXXV
S. Vidhya and V. Kalaivani [16]Dcen.VVVVXVV
A. K. Jakhar et al. [17]Cen.VVVVXVV
J. Kaur et al. [18]Cen.VVVVXXV
Our ResearchDcen.VVVVVVV
Table 2. This table presents the function list of the DID-Chain smart contract.
Table 2. This table presents the function list of the DID-Chain smart contract.
FunctionDescriptionPermitted Roles
IdentityManager—
addUser()
A unique Main Identity is generated using the hash of the user’s national identification number.Government Agency: Upon successful verification of the user’s identity, the government agency initiates a request to generate the Main Identity.
IdentityManager—
bindWallet()
The user’s digital wallet is linked to their Main Identity, and a Personal contract is created accordingly.Government Agency: After the user submits their wallet address along with the unique identifier of their Main Identity to the appropriate government agency, the agency proceeds to issue a binding request.
IdentityManager—
authentication()
Enables application providers to verify the user’s digital signature as part of the authentication process.Application providers, such as EMR-Chain service providers or affiliated hospitals.
IdentityManager—
getId()
Extract the user’s Decentralized Identifier (DID).Any entity requiring verification or query of the DID, such as application providers and end users through the dashboard interface.
IdentityManager—getUserType()Extract the type of the user’s
identity.
Any entity requiring verification or query of the
user’s identity type.
IdentityManager—getPersonalAddress()Extract the address of the user’s Personal smart contract.Any entity requiring access to the Personal contract address, such as application providers and end users through the dashboard interface.
Personal—set-app-private()Enables users to securely store their application chain private key or other personal information within the Personal contract, with all data encrypted prior to upload.Patient/Data Owner: As an integral part of their decentralized identity, the patient retains full control over this contract.
Personal—get-app-private()Enables users to retrieve encrypted information stored within their Personal contract.Patient/Data Owner
Table 3. This table outlines the functions provided by the EMR-Chain Identity Management chaincode.
Table 3. This table outlines the functions provided by the EMR-Chain Identity Management chaincode.
FunctionDescriptionPermitted Roles
IDM—beforeTransaction()Executed prior to any function invocation, this is used to enforce access control for the chaincode functions.System-internal mechanism: Automatically triggered by the chaincode.
IDM—verify_role()Retrieves the role of the transaction submitter.System internal mechanism: Frequently utilized by the AccessControl and TransactionRecord chaincodes to check if the submitter possesses the necessary authorization.
IDM—create_identity()Generate an EMR-chain identity for the user and store their encrypted X.509 certificate.Service Provider (Hospital): Upon the user’s application, the service provider verifies the DID-Chain identity and subsequently registers the identity with the MOHW’s Certificate Authority (CA).
IDM—consent_doc_role()/consent_sup_role()Modify the roles of medical service providers and hospital administrative units within the IdentityManagement channel to either “Doctor” or “Supervisor”.Healthcare Certification Authority (HCA): Responsible for validating medical personnel licenses and assigning the role of “Doctor.”
Ministry of Health and Welfare (MOHW): Responsible for validating hospital licenses and assigning the role of “Supervisor.”
IDM—revoke_doc_role()/revoke_sup_role()Enables HCA and MOHW to revoke the roles assigned to medical service providers and hospital administrative units.HCA (Healthcare Certification Authority): Revokes the role of medical personnel.
MOHW (Ministry of Health and Welfare): Revokes the role of administrative staff.
IDM—authenticate_identity()Perform the digital signature verification procedure to validate that the signature is from the asserted identity and verify that the identity’s role is either “Doctor” or “Patient.”System internal mechanism: Mainly called by other chaincodes, such as the authorization() function of the ACL chaincode, to authenticate identities involved in the medical record exchange process.
IDM—login()Verify that the submitted signature corresponds to the caller’s identity and confirm that the identity is enrolled in the EMR-chain.User (submits the digital signature through the web service provided by the service provider or hospital).
Table 4. This table outlines the functions provided by the EMR-Chain ACL (Access Control) chaincode.
Table 4. This table outlines the functions provided by the EMR-Chain ACL (Access Control) chaincode.
FunctionDescriptionPermitted Roles
ACL—beforeTransaction()As with the IDM chaincode, this mechanism is executed prior to any function invocation to enforce access control and validate the permissions of the caller.System internal mechanism: Automatically triggered by the chaincode.
ACL—
create_patient_instance()
Activated upon a user’s initial enrollment in the EMR-chain, creating a blank instance for that user.Service Provider (Hospital): Responsible for creating an instance for the patient upon completion of identity registration.
ACL—update_instance()/update_hash()Function used for uploading new medical record instances or their hash values to the ledger.Doctor: Access to this function is limited exclusively to users with the “Doctor” role.
ACL—consent_access()/
revoke_access()
Enable patients to modify the Access Control List (ACL) of their medical records at a specific hospital. Patients can grant or revoke access permissions.Patients: This functionality is restricted to users with the ‘Patient’ role only.
ACL—validate_hash()Compare the hash value held by the healthcare provider with the hash value recorded on the blockchain.Data requester (healthcare provider).
ACL—authorization()Assess whether access authorization should be granted. If approved, generate a JWT and return it along with the data address to the data requester. This process requires verification of the identities and roles of both the data owner and the data requester.Data requester (healthcare provider) and data owner (patient): The data requester initiates the request, and the patient provides a digital signature to indicate consent.
Table 5. This table outlines the functions provided by the EMR-Chain TSR (TransactionRecord) chaincode.
Table 5. This table outlines the functions provided by the EMR-Chain TSR (TransactionRecord) chaincode.
FunctionDescriptionPermitted Roles
TSR—beforeTransaction()Similarly to ACL smart contracts, it is used to verify whether a user has permission to access specific functionalities.Internal system mechanism: automatically executed by the chaincode.
TSR—record()Log the access requests.Hospital administration unit: Only hospital administrative personnel with the ‘Supervisor’ role are authorized to perform this operation.
Table 7. System Deployment Environment Specifications.
Table 7. System Deployment Environment Specifications.
ParameterDescription
CPUIntel(R) Core(TM) i5-8400 CPU @ 2.80 GHz
Cores6
RAM48 GB
OSUbuntu 20.04
Table 8. Ethereum Network Settings.
Table 8. Ethereum Network Settings.
ParameterDescription
Number of nodes1
Number of miners1
State datebaseLevelDB
Consensus algorithmPoA
Block time0.5 s
Table 9. Hyperledger Fabric Network Settings.
Table 9. Hyperledger Fabric Network Settings.
ParameterDescription
Consensue algorithmSolo
DatabaseCouchDB
Number of channels and peer nodes3 channels, 2 nodes in AccessControl channel
and TransactionRecord channel, 4 nodes in IdentityManagement channel
Table 11. EMR System Workload Statistics.
Table 11. EMR System Workload Statistics.
Year201820192020
Upload Medical Record Index211,438,234190,340,272179,737,101
Query History Count2,465,2951,771,9951,714,692
Table 12. Summary of Performance Evaluation Results.
Table 12. Summary of Performance Evaluation Results.
CategoryFunction TestedPerformance Metric (Throughput)Comparison with 2018 Taiwan
Average Demand
Execution SpeedMedical Record Index Upload updateInstance()Approx. 40 TPS
(at a 50 rps request rate)
Significantly Higher than the average of 6.7 requests per second.
Execution SpeedMedical Record Query
authorization()
Approx. 49 TPS
(at a 50 rps request rate)
Achieved a throughput of 49 TPS. This figure is substantially higher than Taiwan’s 2018 average demand of approximately 4.7 query requests per minute (or 0.08 TPS).
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Share and Cite

MDPI and ACS Style

Tseng, C.-H.; Hsieh, Y.-H.; Lin, H.-Y.; Yuan, S.-M. EMR-Chain: Decentralized Electronic Medical Record Exchange System. Technologies 2025, 13, 446. https://doi.org/10.3390/technologies13100446

AMA Style

Tseng C-H, Hsieh Y-H, Lin H-Y, Yuan S-M. EMR-Chain: Decentralized Electronic Medical Record Exchange System. Technologies. 2025; 13(10):446. https://doi.org/10.3390/technologies13100446

Chicago/Turabian Style

Tseng, Ching-Hsi, Yu-Heng Hsieh, Heng-Yi Lin, and Shyan-Ming Yuan. 2025. "EMR-Chain: Decentralized Electronic Medical Record Exchange System" Technologies 13, no. 10: 446. https://doi.org/10.3390/technologies13100446

APA Style

Tseng, C.-H., Hsieh, Y.-H., Lin, H.-Y., & Yuan, S.-M. (2025). EMR-Chain: Decentralized Electronic Medical Record Exchange System. Technologies, 13(10), 446. https://doi.org/10.3390/technologies13100446

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop