A consensus method and device

Through the P-Raft consensus mechanism, the secret share is periodically updated and abnormal nodes are replaced in the blockchain system, which solves the problem of malicious users recovering secrets and realizes the protection of data security and confidentiality.

CN118764194BActive Publication Date: 2024-11-08THREE GORGES GROUP IND DEVELOPMENT (BEIJING) CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411213437.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-08-30
Publication Date
2024-11-08
Estimated Expiration
2044-08-30

AI Technical Summary

Technical Problem

The node secret share of blockchain systems has a long life cycle. Over time, malicious users can corrupt enough nodes to restore real secrets and then realize unauthorized operations.

Method used

The P-Raft consensus mechanism is adopted to periodically update secret shares between committee nodes, and determine the honesty level based on online time and share update speed, filter and replace leadership nodes and candidate nodes to prevent malicious recovery of secrets.

Benefits of technology

It effectively avoids the centralized risk of secret share, ensures the confidentiality of secrets, prevents malicious users from recovering real secrets and performing unauthorized operations, and ensures data security.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118764194B_ABST
    Figure CN118764194B_ABST
Patent Text Reader

Abstract

The embodiment of the present invention provides a consensus method and device, the method comprising: in the process of periodically executing a round of consensus on mutual update of secret shares between committee nodes, determining the honesty of the committee nodes according to the online time of the committee nodes and the share update speed of the secret shares; when there is an abnormality in the leader node, selecting a new leader node from the candidate nodes based on the honesty, and replacing the leader node with the new leader node; selecting a new candidate node from the follower nodes, and replacing the committee node replaced by the leader node with the new candidate node. The embodiment of the present invention avoids the risk of secret share centralization based on the blockchain system, and the committee nodes of the blockchain system periodically update the secret share of the secret, prevent malicious recovery of the secret, ensure the confidentiality of the secret, and malicious users cannot perform unauthorized operations.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] Embodiments of the present invention relate to the field of computer technology, and in particular, to a consensus method and device. Background Art

[0002] When a centralized server provides key generation, ciphertext header generation and other similar services to users or devices, it will be limited by centralization and face risks such as single point failure and performance bottleneck. However, through blockchain technology, providing the above services to users or devices in a secret sharing manner can effectively alleviate these problems. For example, in the ciphertext header distribution scenario, each node in the blockchain has a secret share After receiving the user's ciphertext header request, the node generates a ciphertext header share for the user. Since the threshold for the ciphertext header is k + 1, when the user receives the ciphertext header shares from at least k + 1 nodes, the ciphertext header can be restored.

[0003] However, since the secret shares of the nodes of the blockchain system have a long life cycle after the blockchain system is initialized, over time, malicious users can corrupt enough blockchain nodes to recover the real secrets, and then obtain any ciphertext header or key, thereby achieving unauthorized operations. Summary of the invention

[0004] In view of the above problems, a consensus method and device are proposed to overcome the above problems or at least partially solve the above problems. The specific technical solution is as follows:

[0005] In a first aspect of the implementation of the present invention, a consensus method is first provided, which is applied to a blockchain system, wherein the blockchain system includes a committee node and a follower node, wherein the committee nodes respectively have a secret share of a secret distributed by a central server, wherein the committee nodes include a leader node and a candidate node, wherein the number of the committee nodes needs to be greater than or equal to a preset number of nodes, and wherein the committee nodes mutually update the secret share, and wherein the method includes:

[0006] Determining the honesty of the committee node according to the online time of the committee node and the share update speed of the secret share;

[0007] When the leader node is abnormal, a new leader node is selected from the candidate nodes based on the honesty, and the leader node is replaced by the new leader node;

[0008] A new candidate node is selected from the follower nodes, and the committee node replaced by the leader node is replaced by the new candidate node.

[0009] In a second aspect of the implementation of the present invention, a consensus device is provided, which is applied to a blockchain system, wherein the blockchain system includes a committee node and a follower node, wherein the committee nodes respectively have a secret share of a secret distributed by a central server, wherein the committee nodes include a leader node and a candidate node, wherein the number of the committee nodes needs to be greater than or equal to a preset number of nodes, wherein the committee nodes mutually update the secret share, and wherein the device includes:

[0010] An honesty determination module, used to determine the honesty of the committee node according to the online time of the committee node and the share update speed of the secret share;

[0011] A leader node replacement module, used for selecting a new leader node from the candidate nodes based on the honesty when the leader node is abnormal, and replacing the leader node with the new leader node;

[0012] The candidate node replacement module is used to select a new candidate node from the follower nodes and replace the committee node replaced by the leader node with the new candidate node.

[0013] In another aspect of the present invention, a computer-readable storage medium is provided, wherein instructions are stored in the computer-readable storage medium, and when the computer-readable storage medium is run on a computer, the computer executes any of the consensus methods described above.

[0014] In another aspect of the present invention, a computer program product comprising instructions is provided, which, when executed on a computer, enables the computer to execute any of the consensus methods described above.

