Block chain consensus method and device

Through the two-stage election and reputation value mechanism, the problem of low efficiency of malicious node tampering and elimination in the blockchain system is solved, the stability and security of the system are improved, and the accuracy and decentralized characteristics of the accounting information are ensured.

CN119276561APending Publication Date: 2025-01-07JD DIGITS HAIYI INFORMATION TECHNOLOGY CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411351632.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-26
Publication Date
2025-01-07

AI Technical Summary

Technical Problem

The illegal tampering and elimination of malicious nodes in the blockchain system is inefficient, resulting in bookkeeping information fallback and transaction information loss, affecting system stability and security.

Method used

The two-stage election mechanism is adopted, firstly, the primary accounting nodes are elected according to the number of network nodes. In the second stage, the accounting nodes are elected through reputation values ​​and voting mechanisms, and insurance mechanisms and incentive mechanisms are introduced to reduce the reputation values ​​of malicious nodes and eliminate malicious intentions. node.

Benefits of technology

It improves the stability and security of nodes in the network, ensures the accuracy and completeness of accounting information, reduces the impact of malicious nodes, and improves the decentralized characteristics of the system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119276561A_ABST
    Figure CN119276561A_ABST
Patent Text Reader

Abstract

The embodiment of the invention discloses a block chain consensus method and device. The specific embodiment of the method comprises the following steps: grouping nodes participating in consensus in a block chain; primary accounting nodes are voted in each group, and a primary accounting node set is formed; and voting from the primary bookkeeping node set to elect bookkeeping nodes. According to the embodiment, the influence of the nodes in the rights and interests set on the system is reduced in a grouping election mode, and the operation efficiency of the system is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

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

[0002] Blockchain systems are similar to traditional distributed systems, and both have problems such as transmission delay, damage, loss, and tampering. In addition, the decentralized nature of blockchains can cause nodes in the network to maliciously tamper with node data due to trust issues. If a malicious node in the blockchain system illegally tampers with the transaction information of the accounting block, it will be verified by its verification node, and then it will be detected that there is a problem with the packaged data. The impact of this malicious behavior is that the information of the current block accounting will be rolled back, and the transaction information of the entire block will be lost. Therefore, a consensus algorithm that can efficiently detect malicious nodes and efficiently eliminate malicious nodes is very important. Summary of the invention

[0003] The embodiments of the present disclosure provide a blockchain consensus method and device.

[0004] In a first aspect, an embodiment of the present disclosure provides a blockchain consensus method, comprising: grouping nodes participating in consensus in a blockchain; voting to elect primary accounting nodes in each group to form a primary accounting node set; and voting to elect an accounting node from the primary accounting node set.

[0005] In some embodiments, voting to elect a bookkeeping node from the set of primary bookkeeping nodes includes: counting the number of negative votes received by the primary bookkeeping node; and revoking the bookkeeping rights of the primary bookkeeping nodes whose number of negative votes is greater than a predetermined threshold.

[0006] In some embodiments, the method also includes: broadcasting at least one of the following node states in the blockchain: good state, normal state, malicious state; and voting to elect a bookkeeping node from the set of primary bookkeeping nodes, including: querying the node state of the primary bookkeeping node, wherein the node state is adjusted according to the reputation value of the node; and voting to elect a bookkeeping node from the set of primary bookkeeping nodes according to the node state.

[0007] In some embodiments, the method further includes: updating the reputation value of the node according to the voting result; in response to detecting that the reputation value of the updated node reaches a state change threshold, converting the node state of the updated node.

[0008] In some embodiments, the method further comprises: in response to detecting that the reputation value of the updated node exceeds a predetermined reset threshold, resetting the reputation value of the updated node to an initial value.

[0009] In some embodiments, the method also includes: setting the weight of the number of support votes and the weight of the number of opposition votes according to the reputation value of the primary accounting node; calculating the weighted sum of the number of support votes, the number of opposition votes and the reputation value of the primary accounting node as the voting score of the primary accounting node, wherein the weight of the number of support votes is a positive number, the weight of the number of opposition votes is a negative number, the difference between the weight of the number of support votes and the weight of the number of opposition votes is a first fixed positive value, the higher the reputation value, the greater the weight of the number of support votes, and the weight of the reputation value is a second fixed positive value; selecting a predetermined number of primary accounting nodes as accounting nodes in descending order of voting scores.

[0010] In some embodiments, the reputation value of the node is updated according to the voting results, including: increasing the reputation value of the node that votes in favor of the primary accounting node in a good state or votes against the primary accounting node in a malicious state; and reducing the reputation value of the node that abstains from voting or is offline for a predetermined timeout threshold.

