Blockchain-based target node acquisition method, device, electronic device, and medium

By introducing the proof-of-work consensus mechanism and reputation value evaluation into the blockchain network, and combining it with a double voting mechanism to elect accounting nodes and verification nodes, the problem of accounting node election being affected by the amount of digital currency is solved, and the security and decentralization of the blockchain network are improved.

CN115801336BActive Publication Date: 2025-10-03CHINA RAILWAY 19 BUREAU GRP ELECTRIC ENG +2
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211329599.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-10-27
Publication Date
2025-10-03
Estimated Expiration
2042-10-27

AI Technical Summary

Technical Problem

In existing blockchain networks, the election of accounting nodes is greatly influenced by nodes that own a large amount of digital currency, resulting in reduced blockchain network security. Dishonest nodes are not effectively replaced or punished, affecting network security.

Method used

The proof-of-work consensus mechanism is introduced to elect consensus nodes and non-consensus nodes. Accounting nodes and verification nodes are elected through voting by non-consensus nodes. Combined with reputation value evaluation, the decentralization and node reliability of the blockchain network are improved.

Benefits of technology

Through reputation evaluation and double voting mechanisms, the probability of malicious nodes being selected is reduced, and the security and decentralization of the blockchain network are improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115801336B_ABST
    Figure CN115801336B_ABST
Patent Text Reader

Abstract

The present disclosure provides a method and device for acquiring a target node based on a blockchain. The method includes: determining a consensus node set and a non-consensus node set from a candidate node set based on a proof-of-work consensus mechanism; obtaining a set of accounting nodes and the number of votes received by each node based on non-consensus nodes in the non-consensus node set voting on consensus nodes in the consensus node set; obtaining a set of verification nodes and the number of votes received by each node based on mutual voting between non-consensus nodes in the non-consensus node set; obtaining the reputation value of each node in the accounting node set and the verification node set after a preset period; calculating the final number of votes for each node based on the number of votes and reputation value of each node in the accounting node set and the number of votes and reputation value of each node in the verification node set; and determining a target accounting node set and a target verification node set based on the final number of votes received by each node. This method can improve the security of a blockchain network.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure belongs to the technical field of blockchain consensus algorithms, and in particular relates to a method, device, electronic device, and medium for acquiring a target node based on blockchain. Background Art

[0002] Blockchain uses a decentralized, reliable, and tamper-resistant database storage format. The consensus algorithm is the most crucial component of blockchain, ensuring that all nodes in the blockchain achieve eventual consistency in stored data without third-party constraints.

[0003] Common consensus algorithms in existing technology include PoW (Proof of Work), PoS (Proof of Stake), and DPOS (Delegated Proof of Stake). The PoS consensus algorithm optimizes the PoW consensus algorithm to some extent, while the DPOS consensus algorithm is an improvement on the PoW consensus algorithm. The DPOS consensus algorithm first requires nodes in the network to vote with each other. The top N nodes with the highest votes are designated as ledger nodes, which take turns producing blocks. The value of N can be adjusted based on different business needs. Ledger nodes are responsible for packaging transactions in the network into blocks and reaching consensus. If a ledger node fails to produce a block properly or produces an erroneous block during its turn, it will be skipped and the next ledger node will be allowed to produce the block. In the next round of voting, a vote can be taken to disqualify it from being a ledger node. The accounting nodes of this consensus method are elected by coin holders. However, the DPOS consensus algorithm has the problem that the election of accounting nodes is greatly influenced by nodes with a large amount of digital currency. When some malicious nodes with a large amount of digital currency are selected as accounting nodes or verification nodes, the security of the blockchain network will be reduced. Summary of the Invention

[0004] Based on this, it is necessary to provide a blockchain-based target node acquisition method, device, electronic device and medium to address the issue of how to improve the security of blockchain networks.

[0005] In a first aspect, an embodiment of the present disclosure provides a method for acquiring a target node based on blockchain, the method comprising:

[0006] Determining a consensus node set and a non-consensus node set from a candidate node set based on a proof-of-work consensus mechanism; the candidate node set is a set of nodes in the blockchain network that have passed identity verification;

[0007] Voting the consensus nodes in the consensus node set according to the non-consensus nodes in the non-consensus node set to obtain the accounting node set and the number of votes of each node in the accounting node set;

[0008] Obtaining a verification node set and the number of votes obtained by each node in the verification node set based on mutual voting among the non-consensus nodes in the non-consensus node set;

[0009] After the preset period ends, the reputation value of each node in the accounting node set and the reputation value of each node in the verification node set are obtained;

[0010] Calculate the final number of votes for each node based on the number of votes and reputation of each node in the accounting node set and the number of votes and reputation of each node in the verification node set;

[0011] The target accounting node set and target verification node set are determined based on the final number of votes for each node.

[0012] As an optional implementation of the present disclosure, determining the consensus node set and the non-consensus node set from the candidate node set according to the proof-of-work consensus mechanism includes:

[0013] Determine the nodes that have passed identity authentication as the candidate node set of the blockchain;

[0014] Determining a consensus node set from the candidate node set according to a proof-of-work consensus mechanism;

[0015] A non-consensus node set is determined based on the candidate node set and the consensus node set.

[0016] As an optional implementation of the present disclosure, before obtaining the reputation value of each node in the accounting node set and the reputation value of each node in the verification node set, the method further includes:

[0017] Obtaining the initial reputation value of each candidate node in the candidate node set.

[0018] As an optional implementation of the present disclosure, after the preset period ends, obtaining the reputation value of each node in the accounting node set and the reputation value of each node in the verification node set includes:

[0019] According to the formula Calculate the number of valid blocks generated by accounting nodes;