[0015] Compared with the related art, the embodiments of the present invention have at least the following advantages:

[0016] In the embodiment of the present invention, it can be applied to a blockchain system, wherein the blockchain system includes a committee node and a follower node, wherein the committee node has a secret share of a secret distributed by a central server, wherein the committee node includes a leader node and a candidate node, wherein the number of committee nodes needs to be greater than or equal to the preset number of nodes, wherein the committee nodes periodically update the secret share, and in the process of periodically executing a consensus of mutually updating the secret share between the committee nodes, the honesty of the committee node is determined according to the online time of the committee node and the share update speed of the secret share; when an abnormality exists in the leader node, a new leader node is selected from the candidate node based on the honesty, and the leader node is replaced with a new leader node; a new candidate node is selected from the follower node, and the committee node replaced with the leader node is replaced with a new candidate node. The embodiment of the present invention avoids the risk of secret share centralization based on the blockchain system, and the committee node of the blockchain system periodically updates the secret share of the secret, prevents malicious recovery of the secret, and ensures the confidentiality of the secret, so that even if it is difficult for malicious users to corrupt enough nodes of the blockchain to recover the real secret over time, they cannot obtain any ciphertext header or key based on the secret, and of course they cannot perform unauthorized operations, thereby ensuring data security. In addition, when an abnormality is found in a committee node, the committee node (including the leader node and the candidate node) can also be replaced, further ensuring that unauthorized operations cannot be performed and further ensuring data security. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art are briefly introduced below.

[0018] Figure 1 A flowchart of a consensus method provided in an embodiment of the present invention;

[0019] Figure 2 A schematic diagram of a P-Raft consensus process provided in an embodiment of the present invention;

[0020] Figure 3 A structural block diagram of a consensus device provided in an embodiment of the present invention;

[0021] Figure 4 The present invention is a block diagram of an electronic device provided in an embodiment of the present invention. DETAILED DESCRIPTION

[0022] The technical solutions in the embodiments of the present invention will be described below in conjunction with the accompanying drawings in the embodiments of the present invention.

[0023] In the specific implementation, after the blockchain system is initialized, the secret shares of the blockchain nodes have a long life cycle. As time goes by, malicious users can corrupt enough blockchain nodes to recover the real secrets, and then obtain any secrets such as ciphertext headers or keys, thereby achieving unauthorized operations. Furthermore, when using the active secret sharing scheme to update the secret shares of each node (committee node), if a blockchain node is down or not updated correctly, a node replacement is required, but if a malicious node is selected to replace the node, malicious recovery of secrets will still occur. For example, in the ciphertext header distribution scenario, the candidate node is used to distribute ciphertext header shares to users, and the follower node is used to replace the failed candidate node. Assume that there are k malicious nodes in both the candidate node and the follower node. When the candidate node is replaced, a malicious follower node is selected as the new candidate node. , if the node Will Send to candidate nodes ,in,

[0024] , in the point set In the candidate node Able to recover polynomial , and calculate the system secret share , then, the k malicious nodes and candidate nodes in the committee The ciphertext header can be easily recovered.

[0025] In view of the above problems, the present invention proposes a P-Raft consensus mechanism based on PSS (Proactive secret sharing) and Raft (a distributed consensus algorithm) consensus mechanism, which is used for distributed distribution of keys or ciphertext headers, or other similar scenarios, to increase the difficulty of secret recovery and ensure the confidentiality of secrets. The secret share of each node in the blockchain system can be periodically updated while keeping the secret unchanged. When the blockchain system has a certain number of honest nodes, malicious users cannot perform illegal operations by recovering the secret, thus ensuring data security.

[0026] Reference Figure 1 , is a flowchart of a consensus method provided in an embodiment of the present invention, such as Figure 1As shown, for a blockchain system, the blockchain system includes committee nodes and follower nodes, the committee nodes respectively have secret shares of secrets distributed by a central server, the committee nodes include leader nodes and candidate nodes, the number of the committee nodes needs to be greater than or equal to the preset number of nodes, and the committee nodes periodically update the secret shares with each other. The method may specifically include the following steps:

[0027] Step 101: during a periodic round of consensus on mutual updating of the secret shares among the committee nodes, the honesty of the committee nodes is determined according to the online time of the committee nodes and the share update speed of the secret shares.

[0028] Step 102: When the leader node is abnormal, a new leader node is selected from the candidate nodes based on the honesty, and the leader node is replaced by the new leader node.

[0029] Step 103: Select a new candidate node from the follower nodes, and replace the committee node replaced by the leader node with the new candidate node.

