# A Hyperledger Fabric-Based System Framework for Healthcare Data Management
## 4 System Design and Implementation
### System Implementation  
System participant. The establishment and supervision of the entire system are led by the government. Since the public healthcare program is an important part of the common good, the government must provide management, certification, authorization, supervision, and auditing to each system participant during the operation of the system. This paper only discusses basic participant entities including patient, doctor, researcher, and supervisor. Other stakeholders such as commercial insurance companies, pharmacy, and transnational health care industries also have the potential to participate through the Fabric-based consortium blockchain. Hierarchical access control for privacy issues. The scheme has some special designs to achieve privacy preservation during data sharing. (1) All information usage logs are fed back to and are actively supervised by patients. (2) In the permissioned network,participation in the system requires authorization. (3) During the consensus process, illegal access will be identified and filtered out. (4) Implementation of the hierarchical access control is through smart contracts, further review the purpose of access, as shown in Figure 3. Similar to Bitcoin which solves the privacy problem by not binding the account address to the physical identity of the address holder [41]. According to the characteristics of healthcare data, someone's medical history, diagnosis, and treatment records are indeed private. However, if the data is not linked to a specific person, this kind of data will not have privacy issues and the cost of obtaining the data legally will also be reduced. The hierarchical access control opens different permissions to different scenarios so that privacy violations can be avoided when the actor, the process, or the purpose of the access is inappropriate. Ledger design. The ledger is composed of the world state and the blockchain. The blockchain is structured as hash-linked blocks. Each block header includes a hash of the current block and a hash value of the prior block so that the data that is stored on the ledger is sequenced and tamper-resistant. The main content that is stored in the block is the index of each original medical record and its usage logs, such as add, query, and read. In this way, the ledger plays the role of a logbook in the system to store the immutable and sequenced healthcare information in blocks. In the implementation of this paper, due to the smaller amount of designed data in the implementation, all data is still stored in the world ledger instead of the medical cloud. The ledger uses the Couch DB database as state database (world state) to achieve the function of searching for cases by keywords. It stores the medical data that we will operate in chaincode in the form of key-value pairs. In the file system of the blockchain, the historical data and the index of the blockchain are stored in Level DB and currently does not support changes. Fabric 2.0x currently supports the Couch DB as database for handling specific business logic. There are three data types that are stored in the ledger. Table 1 shows their details:  
Consensus mechanism. In the implementation phase of this article, we use the Raft consensus which is recommended by Fabric officially. In future, other consensus algorithms may become available for deployed through smart contracts. Incentive mechanism. The Hyperledger Fabric cancels the mining and incentive mechanism because each member in the consortium blockchain must deploy their nodes to ensure data security and user service. The incentive mechanism in this paper refers specifically to the incentive for all stakeholders of the entire scheme. Patients are able to know how and by whom their healthcare information is used, which will increase their participation. Correspondingly, the government can obtain more healthcare data, promote  
Figure 3: Hierarchical access control for privacy-preserving design. the development of medical big data, and strengthen the supervision of the healthcare industry.