[0011] In some embodiments, the method further includes: selecting a predetermined number of standby accounting nodes from the primary accounting node set in descending order of the number of support tickets.

[0012] In a second aspect, an embodiment of the present disclosure provides a blockchain consensus device, comprising: a grouping unit, configured to group nodes participating in consensus in the blockchain; a first election unit, configured to vote for primary accounting nodes in each group and form a primary accounting node set; a second election unit, configured to vote for accounting nodes from the primary accounting node set.

[0013] In some embodiments, the second election unit is further configured to: count the number of negative votes received by the primary accounting node; and revoke the accounting rights of the primary accounting nodes whose number of negative votes is greater than a predetermined threshold.

[0014] In some embodiments, the device also includes a broadcast unit configured to: broadcast at least one of the following node states in the blockchain: good state, normal state, malicious state; and the second election unit is further configured to: query the node state of the primary accounting node, wherein the node state is adjusted according to the reputation value of the node; and vote to elect an accounting node from the set of primary accounting nodes according to the node state.

[0015] In some embodiments, the device also includes an updating unit configured to: update the reputation value of the node according to the voting result; and convert the node state of the updated node in response to detecting that the reputation value of the updated node reaches a state change threshold.

[0016] In some embodiments, the apparatus further comprises a resetting unit configured to: in response to detecting that the reputation value of the updated node exceeds a predetermined reset threshold, reset the reputation value of the updated node to an initial value.

[0017] In some embodiments, the second election unit is further configured to: set the weight of the number of support votes and the weight of the number of opposition votes according to the reputation value of the primary accounting node; calculate the weighted sum of the number of support votes, the number of opposition votes and the reputation value of the primary accounting node as the voting score of the primary accounting node, wherein the weight of the number of support votes is a positive number, the weight of the number of opposition votes is a negative number, the difference between the weight of the number of support votes and the weight of the number of opposition votes is a first fixed positive value, the higher the reputation value, the greater the weight of the number of support votes, and the weight of the reputation value is a second fixed positive value; select a predetermined number of primary accounting nodes as accounting nodes in descending order of voting scores.

[0018] In some embodiments, the updating unit is further configured to include: increasing the reputation value of a node that votes in favor of a primary accounting node in a good state or a node that votes against a primary accounting node in a malicious state; and reducing the reputation value of a node that abstains from voting or is offline for a period of time that reaches a predetermined timeout threshold.

[0019] In some embodiments, the apparatus further comprises a backup unit configured to: select a predetermined number of backup accounting nodes from the primary accounting node set in descending order of the number of support tickets.

[0020] In a third aspect, an embodiment of the present disclosure provides an electronic device, comprising: one or more processors; a storage device on which one or more computer programs are stored, and when the one or more computer programs are executed by the one or more processors, the one or more processors implement a method as described in any one of the first aspect or the second aspect.

[0021] In a fourth aspect, an embodiment of the present disclosure provides a computer-readable medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the method as described in any one of the first aspect or the second aspect is implemented.

[0022] In a fifth aspect, an embodiment of the present disclosure provides a computer program product, including a computer program, which implements the method as described in any one of the first aspect or the second aspect when executed by a processor.

[0023] The blockchain consensus method and device provided by the embodiments of the present disclosure are improved on the basis of the existing consensus mechanism, and the election process of the accounting node is divided into two stages of election. In the first stage of the accounting node election, the nodes in the network are first grouped according to the actual number of participating nodes in the network. Then, the primary accounting nodes of the first stage are elected in the group using the conventional node election method. This group election method can minimize the impact between groups. Through the candidate node election in the first stage, a batch of high-quality primary accounting nodes have been obtained. In the second stage of the election, all candidate nodes in the network can have a similar probability of becoming accounting nodes, making the entire network more stable and more secure.

[0024] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it intended to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0025] Other features, objects and advantages of the present disclosure will become more apparent from the detailed description of non-limiting embodiments made with reference to the following drawings:

[0026] Figure 1 is an exemplary system architecture diagram in which an embodiment of the present disclosure may be applied;

[0027] Figure 2 is a flow chart of an embodiment of a blockchain consensus method according to the present disclosure;

[0028] Figure 3a-3e is a schematic diagram of an application scenario of the blockchain consensus method according to the present disclosure;

[0029] Figure 4 It is a structural schematic diagram of an embodiment of a blockchain consensus device according to the present disclosure;