[0030] In a specific implementation, the system architecture of the embodiment of the present invention includes a central server CA and a blockchain network BN of a blockchain system (blockchain). Specifically, the central server CA distributes system secret shares (secret shares) to committee nodes. In the real-time process of the embodiment of the present invention, the central server CA is completely trustworthy and can exit after completing the distribution of secret shares, that is, it will no longer participate in the processing of secret shares in the embodiment of the present invention. The blockchain network BN includes three types of nodes, a leader node, a candidate node, and a follower node, wherein there is only one leader node, a number of candidate nodes, and a follower node at the same time. The leader node and the candidate node together form a committee as committee nodes, and provide users with key or ciphertext header generation services through secret shares. The leader node is selected from the candidate nodes and maintains the blockchain ledger together with the remaining candidate nodes, while the follower node is used to replace the candidate node that is down or bad. Among them, the number of committee nodes needs to be greater than or equal to the preset number of nodes, that is, the number of committee nodes is kept stable. If there is an abnormality in the committee node (such as downtime), resulting in the effective committee node being less than the preset number of nodes, it is necessary to re-select the committee node to replace the abnormal committee node.

[0031] The P-Raft consensus mechanism innovatively proposed in the embodiment of the present invention can support the dynamic changes of nodes in the blockchain system. The committee can include 1 leader node and N-1 candidate nodes, where the leader node is determined based on the online time of other committee nodes. And the share update speed To calculate the honesty of the committee node If a committee node fails to update the secret share in time or fails to update the secret share honestly due to an abnormality such as downtime, it will be replaced by other nodes. The first leader node can be elected according to the Raft consensus mechanism when the blockchain network BN is initialized, or it can be generated by other methods. The embodiment of the present invention does not need to limit this. If the current leader node fails, then the one with the highest honesty The committee node will become the successor leader node, and there is no need to re-elect the leader node. In order to keep the number of committee nodes stable, the leader node will randomly select a follower node as a new candidate node to join the committee.

[0032] Reference Figure 2 , is a schematic diagram of a P-Raft consensus process provided in an embodiment of the present invention, Figure 2 The operation process of the P-Raft consensus mechanism is shown in Figure 1, which can be divided into four stages: request stage, sub-share generation and verification stage, share update and verification stage, and Raft block consensus stage. Among them, the request stage and Raft block consensus stage are the same as the Raft consensus mechanism.

[0033] In the above consensus method, the risk of secret share centralization is avoided based on the blockchain system, and the committee nodes of the blockchain system periodically update the secret share of the secret to prevent malicious recovery of the secret and ensure the confidentiality of the secret. In this way, even over time, it is difficult for malicious users to corrupt enough blockchain nodes to recover the real secret, and they cannot obtain any ciphertext header or key based on the secret, and of course they cannot perform unauthorized operations, thus ensuring data security. In addition, when an abnormality is found in the committee node, the committee node (including the leader node and the candidate node) can also be replaced, further ensuring that unauthorized operations cannot be performed, further ensuring data security.

[0034] In one embodiment of the present invention, when the leader node is abnormal, selecting a new leader node from the candidate nodes based on the honesty, and replacing the leader node with the new leader node includes:

[0035] The candidate node with the highest honesty degree broadcasts its honesty degree in the blockchain system;

[0036] The other candidate nodes verify the honesty of the candidate node with the highest honesty. If the verification passes, the candidate node with the highest honesty is selected as the new leader node.

[0037] In the embodiment of the present invention, if the current leader node has an abnormality, such as a downtime or error, the leader node with the highest honesty will be replaced. The candidate node succeeds as the new leader node. For example, assuming that the candidate node With the highest honesty , then first the candidate node Broadcast it in the blockchain network BN , other committee nodes will verify Is it the highest? If the verification passes, the candidate node is accepted. If the verification fails, the leader node election will continue until a new leader node is elected. It should be noted that after the leader node is replaced, the candidate node replacement needs to be performed to keep the number of committee nodes stable, that is, at least the vacancies of the candidate node elected as the leader node need to be supplemented. In an optional way, a node can be randomly selected from the follower nodes as the new candidate node, and the candidate node elected as the leader node is replaced with the new candidate node.

[0038] In one embodiment of the present invention, the method further comprises:

[0039] When the candidate node is abnormal, a new candidate node is selected from the follower nodes, and the candidate node with the abnormality is replaced by the new candidate node.

[0040] In an embodiment of the present invention, if it is found that a candidate node in the committee has an abnormality such as downtime or error, a node can be randomly selected from the follower nodes as a new candidate node, and the abnormal candidate node can be replaced with the new candidate node, thereby ensuring that there are no abnormal nodes in the committee nodes of the committee.

[0041] In one embodiment of the present invention, the method further comprises:

[0042] Each of the committee nodes obtains the secret shares of other committee nodes, and generates updated secret shares for other committee nodes by executing a sub-share generation algorithm according to the secret shares of other committee nodes, and generates verification evidence for the updated secret shares and broadcasts it in the blockchain system;

[0043] When the committee node receives the updated secret share, it executes the sub-share verification algorithm to verify the correctness of the updated secret share based on the verification evidence, and when the correctness verification of the updated secret share passes, it updates the secret share based on the updated secret share according to the share update algorithm, generates a current update evidence, and sends the current update evidence to the leader node;

