Consensus method and device and block chain system
By assigning different weights to consensus voting node groups in the blockchain system and dynamically adjusting them, combined with reputation value and staked equity information, the impact of malicious nodes is identified and reduced, thus solving the problem of security and performance degradation of the blockchain system caused by malicious nodes and achieving higher security and performance.
Patent Information
- Application Number
- CN202411413213.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-10
- Publication Date
- 2025-01-10
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
In a blockchain system, an excessive number of malicious nodes can lead to a decline in the security and performance of the consensus voting node group, making it difficult to guarantee the security and overall performance of the blockchain system.
By assigning different weights to each node in the consensus voting node group, the consensus vote is determined based on the sum of the voting results and the node weights. The node weights are dynamically adjusted by combining reputation value and staked equity information to reduce the impact of malicious nodes. Furthermore, a set of suspected consensus nodes is identified through historical voting records to adjust their weights.
This improves the security of the blockchain system, reduces the impact of malicious nodes deliberately not voting on system performance, and ensures the fairness and efficiency of consensus voting.
Smart Images

Figure CN119299070A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to blockchain technology, and in particular to a consensus method, device and blockchain system. Background Art
[0002] Blockchain technology is a distributed ledger technology that records and protects data in a decentralized and encrypted manner.
[0003] In the scalable consensus framework based on blockchain technology, some consensus nodes are usually selected from the candidate consensus nodes as the consensus voting node group, and each consensus node in the consensus voting node group has one vote. When the blockchain system generates a new transaction block, each consensus node in the consensus voting node group will perform a consensus vote on the new transaction block, and determine whether the consensus vote is passed based on the numerical relationship between the number of consensus votes received and the total number of votes. In this consensus method, if there are a large number of malicious nodes in the consensus voting node group, it will be difficult to ensure the security of the blockchain system, and the overall performance of the blockchain system will be reduced.
[0004] How to adopt a reasonable consensus method for the blockchain system to ensure the security of the blockchain system and improve the overall performance of the blockchain system is an urgent problem to be solved. Summary of the invention
[0005] The embodiments of the present disclosure provide a consensus method, device and blockchain system to solve the above problems.
[0006] A first aspect of the embodiments of the present disclosure provides a consensus method, including:
[0007] Obtain the voting results of the consensus voting node group for at least one consensus vote on the consensus block;
[0008] Determining, based on the voting result, a sum of weights of the voted nodes in each consensus vote of the at least one consensus vote;
[0009] Determining whether each consensus vote is passed based on the sum of the weights of the voted nodes in each consensus vote and the sum of the weights of all consensus nodes in the consensus voting node group;
[0010] In response to each consensus vote being passed, it is determined that the consensus on the block to be agreed upon is passed.
[0011] In some embodiments of the present disclosure, determining the sum of weights of voted nodes in each consensus vote of the at least one consensus vote based on the voting result includes:
[0012] Based on the voting results, determine the voted nodes in each consensus vote;
[0013] Based on the voted nodes in each consensus vote and the weights of each consensus node in the consensus voting node group, the sum of the weights of the voted nodes in each consensus vote is determined.
[0014] In some embodiments of the present disclosure, before obtaining the voting result of at least one consensus vote by the consensus voting node group on the consensus block, the method further includes:
[0015] Based on the reputation value and pledge equity information of each consensus node, the weight of each consensus node is determined.
[0016] In some embodiments of the present disclosure, before determining the weight of each consensus node based on the reputation value and pledged equity information of each consensus node, the method further includes:
[0017] Determine a first reputation value of each consensus node based on the enterprise information of each consensus node;
[0018] Determine a second reputation value of each consensus node based on historical consensus voting information and historical block information of each consensus node;
[0019] Based on the first reputation value of each consensus node and the second reputation value of each consensus node, the reputation value of each consensus node is determined.
[0020] In some embodiments of the present disclosure, determining whether each consensus vote is passed based on the sum of the weights of the voted nodes in each consensus vote and the sum of the weights of all consensus nodes in the consensus voting node group includes:
[0021] In each consensus vote, in response to the sum of the weights of the voted nodes being greater than the product of the sum of the weights and a preset constant, it is determined that the consensus vote is passed, where 0<the preset constant<1.
[0022] In some embodiments of the present disclosure, it further includes:
[0023] Obtaining the voted nodes for each consensus vote in the historical consensus votes of the consensus voting node group;
[0024] Determine a target consensus node set for suspected consistent consensus voting in the consensus voting node group based on the voted nodes of each consensus vote in the historical consensus vote, wherein the target consensus node set includes at least two consensus nodes in the consensus voting node group;
[0025] Reduce the weight of each consensus node in the target consensus node set.
[0026] In some embodiments of the present disclosure, determining a target consensus node set for suspected consistent consensus voting in the consensus voting node group based on the voted nodes of each consensus vote in the historical consensus vote includes:
[0027] Based on the voted nodes of each consensus vote in the historical consensus vote, determining whether there are M consensus nodes in the historical consensus vote with the same voting results in N consecutive consensus votes, where M and N are both integers greater than 2, and the voting results of the consensus vote include voted and not voted;
[0028] In response to the fact that there are M consensus nodes in the historical consensus voting that have the same voting results in N consecutive consensus votings, a consensus node set consisting of the M consensus nodes is determined as the target consensus node set.
[0029] A second aspect of the embodiments of the present disclosure provides a consensus device, including:
[0030] An acquisition module is used to obtain the voting results of the consensus voting node group for at least one consensus vote on the consensus block;
[0031] A first determination module, configured to determine, based on the voting result, a sum of weights of voted nodes in each consensus vote of the at least one consensus vote;
[0032] A second determination module is used to determine whether each consensus vote is passed based on the sum of the weights of the voted nodes in each consensus vote and the sum of the weights of all consensus nodes in the consensus voting node group;
[0033] The third determination module is used to determine that the consensus on the block to be agreed upon is passed in response to each consensus vote being passed.
[0034] In some embodiments of the present disclosure, the first determination module is used to determine the voted nodes in each consensus vote based on the voting results; the first determination module is also used to determine the sum of the weights of the voted nodes in each consensus vote based on the voted nodes in each consensus vote and the weights of each consensus node in the consensus voting node group.
[0035] In some embodiments of the present disclosure, the device further comprises:
[0036] The node weight setting module is used to determine the weight of each consensus node based on the reputation value and pledge equity information of each consensus node.
[0037] In some embodiments of the present disclosure, the node weight setting module is used to determine the first credibility value of each consensus node based on the enterprise information of each consensus node; the node weight setting module is also used to determine the second credibility value of each consensus node based on the historical consensus voting information and historical block information of each consensus node; the node weight setting module is also used to determine the credibility value of each consensus node based on the first credibility value of each consensus node and the second credibility value of each consensus node.
[0038] In some embodiments of the present disclosure, the second determination module is used to determine that the consensus vote is passed in response to the sum of the weights of the voted nodes being greater than the product of the sum of the weights and a preset constant in each consensus vote, where 0<the preset constant<1.
[0039] In some embodiments of the present disclosure, the device further comprises:
[0040] A historical consensus voting statistics module, used to obtain the voted nodes for each consensus vote in the historical consensus voting of the consensus voting node group;
[0041] A voting consistency determination module, configured to determine a target consensus node set for a suspected consistent consensus vote in the consensus voting node group based on the voted nodes of each consensus vote in the historical consensus vote, wherein the target consensus node set includes at least two consensus nodes in the consensus voting node group;
[0042] Among them, the node weight setting module is also used to reduce the weight of each consensus node in the target consensus node set.
[0043] In some embodiments of the present disclosure, the voting consistency determination module is used to determine whether there are M consensus nodes in the historical consensus voting with the same voting results in N consecutive consensus votes based on the voted nodes of each consensus vote in the historical consensus voting, wherein M and N are both integers greater than 2, and the voting results of the consensus voting include voted and not voted; the voting consistency determination module is also used to determine the consensus node set consisting of the M consensus nodes as the target consensus node set in response to the existence of M consensus nodes in the historical consensus voting with the same voting results in N consecutive consensus votes.
[0044] A third aspect of the embodiments of the present disclosure provides a blockchain system, including:
[0045] The consensus voting node group is used to reach consensus through the method described in the first aspect above.
[0046] According to a fourth aspect of the embodiments of the present disclosure, an electronic device is provided, including:
[0047] A memory for storing a computer program product;
[0048] The processor is used to execute the computer program product stored in the memory, and when the computer program product is executed, the method described in the first aspect above is implemented.
[0049] According to a fifth aspect of the embodiments of the present disclosure, a computer-readable storage medium is provided, on which computer program instructions are stored. When the computer program instructions are executed by a processor, the method described in the first aspect is implemented.
[0050] The consensus method, device and blockchain system of the disclosed embodiments, since the weights of the consensus nodes in the consensus voting node group can be different (for example, the malicious node has a lower weight than other consensus nodes), the consensus voting node group determines whether the vote is passed based on the sum of the weights of the voted nodes and the sum of the weights of all consensus nodes when performing consensus voting, which can ensure the security of the blockchain system and reduce the impact on the overall performance of the blockchain system caused by malicious nodes deliberately not voting.
[0051] The technical solution of the present disclosure is further described in detail below through the accompanying drawings and embodiments. BRIEF DESCRIPTION OF THE DRAWINGS
[0052] The accompanying drawings, which constitute a part of the specification, illustrate embodiments of the present disclosure and, together with the description, serve to explain the principles of the present disclosure.
[0053] The present disclosure may be more clearly understood from the following detailed description with reference to the accompanying drawings, in which:
[0054] Figure 1 It is a flowchart of the consensus method in some embodiments of the present disclosure;
[0055] Figure 2 A working principle diagram of a consensus voting node group performing a consensus vote in an example of the present disclosure;
[0056] Figure 3 is a flowchart of step S2 in some embodiments of the present disclosure;
[0057] Figure 4 is a flowchart of step S0 in some embodiments of the present disclosure;
[0058] Figure 5 is a flowchart of the steps included in the consensus method in other embodiments of the present disclosure;
[0059] Figure 6 is a flowchart of step S6 in some embodiments of the present disclosure;
[0060] Figure 7 It is a structural block diagram of a consensus device in some embodiments of the present disclosure;
[0061] Figure 8 It is a structural block diagram of a consensus device in some other embodiments of the present disclosure;
[0062] Fig. 9 A structural block diagram of a consensus device in some other embodiments of the present disclosure;
[0063] Fig.10 It is a structural block diagram of an electronic device in some embodiments of the present disclosure. DETAILED DESCRIPTION
[0064] Various exemplary embodiments of the present disclosure will now be described in detail with reference to the accompanying drawings. It should be noted that the relative arrangement of components and steps, numerical expressions and numerical values set forth in these embodiments do not limit the scope of the present disclosure unless otherwise specifically stated.
[0065] Those skilled in the art can understand that the terms "first" and "second" in the embodiments of the present disclosure are only used to distinguish different steps, devices or modules, etc., and neither represent any specific technical meaning nor indicate the necessary logical order between them.
[0066] It should also be understood that in the embodiments of the present disclosure, “plurality” may refer to two or more than two, and “at least one” may refer to one, two, or more than two.
[0067] It should also be understood that any component, data or structure mentioned in the embodiments of the present disclosure can generally be understood as one or more, unless explicitly limited or otherwise indicated in the context.
[0068] In addition, the term "and / or" in the present disclosure is only a description of the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in the present disclosure generally indicates that the associated objects before and after are in an "or" relationship.
[0069] It should also be understood that the description of the various embodiments in the present disclosure focuses on the differences between the various embodiments, and the same or similar aspects thereof can be referenced to each other, and for the sake of brevity, they will not be described one by one.
[0070] The following description of at least one exemplary embodiment is merely illustrative in nature and is in no way intended to limit the present disclosure, its application, or uses.
[0071] Technologies, methods, and equipment known to ordinary technicians in the relevant art may not be discussed in detail, but where appropriate, the technologies, methods, and equipment should be considered as part of the specification.
[0072] It should be noted that like reference numerals and letters refer to similar items in the following figures, and therefore, once an item is defined in one figure, it need not be further discussed in subsequent figures.
[0073] The embodiments of the present disclosure can be applied to electronic devices such as terminal devices, computer systems, servers, etc., which can operate with many other general or special computing system environments or configurations. Examples of well-known terminal devices, computing systems, environments and / or configurations suitable for use with electronic devices such as terminal devices, computer systems, servers, etc. include, but are not limited to: personal computer systems, server computer systems, thin clients, thick clients, handheld or laptop devices, microprocessor-based systems, set-top boxes, programmable consumer electronics, network personal computers, small computer systems, large computer systems, and distributed cloud computing technology environments including any of the above systems, etc.
[0074] Electronic devices such as terminal devices, computer systems, servers, etc. can be described in the general context of computer system executable instructions (such as program modules) executed by computer systems. Generally, program modules can include routines, programs, object programs, components, logic, data structures, etc., which perform specific tasks or implement specific abstract data types. Computer systems / servers can be implemented in a distributed cloud computing environment, where tasks are performed by remote processing devices linked through a communication network. In a distributed cloud computing environment, program modules can be located on local or remote computing system storage media including storage devices.
[0075] Figure 1 1 is a flow chart of the consensus method in some embodiments of the present disclosure. The consensus method can be applied to the consensus of the blockchain system on the blocks. Figure 1 As shown, the consensus method may include the following steps:
[0076] S1: Obtain the voting results of the consensus voting node group for at least one consensus vote on the consensus block.
[0077] For the newly generated consensus blocks in the blockchain system, the consensus voting node group needs to preset a consensus method to reach a consensus on the consensus blocks. Among them, the consensus voting node group includes multiple consensus nodes. In order to ensure the fairness of the consensus, the number of consensus nodes in the consensus voting node group is usually greater than or equal to four.
[0078] Figure 2 This is a working principle diagram of a consensus voting node group in an example of this disclosure. Figure 2As shown, when the consensus voting node group performs consensus voting on the consensus block, consensus voting corresponding to the number of times of the preset consensus method is performed. Among them, the preset consensus method can be a consensus voting method similar to the following consensus methods: Byzantine Fault Tolerance (Practical Byzantine Fault Tolerance, PBFT) method, HotStuff consensus method (a distributed consensus method based on Byzantine Fault Tolerance) / Dumbo BFT consensus method (i.e. Dumbo Byzantine Fault Tolerance consensus method).
[0079] It should be noted that the difference between the preset consensus method of the embodiment of the present disclosure and the PBFT consensus method, the HotStuff consensus method and the Dumbo BFT consensus method is that the weight of each consensus node can be different in each consensus vote, and the conditions for determining whether the consensus vote is passed are different, which will be explained in detail in the subsequent steps.
[0080] The voting result of at least one consensus vote may include the voting status of each node in each consensus vote (voted or not voted).
[0081] S2: Based on the voting results, determine the sum of the weights of the voted nodes in each consensus vote of at least one consensus vote.
[0082] The voting results can be used to extract the voting status (voted or not voted) of each consensus node in the consensus voting node group for each consensus vote, and combined with the weight of each consensus node in the consensus voting node group, so as to calculate the sum of the weights of the voted nodes in each consensus vote.
[0083] S3: Determine whether each consensus vote is passed based on the sum of the weights of the voted nodes in each consensus vote and the sum of the weights of all consensus nodes in the consensus voting node group.
[0084] The sum of the weights of the voting nodes in each consensus vote is recorded as W A , the sum of the weights of all consensus nodes in the consensus voting node group is recorded as W B , W A ≤W B .
[0085] Judge W A and W B Whether the preset relationship is satisfied between them, the consensus vote is judged based on the test results. A and W B If the preset relationship is satisfied between them, the consensus vote is considered passed; if W A and W B If the preset relationship is not satisfied, the consensus vote is deemed to have failed.
[0086] S4: In response to each consensus vote being passed, determining that a consensus on the consensus block is passed.
[0087] If the consensus voting node group adopts the preset consensus method to pass each consensus vote on the consensus block, the consensus on the consensus block is passed.
[0088] In this embodiment, since the weight of each consensus node in the consensus voting node group can be different (for example, the malicious node has a lower weight than other consensus nodes), the consensus voting node group determines whether to pass the vote based on the sum of the weights of the voted nodes and the sum of the weights of all consensus nodes when performing a consensus vote. This can ensure the security of the blockchain system and reduce the impact on the overall performance of the blockchain system caused by malicious nodes deliberately not voting.
[0089] Figure 3 FIG. 1 is a flow chart of step S2 in some embodiments of the present disclosure. Figure 3 As shown, step S2 may include the following steps:
[0090] S2-1: Based on the voting results, determine the voted nodes in each consensus vote.
[0091] The voting results may include the node identifiers of the nodes that have voted in each consensus vote, and may also include the node identifiers of the nodes that have not voted in each consensus vote. The node identifier is used to uniquely identify the corresponding consensus node.
[0092] S2-2: Based on the voted nodes in each consensus vote and the weights of each consensus node in the consensus voting node group, determine the sum of the weights of the voted nodes in each consensus vote.
[0093] The nodes that have voted in each consensus vote can be determined by the node identifiers of the nodes that have voted in each consensus vote, and the node weights of the nodes that have voted can be obtained from the weight set of each consensus node in the consensus voting node group, and then the sum of the weights of the nodes that have voted in each consensus vote can be calculated.
[0094] In one example of the present disclosure, the consensus voting node group includes node n1, node n2, node n3 and node n4, and the corresponding weights are W1, W2, W3 and W4 respectively. If the voted nodes in a consensus vote include node n1, node n2 and node n3, then the sum of the weights of the consensus vote is W A =W1+W2+W3, the total weight W B =W1+W2+W3+W4.
[0095] In this embodiment, after extracting the voted nodes in each consensus vote from the voting results of at least one consensus vote, the weight of each consensus node in the voted nodes is extracted from the weight of each consensus node in the consensus voting node group, and then the sum of the weights of the voted nodes in each consensus vote can be quickly calculated.
[0096] In some embodiments of the present disclosure, before step S1, the following steps may also be included:
[0097] S0: Determine the weight of each consensus node based on its reputation and pledged equity information.
[0098] The reputation value of each consensus node can be quantified based on the registration information of each consensus node and the historical behavior information of each consensus node on the blockchain. Among them, the name of the company to which each consensus node belongs can be obtained through the registration information of each consensus node, and the evaluation of the company to which each consensus node belongs can be obtained based on the company name to which each consensus node belongs, and then the reputation value of the company to which each consensus node belongs in the evaluation dimension can be obtained. The reputation value of each consensus node in the historical behavior dimension can be obtained through the historical behavior information of each consensus node on the blockchain.
[0099] The pledge rights and interests information of each consensus node may include the native token information of each consensus node. Among them, the native token refers to the accounting unit connected to the blockchain system, generated and used in the blockchain system. It is an asset-backed token issued on the blockchain to represent some external assets. The native token of each consensus node can be homogeneous or non-homogeneous, and can be limited in circulation or unlimited in circulation. The more tokens each consensus node has, the greater the voting weight.
[0100] In this embodiment, since the reputation value and pledged equity information of each consensus node in the consensus voting node group affect the node weight, the weight of each consensus node can be reasonably determined according to the reputation value and pledged equity information of each consensus node in the consensus voting node group, which helps to reduce the node weight due to its reputation value when a consensus node in the consensus voting node group acts as a malicious node, and helps to reduce the node weight due to the reduction of pledged equity information caused by the node splitting when a consensus node in the consensus voting node group acts as a consensus node generated after the malicious node is split, thereby helping to reduce the impact of malicious nodes deliberately not voting on the overall performance of the blockchain system.
[0101] Figure 4 FIG. 1 is a flow chart of step S0 in some embodiments of the present disclosure. Figure 4 As shown, step S0 may include the following steps:
[0102] S0-1: Determine the first reputation value of each consensus node based on the enterprise information of each consensus node.
[0103] According to the enterprise information of each consensus node in the consensus voting node group, the industry evaluation of the company to which each consensus node belongs can be searched on the Internet, and then the industry status and other information of the company to which each consensus node belongs can be obtained. Then, the reputation value of each consensus node under the blockchain can be obtained in a quantitative way, which is recorded as the first reputation value of each consensus node.
[0104] S0-2: Determine the second reputation value of each consensus node based on the historical consensus voting information and historical block information of each consensus node.
[0105] According to the historical consensus voting information of each consensus node in the consensus voting node group, it can be determined whether each consensus node actively voted in the historical consensus voting, for example, whether the historical voting rate is greater than the preset voting rate threshold, and then the reputation value of each consensus node in the historical consensus voting dimension can be obtained. Among them, the higher the historical voting rate, the higher the reputation value in the historical consensus voting dimension.
[0106] According to the historical block information of each consensus node in the consensus voting node group, it can be determined whether each consensus node has produced blocks according to regulations, the number of transactions and users included in the node block, etc. By quantifying the historical block information of each consensus node, the reputation value of each consensus node in the historical block dimension can be obtained. Among them, the better the performance of historical block production, for example, the larger the number of transactions / the larger the number of users, the higher the reputation value in the historical block dimension.
[0107] The reputation value of each consensus node in the historical consensus voting dimension and the reputation value in the historical block generation dimension can be weighted averaged, and the weighted average calculation result is recorded as the second reputation value of each consensus node.
[0108] S0-3: Determine the reputation value of each consensus node based on the first reputation value of each consensus node and the second reputation value of each consensus node.
[0109] The final reputation value of each consensus node can be obtained by performing a weighted average calculation on the first reputation value and the second reputation value of each consensus node.
[0110] In this embodiment, the reputation value of each consensus node can be reasonably determined based on the enterprise information, historical consensus voting information and historical block information of each consensus node in the consensus voting node group.
[0111] In some embodiments of the present disclosure, step S3 may include: in each consensus vote, in response to the sum of the weights of the voted nodes being greater than the product of the sum of the weights and a preset constant, determining that the consensus vote is passed. 0<preset constant<1.
[0112] In each consensus vote, the sum of the weights of the voted nodes is recorded as WA The sum of the weights of all consensus nodes in the consensus voting node group is denoted as W. B A preset constant is denoted as C and 0 < C < 1. If W A > W B × C, then this consensus vote passes.
[0113] In an example of the present disclosure, the consensus voting node group includes node n1, node n2, node n3, and node n4, with corresponding weights W1, W2, W3, and W4 respectively, and C takes 2 / 3.
[0114] If the voted nodes in a certain consensus vote include node n1, node n2, and node n3, then the sum of weights W of this consensus vote A = W1 + W2 + W3, and the total weight sum W B = W1 + W2 + W3 + W4. If (W1 + W2 + W3) > (W1 + W2 + W3 + W4) × (2 / 3), then this consensus vote passes.
[0115] In this embodiment, since the weights of malicious consensus nodes are low, in each consensus vote, if the sum of the weights of the voted nodes is greater than the product of the total weight sum and the preset constant, it indicates that a large number of non - malicious consensus nodes recognize this consensus vote, and thus this consensus vote can pass.
[0116] Figure 5 is a schematic flowchart of the steps included in the consensus method in other embodiments of the present disclosure. As Figure 5 shown, the consensus method may further include the following steps:
[0117] S5: Obtain the voted nodes in each consensus vote in the historical consensus votes of the consensus voting node group.
[0118] Read the voting results of the historical consensus votes of the consensus voting node group from the consensus nodes of the blockchain, and then obtain the voted nodes in each consensus vote in the historical consensus votes from them.
[0119] S6: Based on the voted nodes in each consensus vote in the historical consensus votes, determine a set of target consensus nodes for suspected consistent consensus votes in the consensus voting node group, where the set of target consensus nodes includes at least two consensus nodes in the consensus voting node group.
[0120] Count the voted nodes in each consensus vote in the historical consensus votes, so as to obtain the un - voted nodes in each consensus vote in the historical consensus votes.
[0121] For legal transaction blocks, the consensus nodes that do not vote multiple times in the consensus voting node group can be counted. For illegal transaction blocks, the consensus nodes that vote multiple times in the consensus voting node group can be counted.
[0122] According to the preset consensus voting consistency conditions and the statistical results of the voted nodes of the legal transaction blocks and / or illegal transaction blocks, multiple consensus nodes with voting consistency can be determined to construct a target consensus node set.
[0123] S7: Reduce the weight of each consensus node in the target consensus node set.
[0124] Since the sum of the weights of all consensus nodes in the target consensus node set can represent the influence of the target consensus node set on the consensus vote, and the number of historical voting consistency of all consensus nodes in the target consensus node set can represent the influence on the consensus vote, for all consensus nodes in the target consensus node set, the weight of each consensus node in the target consensus node set can be reduced according to the sum of the weights of all consensus nodes and the number of historical voting consistency of all consensus nodes.
[0125] This embodiment is applicable to the following consensus voting scenarios: each consensus node in the consensus voting node group is selected from the candidate consensus node set of the blockchain system. Among them, the consensus architecture of the blockchain system is a scalable consensus architecture, that is, the number of consensus nodes in the candidate consensus node set is scalable.
[0126] In this consensus voting scenario, if all consensus nodes in the consensus voting node group have the same weight (for example, each consensus node has only one vote, and whether the vote is passed is determined only based on the numerical relationship between the number of votes received and the total number of votes in each consensus vote), there may be a malicious consensus node that is split into multiple consensus nodes in an attempt to increase its influence in the consensus vote.
[0127] In this consensus voting scenario, the consensus method of the disclosed embodiment can achieve the following effects: if a malicious consensus node is split into multiple consensus nodes to participate in the consensus voting, if it is detected that the voting behavior of the multiple consensus nodes after the malicious consensus node is split meets the consensus voting consistency condition, then the weights of all consensus nodes in the multiple consensus nodes after the malicious consensus node is split are reduced, thereby reducing the influence of the multiple consensus nodes after the malicious consensus node is split on whether each consensus vote is passed.
[0128] In this embodiment, for the voted nodes in each consensus vote in the historical consensus votes of the consensus voting node group, a target consensus node set that has voting consistency and affects the fairness of the consensus voting can be determined. By reducing the weight of each consensus node in the target consensus node set, the fairness of the consensus voting can be guaranteed, which helps to reduce the impact of multiple malicious nodes on the consensus voting through consistent voting.
[0129] Figure 6FIG. 5 is a flow chart of step S6 in some embodiments of the present disclosure. Figure 6 As shown, step S6 may include the following steps:
[0130] S6-1: Based on the voted nodes of each consensus vote in the historical consensus vote, determine whether there are M consensus nodes in the historical consensus vote with the same voting results in N consecutive consensus votes. Wherein, M and N are both integers greater than 2, and the voting results of the consensus vote include voted and not voted.
[0131] The nodes that have voted for each consensus vote in the historical consensus vote can be counted, and the nodes that have not voted for each consensus vote in the historical consensus vote can be counted.
[0132] In an optional example of the present disclosure, the consistency voting condition may include that the voting results of multiple nodes in N consecutive consensus votes are the same. By counting the historical consensus votes, it is possible to determine whether multiple consensus nodes in the consensus voting node group in the historical consensus votes have voted consistently.
[0133] S6-2: In response to the fact that there are M consensus nodes in the historical consensus voting with the same voting results in N consecutive consensus votings, a consensus node set consisting of the M consensus nodes is determined as a target consensus node set.
[0134] If in the historical consensus voting, there are M consensus nodes with the same voting results in N consecutive consensus votings, then the M consensus nodes are determined to be suspected consistent voting. At this time, the consensus node set consisting of the M consensus nodes can be determined as the target consensus node set, so that the influence of malicious nodes on consensus voting can be reduced by reducing the weight of each consensus node in the target consensus node set.
[0135] Figure 7 FIG. 1 is a block diagram of a consensus device in some embodiments of the present disclosure. Figure 7 As shown, the consensus device includes:
[0136] An acquisition module 100 is used to obtain the voting result of at least one consensus vote by the consensus voting node group on the consensus block;
[0137] A first determination module 200, configured to determine, based on the voting result, the sum of the weights of the voted nodes in each consensus vote of at least one consensus vote;
[0138] A second determination module 300 is used to determine whether each consensus vote is passed based on the sum of the weights of the voted nodes in each consensus vote and the sum of the weights of all consensus nodes in the consensus voting node group;
[0139] The third determination module 400 is used to determine that the consensus of the consensus block has passed in response to each consensus vote being passed.
[0140] In some embodiments of the present disclosure, the first determination module 200 is used to determine the voted nodes in each consensus vote based on the voting results; the first determination module 200 is also used to determine the sum of the weights of the voted nodes in each consensus vote based on the voted nodes in each consensus vote and the weights of each consensus node in the consensus voting node group.
[0141] Figure 8 FIG. 1 is a structural block diagram of a consensus device in some other embodiments of the present disclosure. Figure 8 As shown, the consensus device also includes:
[0142] The node weight setting module 500 is used to determine the weight of each consensus node based on the reputation value and pledge equity information of each consensus node.
[0143] In some embodiments of the present disclosure, the node weight setting module 500 is used to determine the first reputation value of each consensus node based on the enterprise information of each consensus node; the node weight setting module 500 is also used to determine the second reputation value of each consensus node based on the historical consensus voting information and historical block information of each consensus node; the node weight setting module 500 is also used to determine the reputation value of each consensus node based on the first reputation value of each consensus node and the second reputation value of each consensus node.
[0144] In some embodiments of the present disclosure, the second determination module 300 is used to determine that the consensus vote has passed in each consensus vote in response to the sum of the weights of the voted nodes being greater than the product of the sum of the weights and a preset constant, where 0<preset constant<1.
[0145] Fig. 9 FIG. 1 is a structural block diagram of a consensus device in some other embodiments of the present disclosure. Fig. 9 As shown, the consensus device also includes:
[0146] The historical consensus voting statistics module 600 is used to obtain the voted nodes for each consensus vote in the historical consensus voting of the consensus voting node group;
[0147] A voting consistency determination module 700 is used to determine a target consensus node set for suspected consistent consensus voting in a consensus voting node group based on the voted nodes of each consensus vote in the historical consensus vote, wherein the target consensus node set includes at least two consensus nodes in the consensus voting node group;
[0148] Among them, the node weight setting module 500 is also used to reduce the weight of each consensus node in the target consensus node set.
[0149] In some embodiments of the present disclosure, the voting consistency determination module 700 is used to determine whether there are M consensus nodes in the historical consensus voting with the same voting results in N consecutive consensus votes based on the voted nodes of each consensus vote in the historical consensus voting, wherein M and N are both integers greater than 2, and the voting results of the consensus voting include voted and not voted; the voting consistency determination module 700 is also used to determine the consensus node set consisting of M consensus nodes as the target consensus node set in response to the existence of M consensus nodes in the historical consensus voting with the same voting results in N consecutive consensus votes.
[0150] It should be noted that the specific implementation of the consensus device of the embodiment of the present disclosure is similar to the specific implementation of the consensus method of the embodiment of the present disclosure. Please refer to the description of the consensus method part for details. The technical effect of the consensus device of the embodiment of the present disclosure is similar to the technical effect of the consensus method of the embodiment of the present disclosure. In order to reduce redundancy, they are not repeated here.
[0151] The present disclosure also provides a blockchain system, including:
[0152] The consensus voting node group is used to reach consensus through the consensus method described in any of the above embodiments.
[0153] In addition, an embodiment of the present disclosure further provides an electronic device, including:
[0154] Memory for storing computer programs;
[0155] A processor is used to execute the computer program stored in the memory, and when the computer program is executed, the consensus method described in any of the above embodiments of the present disclosure is implemented.
[0156] Below, reference Fig.10 To describe the electronic device according to the embodiment of the present disclosure. Fig.10 As shown, the electronic device includes one or more processors and memory.
[0157] The processor may be a central processing unit (CPU) or other forms of processing units having data processing capabilities and / or instruction execution capabilities, and may control other components in the electronic device to perform desired functions.
[0158] The memory may store one or more computer program products, and the memory may include various forms of computer-readable storage media, such as volatile memory and / or non-volatile memory. The volatile memory may include, for example, a random access memory (RAM) and / or a cache memory (cache), etc. The non-volatile memory may include, for example, a read-only memory (ROM), a hard disk, a flash memory, etc. One or more computer program products may be stored on the computer-readable storage medium, and the processor may run the computer program product to implement the consensus method of each embodiment of the present disclosure described above and / or other desired functions.
[0159] In one example, the electronic device may further include: an input device and an output device, and these components are interconnected via a bus system and / or other forms of connection mechanisms (not shown).
[0160] In addition, the input device may also include, for example, a keyboard, a mouse, and the like.
[0161] The output device can output various information to the outside, including determined distance information, direction information, etc. The output device can include, for example, a display, a speaker, a printer, a communication network and a remote output device connected thereto, and the like.
[0162] Of course, to simplify, Fig.10 Only some of the components related to the present disclosure in the electronic device are shown, and components such as a bus, an input / output interface, etc. are omitted. In addition, according to specific application situations, the electronic device may further include any other appropriate components.
[0163] In addition to the above-mentioned methods and devices, an embodiment of the present disclosure may also be a computer program product, which includes computer program instructions, which, when executed by a processor, enable the processor to execute the steps of the consensus method according to various embodiments of the present disclosure described in the above part of this specification.
[0164] The computer program product may be written in any combination of one or more programming languages to write program code for performing the operations of the disclosed embodiments, including object-oriented programming languages such as Java, C++, etc., and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user device, as a separate software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server.
[0165] In addition, an embodiment of the present disclosure may also be a computer-readable storage medium on which computer program instructions are stored. When the computer program instructions are executed by a processor, the processor executes the steps of the consensus method according to various embodiments of the present disclosure described in the above part of this specification.
[0166] The computer readable storage medium can adopt any combination of one or more readable media. The readable medium can be a readable signal medium or a readable storage medium. The readable storage medium can include, for example, but is not limited to, a system, device or device of electricity, magnetism, light, electromagnetic, infrared, or semiconductor, or any combination of the above. More specific examples (non-exhaustive list) of readable storage media include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.
[0167] The basic principles of the present disclosure are described above in conjunction with specific embodiments. However, it should be noted that the advantages, strengths, effects, etc. mentioned in the present disclosure are only examples and not limitations, and it cannot be considered that these advantages, strengths, effects, etc. are required by each embodiment of the present disclosure. In addition, the specific details disclosed above are only for the purpose of illustration and ease of understanding, and are not limitations. The above details do not limit the present disclosure to the necessity of adopting the above specific details to be implemented.
[0168] Each embodiment in this specification is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the system embodiment, since it basically corresponds to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0169] The block diagrams of the devices, apparatuses, equipment, and systems involved in this disclosure are only illustrative examples and are not intended to require or imply that they must be connected, arranged, and configured in the manner shown in the block diagrams. As will be appreciated by those skilled in the art, these devices, apparatuses, equipment, and systems can be connected, arranged, and configured in any manner. Words such as "including," "comprising," "having," and the like are open words, referring to "including but not limited to," and can be used interchangeably therewith. The words "or" and "and" used herein refer to the words "and / or," and can be used interchangeably therewith, unless the context clearly indicates otherwise. The word "such as" used herein refers to the phrase "such as but not limited to," and can be used interchangeably therewith.
[0170] The method and apparatus of the present disclosure may be implemented in many ways. For example, the method and apparatus of the present disclosure may be implemented by software, hardware, firmware, or any combination of software, hardware, and firmware. The above order of steps for the method is for illustration only, and the steps of the method of the present disclosure are not limited to the order specifically described above, unless otherwise specifically stated. In addition, in some embodiments, the present disclosure may also be implemented as a program recorded in a recording medium, which includes machine-readable instructions for implementing the method according to the present disclosure. Therefore, the present disclosure also covers a recording medium storing a program for executing the method according to the present disclosure.
[0171] It should also be noted that in the apparatus, device and method of the present disclosure, each component or each step can be decomposed and / or recombined. Such decomposition and / or recombination should be regarded as equivalent solutions of the present disclosure.
[0172] The above description of the disclosed aspects is provided to enable any person skilled in the art to make or use the present disclosure. Various modifications to these aspects will be readily apparent to those skilled in the art, and the general principles defined herein may be applied to other aspects without departing from the scope of the present disclosure. Therefore, the present disclosure is not intended to be limited to the aspects shown herein, but rather to the widest scope consistent with the principles and novel features disclosed herein.
[0173] The above description has been given for the purpose of illustration and description. In addition, this description is not intended to limit the embodiments of the present disclosure to the forms disclosed herein. Although multiple example aspects and embodiments have been discussed above, those skilled in the art will recognize certain variations, modifications, changes, additions and sub-combinations thereof.
Claims
1. A consensus method, characterized in that: include: Obtain the voting results of the consensus voting node group for at least one consensus vote on the consensus block; Determining, based on the voting result, a sum of weights of the voted nodes in each consensus vote of the at least one consensus vote; Determining whether each consensus vote is passed based on the sum of the weights of the voted nodes in each consensus vote and the sum of the weights of all consensus nodes in the consensus voting node group; In response to each consensus vote being passed, it is determined that the consensus on the block to be agreed upon is passed.
2. The method according to claim 1, characterized in that The determining, based on the voting result, the sum of the weights of the voted nodes in each consensus vote of the at least one consensus vote comprises: Based on the voting results, determine the voted nodes in each consensus vote; Based on the voted nodes in each consensus vote and the weights of each consensus node in the consensus voting node group, the sum of the weights of the voted nodes in each consensus vote is determined.
3. The method according to claim 2, characterized in that Before obtaining the voting result of at least one consensus vote by the consensus voting node group on the consensus block, the method further includes: Based on the reputation value and pledge equity information of each consensus node, the weight of each consensus node is determined.
4. The method according to claim 3, characterized in that Before determining the weight of each consensus node based on the reputation value and pledged equity information of each consensus node, the method further includes: Determine a first reputation value of each consensus node based on the enterprise information of each consensus node; Determine a second reputation value of each consensus node based on historical consensus voting information and historical block information of each consensus node; Based on the first reputation value of each consensus node and the second reputation value of each consensus node, the reputation value of each consensus node is determined.
5. The method according to any one of claims 1 to 4, characterized in that: The determining whether each consensus vote is passed based on the sum of the weights of the voted nodes in each consensus vote and the sum of the weights of all consensus nodes in the consensus voting node group includes: In each consensus vote, in response to the sum of the weights of the voted nodes being greater than the product of the sum of the weights and a preset constant, it is determined that the consensus vote is passed, where 0<the preset constant<1.
6. The method according to claim 5, characterized in that Also includes: Obtaining the voted nodes for each consensus vote in the historical consensus votes of the consensus voting node group; Determine a target consensus node set for suspected consistent consensus voting in the consensus voting node group based on the voted nodes of each consensus vote in the historical consensus vote, wherein the target consensus node set includes at least two consensus nodes in the consensus voting node group; Reduce the weight of each consensus node in the target consensus node set.
7. The method according to claim 6, characterized in that The determining of a target consensus node set for suspected consistent consensus voting in the consensus voting node group based on the voted nodes for each consensus vote in the historical consensus vote includes: Based on the voted nodes of each consensus vote in the historical consensus vote, determining whether there are M consensus nodes in the historical consensus vote with the same voting results in N consecutive consensus votes, where M and N are both integers greater than 2, and the voting results of the consensus vote include voted and not voted; In response to the fact that there are M consensus nodes in the historical consensus voting that have the same voting results in N consecutive consensus votings, a consensus node set consisting of the M consensus nodes is determined as the target consensus node set.
8. A consensus device, characterized in that: include: An acquisition module is used to obtain the voting results of the consensus voting node group for at least one consensus vote on the consensus block; A first determination module, configured to determine, based on the voting result, a sum of weights of voted nodes in each consensus vote of the at least one consensus vote; A second determination module is used to determine whether each consensus vote is passed based on the sum of the weights of the voted nodes in each consensus vote and the sum of the weights of all consensus nodes in the consensus voting node group; The third determination module is used to determine that the consensus on the block to be agreed upon is passed in response to each consensus vote being passed.
9. A blockchain system, characterized in that: include: A consensus voting node group, used to reach consensus through any method described in claims 1-7.
10. An electronic device, characterized in that: include: a memory for storing a computer program product; A processor is used to execute the computer program product stored in the memory, and when the computer program product is executed, it implements the method described in any one of claims 1 to 7.
11. A computer-readable storage medium having computer program instructions stored thereon, characterized in that: When the computer program instructions are executed by a processor, the method described in any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Power transaction method and device based on PBFT algorithm, equipment and medium
CN115204899A