[0030] Figure 5 It is a structural diagram of a computer system of an electronic device suitable for implementing an embodiment of the present disclosure. DETAILED DESCRIPTION

[0031] The present disclosure is further described in detail below in conjunction with the accompanying drawings and embodiments. It is understood that the specific embodiments described herein are only used to explain the relevant invention, rather than to limit the invention. It is also necessary to explain that, for ease of description, only the parts related to the relevant invention are shown in the accompanying drawings.

[0032] It should be noted that, in the absence of conflict, the embodiments and features in the embodiments of the present disclosure may be combined with each other. The present disclosure will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.

[0033] Figure 1 An exemplary system architecture 100 to which an embodiment of a blockchain consensus method or a blockchain consensus device of the present disclosure may be applied is shown.

[0034] like Figure 1 As shown, the system architecture 100 may include a local terminal 101, a node 102, a third-party server 103, and a consensus terminal 104. The local terminal 101, the node 102, the third-party server 103, and the consensus terminal 104 communicate with each other through a network. The network may include various connection types, such as wired, wireless communication links, or optical fiber cables, etc.

[0035] The user can make the local terminal 101 interact with the node 102, the third-party server 103 and the consensus terminal 104 through the network to receive or send messages, etc. Various communication client applications can be installed on the local terminal 101 and the consensus terminal, such as web browser applications, shopping applications, search applications, instant messaging tools, email clients, social platform software, etc.

[0036] The local terminal 101 and the consensus terminal 104 can be hardware or software. When the local terminal 101 and the consensus terminal 104 are hardware, they can be various electronic devices that support consensus requests. Any terminal device connected to a node can be used as the local terminal 101, that is, the local terminal 101 and the consensus terminal 104 are interchangeable. A user can actively initiate a consensus request through a terminal, or a third-party server can control each node to initiate a consensus request.

[0037] Nodes A, B, C, and D belong to the same organization. Transactions within the organization are visible. Nodes A, B, C, and D can execute the same transaction respectively. Users can initiate a consensus request through the local terminal 101, and then the consensus users vote through the terminal 104 to determine whether the transaction result is correct.

[0038] The blockchain system consists of a data layer, a network layer, a consensus layer, an incentive layer, a contract layer, and an application layer. The consensus layer mainly encapsulates various consensus algorithms of network nodes (i.e., nodes). Through the voting of nodes, the verification and confirmation of transactions are completed in a very short time. For a transaction, if the number of valid evidence reaches a certain threshold, such as more than two-thirds of the nodes of the organization can reach a consensus, we can assume that the entire network can also reach a consensus on this.

[0039] It should be noted that a node can be implemented as a distributed server cluster consisting of multiple servers, or as a single server.

[0040] The third-party server 103 can provide node management functions, such as adding / deleting nodes, allocating keys, etc.

[0041] It should be noted that the blockchain consensus method provided in the embodiments of the present disclosure is generally executed by node 102, and any node in the organization can initiate a consensus request. Accordingly, the blockchain consensus device is generally set in node 102.

[0042] It should be understood that Figure 1 The number of local terminals, nodes, third-party servers, and consensus terminals in the example is only illustrative. Any number of local terminals, nodes, third-party servers, and consensus terminals may be provided as required.

[0043] Continue to refer Figure 2 , shows a process 200 of an embodiment of a blockchain consensus method according to the present disclosure. The blockchain consensus method comprises the following steps:

[0044] Step 201, grouping the nodes participating in the consensus in the blockchain.