[0044] The leader node obtains the most recent update evidence of the committee node from the blockchain ledger, and performs verification based on the most recent update evidence and the current update evidence using a share verification algorithm; when the current update evidence of the committee node passes the verification, the step of determining the honesty of the committee node based on the online time of the committee node and the share update speed of the secret share is performed; when there is a committee node that fails the verification of the current update evidence, it is determined that the committee node that fails the verification has an abnormality, and the step of selecting a new candidate node from the follower node when the candidate node has an abnormality and replacing the candidate node with the new candidate node is performed.

[0045] In one embodiment of the present invention, the method further comprises:

[0046] When the correctness verification of the updated secret share fails, broadcasting an accusation message of the committee node that fails to verify the correctness of the updated secret share in the blockchain system;

[0047] When there is a committee node with accusation messages exceeding a preset threshold and the committee node is not a leader node, the committee node is determined as the committee node with an abnormality, and the step of selecting a new candidate node from the follower nodes when the candidate node has an abnormality and replacing the candidate node with the new candidate node is performed;

[0048] When there is a committee node with accusation messages exceeding a preset threshold and the committee node is a leader node, the leader node is determined to be the leader node with an abnormality, and the steps of selecting a new leader node from the candidate nodes based on the honesty when the leader node has an abnormality and replacing the leader node with the new leader node are performed.

[0049] In the embodiment of the present invention, during the sub-share generation phase,

[0050] Each committee node All need to be updated with sub-shares (secret shares) from other committee nodes ,therefore, First, sub-shares need to be generated for other committee nodes (updating secret shares).

[0051] For each committee node Choose a random polynomial and , in one example, the random polynomial Can be:

[0052]

[0053] For all other committee nodes Calculating Sub-Shares , and a verification proof to verify its correctness , Will Sent secretly to other committee nodes , and broadcast the verification evidence in the blockchain network BN , which is the current verification evidence.

[0054] Next, in the sub-share verification phase, after receiving After the sub-share of Verify the sub-share according to the following formula Correctness:

[0055] (1)

[0056] If the above formula holds, A share update will be performed; otherwise, A peer node will be published in the blockchain network BN "Accusation Message", where if the current leader node collects more than a preset threshold of accusation messages for a candidate node, for example, if the current leader node collects more than half of the accusation messages for a candidate node, then the candidate node will be replaced. In addition, if a candidate node collects more than a preset threshold of accusation messages for the leader node, if a candidate node collects more than half of the accusation messages for the leader node, then all candidate nodes will execute the leader node replacement.

[0057] In the embodiment of the present invention, during the share update phase, each committee node Update their respective system secret shares according to Formula 2 :

[0058] (2)

[0059] at the same time, Update evidence also needs to be generated ’ and sends it to the leader node.

[0060] During the share verification phase, the leader node verifies other committee nodes First, get the node from the blockchain ledger. The most recent update evidence , then verify:

[0061] (3)

[0062] If formula 3 is not true, the candidate node replacement operation will be performed. If formula 3 is true, the leader node will be node Calculating Honesty :

[0063] (4)

[0064] in, For Node Online time, represented by the current timestamp and the timestamp of when the node started to become a committee node By formula Calculate, where Recorded in the blockchain ledger. For Node The update speed of is represented by a set of discrete integers, namely The node that completes the update first has an update speed of ,in, and is the weight, which can generally be set to .

[0065] In one embodiment of the present invention, the method further comprises:

[0066] When all the committee nodes update their secret shares based on the updated secret shares according to the share update algorithm, the leader node writes the current update evidence and honesty of all the committee nodes into a new block, and updates the blockchain ledger based on the new block;

[0067] The committee node verifies the new block in the blockchain ledger. When the verification of the new block fails, the leader node is determined to be the abnormal leader node, and the steps of selecting a new leader node from the candidate nodes based on the honesty when the leader node is abnormal and replacing the leader node with the new leader node are performed.

[0068] In the share update and verification phase, if all candidate nodes have honestly updated their respective system secret shares (secret shares), the leader node will update its own updated system secret share and the update evidence of all nodes in this round of consensus. , Honesty and other transactions into a new block, and update the blockchain ledger. In addition to verifying the format of the block, the candidate node that receives the new block also needs to verify the correctness of the update evidence of each node according to Formula 3. If the update evidence is verified, the block is accepted. Otherwise, it is considered that the leader node is wrong and the leader node replacement operation is performed.

[0069] In one embodiment of the present invention, the new candidate node is a new committee node. After selecting the new candidate node from the follower nodes and replacing the committee node replaced by the leader node with the new candidate node, the method further includes:

[0070] Each of the committee nodes selects a random polynomial, wherein the random polynomial includes at least a first random polynomial and a second random polynomial;

[0071] Each of the committee nodes sends the random polynomial to other committee nodes, and broadcasts the verification evidence for the second random polynomial in the blockchain system;

