# eHealth Integrity Model Based on Permissioned Blockchain +
## 2 Blockchain Based eHealth Integrity Model
### Architecture  
In the BEIM, we assume that the eHealth system is designed using a service-oriented architecture. Hospitals, medical centers, or general practitioners (GPs) might internally use software for managing medical records from different vendors that is compliant with the eHealth system. Therefore, a blockchain could be added to existing systems with minimum work (see Figure 1). There are two types of nodes, authorities and client nodes. In the proposed model, the authorities are nodes located inside eHealth clouds, and in major hospital information systems. Smaller hospitals and GP offices that store some medical records can only run client nodes. Authority nodes run a blockchain protocol, and client nodes store only a copy of the blockchain. Thus, the model can be deployed in all types of healthcare sites. In Figure 1 the yellow connections are secure logical links used for running a blockchain protocol. The dotted yellow lines show secure links used by client nodes to download and synchronize the current blockchain.  
Due to the integrity requirements that are presented in Section 2.2, the consensus mechanism should be implemented using the Practical Byzantine Fault Tolerant (PBFT) algorithm. Therefore, the permissioned blockchains that use PBFT consensus must be used in the BEIM, e.g., Multichain [22] or Hyperledger Fabric [23]. Other popular consensus algorithms, such as Proof-of-Work (PoW), Proof-of-Stake (PoS), or Proof-of-Authority (PoA), do not meet one or more integrity requirements. The PoW and PoS algorithms cannot be used as, in practice, they can only be applied to cryptocurrencies [24]. These algorithms also do not fulfil the Finality property [21]. PoA [25] is a consensus protocol in which \(N\) trusted nodes (authorities) participate that are uniquely identified, and their majority \(N/2+1\) are assumed to be honest. The PoA consensus is based on a mining rotation scheme. Examples of PoA algorithms are Aura [26] and Clique [27]. However, according to analysis provided by [PERSON] et al. [25], PoA does not ensure consistency.  
Due to the privacy (confidentiality) requirements, in the BEIM, the blockchain is permissioned, and only certified nodes have access to it. Only off-chain storage is used, where only hashes and other metadata are stored in the transactions submitted to the blockchain. The transaction body is encrypted and identified by a covert patient identifier. The real identifier is only available to nodes processing the patient's documents, i.e., adding or verifying the EHR or logs. Each node that creates a transaction encrypts it (except for a covert user identifier) using a user's public key that is only used to encrypt blockchain transactions. The private key that enables the decryption of blockchain-transaction content for any subject of care is given by the central eHealth service to an entity that has an EHR integrity-verification access right. The right is given to entities that have access right to the specified EHR. After verification, the private key is destroyed by the verifier's application.  
There are three types of transactions:  
1. add a new record to the patient's EHR and (b) remove an existing record from the patient's EHR;
2. add access rights and (b) remove access rights; and
3. add log entry and (b) remove log entry. The structure for each type of transaction is similar:  
* a user's covert ID;
* transaction Type \(1|2|3\), subtype \(a|b\);
* record/entry consecutive number \(j\) (for each subject of care) that is also a transaction number;
* a hash from record/entry \(j\); and
* a timestamp.