[0020] in, Indicates the number of valid blocks generated by the accounting node in a consensus cycle. Indicates whether the accounting node produces blocks normally in the tth production cycle, Indicates the number of transactions contained in a block in a theoretical production cycle, Indicates the number of transactions actually included in a block of a production cycle;

[0021] Calculate the number of valid blocks generated by the verification node according to the formula;

[0022]

[0023] in, Indicates the number of blocks that the verification node effectively verifies within a consensus cycle. Indicates whether the current verification node verifies the block in the tth production cycle. Indicates the actual time consumed by the verification. Indicates the block verification cycle;

[0024] According to the formula Calculate the penalty coefficient;

[0025] in, represents the penalty coefficient, Indicates the penalty value corresponding to different behavior of accounting nodes or verification nodes;

[0026] According to the formula Updating the reputation value of each node in the accounting node set and the verification node set;

[0027] in, Indicates the reputation value of the current node before the preset period. Indicates the credit value after the preset period ends.

[0028] As an optional embodiment of the present disclosure, the method further includes:

[0029] After the preset period ends, the nodes in the accounting node set and the verification node set whose reputation values ​​are less than the preset reputation values ​​are removed from the candidate node set.

[0030] As an optional embodiment of the present disclosure, the final number of votes for each node is calculated based on the number of votes and reputation of each node in the accounting node set and the number of votes and reputation of each node in the verification node set, including:

[0031]

[0032] in, Indicates the final number of votes for the current node. Indicates the number of votes obtained by the current node. Indicates the weight of the number of votes obtained by the current node, Indicates the weight of the current node’s reputation value, and The sum is 1.

[0033] As an optional embodiment of the present disclosure, determining the target accounting node set and the target verification node set based on the final number of votes of each node includes:

[0034] Sort the consensus nodes in the consensus node set according to the final number of votes of each node to obtain the target accounting node set and the candidate node set;

[0035] The non-consensus nodes in the non-consensus node set are sorted according to the final number of votes of each node to obtain the target verification node set.

[0036] In a second aspect, an embodiment of the present disclosure provides a target node acquisition device based on blockchain, the device comprising:

[0037] A consensus node determination module, configured to determine a consensus node set and a non-consensus node set from a candidate node set based on a proof-of-work consensus mechanism; the candidate node set is a set of authenticated nodes in the blockchain network;

[0038] A bookkeeping node determination module, configured to vote on the consensus nodes in the consensus node set based on the non-consensus nodes in the non-consensus node set, and obtain the bookkeeping node set and the number of votes obtained by each node in the bookkeeping node set;

[0039] A verification node determination module, configured to obtain a verification node set and the number of votes obtained by each node in the verification node set based on mutual voting among the non-consensus nodes in the non-consensus node set;

[0040] A reputation value updating module, configured to obtain the reputation value of each node in the accounting node set and the reputation value of each node in the verification node set after a preset period ends;

[0041] A node vote counting module, configured to calculate the final number of votes for each node based on the number of votes and reputation of each node in the accounting node set and the number of votes and reputation of each node in the verification node set;

[0042] The target node determination module is used to determine the target accounting node set and the target verification node set based on the final number of votes of each node.

[0043] As an optional implementation of the present disclosure, the consensus node determination module is specifically configured to:

[0044] Determine the nodes that have passed identity authentication as the candidate node set of the blockchain;

[0045] Determining a consensus node set from the candidate node set according to a proof-of-work consensus mechanism;

[0046] A non-consensus node set is determined based on the candidate node set and the consensus node set.

[0047] As an optional embodiment of the present disclosure, the device further includes:

[0048] The initial reputation value acquisition module is used to obtain the initial reputation value of each candidate node in the candidate node set.

[0049] As an optional implementation of the present disclosure, the reputation value updating module is specifically configured to:

[0050] According to the formula Calculate the number of valid blocks generated by accounting nodes;

[0051] in, Indicates the number of valid blocks generated by the accounting node in a consensus cycle. Indicates whether the accounting node produces blocks normally in the tth production cycle, Indicates the number of transactions contained in a block in a theoretical production cycle, Indicates the number of transactions actually included in a block of a production cycle;

[0052] According to the formula

[0053]

[0054] Calculate the number of valid blocks generated by the verification node;

[0055] in, Indicates the number of blocks that the verification node effectively verifies within a consensus cycle. Indicates whether the current verification node verifies the block in the tth production cycle. Indicates the actual time consumed by the verification. Indicates the block verification cycle;

[0056] According to the formula Calculate the penalty coefficient;

[0057] in, represents the penalty coefficient, Indicates the penalty value corresponding to different behavior of accounting nodes or verification nodes;

[0058] According to the formula Updating the reputation value of each node in the accounting node set and the verification node set;

[0059] in, Indicates the reputation value of the current node before the preset period. Indicates the credit value after the preset period ends.

[0060] As an optional implementation of the present disclosure, the reputation value updating module is further configured to:

[0061] After the preset period ends, the nodes in the accounting node set and the verification node set whose reputation values ​​are less than the preset reputation values ​​are removed from the candidate node set.

[0062] As an optional implementation of the present disclosure, the node vote counting module is specifically configured to:

[0063]

[0064] in, Indicates the final number of votes for the current node. Indicates the number of votes obtained by the current node. Indicates the weight of the number of votes obtained by the current node, Indicates the weight of the current node’s reputation value, and The sum is 1.

[0065] As an optional implementation manner of the present disclosure, the target node determination module is specifically configured to:

[0066] Sort the consensus nodes in the consensus node set according to the final number of votes of each node to obtain the target accounting node set and the candidate node set;