[0072] When receiving the random polynomial, each of the committee nodes executes a sub-share verification algorithm to verify the correctness of the second random polynomial based on the verification evidence, and when the correctness verification of the second random polynomial succeeds, calculates the share according to the random polynomial and the latest secret share;

[0073] The new committee node requests the shares from each of the committee nodes, and when the shares obtained exceed the preset number of nodes, calculates its secret share according to the shares exceeding the preset number of nodes;

[0074] The new committee node selects a third random polynomial, and broadcasts the verification evidence for the third random polynomial in the blockchain system;

[0075] Each of the committee nodes executes a sub-share verification algorithm to verify the correctness of the third random polynomial based on the verification evidence, and when the correctness verification of the third random polynomial is successful, updates its secret share according to the third random polynomial.

[0076] In the embodiment of the present invention, when a candidate node is replaced, if a candidate node is down or does not correctly update the secret share, the leader node will randomly select a follower node. Replace it. is a set of nodes that are currently legal committee nodes, and The number of members in .

[0077] Each committee node Choose two random polynomials and , that is, the first random polynomial and the second random polynomial, where, , .Then, Committee Node Calculate and send and .in addition, It is also necessary to broadcast the polynomial in the blockchain network BN Verification evidence .

[0078] node Upon receiving a request from a node Random polynomial of and Then, first, verify according to formula 1 After the correctness of the verification is passed, the share is calculated based on the random polynomial according to the following formula 5, where: Here are the most recently updated secret shares:

[0079] (5)

[0080] New candidate nodes (i.e. new committee nodes) To Node Request the above shares and obtain the preset number of nodes, such as at least After the shares, the polynomial is restored according to the following formula 6 :

[0081] (6)

[0082] node First, the system secret share is calculated by formula 6 Then choose a random polynomial , that is, the third random polynomial, where , and Send to Node .in addition, Broadcasting polynomials in blockchain networks Verification evidence .

[0083] node First, verify according to formula 1 If the verification is successful, each committee node Update the respective system secret shares according to the following formula 7:

[0084] (7)

[0085] After each committee node updates its own system secret share, it is necessary to go through the share update and share verification process. Since the remaining steps are consistent with the aforementioned share update and share verification, they will not be repeated here.

[0086] In an embodiment of the present invention, the blockchain network consensus process is as follows:

[0087] 1. Each committee node executes the sub-share generation algorithm to generate sub-shares for other committee nodes.

[0088] 2. Each committee node executes the sub-share verification algorithm to verify the sub-shares from other committee nodes; after the verification is passed, the share update algorithm is executed; otherwise, the update is rejected.

[0089] 3. The leader node executes the share verification algorithm to verify the update evidence of other committee nodes. If a candidate node crashes or does not update the secret share correctly, the leader node will execute the candidate node replacement algorithm. If the leader node crashes or fails, the blockchain network will execute the leader node replacement algorithm.

[0090] 4. The leader node collects transactions from clients, packages a certain number of transactions into a new block, and broadcasts it to all candidate nodes. Transaction refers to specific data, such as the summary value of the data shared in a data sharing transaction, etc.

[0091] 5. The candidate node verifies the block and transactions within the block. The main verification content includes the format of the data, whether the transaction is valid, etc. After passing, the candidate node’s local blockchain ledger is updated and a block confirmation message is sent to the leader node.

[0092] 6. After collecting block confirmation messages from more than half of the candidate nodes, the leader node updates the local blockchain ledger, broadcasts the update (commit) message to the candidate nodes, and sends a transaction response message to the client.

[0093] The application of the P-Raft consensus mechanism of the embodiment of the present invention can effectively avoid centralization risks, support the periodic update of the secret share of each node in the blockchain, prevent malicious recovery of secrets, and ensure the confidentiality of secrets.

[0094] It should be noted that, for the sake of simplicity, the method embodiments are described as a series of action combinations, but those skilled in the art should be aware that the embodiments of the present invention are not limited by the order of the actions described, because according to the embodiments of the present invention, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily required by the embodiments of the present invention.

[0095] Reference Figure 3 , is a structural block diagram of a consensus device provided in an embodiment of the present invention, such as Figure 4 As shown, it is applied to a blockchain system, the blockchain system includes a committee node and a follower node, the committee nodes respectively have a secret share of a secret distributed by a central server, the committee nodes include a leader node and a candidate node, the number of the committee nodes needs to be greater than or equal to the preset number of nodes, and the committee nodes periodically update the secret share. The device may specifically include the following modules:

[0096] The honesty determination module 301 is used to determine the honesty of the committee nodes according to the online time of the committee nodes and the share update speed of the secret shares during a periodic execution of a consensus process of mutually updating the secret shares between the committee nodes;

[0097] A leader node replacement module 302, configured to select a new leader node from the candidate nodes based on the honesty when the leader node is abnormal, and replace the leader node with the new leader node;