[0045] In this embodiment, the execution entity of the blockchain consensus method (e.g. Figure 1 The third-party server shown in the figure can group the nodes in the network according to the number of nodes actually participating in the consensus. This group election method can minimize the impact between groups. The group election diagram is shown in Figure 3a shown.

[0046] Step 202: vote to elect primary accounting nodes in each group and form a primary accounting node set.

[0047] In this embodiment, any of the following consensus algorithms may be used to perform the first phase of accounting node election within each group.

[0048] POW: Proof of Work consensus algorithm.

[0049] POS: Proof of Stake consensus algorithm.

[0050] DPOS: Delegated Proof of Stake consensus algorithm.

[0051] POC: Proof of Space Capacity consensus algorithm.

[0052] POET: An elapsed time consensus mechanism based on Intel SGX trusted hardware. Each node gets a random waiting time from the trusted SGX environment, and this waiting time is inversely proportional to the resources you contribute to the network, that is, the more resources you contribute, the shorter the random waiting time you get, and the easier it is to generate blocks.

[0053] Preferably, DPOS is used for the first stage election.

[0054] Step 203: vote to elect a bookkeeping node from the primary bookkeeping node set.

[0055] In this embodiment, if Figure 3a As shown, the second stage of election is carried out. The second stage of election can also use any of the consensus algorithms described above. The two stages can use the same consensus algorithm or different consensus algorithms. The combination of two different consensus algorithms can make up for the shortcomings of each algorithm.

[0056] The method provided by the above embodiment of the present disclosure has obtained a batch of high-quality primary accounting nodes through the first stage of candidate node election. In the second stage of election, all candidate nodes in the network have a similar probability of becoming accounting nodes, making the entire network more stable and more secure.

[0057] In some optional implementations of this embodiment, before voting to elect an accounting node from the set of primary accounting nodes, the method also includes: counting the number of negative votes received by the primary accounting nodes; and revoking the accounting rights of the primary accounting nodes whose number of negative votes is greater than a predetermined threshold.

[0058] This is the insurance mechanism designed by this application. The insurance mechanism is to solve the problem of slow deletion of malicious nodes in traditional consensus algorithms (such as DPOS). In the election of unimproved consensus algorithms, the randomness of node voting is very large. Generally, they vote based on the degree of trust in their own nodes, and generally vote for the nodes they trust the most. In addition, traditional consensus algorithms can only vote in favor of nodes they recognize, and cannot vote against malicious nodes. This is also one of the reasons why malicious nodes are not removed in time. In addition, since the traditional consensus algorithm has a long round of elections, this also leads to slow removal of malicious nodes. In response to the above problems, an insurance mechanism is added to this solution. When a node realizes that there are malicious nodes in the election node, it can vote against it, which will reduce the reputation value of the node. When the reputation value reaches the threshold, the insurance mechanism will be triggered immediately, forcibly releasing the node's accounting rights and reducing the node's credit status. These operations do not need to wait until the next round of node elections begins. The calculation formula for triggering the insurance mechanism is:

[0059] Threshold = C × TotalVotes

[0060] totalVotes is the total number of votes; C is the insurance coefficient, which can be adjusted according to the operation needs of the blockchain system. The value range is usually between (0, 0.5]. For blockchain systems with higher security requirements, the insurance coefficient can be reduced.

[0061] When a node casts a negative vote against another node, the action will be broadcast to the entire network. The system will monitor and check the credit status of the node. When the number of negative votes reaches the threshold, the insurance mechanism will be triggered to revoke the accounting rights of the node.

[0062] If the review finds that the insurance threshold is not reached, the system will continue to detect until the insurance mechanism is executed or the next round of elections is completed. The insurance mechanism flow chart is described as follows: Figure 3b shown.

[0063] In some optional implementations of this embodiment, the method also includes: broadcasting at least one of the following node states in the blockchain: good state, normal state, malicious state; and voting to elect a bookkeeping node from the set of primary bookkeeping nodes, including: querying the node state of the primary bookkeeping node, wherein the node state is adjusted according to the reputation value of the node; and voting to elect a bookkeeping node from the set of primary bookkeeping nodes according to the node state.

[0064] Analyzing the malicious behaviors of malicious nodes in the blockchain system, such as tampering with block information, generating invalid blocks, and forking, this solution proposes concepts such as node reputation value, node status, and reputation coefficient, and adds basic attributes such as reputation value and node status to each node. These attributes will affect the results of each voting election. The purpose is to make good nodes with high reputation values ​​have a greater chance of becoming accounting nodes, and reduce the possibility of general nodes or malicious nodes with low reputation values ​​becoming accounting nodes. And rewards nodes that correctly exercise accounting rights through reputation values, so that nodes are more active in voting.

[0065] This scheme adds a new attribute to all nodes - reputation. The system starts to set an initial reputation value for all nodes, for example, 100 points. The reputation value quantification standard and the upper limit of reputation value accumulation in this scheme are experimental reasonable values ​​derived from theoretical analysis. When applied to a specific environment, they need to be set separately according to the operation needs of the system. In this scheme, if a node is successfully elected as a bookkeeping node, and successfully generates a new block and is verified by other nodes, the system will increase the reputation value of this bookkeeping node by 10 points. The initial setting is that only correct bookkeeping and block generation will receive reputation value rewards; if the block generated by the bookkeeping node fails to pass the verification of other nodes and is judged to be an invalid block, the node reputation value will be deducted by 10 points. The following is an incentive mechanism for negative votes against malicious nodes, which can also receive reputation value rewards. The reputation value of a node gradually accumulates. The scheme sets that when the accumulated reputation value is greater than or equal to 200 points, the reputation value reset will be triggered.

[0066] According to the reputation points of each node, the reputation value interval status is set. This solution sets three node states: Normal (normal state), Good (good state), and Bad (malicious state).

[0067] Normal: Nodes with a reputation value within [100, 150], which are normal, have no accounting performance, or are newly registered nodes;

[0068] Good: Nodes with a reputation value within (150, 200] have good accounting performance, or have poor performance, but good behavior outweighs malicious behavior;

[0069] Bad: Nodes with a reputation value in the range of [0, 100). The node performance is poor, with more malicious behaviors than good behaviors, or the node is less active and is offline for a long time.

[0070] The nodes participating in the consensus can know the status of the voted nodes from the broadcast, and will vote in favor of nodes in good status and vote against nodes in malicious status. The node with the most votes becomes the accounting node.

[0071] In some optional implementations of this embodiment, the method further includes: updating the reputation value of the node according to the voting result; in response to detecting that the reputation value of the updated node reaches a state change threshold, converting the node state of the updated node.

[0072] The node status is divided according to the node's reputation points. When the corresponding point interval is reached, the node status of the corresponding interval is changed. The interval of 50 reputation points is divided according to the scheme's plus or minus reputation points. Strictly speaking, the node plus or minus points are in a certain proportion to the system's state transition interval value. The selection of interval scores needs to be set according to the system plus or minus points and the node scale. If the interval score is set large, the time for the node to obtain the accounting right will be too long, which will dispel the node's enthusiasm for obtaining the accounting right to a certain extent. In addition, due to the large state transition interval score, malicious nodes need more malicious behaviors before the system lowers their status, which is more harmful to the system; if the interval score is set small, it will cause the node's status to switch frequently, reduce system stability, waste system computing power, and increase system pressure. Therefore, the selection of the state interval score needs to select an appropriate value according to the system rules.

[0073] Node status changes such as Figure 3cAs shown. When the behavior of a node causes harm or adverse effects on the operation of the system, the state of the node may change according to the node reputation value. At the beginning, all nodes in the system are in the Normal state. When the behavior of the node promotes the operation of the system, the node changes its state when the reputation value of the node reaches the node state change threshold according to the system reputation value calculation rules. For example, a node in the Normal state: if invalid blocks are generated multiple times, it will be converted to the Bad state; if valid blocks are generated, it will be converted to the Good state. A node in the Good state: if invalid blocks are generated or the reputation value reaches the threshold, it will be converted to the Normal state; if invalid blocks are generated multiple times, it will be converted to the Bad state. A node in the Bad state: if valid blocks are generated, it will be converted to the Normal state.

[0074] In some optional implementations of this embodiment, the method further includes: in response to detecting that the reputation value of the updated node exceeds a predetermined reset threshold, resetting the reputation value of the updated node to an initial value.

[0075] If the node continues to perform well, according to the settings of this plan, the node's reputation value will continue to rise. Since the node's reputation value has a greater impact on the election during the election process, an excessively high reputation value will cause the node to easily obtain the right to keep accounts, which will lead to the problem of network centralization, violating the decentralized nature of blockchain. Therefore, in response to this situation, this plan is set up so that the system will detect the node's reputation value points after each round of elections. For example, when the node's reputation value reaches 200, the system will reset the node's reputation value to normal.

[0076] The credit value transfer process is as follows: Figure 3d As shown. In the traditional consensus mechanism, the election of nodes is completely based on the random selection of nodes by nodes based on their own vision. After adding the credit mechanism in this scheme, each node has a status flag. When participating in the election of candidate nodes, the node status is public. Therefore, when voting in the election, nodes can choose high-quality nodes with a node status of good to vote, because nodes in the good state have performed well many times in the consensus of the network, which also provides a voting basis for the election of nodes. In addition, nodes with high node reputation values ​​have more advantages in the election process, which is mainly determined by the credit coefficient below.

[0077] In some optional implementations of this embodiment, the accounting node is elected from the primary accounting node set by voting according to the node status, including: setting the weight of the number of support votes and the weight of the number of opposition votes according to the reputation value of the primary accounting node; calculating the weighted sum of the number of support votes, the number of opposition votes and the reputation value of the primary accounting node as the voting score of the primary accounting node, wherein the weight of the number of support votes is a positive number, the weight of the number of opposition votes is a negative number, the difference between the weight of the number of support votes and the weight of the number of opposition votes is a first fixed positive value, the higher the reputation value, the greater the weight of the number of support votes, and the weight of the reputation value is a second fixed positive value; and selecting a predetermined number of primary accounting nodes as accounting nodes in descending order of voting scores.

[0078] The credit coefficient is an important parameter of the trust mechanism in the improvement plan. Its main function is to greatly promote the election of nodes. To a certain extent, nodes with good reputation have a greater chance of becoming accounting nodes. On the contrary, nodes with poor reputation have a lower probability of obtaining accounting rights, which improves the fairness of election results and the security of the system. The formula for calculating the number of voting rights is as follows:

[0079] Result=α×supportVotes-β×AgainstVotes+λ×CreditValue

[0080] In the formula, α and β are coefficients set according to the reputation value, and α+β=1, which is set according to system requirements. λ is the calculation coefficient of the reputation value, which is generally a fixed value and depends on the application scenario. Usually, the α of a good state node is greater than 0.67 and β is less than 0.33; the α and β of a normal state node are both 0.5; the α of a bad state node is less than 0.33 and β is greater than 0.67.

[0081] Through this mechanism, nodes with high reputation values ​​can obtain relatively fewer votes than nodes with low reputation values ​​and obtain accounting rights, thereby speeding up the efficiency of eliminating malicious nodes to a certain extent.

[0082] In some optional implementations of this embodiment, the reputation value of the node is updated according to the voting results, including: increasing the reputation value of the node that votes in favor of the primary accounting node in a good state or votes against the primary accounting node in a malicious state; and reducing the reputation value of the node that abstains from voting or is offline for a period of time that reaches a predetermined timeout threshold.

[0083] This is the voting incentive mechanism designed by this application. The incentive mechanism is mainly to mobilize the enthusiasm of nodes to vote, enhance the activity of system nodes and system stability. The original consensus mechanism lacks an incentive mechanism, resulting in low node activity and poor voting enthusiasm, which leads to fewer nodes participating in the election. This may lead to collusion between nodes to swipe votes, affecting system security.

[0084] Incentive mechanism process Figure 3e As shown. To enhance the activity of nodes, the incentive mechanism increases the reputation of nodes that correctly exercise their voting rights. For example, if a negative vote causes a malicious node to trigger the insurance mechanism, the voting node will receive a certain reputation reward. At the same time, for nodes that abandon their votes or are offline for a long time, the system will gradually reduce the reputation of the node until it becomes an ordinary node. The good behavior of the node will promote the consensus of the system, which will also make it recognized by the system and increase the probability of becoming a bookkeeping node next time. In this way, the activity of system nodes can be improved to a certain extent, the election enthusiasm of nodes can be enhanced, and the stable operation of the system can be promoted.

[0085] In some optional implementations of this embodiment, the method further includes: selecting a predetermined number of standby accounting nodes from the primary accounting node set in descending order of the number of support tickets.

[0086] The backup accounting nodes are to ensure that there will be no shortage of accounting nodes after a node in the system triggers the insurance mechanism and is removed. According to our improvement plan, after the credit mechanism and insurance mechanism algorithms run, the system will vote out malicious nodes from the accounting nodes. Since the election cycle is long, there may be a shortage of overall accounting nodes at this time, and the vacant nodes cannot be filled in time.

[0087] In order to ensure that the total number of accounting nodes is constant and the system is running stably, a list of standby accounting nodes is added in the improvement plan. After multiple group elections, the system will select x+y nodes from high to low according to the number of votes (for example, the number of votes calculated by the formula above, or the number of supporting votes), which is recorded as the set A = {a1, a2, ..., a x ,a x+1 ,…,a x+y}, where the first x nodes with the highest number of votes {a1,a2,…,a x} becomes the accounting node, and the following y nodes {a x+1 ,…,a x+y}Enter the list of backup accounting nodes and sort them by votes. When a malicious node triggers the insurance mechanism, the node with the highest number of votes among the backup accounting nodes will be promoted to the accounting node to ensure the stable operation of this round of accounting.

[0088] The list of backup accounting nodes will be updated in each formal election to ensure the activity of the backup nodes. The backup nodes are replaced in descending order according to the number of votes.

[0089] Further references Figure 4As an implementation of the methods shown in the above figures, the present disclosure provides an embodiment of a blockchain consensus device. Figure 2 Corresponding to the method embodiment shown, the device can be specifically applied to various electronic devices.

[0090] like Figure 4 As shown, the blockchain consensus device 400 of this embodiment includes: a grouping unit 401, a first election unit 402 and a second election unit 403. The grouping unit 401 is configured to group the nodes participating in the consensus in the blockchain; the first election unit 402 is configured to vote for the primary accounting nodes in each group and form a primary accounting node set; the second election unit 403 is configured to vote for the accounting nodes from the primary accounting node set.

[0091] In this embodiment, the specific processing of the grouping unit 401, the first election unit 402 and the second election unit 403 of the blockchain consensus device 400 can be referred to Figure 2 This corresponds to step 201, step 202 and step 203 in the embodiment.

[0092] In some optional implementations of this embodiment, the second election unit 403 is further configured to: count the number of negative votes received by the primary accounting node; and revoke the accounting rights of the primary accounting node whose number of negative votes is greater than a predetermined threshold.

[0093] In some optional implementations of this embodiment, the device also includes a broadcast unit (not shown in the drawings), configured to: broadcast at least one of the following node states in the blockchain: good state, normal state, malicious state; and the second election unit 403 is further configured to: query the node state of the primary accounting node, wherein the node state is adjusted according to the reputation value of the node; and vote to elect an accounting node from the set of primary accounting nodes according to the node state.

[0094] In some optional implementations of this embodiment, the device also includes an update unit (not shown in the drawings), which is configured to: update the reputation value of the node according to the voting results; in response to detecting that the reputation value of the updated node reaches a state change threshold, convert the node state of the updated node.

[0095] In some optional implementations of this embodiment, the device also includes a reset unit (not shown in the drawings), which is configured to: in response to detecting that the reputation value of the updated node exceeds a predetermined reset threshold, reset the reputation value of the updated node to an initial value.

[0096] In some optional implementations of this embodiment, the second election unit 403 is further configured to: set the weight of the number of support votes and the weight of the number of opposition votes according to the reputation value of the primary accounting node; calculate the weighted sum of the number of support votes, the number of opposition votes and the reputation value of the primary accounting node as the voting score of the primary accounting node, wherein the weight of the number of support votes is a positive number, the weight of the number of opposition votes is a negative number, the difference between the weight of the number of support votes and the weight of the number of opposition votes is a first fixed positive value, the higher the reputation value, the greater the weight of the number of support votes, and the weight of the reputation value is a second fixed positive value; select a predetermined number of primary accounting nodes as accounting nodes in descending order of voting scores.

[0097] In some optional implementations of this embodiment, the update unit is further configured to include: increasing the reputation value of a node that votes in favor of a primary accounting node in a good state or votes against a primary accounting node in a malicious state; and reducing the reputation value of a node that abstains from voting or is offline for a period of time that reaches a predetermined timeout threshold.

[0098] In some optional implementations of this embodiment, the device also includes a backup unit (not shown in the drawings), which is configured to: select a predetermined number of backup accounting nodes from the primary accounting node set in order of the number of support tickets from high to low.

[0099] It should be noted that the collection, collection, updating, analysis, processing, use, transmission, storage and other aspects of user personal information involved in the technical solution of this disclosure are in compliance with the provisions of relevant laws and regulations, are used for legitimate purposes, and do not violate public order and good morals. Necessary measures are taken for user personal information to prevent illegal access to user personal information data and maintain the security of user personal information, network security and national security.

[0100] According to an embodiment of the present disclosure, the present disclosure also provides an electronic device and a readable storage medium.

[0101] An electronic device comprises: one or more processors; a storage device on which one or more computer programs are stored, and when the one or more computer programs are executed by the one or more processors, the one or more processors implement the method described in process 200.

[0102] A computer-readable medium stores a computer program, wherein the computer program implements the method described in process 200 when executed by a processor.

[0103] Figure 5A schematic block diagram of an example electronic device 500 that can be used to implement an embodiment of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or required herein.

[0104] like Figure 5 As shown, the device 500 includes a computing unit 501, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 502 or a computer program loaded from a storage unit 508 into a random access memory (RAM) 503. In the RAM 503, various programs and data required for the operation of the device 500 can also be stored. The computing unit 501, the ROM 502, and the RAM 503 are connected to each other via a bus 504. An input / output (I / O) interface 505 is also connected to the bus 504.

[0105] A number of components in the device 500 are connected to the I / O interface 505, including: an input unit 506, such as a keyboard, a mouse, etc.; an output unit 507, such as various types of displays, speakers, etc.; a storage unit 508, such as a disk, an optical disk, etc.; and a communication unit 509, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 509 allows the device 500 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.

[0106] The computing unit 501 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 501 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 501 performs the various methods and processes described above, such as the road area planning method. For example, in some embodiments, the road area planning method may be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as a storage unit 508. In some embodiments, part or all of the computer program may be loaded and / or installed on the device 500 via the ROM 502 and / or the communication unit 509. When the computer program is loaded into the RAM 503 and executed by the computing unit 501, one or more steps of the road area planning method described above may be performed. Alternatively, in other embodiments, the computing unit 501 may be configured to perform the road area planning method in any other appropriate manner (e.g., by means of firmware).

[0107] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0108] The program code for implementing the method of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that the program code, when executed by the processor or controller, enables the functions / operations specified in the flow chart and / or block diagram to be implemented. The program code may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.