[0067] The non-consensus nodes in the non-consensus node set are sorted according to the final number of votes of each node to obtain the target verification node set.

[0068] In a third aspect, an embodiment of the present disclosure provides an electronic device comprising: a memory and a processor, the memory being used to store a computer program; the processor being used to execute the blockchain-based target node acquisition method described in the first aspect or any embodiment of the first aspect when calling the computer program.

[0069] In a fourth aspect, an embodiment of the present disclosure provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the blockchain-based target node acquisition method described in the first aspect or any embodiment of the first aspect is implemented.

[0070] The target node acquisition method based on blockchain provided by the embodiment of the present disclosure determines a consensus node set and a non-consensus node set from a candidate node set according to a proof-of-work consensus mechanism, wherein the candidate node set is a set of nodes that have passed identity authentication in the blockchain network, the non-consensus nodes in the non-consensus node set vote on the consensus nodes in the consensus node set, obtains a bookkeeping node set and the number of votes of each node in the bookkeeping node set, obtains a verification node set and the number of votes of each node in the verification node set according to the non-consensus nodes in the non-consensus node set voting with each other, obtains a reputation value of each node in the bookkeeping node set and a reputation value of each node in the verification node set after a preset period, calculates the final number of votes of each node based on the number of votes and reputation value of each node in the bookkeeping node set and the number of votes and reputation value of each node in the verification node set, and determines the target bookkeeping node set and the target verification node set based on the final number of votes of each node. By introducing the proof-of-work consensus mechanism to elect the consensus nodes and non-consensus nodes of this round, the bookkeeping nodes are then elected by the non-consensus nodes voting on the consensus nodes, thereby improving the decentralization of the blockchain network. During the voting phase, each non-consensus node must complete two votes: the first vote for the consensus node to elect the ledger node, and the second vote for the non-consensus node to elect the validator node. The final election results also take the node's reputation into account, further evaluating the reliability of the network nodes in the blockchain network, reducing the probability of malicious nodes being selected as ledger nodes and validators, thereby improving the security of the entire blockchain network. BRIEF DESCRIPTION OF THE DRAWINGS

[0071] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the present disclosure.

[0072] In order to more clearly illustrate the embodiments of the present disclosure or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.

[0073] Figure 1 A schematic diagram of a consensus process based on a delegated proof-of-stake consensus algorithm provided in one embodiment of the present disclosure;

[0074] Figure 2 A schematic diagram of the conversion relationship between various types of nodes in a blockchain network provided in one embodiment of the present disclosure;

[0075] Figure 3 A flowchart of a method for acquiring a target node based on blockchain according to an embodiment of the present disclosure;

[0076] Figure 4 A schematic diagram of a target node acquisition device based on blockchain provided in one embodiment of the present disclosure;

[0077] Figure 5 This is a diagram of the internal structure of an electronic device provided in one embodiment of the present disclosure. DETAILED DESCRIPTION

[0078] In order to more clearly understand the above-mentioned objectives, features and advantages of the present disclosure, the scheme of the present disclosure will be further described below. It should be noted that the embodiments of the present disclosure and the features therein can be combined with each other in the absence of conflict.

[0079] In the following description, many specific details are set forth to facilitate a full understanding of the present disclosure, but the present disclosure may also be implemented in other ways different from those described herein; it is obvious that the embodiments in the specification are only part of the embodiments of the present disclosure, rather than all of the embodiments.

[0080] In the embodiments of the present disclosure, words such as "exemplary" or "for example" are used to indicate examples, illustrations, or descriptions. Any embodiment or design described as "exemplary" or "for example" in the embodiments of the present disclosure should not be interpreted as being more preferred or advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary" or "for example" is intended to present the relevant concepts in a concrete manner. In addition, in the description of the embodiments of the present disclosure, unless otherwise specified, the meaning of "a plurality of" refers to two or more.

[0081] In the existing technology, the election of accounting nodes and verification nodes is based on the Delegated Proof of Stake consensus algorithm. The consensus process of the Delegated Proof of Stake consensus algorithm can be divided into two stages. Figure 1 As shown, Figure 1The following is a diagram of the consensus process based on the Delegated Proof of Stake consensus algorithm. The first phase is the election of ledger nodes: ledger nodes are elected by all nodes in the blockchain through mutual voting at regular intervals (the election interval is determined by the blockchain itself). Voting is accomplished by a node sending a transaction to the blockchain containing the voter's identity, the voted-for identity, and the number of votes cast. This transaction is then sent via the peer-to-peer network to all nodes participating in the consensus process and ultimately packaged into a block. Every node in the blockchain can participate in the voting process and be elected as a ledger node. The number of votes each node holds is related to the amount of digital currency it holds. For example, the number of ledger nodes is determined by the blockchain. If a blockchain requires k ledger nodes, the top k nodes with the most votes after voting are considered the set of ledger nodes, and their rights to produce blocks are fully equivalent. The second phase is the consensus phase: once the accounting nodes are elected, the blockchain enters the consensus phase. In the delegated proof-of-stake consensus algorithm, block production is accomplished by nodes in the accounting node set, which take turns packaging transactions in the blockchain. The period during which an accounting node produces blocks is called a production cycle. After a accounting node completes its block production cycle, it must submit the block to subsequent accounting nodes for verification. When the number of accounting nodes that pass verification exceeds two-thirds of the total number of accounting nodes, the block is deemed irreversible, meaning that the transactions contained in the block are valid, and the accounting node that generated the block will receive a certain amount of digital currency as a reward. If a accounting node fails to produce a normal block or produces an erroneous block during its production cycle for various reasons, the system will skip the current production cycle for that block, handing the block production task to the next accounting node, and the accounting node's security deposit will be confiscated. However, this approach presents the following issues: the number of votes each node in the blockchain network holds is proportional to the amount of digital currency it holds. This results in nodes with large digital currency holdings having a significant influence on the election of ledger nodes, undermining the fairness of the election system and weakening the blockchain network's degree of decentralization. If a dishonest node is among the elected ledger nodes, the Delegated Proof of Stake consensus algorithm simply skips the node's current production cycle and confiscates its deposit, without replacing or punishing it. The dishonest node can still participate in block production subsequent to the current consensus cycle, and its right to be elected as a ledger node remains unaffected, resulting in lower security for the blockchain network.