[0098] The candidate node replacement module 303 is used to select a new candidate node from the follower nodes, and replace the committee node replaced by the leader node with the new candidate node.

[0099] In one embodiment of the present invention, the leader node replacement module 302 is used to:

[0100] The candidate node with the highest honesty degree broadcasts its honesty degree in the blockchain system;

[0101] The other candidate nodes verify the honesty of the candidate node with the highest honesty. If the verification passes, the candidate node with the highest honesty is selected as the new leader node.

[0102] In one embodiment of the present invention, the apparatus further includes a candidate node replacement module, configured to:

[0103] When the candidate node is abnormal, a new candidate node is selected from the follower nodes, and the candidate node with the abnormality is replaced by the new candidate node.

[0104] In one embodiment of the present invention, the device further includes: an updating module, configured to:

[0105] Each of the committee nodes obtains the secret shares of other committee nodes, and generates updated secret shares for other committee nodes by executing a sub-share generation algorithm according to the secret shares of other committee nodes, and generates verification evidence for the updated secret shares and broadcasts it in the blockchain system;

[0106] When the committee node receives the updated secret share, it executes the sub-share verification algorithm to verify the correctness of the updated secret share based on the verification evidence, and when the correctness verification of the updated secret share passes, it updates the secret share based on the updated secret share according to the share update algorithm, generates a current update evidence, and sends the current update evidence to the leader node;

[0107] The leader node obtains the most recent update evidence of the committee node from the blockchain ledger, and performs verification based on the most recent update evidence and the current update evidence using a share verification algorithm; when the current update evidence of the committee node passes the verification, the step of determining the honesty of the committee node based on the online time of the committee node and the share update speed of the secret share is performed; when there is a committee node that fails the verification of the current update evidence, it is determined that the committee node that fails the verification has an abnormality, and the step of selecting a new candidate node from the follower node when the candidate node has an abnormality and replacing the candidate node with the new candidate node is performed.

[0108] In one embodiment of the present invention, the update module is used to:

[0109] When the correctness verification of the updated secret share fails, broadcasting an accusation message of the committee node that fails to verify the correctness of the updated secret share in the blockchain system;

[0110] When there is a committee node with accusation messages exceeding a preset threshold and the committee node is not a leader node, the committee node is determined as the committee node with an abnormality, and the step of selecting a new candidate node from the follower nodes when the candidate node has an abnormality and replacing the candidate node with the new candidate node is performed;

[0111] When there is a committee node with accusation messages exceeding a preset threshold and the committee node is a leader node, the leader node is determined to be the leader node with an abnormality, and the steps of selecting a new leader node from the candidate nodes based on the honesty when the leader node has an abnormality and replacing the leader node with the new leader node are performed.

[0112] In one embodiment of the present invention, the update module is used to:

[0113] When all the committee nodes update their secret shares based on the updated secret shares according to the share update algorithm, the leader node writes the current update evidence and honesty of all the committee nodes into a new block, and updates the blockchain ledger based on the new block;

[0114] The committee node verifies the new block in the blockchain ledger. When the verification of the new block fails, the leader node is determined to be the abnormal leader node, and the steps of selecting a new leader node from the candidate nodes based on the honesty when the leader node is abnormal and replacing the leader node with the new leader node are performed.

[0115] In one embodiment of the present invention, the new candidate node is a new committee node, and the apparatus further includes a secret share updating module, which is used to:

[0116] Each of the committee nodes selects a random polynomial, wherein the random polynomial includes at least a first random polynomial and a second random polynomial;

[0117] Each of the committee nodes sends the random polynomial to other committee nodes, and broadcasts the verification evidence for the second random polynomial in the blockchain system;

[0118] When receiving the random polynomial, each of the committee nodes executes a sub-share verification algorithm to verify the correctness of the second random polynomial based on the verification evidence, and when the correctness verification of the second random polynomial succeeds, calculates the share according to the random polynomial and the latest secret share;

[0119] The new committee node requests the shares from each of the committee nodes, and when the shares obtained exceed the preset number of nodes, calculates its secret share according to the shares exceeding the preset number of nodes;

[0120] The new committee node selects a third random polynomial, and broadcasts the verification evidence for the third random polynomial in the blockchain system;

[0121] Each of the committee nodes executes a sub-share verification algorithm to verify the correctness of the third random polynomial based on the verification evidence, and when the correctness verification of the third random polynomial is successful, updates its secret share according to the third random polynomial.

[0122] The embodiment of the present invention avoids the risk of secret share centralization based on the blockchain system, and the committee nodes of the blockchain system periodically update the secret share of the secret to prevent malicious recovery of the secret and ensure the confidentiality of the secret. In this way, even if it is difficult for malicious users to corrupt enough blockchain nodes to recover the real secret over time, they cannot obtain any ciphertext header or key based on the secret, and of course they cannot perform unauthorized operations, thus ensuring data security. In addition, when an abnormality is found in the committee node, the committee node (including the leader node and the candidate node) can also be replaced, further ensuring that unauthorized operations cannot be performed, further ensuring data security.