[0109] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer 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 foregoing.

[0110] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).

[0111] The systems and techniques described herein may be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), and the Internet.

[0112] A computer system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The relationship between the client and the server is generated by computer programs running on the respective computers and having a client-server relationship with each other. The server may be a server of a distributed system, or a server combined with a blockchain. The server may also be a cloud server, or an intelligent cloud computing server or intelligent cloud host with artificial intelligence technology. The server may be a server of a distributed system, or a server combined with a blockchain. The server may also be a cloud server, or an intelligent cloud computing server or intelligent cloud host with artificial intelligence technology.

[0113] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this disclosure can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved, and this document does not limit this.

[0114] The above specific implementations do not constitute a limitation on the protection scope of the present disclosure. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present disclosure shall be included in the protection scope of the present disclosure.

Claims

1. A blockchain consensus method, comprising: Group the nodes participating in the consensus in the blockchain; In each group, vote to elect the primary accounting nodes and form a set of primary accounting nodes; The accounting nodes are elected by voting from the primary accounting node set.

2. The method according to claim 1, wherein: Before voting to elect a bookkeeping node from the set of primary bookkeeping nodes, the method further includes: Count the number of negative votes received by the primary accounting node; Revoke the accounting rights of primary accounting nodes whose number of dissenting votes is greater than the predetermined threshold.