[0082] The overall concept of this disclosure is as follows: first, the consensus nodes and non-consensus nodes for this round are elected through the introduction of a proof-of-work consensus mechanism. Then, the non-consensus nodes vote on the consensus nodes to elect the accounting nodes, thereby improving the decentralization of the blockchain network. During the voting phase, each non-consensus node must complete two votes: the first vote is for the consensus node to elect the accounting node, and the second vote is for the non-consensus node to elect the verification node. The final election results also take the node's reputation into consideration, ensuring the reliability of the accounting and verification nodes, thereby improving the security of the blockchain network.

[0083] The Proof-of-Work consensus mechanism has been widely adopted as a consensus method for cryptocurrency. In this consensus mechanism, every node in the network simultaneously solves a "mathematical puzzle" through hashing to confirm the transactions stored in the block. Block creators attempt to find different random numbers and then hash them to meet a predetermined difficulty target. When a block creator finds a block that meets the target difficulty, it broadcasts the resulting block to the network for other block creators to verify its correctness. If the transactions in the block are verified, all block creators record the block and use it as a basis for verification of the next block. The "consensus mechanism" can be understood as a process that verifies and confirms transactions in a very short time through voting by specialized nodes. For example, if several nodes with independent interests can reach consensus on a transaction, it can be assumed that the entire blockchain network has reached consensus on the transaction.

[0084] In the embodiment of this disclosure, the nodes in the blockchain network are divided into seven categories: Figure 2 Schematic diagram of the transformation relationship between various types of nodes in the blockchain network.

[0085] Ordinary nodes: Ordinary nodes do not participate in the consensus phase of the blockchain and do not require any authorization to enter or exit the blockchain network. Users can view the transaction status of the entire network when using the system's services. Although they cannot vote or participate in elections, they can forward messages and blocks. Ordinary nodes can become candidate nodes through identity authentication. It should be noted that each identity ID can only be authenticated once.

[0086] Candidate node set: After issuing a proof-of-work request in the blockchain network, the candidate node can verify the request. If the verification is successful, the verification result will be signed and broadcast to the blockchain network.

[0087] Consensus Node Set: Consensus nodes are selected by candidate nodes through proof-of-work. Assuming the number of nodes in the system that need to generate blocks is k, the first 2k candidate nodes that have completed proof-of-work are selected from the candidate nodes and defined as consensus nodes.

[0088] Non-consensus node set: Non-consensus nodes refer to nodes in the candidate node set that fail to become consensus nodes.

[0089] Accounting Node Set: Accounting nodes are used to verify and package transactions in the blockchain network and generate blocks for successfully verified transaction data. The top k nodes in the consensus node set are selected as accounting nodes.

[0090] Alternative Node Set: Alternative nodes are used to replace accounting nodes when they fail to produce blocks due to malicious behavior or other reasons. Nodes ranked k+1 to 2k in the consensus node set are selected as alternative nodes.

[0091] Verification node set: The verification nodes are elected by non-consensus nodes through mutual voting. The number of verification nodes is the same as the number of accounting nodes. The verification nodes are used to verify the blocks generated by the accounting nodes.

[0092] The present disclosure provides a method for obtaining a target node based on blockchain. Figure 3 As shown, the target node acquisition method based on blockchain provided by the embodiment of the present disclosure includes the following steps S31-S36:

[0093] S31. Determine a consensus node set and a non-consensus node set from the candidate node set according to the proof-of-work consensus mechanism.

[0094] Among them, the candidate node set is a set of nodes that have passed authentication in the blockchain network.

[0095] Specifically, consensus node election is implemented using the Proof-of-Work consensus mechanism. Due to its higher degree of decentralization, Proof-of-Work ensures a wider pool of candidate nodes to become consensus nodes. Furthermore, since the performance of ledger nodes significantly impacts the overall performance of the blockchain, and Proof-of-Work reflects a node's computational performance, this method allows for the selection of ledger nodes with relatively high computational performance.

[0096] In some embodiments, S31 (determining the consensus node set and the non-consensus node set from the candidate node set according to the proof-of-work consensus mechanism) can be implemented as follows:

[0097] S311. Determine the nodes that have passed identity authentication as the candidate node set of the blockchain.

[0098] S312. Determine a consensus node set from the candidate node set according to the proof-of-work consensus mechanism.

[0099] S313: Determine a non-consensus node set based on the candidate node set and the consensus node set.

[0100] The proof of work process is achieved by updating the value of the random number in the block header. In this embodiment, the consensus node is selected through the proof of work consensus mechanism, so some values ​​of the block information need to be adjusted. The first step is to generate the value of the Merkle hash root, that is, the node generates a coin transaction by itself, and generates the value of the Merkle hash root through the Merkle tree algorithm with all other transactions to be packaged. Since this block does not really package the transactions in the blockchain network, this value can be set to 0. The second step is to assemble the block header. The block header will be used as an input parameter to calculate the output of the proof of work. Therefore, the value of the Merkle hash root calculated in the first step and the other components of the block header are assembled into a block header. The third step is to calculate the output of the proof of work. The output of the proof of work can be understood through formulas and some pseudocode:

[0101] (1) Output of proof of work = hash (block header);

[0102] (2) if (the output of the proof of work is less than or equal to the difficulty target value), the proof of work completion;

[0103] (3) If the output of the proof of work is greater than the difficulty target value, change the random number, recurse the logic of (1), and continue to compare with the target value.

[0104] For example, a target difficulty value of 6 and an average verification time of 15 seconds can meet the experimental requirements. In actual use, the target difficulty value can be set according to different situations or defined as a dynamically changing value based on other factors such as the number of nodes. Assuming that the number of nodes in the system that need to generate blocks is k, the first 2k candidate nodes that have completed the proof of work in the candidate node set are selected and defined as consensus nodes. Accordingly, the non-consensus node set includes: nodes in the candidate set that failed to become consensus nodes.

[0105] Specifically, the consensus node election process is as follows: First, the blockchain network broadcasts a proof-of-work request. The request includes the hash value of the parent block in the block header verified by the candidate node. This value can be the hash value of the latest block at the current moment and a random number. Second, after receiving the proof-of-work request, the candidate node in the blockchain network verifies the random value according to the above-mentioned proof-of-work principle. After verifying the random number that meets the difficulty value, the candidate node sends a verification success message to the blockchain network. The message includes the verified block header, and the node that successfully verifies will sign this information. Third, when the system receives 2k verification success messages and the verification is successful, it broadcasts a stop verification message to other nodes in the blockchain network. The message includes the address information of the 2k consensus nodes in this round. After receiving this message, the other candidate nodes in the blockchain network stop the proof of work in this round, and the consensus node election in this round ends.

[0106] S32. Voting the consensus nodes in the consensus node set according to the non-consensus nodes in the non-consensus node set to obtain the accounting node set and the number of votes of each node in the accounting node set.

[0107] For example, the non-consensus nodes in the non-consensus node set vote on the consensus nodes in the consensus node set, and the nodes ranked in the top k by votes in the consensus node set are selected as accounting nodes. In addition, the nodes ranked in the range of k+1 to 2k by votes in the consensus node set are selected as candidate nodes.

[0108] S33. Obtain a verification node set and the number of votes obtained by each node in the verification node set based on mutual voting among the non-consensus nodes in the non-consensus node set.

[0109] Specifically, the verification node is elected through mutual voting among the non-consensus nodes in the non-consensus node set.

[0110] S34. After the preset period ends, the reputation value of each node in the accounting node set and the reputation value of each node in the verification node set are obtained.

[0111] The preset period refers to the time from the end of the current round of voting to the end of the next round of voting, which can also be called the consensus period.

[0112] Specifically, the reputation value takes into account factors such as block generation and verification of accounting nodes and verification nodes.

[0113] In some embodiments, S34 (obtaining the reputation value of each node in the accounting node set and the reputation value of each node in the verification node set after the preset period ends) can be implemented as follows:

[0114] According to the formula Calculate the number of valid blocks generated by the accounting node.

[0115] in, Indicates the number of valid blocks generated by the accounting node in a consensus cycle. Indicates whether the accounting node produces blocks normally in the tth production cycle, Indicates the number of transactions contained in a block in a theoretical production cycle, Indicates the number of transactions actually included in a block of a production cycle.

[0116] For example, if the block is generated normally, The value of can be 0.2. If the block cannot be generated or there is a problem with the generated block, then The value can be 0.

[0117] According to the formula

[0118]

[0119] Calculate the number of valid blocks generated by the verification node.

[0120] in, Indicates the number of blocks that the verification node effectively verifies within a consensus cycle. Indicates whether the current verification node verifies the block in the tth production cycle. Indicates the actual time consumed by the verification. Indicates the block verification cycle.

[0121] For example, if the verification result has been sent to the accounting node in the current cycle, then The value of can be 0.02. If no verification result is sent to the accounting node in the current cycle, The value of is 0. In addition, it should be noted that T represents the theoretical value of the verification node completing block verification.

[0122] According to the formula Calculate the penalty coefficient.

[0123] in, represents the penalty coefficient, Indicates the penalty value corresponding to different behavior of accounting nodes or verification nodes.

[0124] Specifically, the penalty coefficient is a behavioral constraint imposed by the system on accounting nodes and verification nodes. If the node fails to work properly during its verification cycle or production cycle, its reputation value will be deducted.

[0125] For example, for a set of accounting nodes, if the accounting node cannot produce blocks normally within the production cycle or the blocks produced are verified to be invalid, it needs to be removed from the accounting node set, and its reputation value C will be reset to zero, and a node will be selected from the candidate nodes to replace the current accounting node. The penalty coefficient P decreases according to different behaviors. If the block produced is verified to be invalid by the accounting node, then If the block cannot be produced normally during the production cycle, .

[0126] For the verification node set, if the verification node verifies an error or fails to verify a block during the verification cycle, the number of blocks V of its verification node will be halved. The penalty coefficient P decreases according to different behaviors. If the verification node believes that there is a problem with the block, but the block is finally verified; or if the verification node believes that there is no problem with the block, but the block fails to pass the verification, the penalty factor will be accumulated in the verification cycle. If verification fails during the verification period, .

[0127] According to the formula The reputation value of each node in the accounting node set and the verification node set is updated.

[0128] in, Indicates the reputation value of the current node before the preset period. Indicates the credit value after the preset period ends.

[0129] For example, after a consensus cycle ends, the reputation values ​​of the accounting node set and the verification node set will be updated.

[0130] Furthermore, after the preset period ends, the nodes in the accounting node set and the verification node set whose reputation values ​​are less than the preset reputation values ​​are removed from the candidate node set.