[0123] As for the above-mentioned device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0124] The embodiment of the present invention further provides an electronic device, such as Figure 4 As shown, it includes a processor 501, a communication interface 502, a memory 503 and a communication bus 504, wherein the processor 501, the communication interface 502, and the memory 503 communicate with each other through the communication bus 504.

[0125] Memory 503, used for storing computer programs;

[0126] The processor 501 is used to implement any consensus method described in the above embodiments when executing the program stored in the memory 503:

[0127] In a periodic execution of a round of consensus on mutual updating of the secret share between the committee nodes, the honesty of the committee nodes is determined according to the online time of the committee nodes and the share update speed of the secret share;

[0128] When the leader node is abnormal, a new leader node is selected from the candidate nodes based on the honesty, and the leader node is replaced by the new leader node;

[0129] A new candidate node is selected from the follower nodes, and the committee node replaced by the leader node is replaced by the new candidate node.

[0130] The communication bus mentioned in the above terminal can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.

[0131] The communication interface is used for communication between the above terminal and other devices.

[0132] The memory may include a random access memory (RAM) or a non-volatile memory, such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.

[0133] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.

[0134] In another embodiment provided by the present invention, a computer-readable storage medium is also provided, in which instructions are stored. When the computer-readable storage medium is run on a computer, the computer executes the consensus method described in any one of the above embodiments.

[0135] In another embodiment provided by the present invention, a computer program product comprising instructions is also provided, which, when executed on a computer, enables the computer to execute the consensus method described in any one of the above embodiments.

[0136] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented by software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present invention is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions may be transmitted from one website site, computer, server or data center to another website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium may be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrated. The available medium may be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state drive Solid State Disk (SSD)), etc.

[0137] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.

[0138] Each embodiment in this specification is described in a related manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0139] The above description is only a preferred embodiment of the present invention and is not intended to limit the protection scope of the present invention. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention are included in the protection scope of the present invention.

Claims

1. A consensus method applied to a blockchain system, characterized in that: The blockchain system includes committee nodes and follower nodes, each of which has a secret share distributed by a central server. The committee nodes include leader nodes and candidate nodes. The number of committee nodes needs to be greater than or equal to a preset number of nodes. The committee nodes periodically update the secret share. The method includes: In a periodic execution of a round of consensus on mutual updating of the secret share between the committee nodes, the honesty of the committee nodes is determined according to the online time of the committee nodes and the share update speed of the secret share; When the leader node is abnormal, a new leader node is selected from the candidate nodes based on the honesty, and the leader node is replaced by the new leader node; Selecting a new candidate node from the follower nodes, and replacing the committee node replaced by the leader node with the new candidate node; Wherein, when the leader node is abnormal, selecting a new leader node from the candidate nodes based on the honesty, and replacing the leader node with the new leader node, comprises: The candidate node with the highest honesty degree broadcasts its honesty degree in the blockchain system; The other candidate nodes verify the honesty of the candidate node with the highest honesty, and if the verification passes, the candidate node with the highest honesty is selected as the new leader node; When the candidate node is abnormal, a new candidate node is selected from the follower node, and the candidate node with the abnormality is replaced by the new candidate node; Each of the committee nodes obtains the secret shares of other committee nodes, and generates updated secret shares for other committee nodes by executing a sub-share generation algorithm according to the secret shares of other committee nodes, and generates verification evidence for the updated secret shares and broadcasts it in the blockchain system; When the committee node receives the updated secret share, it executes the sub-share verification algorithm to verify the correctness of the updated secret share based on the verification evidence, and when the correctness verification of the updated secret share passes, it updates the secret share based on the updated secret share according to the share update algorithm, generates a current update evidence, and sends the current update evidence to the leader node; The leader node obtains the most recent update evidence of the committee node from the blockchain ledger, and performs verification based on the most recent update evidence and the current update evidence using a share verification algorithm; when the current update evidence of the committee node passes the verification, the step of determining the honesty of the committee node based on the online time of the committee node and the share update speed of the secret share is performed; when there is a committee node that fails the verification of the current update evidence, it is determined that the committee node that fails the verification has an abnormality, and the step of selecting a new candidate node from the follower node when the candidate node has an abnormality and replacing the candidate node with the new candidate node is performed.

2. The method according to claim 1, characterized in that The method further comprises: When the correctness verification of the updated secret share fails, broadcasting an accusation message of the committee node that fails to verify the correctness of the updated secret share in the blockchain system; When there is a committee node with accusation messages exceeding a preset threshold and the committee node is not a leading node, the committee node is determined to be the committee node with an abnormality, and the steps of selecting a new candidate node from the follower nodes and replacing the candidate node with the abnormality with the new candidate node when the candidate node has an abnormality are performed.