3. The method according to claim 1, wherein: The method further comprises: Broadcast at least one of the following node states in the blockchain: good state, normal state, malicious state; and Voting to elect a bookkeeping node from the primary bookkeeping node set includes: Querying the node status of the primary accounting node, wherein the node status is adjusted according to the reputation value of the node; The accounting node is elected from the primary accounting node set by voting according to the node status.

4. The method according to claim 3, wherein: The method further comprises: Update the node's reputation value based on the voting results; In response to detecting that the reputation value of the updated node reaches a state change threshold, the node state of the updated node is converted.

5. The method according to claim 4, wherein: The method further comprises: In response to detecting that the reputation value of the updated node exceeds a predetermined reset threshold, the reputation value of the updated node is reset to an initial value.

6. The method according to claim 3, wherein: The step of voting to elect a bookkeeping node from the primary bookkeeping node set according to the node status includes: The weight of the number of votes in favor and the number of votes against are set according to the reputation of the primary accounting node; Calculate the weighted sum of the number of support votes, the number of opposition votes and the reputation value of the primary accounting node as the voting score of the primary accounting node, where the weight of the number of support votes is a positive number, the weight of the number of opposition votes is a negative number, the difference between the weight of the number of support votes and the weight of the number of opposition votes is a first fixed positive value, the higher the reputation value, the greater the weight of the number of support votes, and the weight of the reputation value is a second fixed positive value; A predetermined number of primary accounting nodes are selected as accounting nodes in descending order of voting scores.

7. The method according to claim 4, wherein: The updating of the node's reputation value according to the voting results includes: Increase the reputation of nodes that vote for primary accounting nodes in good status or vote against primary accounting nodes in malicious status; The reputation value of nodes that abandon votes or are offline for a predetermined timeout period is reduced.

8. The method according to claim 1, wherein: The method further comprises: A predetermined number of standby accounting nodes are selected from the primary accounting node set in descending order of the number of support tickets.

9. A blockchain consensus device, comprising: A grouping unit, configured to group nodes participating in consensus in the blockchain; The first election unit is configured to vote for the primary accounting nodes in each group and form a set of primary accounting nodes; The second election unit is configured to vote and elect an accounting node from the primary accounting node set.

10. An electronic device, comprising: one or more processors; a storage device having one or more computer programs stored thereon, When the one or more computer programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 8.

11. A computer readable medium having a computer program stored thereon, wherein: When the computer program is executed by a processor, the method according to any one of claims 1 to 8 is implemented.

12. A computer program product, comprising a computer program, which, when executed by a processor, implements the method according to any one of claims 1 to 8.