[0131] For example, the preset reputation value can be 40, or other reasonable values, which are not specifically limited here. For example, if the updated reputation value of a node is less than 40, the node is removed from the candidate node set and its identity ID is banned, restricting the node from serving as a candidate node.

[0132] In addition, after 50 rounds of consensus, the reputation of candidate nodes in the system with a reputation value greater than 60 will be deducted. The part of the reputation value greater than 60 will be reduced to half of the original value, avoiding the centralization of accounting nodes due to the introduction of reputation values.

[0133] S35. Calculate the final number of votes for each node based on the number of votes and reputation of each node in the accounting node set and the number of votes and reputation of each node in the verification node set.

[0134] In some embodiments, S35 (calculating the final number of votes for each node based on the number of votes and reputation of each node in the accounting node set and the number of votes and reputation of each node in the verification node set) can be implemented as follows:

[0135]

[0136] in, Indicates the final number of votes for the current node. Indicates the number of votes obtained by the current node. Indicates the weight of the number of votes obtained by the current node, Indicates the weight of the current node’s reputation value, and The sum is 1.

[0137] Specifically, to ensure the reliability of the ledger nodes and validator nodes selected from the candidate nodes, the voting phase no longer solely considers the number of votes a node receives as the sole reference criterion. Instead, candidate nodes are evaluated in combination with their reputation. A node with a higher reputation requires fewer votes to be elected as a ledger node or validator than a node with a lower reputation.

[0138] For example, in order to prevent the problem that the credibility value of the blockchain has too little or too much influence on the voting results due to a long or short running time, the number of votes of the consensus node is weighted in the form of a percentage. and Indicates the weight of the number of votes and reputation value, and . and The value of can be set according to the requirements of the blockchain for accounting nodes and verification nodes. If the selected node is the node with the highest number of votes, then If the selected node tends to be a node with high reputation value, then If you want the two to be in equal proportion, For example, in this embodiment, both values ​​may be set to 0.5.

[0139] S36. Determine the target accounting node set and target verification node set based on the final number of votes for each node.

[0140] In some embodiments, S36 (determining the target accounting node set and target verification node set based on the final number of votes received by each node) can be implemented as follows:

[0141] The consensus nodes in the consensus node set are sorted according to the final number of votes of each node to obtain the target accounting node set and the candidate node set.

[0142] The non-consensus nodes in the non-consensus node set are sorted according to the final number of votes of each node to obtain the target verification node set.

[0143] In some embodiments, before obtaining the reputation value of each node in the accounting node set and the reputation value of each node in the verification node set, the following steps are further performed:

[0144] Obtaining the initial reputation value of each candidate node in the candidate node set.

[0145] Reputation is used to quantitatively describe the trustworthiness of each network node. This value can be used to assess the reliability of network node behavior, reduce the probability of malicious nodes being selected as ledger and verification nodes, and enhance the security of the entire blockchain network. Furthermore, the quantification standard for reputation is a reasonable value established based on this experiment and can vary depending on the system's operating environment.

[0146] Exemplarily, the initial reputation value of the candidate node may be in the range of 60-100, or other reasonable numerical ranges, which are not specifically limited here.

[0147] The target node acquisition method based on blockchain provided by the embodiment of the present disclosure introduces a proof-of-work consensus mechanism to elect the consensus nodes and non-consensus nodes of this round, and then the non-consensus nodes vote on the consensus nodes to elect the accounting nodes, so as to improve the degree of decentralization of the blockchain network. During the voting and election stage, each non-consensus node needs to complete two votes. The first vote is to vote for the consensus node to elect the accounting node, and the second vote is to vote for the non-consensus node to elect the verification node. The final election result will also take the reputation value of the node into consideration, and further evaluate the behavioral reliability of the network nodes in the blockchain network, reducing the probability of malicious nodes being selected as accounting nodes and verification nodes, thereby improving the security of the entire blockchain network.

[0148] The embodiments of the present disclosure provide a target node acquisition device based on blockchain, which is used to execute any of the target node acquisition methods based on blockchain provided in the above embodiments, and has the corresponding beneficial effects of the target node acquisition method based on blockchain.

[0149] Figure 4 A schematic diagram of a target node acquisition device 400 based on blockchain provided in an embodiment of the present disclosure is shown in FIG. Figure 4As shown, the target node acquisition device 400 based on blockchain includes:

[0150] A consensus node determination module 410 is configured to determine a consensus node set and a non-consensus node set from a candidate node set based on a proof-of-work consensus mechanism; the candidate node set is a set of nodes in the blockchain network that have passed identity verification;

[0151] The accounting node determination module 420 is configured to vote on the consensus nodes in the consensus node set based on the non-consensus nodes in the non-consensus node set, and obtain the accounting node set and the number of votes obtained by each node in the accounting node set;

[0152] A verification node determination module 430 is configured to obtain a verification node set and a number of votes obtained by each node in the verification node set based on mutual voting among the non-consensus nodes in the non-consensus node set;

[0153] The reputation value updating module 440 is used to obtain the reputation value of each node in the accounting node set and the reputation value of each node in the verification node set after the preset period ends;

[0154] The node vote counting module 450 is used to calculate the final number of votes for each node based on the number of votes and reputation of each node in the accounting node set and the number of votes and reputation of each node in the verification node set;

[0155] The target node determination module 460 is used to determine the target accounting node set and the target verification node set based on the final number of votes of each node.

[0156] As an optional implementation of the present disclosure, the consensus node determination module 410 is specifically configured to:

[0157] Determine the nodes that have passed identity authentication as the candidate node set of the blockchain;

