PMHE is a cloud computing framework for smart medical systems based on blockchain and homomorphic encryption technology. The wearable medical device transmits the collected physiological data of the user to the client, and then the client encodes and encrypts the data. The encrypted plaintexts is transmitted to the blockchain and triggers a smart contract on the blockchain. The AI prediction model written using smart contract calculates the ciphertext and predicts the results. The client receives the resulting message after homomorphic operations from the cloud server, and finally gets the predictive plaintext by homomorphic decryption. According to the plaintext information, the client can predict the user's disease or evaluate the user's health status. The Program framework of PMHE with CKKS Supporting in Fig. 3.
The basic idea of PMHE is to use CKKS encryption algorithm to encrypt plaintext into ciphertext during medical data transmission, calculation, and storage. And the entire process of computing is encrypted to ensure data integrity, privacy and security. Therefore, it is necessary to improve each stage in order to use ciphertext to achieve its function. Table 1 lists the symbols involved in PMHE.
4.1 The Design of Data Tuple
CKKS encryption algorithm only supports addition and multiplication, but AI model involves some functional operations which do not meet homomorphism characteristic, such as exponential function, logarithmic function , square root function etc. Although some functions can be converted to addition and multiplication by polyfit (for example, sigmod can be fitted using polynomial approximation), a lot of ciphertext operations need to be performed in blockchain network. These extra operations will not only result in a loss of efficiency, but will more likely exceed the CKKS multiplication limit.
In PMHE, the AI model algorithm is converted into the formation of the data and their polynomial, so that the number of multiplications meets the CKKS limit. The cloud and the client interact by protocol. The server notifies the client to provide basic functions or basic functions’ combination of the original data. The client encrypts the original data and the corresponding function values, and then sends them together to the server in the form of data tuple, so as to the server can perform homomorphic addition and multiplication operations. The AI model can calculate these encrypted data efficiently and conveniently. The protocol using in PMHE is described as follows:
1). the server sends the tuple template to the client.

Where x, y, z, w are the original data of the client. is the meta function of the original data. The original data of the independent variable is not all empty.
2). The client responds to the server, encodes the original data and value of meta functions required by the server as operation factors, encrypts them into ciphertext M in the form of tuples, and sends them to the server.


3). While the server receives the ciphertext data, it uploads them to the blockchain, where the AI prediction model can directly perform approximate calculations on ciphertext and eventually send the prediction results to the client.
Q = F (x, y, z, w) (5)
Z =F(M) (6)
Q ≈ D(Dec(Z)) (7)
4.2 PMHE Scheme
In PMHE, a data tuple is generated on the client side firstly and then submits the tuple data using CKKS homomorphic encryption to hide valuable information. An ideal property of the CKKS scheme is that the ciphertext can be computed directly without prior decryption of the ciphertext. Therefore, privacy security, data authorization distribution and secure transmission of personal data are ensured.
TABLE 1. PMHE symbol definition
Symbol
|
Definition Description
|
Enc
|
Cryptographic operations
|
Dec
|
Decryption operation
|
E
|
Encoding operation
|
D
|
Decoding operation
|
P
|
Original data
|
B
|
Plaintext
|
M
|
Encrypted plaintext
|
Q
|
Unencrypted computation on original data
|
Z
|
Resulting message after homomorphic operations
|
S
|
Server
|
C
|
Client
|
x
|
Heart rate
|
y
|
Diastolic blood pressure
|
z
|
Systolic pressure
|
w
|
Respiratory rate
|
F
|
Disease prediction AI algorithm
|
1) INITIALIZATION. In the initialization phase, the user registers with the client APP, connects the client to the wearable device, and generates the public/private key pair. The public key represents the unique identity and is used to protect data in homomorphic encryption algorithms. The private key is used to sign the submitted data, verify the user's identity, and decrypt the calculation results returned by the cloud.
2) SUBMIT.AI model is deployed on the blockchain and implemented as a smart contract.The client obtains the physiological data collected by the wearable device, encrypts them with the public key after coding, and submits them to the cloud application. The cloud calls the corresponding smart contract, performs the data calculation, and saves the data to the blockchain.
3) PREDICTION. Based on the physiological data collected by wearable devices, ciphertext is calculated in the AI model. After the calculation, the result Z is obtained. In the calculation process of AI model based on homomorphic encryption technology, the valuable information contained in the data cannot be observed, which ensures the privacy of user data.
4) REPORT. Transforming physiological indicator data collected by wearable devices into disease prediction results with medical value provides users with low-cost, high-quality and high-precision medical information. For example, intelligent heart health assessment algorithm can efficiently and accurately predict whether a person has coronary heart disease, and is not affected by the individual ability of the doctor. However, the results in encrypted formation cannot be used for diagnostics, so the server cannot understand it and sends the results to the client.
5) DIAGNOSIS. After the client receives the operation result of the ciphertext, it decodes and decrypts it with the private key to get the unencrypted AI model result Q, and then compares the model reference criteria to give the diagnostic result.
4.3 Smart Contract
Smart contracts can be used to accomplish more complex business logic when more business and application requirements need to be fulfilled in the blockchain. Essentially, smart contracts are pieces of executable code that run in a blockchain, so they have the same decentralized and autonomous characteristics as blockchain. In the PMHE framework, the principle of full homomorphic encryption based on smart contracts is as follows[22]:
1) setup(m):It refers to the function that selects AI model according to parameter m.
2) receive(List(tuple)):It refers to receiving a list of encrypted data tuples from the client
3) issue(result):It refers to issue the results of the AI model operation on encrypted data to the client
4) add(pk, ciphertext1, ciphertext2):It refers to the homomorphic function of addition, which can be used by users to perform addition calculations on ciphertext data
5) mult(pk, ciphertext1, ciphertext2):It refers to a homomorphic function of multiplication that users can use to multiply on ciphertext data.
The formal description of the FHE-Contract algorithm is as follows:
- Input: The encrypted dataset uploaded by the client
- Output: The results of the homomorphic calculation on the encrypted data. The specific algorithm description is shown in Fig. 4.