A medical data security consensus method based on credit rating
By adopting the consensus method of credit rating division in the blockchain medical system, the problem of low recognition and consensus efficiency of malicious nodes is solved, efficient and secure consensus on medical data is achieved, and the overall performance and reliability of the system are improved.
Patent Information
- Application Number
- CN202011209973.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-11-03
- Publication Date
- 2024-12-06
- Estimated Expiration
- 2040-11-03
AI Technical Summary
In the existing blockchain medical system, consensus algorithms such as DPOS and PBFT have problems such as difficult to identify and eliminate malicious nodes and low consensus efficiency, making it difficult to achieve safety and efficiency of medical data consensus.
Adopt medical data security consensus method based on credit rating division, and divide nodes into data nodes, supervision nodes and consensus nodes, implement representative node elections, identity verification mechanisms, reward and punishment mechanisms, and marine predator self-optimization credit rating division algorithms to improve node participation The enthusiasm and consensus efficiency of block consensus.
It realizes the rapid elimination of malicious nodes, improves block consensus efficiency, reduces transaction delays and average transaction delays, and enhances the security and reliability of medical data.
Smart Images

Figure CN112599249B_ABST
Abstract
Description
Technical field:
[0001] The present invention relates to the technical field of blockchain, and in particular to a medical data security consensus method based on credit rating division. Background technology:
[0002] With the development of science and technology and communication technology, smart healthcare is gradually becoming an indispensable part of future medical development with the characteristics of interactive healthcare services. Among them, hospital information system is an important part of smart healthcare, which can digitize medical data such as electronic medical records, hospitalization records, prescriptions, and private health information. While hospital information system brings benefits such as convenient and efficient management to hospitals, it also brings the following new problems: First, it is difficult to share system data, with low interoperability, and users cannot access / store medical data such as electronic medical records, hospitalization records, and prescriptions across regions; second, health information, electronic medical records and other private medical data have become an asset. When patients and doctors access and share medical data, they are subject to strict restrictions, and it takes a lot of resources and time to conduct permission review and data verification, so as to protect the privacy of patients and prevent the leakage of medical data; third, with the rapid growth of economic strength, people's awareness of legal rights protection has gradually increased, and higher requirements have been put forward for medical technology and service levels, resulting in an increase in medical disputes and the need for medical forensic identification. However, in medical forensic identification, it is difficult to identify whether medical data such as electronic medical records have been tampered with by humans. Regarding the third question mentioned above, considering that blockchain technology is an infinitely redundant decentralized shared ledger and distributed database, and each block stores the hash value of the previous block information, it has the characteristic of being tamper-proof. Therefore, blockchain can be introduced into the smart medical system to realize a decentralized, secure, fast and traceable medical data tamper-proof system, and solve the problem of identifying human tampering of medical data such as electronic medical records.
[0003] At present, blockchain is mainly aimed at financial institutions, government departments, etc., and rarely involves the medical field. In the blockchain research for the medical field, some scholars focus on designing decentralized distributed medical data management systems and models. For example, Xue Tengfei et al. used medical institution alliance server groups and audit alliance server groups to divide medical institutions into levels and proposed a blockchain-based medical data sharing model. Zhang Chao et al. proposed a consortium medical blockchain system based on practical byzantine fault tolerance (PBFT) to achieve safe and stable operation of the system. Liu X et al. proposed a medical data sharing and protection scheme based on hospital private blockchain. The scheme designed a symptom matching mechanism to allow patients with the same symptoms to authenticate each other. However, these methods mainly use existing consensus algorithms such as DPOS and PBFT. The DPOS mechanism has the problems of "the rich get richer" and cumulative attacks brought by the POS (Proof of Stake) mechanism, and does not solve the problems of node voting enthusiasm, malicious node removal and low consensus efficiency. In addition, PBFT still has problems such as not considering malicious node detection and low consensus efficiency in consistency confirmation consensus and block generation. At present, only a small number of scholars focus on studying blockchain consensus algorithms for the field of smart medical care. For example, Kumar A et al. proposed three consensus algorithms based on game theory, including single-layer units, multi-layer units, and multi-layer multi-bit. Talukder AK et al. proposed a future-proof disease proof consensus algorithm based on Ethereum. The algorithm uses a group of medical experts as miners to verify and confirm the results and finally submit them to the blockchain. However, these methods do not consider the attacks of malicious nodes and the efficiency of consensus.
[0004] In summary, due to the large scale of medical data, existing consensus algorithms such as DPOS and PBFT in blockchain medical systems have problems such as difficulty in identifying and eliminating malicious nodes and low consensus efficiency, making it difficult for existing consensus methods to achieve consensus on medical data safely and efficiently. The inventor has improved the existing medical data security consensus method, effectively making up for the deficiencies in the above-mentioned prior art, and this case is born out of this. Summary of the invention:
[0005] In view of the above-mentioned deficiencies in the current research of scholars, the present invention provides a medical data security consensus method based on credit rating division, which can not only quickly eliminate malicious nodes, but also avoid the harm such as reduced efficiency of block consensus caused by malicious nodes, and effectively improve the enthusiasm of nodes to participate in block consensus, which can reduce transaction delays and increase transaction throughput, thereby defending against malicious node attacks and improving consensus efficiency.
[0006] In order to achieve the above-mentioned invention object, the technical solution adopted by the present invention is:
[0007] A medical data security consensus method based on credit rating includes the following steps:
[0008] Step 1: Node division and parameter initialization settings: Nodes are divided into "data nodes", "regulatory nodes" and "consensus nodes";
[0009] Step 2: Determine the representative node through node voting, and the representative node executes the node identity authentication mechanism to authenticate each node;
[0010] Step 3: The representative node implements the reward and punishment mechanism for each node, obtains the cumulative score of each node, and converts the cumulative score into a cumulative credit value;
[0011] Step 4: Collect credit assessment factors on behalf of the node, establish a credit rating model, and use the self-optimization credit rating method based on marine predators to classify the credit rating of each node;
[0012] Step 5: The representative node grants different rights to the node according to its level, and clears the node's accumulated credit value and accumulated credit score;
[0013] Step 6: The representative node first determines the candidate representative nodes, and then counts the votes according to the weights, and determines some of the candidate representative nodes as formal representative nodes, and the other nodes as backup representative nodes;
[0014] Step 7: The representative node uses the PBFT consensus mechanism to complete the consensus and write the block into the chain.
[0015] Furthermore, the "data node" can generate medical data, but its computing power cannot achieve fast block consensus; the "regulatory node" does not generate any medical data, but its computing power and protection level are relatively high, and can achieve fast block consensus and regulate medical data; the "consensus node" can generate medical data and its computing power can achieve fast block consensus, but its protection level is relatively low; initialize the following parameters: the reward performance score μ for identity authentication, the limit range ι1 and the cumulative speed ι2 of the credit value model, the maximum number of iterations ψ, the number of iterations step=0, the number of consensus nodes N and the number of regulatory nodes M in the node identity authentication mechanism.
[0016] Furthermore, the node identity authentication mechanism in step 2 is performed as follows:
[0017] First, a verification group is formed: the representative node randomly selects N consensus nodes with a credit rating of "good" and M regulatory nodes to form a verification group; then the identity verification of the "data node", "consensus node" and "regulatory node" is performed separately;
[0018] When verifying the identity of a "data node", the representative node sends a verification request to all nodes in the verification group. If the data node information can be queried in the communicable list of 1 supervisory node and n nodes, where n represents the node number threshold, it is considered to have passed the verification; if the above conditions are not met, the data node will stop its right to send medical data, and repeat the above verification process after a period of time until the identity verification of the data node is completed;
[0019] When verifying the identity of the "consensus node", the representative node sends a verification request to the supervisory node in the verification group. If the consensus node information can be queried in the communicable list of 1 supervisory node and 2n nodes, it is considered to have passed the verification; if the above conditions are not met, the consensus node will stop sending medical data and participating in the block consensus, and repeat the above verification process after a period of time until the identity verification of the consensus node is completed;
[0020] When verifying the identity of the "regulatory node", the representative node sends a verification request to all nodes in the verification group. If the information of the regulator node can be queried in the communicable list of 1 regulator node or 3n nodes, it is considered to have passed the verification; if the above conditions are not met, the regulator node will stop its right to participate in the block consensus, and repeat the above verification process after a period of time until the identity verification of the regulator node is completed.
[0021] Furthermore, in step 3, the representative node obtains the cumulative score of each node in the following manner: Determine whether the previous block consensus of each node is successful. If the consensus is successful, the representative node gives a reward performance point η to the node that voted in favor, and deducts a performance point γ from the node that voted against. If the consensus fails, the representative node gives a reward performance point λ to the node that voted against, and deducts a performance point σ from the node that voted in favor. The representative node also gives a reward performance point μ to the node that participates in and completes the node identity verification. Finally, the representative node obtains and updates the cumulative score of each node.
[0022] The representative node converts the cumulative score of each node into a cumulative credit value through formula (1);
[0023] y(t)=ι1×tan -1 (x(t) / ι2) (1)
[0024] Among them, x(t) represents the cumulative score of the node at the current time t, y(t) represents the cumulative credit value of the node at the current time t, ι1 represents the boundary range of the credit value model, and ι2 represents the accumulation speed.
[0025] Furthermore, in step 4, the credit assessment elements collected include: each node's current accumulated credit value, historical credit rating, number of times it has become a representative node, and number of times it has provided invalid blocks.
[0026] Furthermore, the credit rating classification model in step 4 is as follows:
[0027]
[0028] Among them, FV i represents the fitness of the i-th radius, q represents the total number of nodes, r i represents the i-th radius, k l,i represents the number of nodes surrounded by the lth node when the ith radius is used, β represents the parameter weight, β / (r i ×k l,i ) as the lower bound of fitness, k l,i / (qk l,i ) as the upper bound of fitness.
[0029] Furthermore, the self-optimization credit rating classification method based on marine predators in step 4 is as follows:
[0030] 4.1) The representative node calculates the distance between nodes and sets the search interval of each node radius;
[0031] 4.2) The representative nodes randomly generate radii and form prey vectors;
[0032] 4.3) The representative nodes calculate the fitness and form a fitness vector, from which the radius with the smallest fitness is selected as the predator;
[0033] 4.5) The representative node compares the prey vector and the fitness vector and retains the radius with the smaller fitness;
[0034] 4.6) The representative node further adjusts the movement of the prey vector according to the similarity comparison result of the prey vector, or according to the comparison result between the current iteration number and the maximum iteration number; after the adjustment, the representative node calculates the evaluation value of each node and divides the level.
[0035] Furthermore, the distance between the nodes is calculated according to formula (3), namely:
[0036]
[0037] Where dis represents the distance between any two nodes, yl represents the current cumulative credit value of the lth node, ν l represents the historical level value of the lth node, υ l represents the number of times the lth node becomes a representative node, x l It indicates the sum of invalid blocks and forked blocks provided by the lth node, θ1 indicates the parameter weight value of the current accumulated credit value, θ2 indicates the parameter weight value of the historical level value, θ3 indicates the parameter weight value of the number of times of becoming a representative node, and θ4 indicates the parameter weight value of the sum of the number of invalid blocks and forked blocks provided;
[0038] The search interval of each node radius is determined by formula (4):
[0039] SI=(0,dis max ) (4)
[0040] Among them, SI represents the search interval, dis max Indicates the maximum distance between nodes;
[0041] The representative node randomly generates ξ radii in the search space and forms the prey vector P, which can be expressed as:
[0042] P=[r1 r2 ... r ξ ] T (5)
[0043] Among them, r ξ represents the ξth radius, ξ represents the number of rows of the prey vector P;
[0044] The representative node adjusts the prey vector movement as follows:
[0045] 4.6.1) represents the node that expands the predator to an elite vector E of ξ×1. If the number of iterations step = 0, the prey vector moves according to formula (7) and jumps to step 4.6.4); otherwise, the similarity ρ of the prey vector is calculated according to formula (6); if the similarity ρ is greater than the corresponding threshold Then, the step length is updated by simulating Brownian motion through formula (7), the prey vector is updated through formula (8), and the process goes to step 4.6.4); If none of the above judgment conditions are met, the process goes to step 4.6.2);
[0046]
[0047] Among them, ρ represents the similarity between the current prey vector and the previous vector matrix, P j represents the jth row of the current prey vector, represents the jth row of the last prey vector;
[0048] stepsize j =R B (E j -R B P j ) (7)
[0049]
[0050] Among them, R B represents the random value simulating Brownian motion, E j represents the j rows of the elite vector, stepsize j represents the motion step length of the prey vector, R w represents the parameter weight, Represents the prey vector after the update;
[0051] 4.6.2) The representative node combines formula (6) to calculate the similarity ρ of the prey vector before and after. If the similarity ρ is greater than the threshold The representative node simulates Brownian motion by formula (7) to update the step length of the prey vectors in the first ξ / 2 rows, and updates the prey vectors by formula (9); and simulates Levy motion by formula (10) to update the step length of the prey vectors in the last ξ / 2 rows, and updates the prey vectors by formula (9), and jumps to step 4.6.4); otherwise, jumps to step 4.6.3);
[0052]
[0053] stepsize j =R L (E j -R L P j ) (10)
[0054] Where CF is the adaptive parameter controlling the movement of the predator, R L represents random values that simulate Lévy motion;
[0055] 4.6.3) The representative node allows all prey vectors to simulate the Levy motion through formula (9) to update the step length, and updates the prey vector through formula (10) to complete the search for the optimal radius;
[0056] 4.6.4) The representative node recalculates the distance between nodes according to the latest adjusted prey vector using formula (3), and calculates the fitness FV of each node i according to the credit rating classification model of formula (2) i, form a fitness vector and select the radius with the smallest fitness as the predator; if the current iteration number is not 0, compare the current fitness vector with the previous fitness vector. If the fitness of a radius in the previous fitness vector is smaller than the fitness of all radii in the current fitness vector, replace the maximum fitness value in the current fitness vector and the corresponding radius in the current prey vector with the fitness and its corresponding radius respectively;
[0057] 4.6.5) The representative node needs to adjust the prey vector through formula (11) to avoid the influence of the local optimal solution on the optimization process:
[0058]
[0059] in, represents the prey vector after adjustment, X max Indicated by dis max The size of the vector is ξ′1, U represents a vector composed of 0 and 1 randomly, B s represents a random vector of the same size as the prey vector, ο1 and ο2 represent random numbers in the range of 0 to 1, and P m1 and P m2 The vector representing the shuffled row indices of the prey vector, o yu represents the adjustment state threshold; let the current prey vector be the prey vector after adjustment, step = step + 1;
[0060] 4.6.6) If the current number of iterations step is less than the maximum number of iterations ψ, the node distance and fitness calculation steps before adjustment are performed again. Otherwise, the optimal radius can be obtained according to the above steps. The representative node calculates the evaluation value of each node through formula (12); after obtaining the evaluation value, the nodes are sorted in descending order according to the evaluation value and put into the set NQ; the evaluation values of the two nodes before and after the set NQ are subtracted, and the difference is put into the set SQ in descending order; then find the sequence numbers of the first two elements in the set SQ in the set NQ, and record the larger sequence number as φ1 and the smaller sequence number as φ2; the nodes in the NQ set whose sequence numbers are greater than or equal to φ1 are directly classified as "bad" level, while the nodes whose sequence numbers are less than φ1 but greater than or equal to φ2 are classified as "normal" level, and the nodes whose sequence numbers are less than φ2 are classified as "good" level;
[0061]
[0062] Among them, EV l represents the evaluation value of the lth node, y l,drepresents the current accumulated credit value of the dth node within the radius of the lth node, ν l,d represents the historical level value of the dth node within the radius of the lth node, υ l,d represents the number of times the dth node becomes the representative node within the radius of the lth node, x l,d It represents the sum of the number of invalid blocks and forked blocks provided by the dth node within the radius of the lth node, and QN represents the total number of nodes within the radius of the lth node.
[0063] Furthermore, in step 6, the representative candidate node determination method is as follows: the representative node calculates the score of each node through formula (13), and selects nodes that meet the quantity requirement from high to low as representative candidate nodes;
[0064] score l =θ1×y l +θ2×ν l -θ3×υ l -θ4×χ l (13)
[0065] Among them, score l Indicates the score of the lth node. If multiple nodes have the same score, a node is randomly selected as the representative candidate node.
[0066] The method for determining the formal representative node and the backup representative node among the candidate representative nodes is as follows: each node broadcasts its voting information to other nodes, and uses formula (14) to count the votes with different weights to obtain the voting results;
[0067] reuslt_TNC l =(FN_favour-FN_against)×ε1+(RN_favour-RN_against)×ε2(14)
[0068] Among them, reuslt_TNC l represents the voting result of the lth representative candidate node, FN_favour and FN_against represent the voting results of the consensus node for the lth representative candidate node, ε1 represents the weight of the consensus node when voting, RN_favour and RN_against represent the voting results of the regulatory node for the lth representative candidate node, and ε2 represents the weight of the regulatory node when voting; each node selects NRN number of representative candidate nodes from high to low to become the formal representative nodes according to the voting results, and the unsuccessful representative candidate nodes form the backup representative nodes; if the voting results of the nodes are the same, a node is randomly selected from them as the representative node.
[0069] Furthermore, in step 7, the PBFT consensus mechanism includes the following steps:
[0070] 7.1) Randomly select a node from the representative nodes as the master node, and the other representative nodes as replica nodes;
[0071] 7.2) The master node broadcasts the pre-prepare message to the replica node. When the replica node receives the pre-prepare message, it enters the ready state and broadcasts the ready message to other nodes;
[0072] 7.3) If a node receives 2f1 prepare messages, it enters the guarantee state and broadcasts the guarantee message, where f1 represents the maximum number of malicious nodes allowed in the network;
[0073] 7.4) When the replica node receives 2f1 guarantee messages, it considers that consensus has been reached and writes the block into the chain.
[0074] The beneficial effects of the present invention are mainly manifested in that the present invention considers dividing nodes into data nodes, consensus nodes and regulatory nodes, and proposes a node identity authentication mechanism to quickly verify the node identity in view of the risk of identity theft of nodes. Considering that the mining pool manager needs to process a large amount of data information, the conventional clustering algorithm is too sensitive to key parameters such as radius, and it is necessary to perform feature dimension reduction through algorithms such as PCA (Principal components analysis) and LDA (linear discriminant analysis), which leads to unsatisfactory clustering effect and too long algorithm running time, and cannot meet the real-time requirements of miners' credit rating division. Therefore, the distance calculation method between nodes, the fitness value of the radius judgment and the switching method of different optimization stages are improved, and a self-optimizing credit rating division algorithm based on the improved marine predator is proposed to realize the rapid division of miners' credit rating. At the same time, according to the participation of nodes in the block consensus, a credit rating mechanism is proposed, including a reward and punishment mechanism, a credit value model and a credit rating division algorithm, so as to improve the enthusiasm of nodes to participate in the block consensus and realize reasonable credit rating division. A representative node election mechanism is proposed to avoid malicious nodes from becoming representative nodes as much as possible. Finally, a representative node consensus mechanism is proposed to improve the efficiency of block consensus. Regardless of how the number of malicious nodes changes, the present invention can increase the enthusiasm of nodes to participate in block consensus and avoid the influence of malicious nodes on block consensus, thereby increasing transaction throughput and reducing average transaction delay and average node communication overhead.
[0075] The present invention is further described below through the accompanying drawings and specific embodiments. Description of the drawings:
[0076] Figure 14 is a flowchart of a medical data security consensus method in an embodiment of the present invention. Specific implementation method:
[0077] This embodiment discloses a medical data security consensus method based on credit rating. Figure 1 As shown, it mainly includes the following steps:
[0078] Step 1: Node division and parameter initialization;
[0079] The nodes in the network are divided into three categories: data nodes, regulatory nodes, and consensus nodes. Data nodes can generate medical data, but their computing power cannot achieve fast block consensus. Regulatory nodes do not generate any medical data, but their computing power and protection level are high, and they can achieve fast block consensus and regulate medical data. Consensus nodes can generate medical data and their computing power can achieve fast block consensus, but their protection level is low. The reward performance points μ for initializing identity authentication, the limit range ι1 and cumulative speed ι2 of the credit value model, the maximum number of iterations ψ, the number of iterations step=0, the number of consensus nodes N and the number of regulatory nodes M in the node identity authentication mechanism, and other key parameters.
[0080] Step 2: Determine the representative node through node voting;
[0081] Each node in the blockchain not only broadcasts its own voting information of yes and no votes to other nodes, but also receives voting information from other nodes. If a node receives voting information from all nodes, it will count the voting results of all nodes and sort them from high to low. If some nodes have the same number of votes, the nodes with the same number of votes will be randomly sorted. According to the sorting results, NRN (Number of representative nodes) nodes are selected from high to low as representative nodes, where NRN represents the number of representative nodes, and the representative node information is broadcast, otherwise continue to wait.
[0082] Step 3: The representative node performs the node authentication mechanism to determine the identity of each node and preliminarily exclude malicious nodes.
[0083] In the process of verifying the node identity, first determine whether the node is the first consensus. If it is the first block consensus, jump directly to step 14; if it is not the first consensus, execute step 4. The representative node executes the node identity authentication mechanism as follows:
[0084] 3.1) Forming a verification group: The representative node randomly selects N consensus nodes with a credit rating of good and M supervisory nodes to form a verification group.
[0085] 3.2) Verify the identity of the "data node": When verifying the identity of the data node, the representative node sends a verification request to all nodes in the verification group. If the data node information can be queried in the communication list of 1 supervisory node and n nodes, where n represents the node number threshold, it is considered to have passed the verification. If the above conditions are not met, the data node will stop its right to send medical data, and repeat the above verification process after 20 minutes until the identity verification of the data node is completed.
[0086] 3.3) Verify the identity of the "consensus node": When the identity of the consensus node is to be verified, the representative node sends a verification request to the supervisory node in the verification group. If the consensus node information can be queried in the communicable list of 1 supervisory node and 2n nodes, it is considered to have passed the verification. If the above conditions are not met, the consensus node will stop sending medical data and participating in the block consensus, and repeat the above verification process after 20 minutes until the identity verification of the consensus node is completed.
[0087] 3.4) Verify the identity of the "regulatory node": When verifying the identity of the regulatory node, the representative node sends a verification request to all nodes in the verification group. If the information of the regulatory node can be queried in the communicable list of 1 regulatory node or 3n nodes, it is considered to have passed the verification. If the above conditions are not met, the regulatory node will stop its right to participate in the block consensus, and repeat the above verification process after 20 minutes until the identity verification of the regulatory node is completed.
[0088] Step 4: The representative node implements the reward and punishment mechanism for each node;
[0089] The representative node implements the reward and punishment mechanism for all nodes based on the previous block consensus result to obtain the current cumulative score of each node. The reward and punishment mechanism implemented includes the following steps:
[0090] 4.1) If the previous block consensus is successful, the representative node will reward the node that voted in favor with performance points η, and deduct performance points γ from the node that voted against. If the previous block consensus is unsuccessful, the representative node will reward the node that voted against with performance points λ, and deduct performance points σ from the node that voted in favor;
[0091] 4.2) The representative node will reward performance points μ to the nodes that participate in and complete the node identity verification;
[0092] 4.3) Obtain and update the cumulative score of each node.
[0093] Step 5: The representative node converts the cumulative score of each node into a cumulative credit value using formula (1);
[0094] y(t)=ι1×tan-1 (x(t) / ι2) (1)
[0095] Among them, x(t) represents the cumulative score of the node at the current time t, y(t) represents the cumulative credit value of the node at the current time t, and ι1 and ι2 represent model parameters.
[0096] Step 6: The representative node collects credit assessment factors: The representative node collects information such as the current accumulated credit value, historical credit rating, number of times becoming a representative node, and number of times providing invalid blocks for each node.
[0097] Step 7: The representative node combines formula (2) to establish a credit rating classification model;
[0098]
[0099] Among them, FV i represents the fitness of the i-th radius, q represents the total number of nodes, r i represents the i-th radius, k l,i represents the number of nodes surrounded by the lth node when the ith radius is used, β represents the parameter weight, β / (r i ×k l,i ) as the lower bound of fitness, k l,i / (qk l,i ) as the upper bound of fitness.
[0100] Step 8: The representative node uses a self-optimizing credit rating classification algorithm to classify the credit rating of each node. The self-optimizing credit rating classification algorithm includes the following steps:
[0101] 8.1) The distance between the representative nodes is calculated according to formula (3), that is:
[0102]
[0103] Where dis represents the distance between any two nodes, y l represents the current cumulative credit value of the lth node, ν l represents the historical level value of the lth node, υ l represents the number of times the lth node becomes a representative node, x l It indicates the sum of invalid blocks and forked blocks provided by the lth node, θ1 indicates the parameter weight value of the current accumulated credit value, θ2 indicates the parameter weight value of the historical level value, θ3 indicates the parameter weight value of the number of times of becoming a representative node, and θ4 indicates the parameter weight value of the sum of the number of invalid blocks and forked blocks provided.
[0104] By using formula (4), the search interval of each node radius is set:
[0105] SI=(0,dis max ) (4)
[0106] Among them, SI represents the search interval, dis max Indicates the maximum distance between nodes.
[0107] 8.2) The representative node randomly generates ξ radii in the search space and forms the prey vector P, which can be expressed as:
[0108] P=[r1 r2 ... r ξ ] T (5)
[0109] Among them, r ξ represents the ξth radius, ξ represents the number of rows of the prey vector P.
[0110] 8.3) The representative node calculates the distance between nodes according to the node evaluation factor information through formula (3), and then calculates the fitness FV of the node according to the credit rating classification model of formula (2) i , and form a fitness vector and select the radius with the smallest fitness as the predator.
[0111] 8.4) The representative node compares the prey vector and the fitness vector, and retains the radius with the smaller fitness: if the current number of iterations is 0, the representative node saves the current fitness vector and the prey vector, and jumps to step 8.5); if the current number of iterations is not 0, the current fitness vector is compared with the previous fitness vector. If the fitness of a certain radius in the previous fitness vector is smaller than the fitness of all radii in the current fitness vector, the fitness and its corresponding radius are replaced by the maximum fitness value in the current fitness vector and the corresponding radius in the current prey vector respectively;
[0112] 8.5) represents the node that expands the predator to an elite vector E of ξ×1. If the number of iterations step = 0, the prey vector moves according to formula (7) and jumps to step 8.8); otherwise, the similarity ρ of the prey vector is calculated according to formula (6). If the similarity ρ is greater than the corresponding threshold Then, the step length is updated by simulating Brownian motion using formula (7), the prey vector is updated using formula (8), and the process goes to step 8.8), otherwise, the process goes to step 8.6);
[0113]
[0114] Among them, ρ represents the similarity between the current prey vector and the previous prey vector, P j represents the jth row of the current prey vector, represents the jth row of the last prey vector;
[0115] stepsize j =R B (E j -R B P j ) (7)
[0116]
[0117] Among them, R B represents the random value simulating Brownian motion, E j represents the j rows of the elite vector, stepsize j represents the motion step length of the prey vector, R w represents the parameter weight, Represents the prey vector after the update is completed.
[0118] 8.6) The representative node combines formula (6) to calculate the similarity ρ of the prey vector before and after. If the similarity ρ is greater than the threshold It means that the node will The prey vector of the first row is updated by simulating Brownian motion using formula (7), and the prey vector is updated by formula (9). The prey vector of the last ξ / 2 rows is updated by simulating Levy motion using formula (10), and the prey vector is updated by formula (9). Jump to step 8.8); Otherwise, jump to step 8.7).
[0119]
[0120] stepsize j =R L (E j -R L P j ) (10)
[0121] Where CF is the adaptive parameter controlling the movement of the predator, R L Represents random values that simulate Lévy motion.
[0122] 8.7) The representative node allows all prey vectors to simulate the Levy motion through formula (9) to update the step size, and updates the prey vector through formula (10) to complete the search for the optimal radius.
[0123] 8.8) The representative node recalculates the distance between nodes according to the latest prey vector using formula (3), and calculates the fitness FV of each node i according to the credit rating classification model of formula (2). i, form a fitness vector and select the radius with the smallest fitness as the predator. If the current iteration number is not 0, compare the current fitness vector with the previous fitness vector. If the fitness of a radius in the previous fitness vector is smaller than the fitness of all radii in the current fitness vector, then replace the maximum fitness value in the current fitness vector and the corresponding radius in the current prey vector with the fitness and its corresponding radius respectively;
[0124] 8.9) The representative node needs to adjust the prey vector through formula (11) to avoid the influence of the local optimal solution on the optimization process:
[0125]
[0126] in, represents the prey vector after adjustment, X max Indicated by dis max The size of the vector is ξ′1, U represents a vector composed of 0 and 1 randomly, B s represents a random vector of the same size as the prey vector, ο1 and ο2 represent random numbers in the range of 0 to 1, and P m1 and P m2 The vector representing the shuffled row indices of the prey vector, o yu represents the adjustment state threshold; let the current prey vector be the prey vector after adjustment, step = step + 1;
[0127] 8.10) If the current number of iterations step is less than the maximum number of iterations ψ, then jump to step 8.3), otherwise, according to the previous steps, the optimal radius is obtained, and the representative node calculates the evaluation value of each node through formula (12). After obtaining the evaluation value, the nodes are sorted in descending order according to the evaluation value and put into the set NQ. Then the evaluation values of the two nodes before and after the set NQ are subtracted, and the difference is put into the set SQ in descending order. Next, find the sequence numbers of the first two elements in the set SQ in the set NQ, and record the larger sequence number as φ1 and the smaller sequence number as φ2. Nodes in the NQ set whose element sequence numbers are greater than or equal to φ1 are directly classified as "bad" level, while nodes whose sequence numbers are less than φ1 but greater than or equal to φ2 are classified as "normal" level, and nodes whose sequence numbers are less than φ2 are classified as "good" level.
[0128]
[0129] Among them, EV l represents the evaluation value of the lth node, y l,d represents the current accumulated credit value of the dth node within the radius of the lth node, νl,d represents the historical level value of the dth node within the radius of the lth node, υ l,d represents the number of times the dth node becomes the representative node within the radius of the lth node, x l,d It represents the sum of the number of invalid blocks and forked blocks provided by the dth node within the radius of the lth node, and QN represents the total number of nodes within the radius of the lth node.
[0130] Step 9: The representative node grants level rights according to the node classification level: if the node level is good, the representative node grants it the right to be elected, the right to vote and the right to identity verification; if the node level is nromal, the representative node grants it the right to be elected and the right to vote; if the node level is bad, the representative node does not grant any rights.
[0131] Step 10: The representative node clears the node's accumulated credit value and accumulated score, and starts a new round of accumulated score acquisition.
[0132] Step 11: The representative node calculates the score of each node using formula (13), and selects nodes that meet the quantity requirements from high to low as candidate representative nodes;
[0133] score l =θ1×y l +θ2×ν l -θ3×υ l -θ4×χ l (13)
[0134] Among them, score l Indicates the score of the lth node. If multiple nodes have the same score, a node is randomly selected as the representative candidate node.
[0135] Step 12: Each node broadcasts its voting information to other nodes, and uses formula (14) to count the votes using different weights to obtain the voting results;
[0136] reuslt_TNC l =(FN_favour-FN_against)×ε1+(RN_favour-RN_against)×ε2(14)
[0137] Among them, reuslt_TNC lIt represents the voting result of the lth representative candidate node, FN_favour and FN_against represent the voting result of the consensus node for the lth representative candidate node, ε1 represents the weight of the consensus node when voting, RN_favour and RN_against represent the voting result of the supervisory node for the lth representative candidate node, and ε2 represents the weight of the supervisory node when voting.
[0138] Step 13: Each node selects NRN candidate nodes from high to low according to the voting results to become the official representative nodes, and the unsuccessful candidate nodes become the backup representative nodes. If the voting results of the nodes are the same, a node is randomly selected as the representative node.
[0139] Step 14: The representative node uses the PBFT consensus mechanism to complete the consensus and write the block into the chain. The PBFT mechanism includes the following steps:
[0140] 14.1) Randomly select a node from the representative nodes as the master node, and the other representative nodes as replica nodes;
[0141] 14.2) The master node broadcasts the pre-prepare message to the replica node. When the replica node receives the pre-prepare message, it enters the ready state and broadcasts the ready message to other nodes;
[0142] 14.3) If a node receives 2f1 prepare messages, it enters the guarantee state and broadcasts a guarantee message, where f1 represents the maximum number of malicious nodes allowed in the network;
[0143] 14.4) When the replica node receives 2f1 guarantee messages, it considers that consensus has been reached and writes the block into the chain.
[0144] The above embodiments are only used to illustrate the technical solution of the present invention rather than to limit it. Other modifications or equivalent substitutions made to the technical solution of the present invention by ordinary technicians in this field should be included in the scope of the claims of the present invention as long as they do not depart from the spirit and scope of the technical solution of the present invention.
Claims
1. A medical data security consensus method based on credit rating, characterized by: The steps include: Step 1: Node division and parameter initialization settings: Nodes are divided into "data nodes", "regulatory nodes" and "consensus nodes"; Step 2: Determine the representative node through node voting, and the representative node executes the node identity authentication mechanism to authenticate each node; Step 3: The representative node implements the reward and punishment mechanism for each node, obtains the cumulative score of each node, and converts the cumulative score into a cumulative credit value; Step 4: Collect credit assessment factors on behalf of the node, establish a credit rating model, and use the self-optimization credit rating method based on marine predators to classify the credit rating of each node; Step 5: The representative node grants different rights to the node according to its level, and clears the node's accumulated credit value and accumulated credit score; Step 6: The representative node first determines the candidate representative nodes, and then counts the votes according to the weights, and determines some of the candidate representative nodes as formal representative nodes, and the other nodes as backup representative nodes; Step 7: The representative node uses the PBFT consensus mechanism to complete the consensus and write the block into the chain.
2. According to claim 1, a medical data security consensus method based on credit rating classification is characterized by: The "data node" can generate medical data, but its computing power cannot achieve fast block consensus; the "regulatory node" does not generate any medical data, but its computing power and protection level are high, and it can achieve fast block consensus and regulate medical data; the "consensus node" can generate medical data and its computing power can achieve fast block consensus, but its protection level is low; Initialize the following parameters: the reward performance score μ for identity authentication, the limit range ι1 and accumulation speed ι2 of the credit value model, the maximum number of iterations ψ, the number of iterations step = 0, the number of consensus nodes N and the number of regulatory nodes M in the node identity authentication mechanism.
3. According to claim 1, a medical data security consensus method based on credit rating classification is characterized by: The node identity authentication mechanism in step 2 is performed as follows: First, a verification group is formed: the representative node randomly selects N consensus nodes with a credit rating of "good" and M regulatory nodes to form a verification group; then the identity verification of the "data node", "consensus node" and "regulatory node" is performed separately; When verifying the identity of a "data node", the representative node sends a verification request to all nodes in the verification group. If the data node information can be queried in the communicable list of 1 supervisory node and n nodes, where n represents the node number threshold, it is considered to have passed the verification; if the above conditions are not met, the data node will stop its right to send medical data, and repeat the above verification process after a period of time until the identity verification of the data node is completed; When verifying the identity of the "consensus node", the representative node sends a verification request to the supervisory node in the verification group. If the consensus node information can be queried in the communicable list of 1 supervisory node and 2n nodes, it is considered to have passed the verification; if the above conditions are not met, the consensus node will stop sending medical data and participating in the block consensus, and repeat the above verification process after a period of time until the identity verification of the consensus node is completed; When verifying the identity of the "regulatory node", the representative node sends a verification request to all nodes in the verification group. If the information of the regulator node can be queried in the communicable list of 1 regulator node or 3n nodes, it is considered to have passed the verification; if the above conditions are not met, the regulator node will stop its right to participate in the block consensus, and repeat the above verification process after a period of time until the identity verification of the regulator node is completed.
4. According to claim 1, a medical data security consensus method based on credit rating is characterized by: In step 3, the representative node obtains the cumulative score of each node in the following manner: determine whether the previous block consensus of each node is successful. If the consensus is successful, the representative node gives a reward performance point η to the node that voted in favor, and deducts a performance point γ from the node that voted against. If the consensus fails, the representative node gives a reward performance point λ to the node that voted against, and deducts a performance point σ from the node that voted in favor. The representative node also gives a reward performance point μ to the node that participates in and completes the node identity verification. Finally, the representative node obtains and updates the cumulative score of each node. The representative node converts the cumulative score of each node into a cumulative credit value through formula (1); y(t)=ι1×tan -1 (x(t) / ι2) (1) Among them, x(t) represents the cumulative score of the node at the current time t, y(t) represents the cumulative credit value of the node at the current time t, ι1 represents the boundary range of the credit value model, and ι2 represents the accumulation speed.
5. According to claim 1, a medical data security consensus method based on credit rating classification is characterized by: In step 4, the credit evaluation factors collected include: the current accumulated credit value of each node, the historical credit rating, the number of times it becomes a representative node, and the number of times it provides invalid blocks.
6. The medical data security consensus method based on credit rating according to claim 1 is characterized by: The credit rating classification model in step 4 is as follows: my(FV i ) (2) Among them, FV i represents the fitness of the i-th radius, q represents the total number of nodes, r i represents the i-th radius, k l,i represents the number of nodes surrounded by the lth node when the ith radius is used, β represents the parameter weight, β / (r i ×k l,i ) as the lower bound of fitness, k l,i / (qk l,i ) as the upper bound of fitness.
7. A medical data security consensus method based on credit rating according to claim 6, characterized in that: The self-optimization credit rating classification method based on marine predators in step 4 is as follows: 4.1) The representative node calculates the distance between nodes and sets the search interval of each node radius; 4.2) The representative nodes randomly generate radii and form prey vectors; 4.3) The representative nodes calculate the fitness and form a fitness vector, from which the radius with the smallest fitness is selected as the predator; 4.5) The representative node compares the prey vector and the fitness vector and retains the radius with the smaller fitness; 4.6) The representative node further adjusts the movement of the prey vector according to the similarity comparison result of the prey vector, or according to the comparison result between the current iteration number and the maximum iteration number; after the adjustment, the representative node calculates the evaluation value of each node and divides the level.
8. The medical data security consensus method based on credit rating according to claim 7 is characterized by: The distance between the nodes is calculated according to formula (3), namely: Where dis represents the distance between any two nodes, y l represents the current cumulative credit value of the lth node, ν l represents the historical level value of the lth node, υ l represents the number of times the lth node becomes a representative node, x l It indicates the sum of invalid blocks and forked blocks provided by the lth node, θ1 indicates the parameter weight value of the current accumulated credit value, θ2 indicates the parameter weight value of the historical level value, θ3 indicates the parameter weight value of the number of times of becoming a representative node, and θ4 indicates the parameter weight value of the sum of the number of invalid blocks and forked blocks provided; The search interval of each node radius is determined by formula (4): IF=(0,dis max ) (4) Among them, SI represents the search interval, dis max Indicates the maximum distance between nodes; The representative node randomly generates ξ radii in the search space and forms the prey vector P, which can be expressed as: P=[r1 r2...r ξ ] T (5) Among them, r ξ represents the ξth radius, ξ represents the number of rows of the prey vector P; The representative node adjusts the prey vector movement as follows: 4.6.1) represents the node that expands the predator to an elite vector E of ξ×1. If the number of iterations step = 0, the prey vector moves according to formula (7) and jumps to step 4.6.4); otherwise, the similarity ρ of the prey vector is calculated according to formula (6); if the similarity ρ is greater than the corresponding threshold Then, the step length is updated by simulating Brownian motion through formula (7), the prey vector is updated through formula (8), and the process goes to step 4.6.4); if none of the above judgment conditions are met, the process goes to step 4.6.2); Among them, ρ represents the similarity between the current prey vector and the previous vector matrix, P j represents the jth row of the current prey vector, represents the jth row of the last prey vector; stepsize j =R B (E j -R B P j ) (7) Among them, R B represents the random value simulating Brownian motion, E j represents the j rows of the elite vector, stepsize j represents the motion step length of the prey vector, R w represents the parameter weight, Represents the prey vector after the update; 4.6.2) The representative node combines formula (6) to calculate the similarity ρ of the prey vector before and after. If the similarity ρ is greater than the threshold It means that the node will The prey vector of the first row is updated by simulating Brownian motion using formula (7), and the prey vector is updated by formula (9). The prey vector of the last ξ / 2 rows is updated by simulating Levy motion using formula (10), and the prey vector is updated by formula (9). Then, jump to step 4.6.4); otherwise, jump to step 4.6.3); stepsize j =R L (E j -R L P j ) (10) Where CF is the adaptive parameter controlling the movement of the predator, R L represents random values that simulate Lévy motion; 4.6.3) The representative node allows all prey vectors to simulate the Levy motion through formula (9) to update the step length, and updates the prey vector through formula (10) to complete the search for the optimal radius; 4.6.4) The representative node recalculates the distance between nodes according to the latest adjusted prey vector using formula (3), and calculates the fitness FV of each node i according to the credit rating classification model of formula (2) i , forming a fitness vector and selecting the radius with the smallest fitness as the predator; if the current iteration number is not 0, the current fitness vector is compared with the previous fitness vector. If the fitness of a radius in the previous fitness vector is smaller than the fitness of all radii in the current fitness vector, the fitness and its corresponding radius are used to replace the maximum fitness value in the current fitness vector and the corresponding radius in the current prey vector respectively; 4.6.5) The representative node needs to adjust the prey vector through formula (11) to avoid the influence of the local optimal solution on the optimization process: in, represents the prey vector after adjustment, X max Indicated by dis max The size of the vector is ξ′1, U represents a vector composed of 0 and 1 randomly, B s represents a random vector of the same size as the prey vector, ο1 and ο2 represent random numbers in the range of 0 to 1, and P m1 and P m2 The vector representing the shuffled row index of the prey vector, o yu represents the adjustment state threshold; let the current prey vector be the prey vector after adjustment, step = step + 1; 4.6.6) If the current number of iterations step is less than the maximum number of iterations ψ, the node distance and fitness calculation steps before adjustment are performed again. Otherwise, the optimal radius can be obtained according to the above steps. The representative node calculates the evaluation value of each node by formula (12); after obtaining the evaluation value, the nodes are sorted in descending order according to the evaluation value and put into the set NQ; the evaluation values of the two nodes before and after the set NQ are subtracted, and the difference is put into the set SQ in descending order; then find the sequence numbers of the first two elements in the set SQ in the set NQ, and record the larger sequence number as φ1 and the smaller sequence number as φ2; the nodes in the NQ set whose sequence numbers are greater than or equal to φ1 are directly classified as "bad" level, while the nodes whose sequence numbers are less than φ1 but greater than or equal to φ2 are classified as "normal" level, and the nodes whose sequence numbers are less than φ2 are classified as "good" level; Among them, EV l represents the evaluation value of the lth node, y l,d represents the current accumulated credit value of the dth node within the radius of the lth node, ν l,d represents the historical level value of the dth node within the radius of the lth node, υ l,d represents the number of times the dth node becomes the representative node within the radius of the lth node, x l,d It represents the sum of the number of invalid blocks and forked blocks provided by the dth node within the radius of the lth node, and QN represents the total number of nodes within the radius of the lth node.
9. The medical data security consensus method based on credit rating according to claim 1 is characterized by: In step 6, the representative candidate node determination method is as follows: the representative node calculates the score of each node through formula (13), and selects nodes that meet the quantity requirements from high to low as representative candidate nodes; score l =θ1×y l +θ2×ν l -θ3×υ l -θ4×χ l (13) Among them, score l Indicates the score of the lth node. If multiple nodes have the same score, a node is randomly selected as the representative candidate node. The method for determining the formal representative node and the backup representative node among the candidate representative nodes is as follows: each node broadcasts its voting information to other nodes, and uses formula (14) to count the votes with different weights to obtain the voting results; reuslt_TNC l =(FN_favour-FN_against)×ε1+(RN_favour-RN_against)×ε2(14) Among them, reuslt_TNC l represents the voting result of the lth representative candidate node, FN_favour and FN_against represent the voting results of the consensus node for the lth representative candidate node, ε1 represents the weight of the consensus node when voting, RN_favour and RN_against represent the voting results of the regulatory node for the lth representative candidate node, and ε2 represents the weight of the regulatory node when voting; each node selects NRN number of representative candidate nodes from high to low to become the formal representative nodes according to the voting results, and the unsuccessful representative candidate nodes form the backup representative nodes; if the voting results of the nodes are the same, a node is randomly selected from them as the representative node.
10. The medical data security consensus method based on credit rating according to claim 1 is characterized by: In step 7, the PBFT consensus mechanism includes the following steps: 7.1) Randomly select a node from the representative nodes as the master node, and the other representative nodes as replica nodes; 7.2) The master node broadcasts the pre-prepare message to the replica node. When the replica node receives the pre-prepare message, it enters the ready state and broadcasts the ready message to other nodes; 7.3) If a node receives 2f1 prepare messages, it enters the guarantee state and broadcasts the guarantee message, where f1 represents the maximum number of malicious nodes allowed in the network; 7.4) When the replica node receives 2f1 guarantee messages, it considers that consensus has been reached and writes the block into the chain.
Citation Information
Patent Citations
Internet of Vehicles node consistency consensus method based on block chain
CN110602117A
Consensus method of heterogeneous alliance chain
CN111371877A
Method and device for credit evaluation of copyright user based on block chain
WO2020015406A1