[0158] Determining a consensus node set from the candidate node set according to a proof-of-work consensus mechanism;

[0159] A non-consensus node set is determined based on the candidate node set and the consensus node set.

[0160] As an optional embodiment of the present disclosure, the device further includes:

[0161] The initial reputation value acquisition module is used to obtain the initial reputation value of each candidate node in the candidate node set.

[0162] As an optional implementation of the present disclosure, the reputation value updating module 440 is specifically configured to:

[0163] According to the formula Calculate the number of valid blocks generated by accounting nodes;

[0164] in, Indicates the number of valid blocks generated by the accounting node in a consensus cycle. Indicates whether the accounting node produces blocks normally in the tth production cycle, Indicates the number of transactions contained in a block in a theoretical production cycle, Indicates the number of transactions actually included in a block of a production cycle;

[0165] According to the formula

[0166]

[0167] Calculate the number of valid blocks generated by the verification node;

[0168] in, Indicates the number of blocks that the verification node effectively verifies within a consensus cycle. Indicates whether the current verification node verifies the block in the tth production cycle. Indicates the actual time consumed by the verification. Indicates the block verification cycle;

[0169] According to the formula Calculate the penalty coefficient;

[0170] in, represents the penalty coefficient, Indicates the penalty value corresponding to different behavior of accounting nodes or verification nodes;

[0171] According to the formula Updating the reputation value of each node in the accounting node set and the verification node set;

[0172] in, Indicates the reputation value of the current node before the preset period. Indicates the credit value after the preset period ends.

[0173] As an optional implementation of the present disclosure, the reputation value updating module 440 is further configured to:

[0174] After the preset period ends, the nodes in the accounting node set and the verification node set whose reputation values ​​are less than the preset reputation values ​​are removed from the candidate node set.

[0175] As an optional implementation of the present disclosure, the node vote counting module 450 is specifically configured to:

[0176]

[0177] in, Indicates the final number of votes for the current node. Indicates the number of votes obtained by the current node. Indicates the weight of the number of votes obtained by the current node, Indicates the weight of the current node’s reputation value, and The sum is 1.

[0178] As an optional implementation of the present disclosure, the target node determination module 460 is specifically configured to:

[0179] Sort the consensus nodes in the consensus node set according to the final number of votes of each node to obtain the target accounting node set and the candidate node set;

[0180] The non-consensus nodes in the non-consensus node set are sorted according to the final number of votes of each node to obtain the target verification node set.

[0181] The target node acquisition device based on blockchain provided by the embodiment of the present disclosure introduces a proof-of-work consensus mechanism to elect the consensus nodes and non-consensus nodes of this round, and then the non-consensus nodes vote on the consensus nodes to elect the accounting nodes, so as to improve the degree of decentralization of the blockchain network. During the voting and election stage, each non-consensus node needs to complete two votes. The first vote is to vote for the consensus node to elect the accounting node, and the second vote is to vote for the non-consensus node to elect the verification node. The final election result will also take the reputation value of the node into consideration, and further evaluate the behavioral reliability of the network nodes in the blockchain network, reduce the probability of malicious nodes being selected as accounting nodes and verification nodes, and thus improve the security of the entire blockchain network.

[0182] For the specific definition of the target node acquisition device based on blockchain, please refer to the definition of the target node acquisition method based on blockchain above, and will not be repeated here. Each module in the above-mentioned target node acquisition device based on blockchain can be implemented in whole or in part by software, hardware, or a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the electronic device in hardware form, or can be stored in the memory of the electronic device in software form, so that the processor can call and execute the operations corresponding to the above modules.

[0183] In one embodiment, an electronic device is provided, whose internal structure diagram can be as follows: Figure 5As shown. The electronic device includes a processor, memory, and a communication interface connected via a system bus. The processor of the electronic device is used to provide computing and control capabilities. The memory of the electronic device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and computer program in the non-volatile storage medium. The communication interface of the electronic device is used to communicate with external electronic devices in a wired or wireless manner. The wireless manner can be implemented through WiFi, a carrier network, near-field communication (NFC), or other technologies. When the computer program is executed by the processor, it implements a target node acquisition method based on blockchain.

[0184] Those skilled in the art will understand that Figure 5 The structure shown in the figure is only a block diagram of a part of the structure related to the scheme of the present disclosure, and does not constitute a limitation on the electronic device to which the scheme of the present disclosure is applied. The specific electronic device may include more or fewer components than shown in the figure, or combine certain components, or have a different component arrangement.

[0185] In one embodiment, the target node acquisition device based on blockchain provided by the present disclosure can be implemented in the form of a computer program. The computer program can be used in Figure 5 The electronic device shown is running. The memory of the electronic device may store various program modules constituting the target node acquisition device based on blockchain of the electronic device, for example, Figure 4 The consensus node determination module 410, accounting node determination module 420, verification node determination module 430, reputation value update module 440, node vote counting module 450, and target node determination module 460 are shown. The computer program composed of various program modules enables the processor to execute the steps of the blockchain-based target node acquisition method for an electronic device of various embodiments of the present disclosure described in this specification.

[0186] For example, Figure 5 The electronic device shown can be Figure 4 The consensus node determination module 410 in the blockchain-based target node acquisition device shown executes step S31. The electronic device may execute step S32 via the accounting node determination module 420. The electronic device may execute step S33 via the verification node determination module 430. The electronic device may execute step S34 via the reputation value update module 440. The electronic device may execute step S35 via the node vote counting module 450. The electronic device may execute step S36 via the target node determination module 460.

[0187] In one embodiment, a computer-readable storage medium is further provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above method embodiments are implemented.