3. The method according to claim 2, characterized in that The method further comprises: When there is a committee node with accusation messages exceeding a preset threshold and the committee node is a leader node, the leader node is determined to be the leader node with an abnormality, and the steps of selecting a new leader node from the candidate nodes based on the honesty when the leader node has an abnormality and replacing the leader node with the new leader node are performed.

4. The method according to claim 3, characterized in that The method further comprises: When all the committee nodes update their secret shares based on the updated secret shares according to the share update algorithm, the leader node writes the current update evidence and honesty of all the committee nodes into a new block, and updates the blockchain ledger based on the new block; The committee node verifies the new block in the blockchain ledger. When the verification of the new block fails, the leader node is determined to be the abnormal leader node, and the steps of selecting a new leader node from the candidate nodes based on the honesty when the leader node is abnormal and replacing the leader node with the new leader node are performed.

5. The method according to claim 4, characterized in that The new candidate node is a new committee node. After selecting the new candidate node from the follower nodes and replacing the committee node replaced by the leader node with the new candidate node, the method further includes: Each of the committee nodes selects a random polynomial, wherein the random polynomial includes at least a first random polynomial and a second random polynomial; Each of the committee nodes sends the random polynomial to other committee nodes, and broadcasts the verification evidence for the second random polynomial in the blockchain system; When receiving the random polynomial, each of the committee nodes executes a sub-share verification algorithm to verify the correctness of the second random polynomial based on the verification evidence, and when the correctness verification of the second random polynomial succeeds, calculates the share according to the random polynomial and the latest secret share; The new committee node requests the shares from each of the committee nodes, and when the shares obtained exceed the preset number of nodes, calculates its secret share according to the shares exceeding the preset number of nodes; The new committee node selects a third random polynomial, and broadcasts the verification evidence for the third random polynomial in the blockchain system; Each of the committee nodes executes a sub-share verification algorithm to verify the correctness of the third random polynomial based on the verification evidence, and when the correctness verification of the third random polynomial is successful, updates its secret share according to the third random polynomial.

6. A consensus device applied to a blockchain system, characterized in that: The blockchain system includes committee nodes and follower nodes, each of which has a secret share distributed by a central server. The committee nodes include leader nodes and candidate nodes. The number of committee nodes needs to be greater than or equal to a preset number of nodes. The committee nodes periodically update the secret share. The device includes: An honesty determination module, used to determine the honesty of the committee nodes according to the online time of the committee nodes and the share update speed of the secret shares during a periodic execution of a consensus process of mutually updating the secret shares among the committee nodes; A leader node replacement module, used for selecting a new leader node from the candidate nodes based on the honesty when the leader node is abnormal, and replacing the leader node with the new leader node; A candidate node replacement module, used to select a new candidate node from the follower nodes, and replace the committee node replaced by the leader node with the new candidate node; Wherein, the leadership node replacement module is used to: The candidate node with the highest honesty degree broadcasts its honesty degree in the blockchain system; The other candidate nodes verify the honesty of the candidate node with the highest honesty, and if the verification passes, the candidate node with the highest honesty is selected as the new leader node; The device also includes a candidate node replacement module, which is used to: When the candidate node is abnormal, a new candidate node is selected from the follower node, and the candidate node with the abnormality is replaced by the new candidate node; The device also includes an updating module, which is used to: Each of the committee nodes obtains the secret shares of other committee nodes, and generates updated secret shares for other committee nodes by executing a sub-share generation algorithm according to the secret shares of other committee nodes, and generates verification evidence for the updated secret shares and broadcasts it in the blockchain system; When the committee node receives the updated secret share, it executes the sub-share verification algorithm to verify the correctness of the updated secret share based on the verification evidence, and when the correctness verification of the updated secret share passes, it updates the secret share based on the updated secret share according to the share update algorithm, generates a current update evidence, and sends the current update evidence to the leader node; The leader node obtains the most recent update evidence of the committee node from the blockchain ledger, and performs verification based on the most recent update evidence and the current update evidence using a share verification algorithm; when the current update evidence of the committee node passes the verification, the step of determining the honesty of the committee node based on the online time of the committee node and the share update speed of the secret share is performed; when there is a committee node that fails the verification of the current update evidence, it is determined that the committee node that fails the verification has an abnormality, and the step of selecting a new candidate node from the follower node when the candidate node has an abnormality and replacing the candidate node with the new candidate node is performed.

7. The device according to claim 6, characterized in that The update module is used to: When the correctness verification of the updated secret share fails, broadcasting an accusation message of the committee node that fails to verify the correctness of the updated secret share in the blockchain system; When there is a committee node with accusation messages exceeding a preset threshold and the committee node is not a leading node, the committee node is determined to be the committee node with an abnormality, and the steps of selecting a new candidate node from the follower nodes and replacing the candidate node with the abnormality with the new candidate node when the candidate node has an abnormality are performed.

8. An electronic device, characterized in that: It includes a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other through the communication bus; Memory, used to store computer programs; A processor, for implementing the method steps described in any one of claims 1 to 5 when executing a program stored in a memory.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 5 is implemented.