[0188] Those skilled in the art will appreciate that all or part of the processes in the above-described method embodiments can be implemented by instructing the relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the above-described method embodiments. Any reference to memory, database, or other media used in the various embodiments provided herein may include at least one of non-volatile and volatile memory. Non-volatile memory may include read-only memory (ROM), magnetic tape, floppy disk, flash memory, or optical storage. Volatile memory may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static random access memory (SRAM) and dynamic random access memory (DRAM).

[0189] The technical features of the above embodiments can be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0190] The above-described embodiments merely represent several implementation methods of the present disclosure. While the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the disclosed patent. It should be noted that a person of ordinary skill in the art may make various modifications and improvements without departing from the scope of the present disclosure, all of which fall within the scope of protection of the present disclosure. Therefore, the scope of protection of the disclosed patent shall be determined by the appended claims.

Claims

1. A method for acquiring a target node based on blockchain, characterized in that: The method comprises: Determining a consensus node set and a non-consensus node set from a candidate node set based on a proof-of-work consensus mechanism; the candidate node set is a set of nodes in the blockchain network that have passed identity verification; Voting the consensus nodes in the consensus node set according to the non-consensus nodes in the non-consensus node set to obtain the accounting node set and the number of votes of each node in the accounting node set; Obtaining a verification node set and the number of votes obtained by each node in the verification node set based on mutual voting among the non-consensus nodes in the non-consensus node set; After the preset period ends, the reputation value of each node in the accounting node set and the reputation value of each node in the verification node set are obtained; Calculate the final number of votes for each node based on the number of votes and reputation of each node in the accounting node set and the number of votes and reputation of each node in the verification node set; The target accounting node set and target verification node set are determined based on the final number of votes for each node.

2. The method according to claim 1, characterized in that Determining the consensus node set and the non-consensus node set from the candidate node set according to the proof-of-work consensus mechanism includes: Determine the nodes that have passed identity authentication as the candidate node set of the blockchain; Determining a consensus node set from the candidate node set according to a proof-of-work consensus mechanism; A non-consensus node set is determined based on the candidate node set and the consensus node set.

3. The method according to claim 1, characterized in that Before obtaining the reputation value of each node in the accounting node set and the reputation value of each node in the verification node set, the method further includes: Obtaining the initial reputation value of each candidate node in the candidate node set.

4. The method according to claim 1, wherein After the preset period ends, obtaining the reputation value of each node in the accounting node set and the reputation value of each node in the verification node set includes: According to the formula Calculate the number of valid blocks generated by accounting nodes; in, Indicates the number of valid blocks generated by the accounting node in a consensus cycle. Indicates whether the accounting node produces blocks normally in the tth production cycle, Indicates the number of transactions contained in a block in a theoretical production cycle, Indicates the number of transactions actually included in a block of a production cycle; According to the formula Calculate the number of valid blocks generated by the verification node; in, Indicates the number of blocks that the verification node effectively verifies within a consensus cycle. Indicates whether the current verification node verifies the block in the tth production cycle. Indicates the actual time consumed by the verification. Indicates the block verification cycle; According to the formula Calculate the penalty coefficient; in, represents the penalty coefficient, Indicates the penalty value corresponding to different behavior of accounting nodes or verification nodes; According to the formula Updating the reputation value of each node in the accounting node set and the verification node set; in, Indicates the reputation value of the current node before the preset period. Indicates the credit value after the preset period ends.

5. The method according to claim 4, characterized in that The method further comprises: After the preset period ends, the nodes in the accounting node set and the verification node set whose reputation values ​​are less than the preset reputation values ​​are removed from the candidate node set.

6. The method according to claim 4, characterized in that Calculating the final number of votes for each node based on the number of votes and reputation of each node in the accounting node set and the number of votes and reputation of each node in the verification node set includes: in, Indicates the final number of votes for the current node. Indicates the number of votes obtained by the current node. Indicates the weight of the number of votes obtained by the current node, Indicates the weight of the current node’s reputation value, and The sum is 1.

7. The method according to claim 1, characterized in that The target accounting node set and target verification node set are determined based on the final number of votes of each node, including: Sort the consensus nodes in the consensus node set according to the final number of votes of each node to obtain the target accounting node set and the candidate node set; The non-consensus nodes in the non-consensus node set are sorted according to the final number of votes of each node to obtain the target verification node set.

8. A target node acquisition device based on blockchain, characterized in that: include: A consensus node determination module, configured to determine a consensus node set and a non-consensus node set from a candidate node set based on a proof-of-work consensus mechanism; the candidate node set is a set of authenticated nodes in the blockchain network; A bookkeeping node determination module, configured to vote on the consensus nodes in the consensus node set based on the non-consensus nodes in the non-consensus node set, and obtain the bookkeeping node set and the number of votes obtained by each node in the bookkeeping node set; A verification node determination module, configured to obtain a verification node set and the number of votes obtained by each node in the verification node set based on mutual voting among the non-consensus nodes in the non-consensus node set; A reputation value updating module, configured to obtain the reputation value of each node in the accounting node set and the reputation value of each node in the verification node set after a preset period ends; A node vote counting module, configured to calculate the final number of votes for each node based on the number of votes and reputation of each node in the accounting node set and the number of votes and reputation of each node in the verification node set; The target node determination module is used to determine the target accounting node set and the target verification node set based on the final number of votes of each node.

9. An electronic device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the blockchain-based target node acquisition method according to any one of claims 1 to 7 is implemented.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the blockchain-based target node acquisition method according to any one of claims 1 to 7 is implemented.

Citation Information

Patent Citations

  • Generation method for consensus blocks in block chain and computing device

    CN107124403A

  • Method and apparatus for blockchain consensus

    WO2022116900A1