Blockchain consensus node change method, device and blockchain system

By extending the duration of malicious nodes becoming consensus nodes in the blockchain system, the problem of malicious nodes predicting the timing of consensus nodes affecting blockchain security is solved, and the security of blockchain is improved.

CN115514505BActive Publication Date: 2025-04-25CHINA MOBILE GROUP ZHEJIANG +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202110628936.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-06-07
Publication Date
2025-04-25
Estimated Expiration
2041-06-07

AI Technical Summary

Technical Problem

In a blockchain system, when a consensus node is randomly selected, the malicious node may predict the time for it to be elected, which will affect the security of the blockchain system.

Method used

Only when the previous new consensus node in the loop node group is not recorded in the temporary verification closed-loop chain of the alternative block and the verification closed-loop chain of the previous preset number of blocks, the consensus node in the loop node group can be changed and the duration of the malicious node becoming a consensus node is extended.

Benefits of technology

It effectively improves the security of the blockchain system and prevents malicious nodes from controlling the entire blockchain network by quickly introducing controlled verification nodes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115514505B_ABST
    Figure CN115514505B_ABST
Patent Text Reader

Abstract

The present invention discloses a method, device and blockchain system for changing a consensus node of a blockchain, and belongs to the field of blockchain. The blockchain system includes a cyclic node group, the cyclic node group includes multiple consensus nodes, and the multiple consensus nodes serve as verification nodes in turn to verify the new block in the verification cycle; the method includes: obtaining a temporary verification closed-loop chain of the candidate block under the current verification cycle and the verification closed-loop chain of the first preset number of blocks; wherein the starting node of the verification closed-loop chain of any block is the verification node of the block, and the terminal node is the next verification node; judging whether the last newly added consensus node in the cyclic node group is not recorded in the temporary verification closed-loop chain and all verification closed-loop chains; wherein the newly added consensus node does not perform a verification operation after joining the cyclic node group; if so, the consensus node in the cyclic node group is changed, and the next cyclic verification cycle is entered. The present invention can improve the security of consensus node changes.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of blockchain, and in particular to a method and device for changing a blockchain consensus node, and a blockchain system. Background Art

[0002] In the related technology, the blockchain system generally includes multiple consensus nodes, and after multiple consensus nodes reach consensus, the new block is uploaded to the chain, thereby improving the consensus efficiency of the blockchain. In the blockchain system, the consensus node of this round can generate a random number, and then the consensus node of the next round is determined based on the random number.

[0003] However, during random selection, malicious nodes can predict the timing of their election as consensus nodes and attempt to attack the blockchain system at a lower cost, thereby affecting the security of the blockchain.

[0004] The above contents are only used to assist in understanding the technical solution of the present invention and do not constitute an admission that the above contents are prior art. Summary of the invention

[0005] The main purpose of the present invention is to provide a method and device for changing a blockchain consensus node, and a blockchain system, aiming to solve the technical problem of low security of consensus node changes.

[0006] To achieve the above object, the present invention provides a method for changing a blockchain consensus node, wherein the blockchain system includes a cyclic node group, the cyclic node group includes a plurality of consensus nodes, and the plurality of consensus nodes sequentially serve as verification nodes to verify a new block within a verification cycle;

[0007] The method comprises the following steps:

[0008] Obtaining a temporary verification closed-loop chain of the candidate block in the current verification cycle and a verification closed-loop chain of the first preset number of blocks; wherein the starting node of the verification closed-loop chain of any block is the verification node of the block, and the ending node is the next verification node in the current verification cycle;

[0009] Determine whether the last newly added consensus node in the loop node group is not recorded in the temporary verification closed-loop chain and the verification closed-loop chain; wherein the newly added consensus node does not perform a verification operation after joining the loop node group;

[0010] If yes, the consensus node in the loop node group is changed and the next loop verification cycle is entered.

[0011] In one embodiment, the step of changing the consensus node in the round-robin node group includes:

[0012] Randomly select candidate nodes from the remaining nodes of the blockchain system;

[0013] If the candidate node verifies the candidate block and the verification is successful, the candidate node is determined as a new consensus node and added to the circular node group.

[0014] In one embodiment, the step of randomly selecting a candidate node from the remaining nodes of the blockchain system includes:

[0015] A candidate node is randomly selected from the candidate nodes of the blockchain system; wherein the candidate node is a node whose existence time in the blockchain system is greater than a preset time.

[0016] In one embodiment, the step of verifying the candidate block and successfully verifying the candidate node, and determining the candidate node as a new consensus node to be added to the circular node group includes:

[0017] If the candidate node verifies the candidate block and verifies successfully, the candidate node is determined as a new consensus node, and the new consensus node is added to the circular node group as the current verification node.

[0018] In one embodiment, after the step of changing the consensus node in the cycle node group and entering the next cycle verification cycle, the method further includes:

[0019] If the length value of the next verification cycle is greater than half of the maximum value of the multiple length values ​​of the previous second preset number of verification cycles plus one, the consensus node in the change cycle node group is canceled and returned to the current verification cycle.

[0020] In one embodiment, when the genesis block is generated, the cycle node group includes 5 initial consensus nodes;

[0021] The first preset number is 3; and / or

[0022] The second preset number is 3.

[0023] In a second aspect, the present invention further provides a device for changing a blockchain consensus node, wherein the blockchain system includes a cyclic node group, wherein the cyclic node group includes a plurality of consensus nodes, and the plurality of consensus nodes sequentially serve as verification nodes to verify a new block within a verification cycle;

[0024] The change device of blockchain consensus node includes:

[0025] A record acquisition module is used to obtain a temporary verification closed-loop chain of the candidate block in the current verification cycle and multiple verification closed-loop chains of a preset number of blocks before; wherein the starting node of the verification closed-loop chain of any block is the verification node of the block, and the terminal node is the next verification node in the current verification cycle;

[0026] A result judgment module is used to judge whether the last newly added consensus node in the loop node group is not recorded in the temporary verification closed-loop chain and multiple verification closed-loop chains; wherein the newly added consensus node does not perform a verification operation after joining the loop node group;

[0027] The node change module is used to change the consensus node in the cycle node group and enter the next cycle verification cycle.

[0028] In a third aspect, the present invention further provides a blockchain system, including a cyclic node group, the cyclic node group including a plurality of consensus nodes, and the plurality of consensus nodes sequentially serve as verification nodes to verify a new block within a verification cycle;

[0029] Among them, the consensus node of the circular node group is changed through the above method.

[0030] In a fourth aspect, the present invention further provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the above method.

[0031] In a fifth aspect, the present invention further provides a computer program product, comprising an executable program code, wherein the program code performs the above method when executed by a processor.

[0032] A method for changing a blockchain consensus node proposed in an embodiment of the present invention can change the consensus node of a cycle node only when the temporary verification closed-loop chain of the candidate block under the current verification cycle and multiple verification closed-loop chains of the first preset number of blocks do not record the last newly added consensus node in the cycle node group, thereby ensuring that attackers cannot control the entire blockchain network by quickly introducing verification nodes under their control, thereby improving the security of the blockchain. BRIEF DESCRIPTION OF THE DRAWINGS

[0033] Figure 1 This is a schematic diagram of an embodiment of a blockchain system of the present invention;

[0034] Figure 2 This is a flow chart of a first embodiment of a method for changing a blockchain consensus node of the present invention;

[0035] Figure 3 A schematic diagram of a blockchain system circulating node group in the first embodiment of the blockchain consensus node changing method of the present invention;

[0036] Figure 4 This is a schematic diagram of the blockchain system cyclic node group after adding a new consensus node F in the second embodiment of the blockchain consensus node change method of the present invention;

[0037] Figure 5This is a flow chart of a second embodiment of a method for changing a blockchain consensus node of the present invention;

[0038] Figure 6 This is a flow chart of a third embodiment of a method for changing a blockchain consensus node of the present invention;

[0039] Figure 7 This is a functional module diagram of the first embodiment of the device for changing blockchain consensus of the present invention;

[0040] Figure 8 A schematic diagram of an electronic device involved in the method for changing the blockchain consensus of the present invention.

[0041] The realization of the purpose, functional features and advantages of the present invention will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION

[0042] It should be understood that the specific embodiments described herein are only used to explain the present invention, and are not used to limit the present invention.

[0043] The blockchain consensus mechanism is a blockchain governance system. It is a set of methods designed by combining multiple disciplines such as economics and game theory to ensure that each node in the blockchain can actively maintain the blockchain system. It is the core of maintaining the safe and stable operation of the blockchain.

[0044] In related technologies, there are three main types of blockchain consensus mechanisms: 1. Proof of Work (PoW); 2. Proof of Stake (PoS); 3. Delegated Proof of Stake (DPoS).

[0045] In the PoW mechanism, each node competes for the right to record accounts through computer computing power. Whoever gets it first and completes the accounting work correctly will get the system reward first. Its advantages are complete decentralization, free entry and exit of nodes, and avoiding the cost of establishing and maintaining centralized credit institutions. As long as the computing power of the network destroyer does not exceed 50% of the total computing power of the entire network, historical records cannot be tampered with. This causes a lot of computing power and energy waste, and the settlement cycle of the PoW mechanism is long.

[0046] In the PoS mechanism, the number and duration of holding tokens determine the probability of blockchain nodes obtaining bookkeeping rights, which is similar to the dividend mechanism of stocks. The more shares held, the more dividends can be obtained. Its advantage is that it reduces the resource waste of the PoW mechanism and speeds up the calculation speed. The disadvantage is that the more tokens a node holds and the longer it has held, the greater the probability of obtaining bookkeeping rights, which can easily lead to the Matthew effect, with more and more concentrated rights and interests and lower and lower degree of decentralization, thus losing fairness.

[0047] The DPoS mechanism is a solution derived from the PoS mechanism. It is similar to the voting of the board of directors. People who own tokens vote for fixed nodes and elect several agents, who are responsible for verification and bookkeeping. Unlike PoW and PoS, where the entire network can participate in the bookkeeping competition, the bookkeeping nodes of DPoS are determined within a certain period of time. Compared with PoW, DPoS greatly improves the ability of blockchain to process data. However, its degree of decentralization is weak, and node agents are all selected manually, which will form a cartel (monopoly organization) and the motivation to bribe voters.

[0048] Therefore, in the related art, the blockchain system generally includes multiple consensus nodes, and the multiple consensus nodes complete the chaining of new blocks based on the consensus mechanism, thereby improving the consensus efficiency of the blockchain. In order to ensure the degree of decentralization, a random number is generated in each round of consensus nodes, and then the consensus node for the next round is determined based on the random number. However, during the random selection, malicious nodes can predict the timing of their election as consensus nodes, and try to attack the blockchain system at a lower cost of maliciousness, thereby affecting the security of the blockchain.

[0049] To this end, the present invention provides a method for changing a blockchain consensus node, in which the consensus node of the cycle node can be changed only when the temporary verification closed-loop chain of the alternative block under the current verification cycle and the multiple verification closed-loop chains of the first preset number of blocks do not record the last newly added consensus node in the cycle node group, thereby ensuring that attackers cannot control the entire blockchain network by quickly introducing verification nodes under their control, thereby improving the security of the blockchain.

[0050] The inventive concept of the present application is further described below in conjunction with some specific embodiments.

[0051] The embodiment of the present invention shows a blockchain system, see Figure 1 The blockchain system includes multiple nodes, the multiple nodes include a cyclic node group, the cyclic node group includes multiple consensus nodes, and the multiple consensus nodes serve as verification nodes in turn to verify new blocks during the verification cycle.

[0052] Multiple consensus nodes in the cycle node group vote for different candidate blocks in a fixed time period. In any verification cycle, multiple consensus nodes in the cycle node group become verification nodes in turn. The verification node will select the block with the highest voting score as the candidate block, and verify the candidate block. After passing the verification, it will be added to the blockchain system.

[0053] For example, in this embodiment, multiple consensus nodes in the circular node group vote for different blocks every 7 seconds, and the voting time will not be extended due to the increase in consensus nodes, which effectively guarantees the transaction processing efficiency of the blockchain network. In this embodiment, as long as more than 50% of the consensus nodes remain honest, the block with the highest score can always be selected for verification, thereby maintaining the integrity of the blockchain.

[0054] The number of consensus nodes in the cycle node group can be changed, that is, new consensus nodes can be added or some consensus nodes can be deleted. After the genesis block is generated, the initial number of consensus nodes in the cycle node group can be 5 blocks. In addition to the consensus nodes in the cycle node group, multiple nodes in the blockchain system can wait to join the cycle node group to become new consensus nodes. Therefore, the consensus nodes in the blockchain system provided in this embodiment can be changed, so that the blockchain network has the ability to be decentralized.

[0055] The following consensus rules can be declared in the blockchain to ensure the security of the blockchain network while maintaining high transaction processing performance and decentralization of the blockchain system:

[0056] (1) When the candidate block does not record the last newly added consensus node in the cycle node group in the temporary verification closed-loop chain under the current verification cycle and the verification closed-loop chain of the first preset number of blocks, it is allowed to change the consensus node in the cycle node group.

[0057] (2) The length of any verification cycle is greater than half of the maximum value of the multiple lengths of the second preset number of verification cycles plus one.

[0058] The blockchain system provided by the present invention has a high time cost due to attacking the network. Without sacrificing decentralization and scalability, the security is stronger than any other blockchain. The consensus mechanism in the blockchain of the present invention has no consensus nodes that can be changed, making the blockchain network more decentralized. The circular node group in the present invention can process voting transactions in parallel by each consensus node at the same time, effectively ensuring the transaction processing performance of the blockchain network.

[0059] The present invention provides a first embodiment of a method for changing a blockchain consensus node. Figure 2 , Figure 2 This is a flow chart of the first embodiment of the method for changing a blockchain consensus node of the present invention.

[0060] In this embodiment, the method includes the following steps:

[0061] Step S100: Obtain a temporary verification closed-loop chain of the candidate block in the current verification cycle and a verification closed-loop chain of a first preset number of blocks.

[0062] Among them, the starting node of the verification closed-loop chain of any block is the verification node of the block, and the end node is the next verification node in the current verification cycle.

[0063] After multiple consensus nodes in the loop node group vote for different blocks in parallel, the verification block will use the block with the highest score as a candidate block for verification. For any candidate block or block, when its verification node is determined, the verification node can be used as the starting node to generate a verification closed-loop chain.

[0064] See also Figure 1 and Figure 3 For example, for a loop node group with a verification cycle of 5, the initial consensus nodes of the loop node group are E, D, C, B, and A. In the last verification step of the first round of verification cycle, the verification closed-loop chain of the block with a block height of 5 is: 5E-4D-3C-2B-1A. The starting node of the verification closed-loop chain is E, and the end node is the next verification node A. At this time, the verification closed-loop chain records 5 newly initialized consensus nodes E, D, C, B, and A.

[0065] Step S200: Determine whether the last newly added consensus node in the loop node group is not recorded in the temporary verification closed-loop chain and all verification closed-loop chains.

[0066] Among them, the newly added consensus node performed the verification step when joining the cycle node group, but did not perform the verification operation after joining the cycle node group. After joining the cycle node group, if the newly added consensus node performs a new verification step to verify the candidate block, the consensus node is no longer considered a newly added consensus node.

[0067] For example, the verification closed-loop chain of a block with a block height of 6 is 6A-5E-4D-3C-2B. At this time, the verification closed-loop chain records 4 newly initialized consensus nodes E, D, C, and B. Node A is a newly added consensus node after initially verifying a block with a block height of 1, but after node A verifies a block with a block height of 6, it is no longer considered a newly added consensus node.

[0068] Step S300: If yes, then change the consensus node in the cycle node group and enter the next cycle verification period.

[0069] In this embodiment, by delaying the time for nodes to join the consensus nodes, when the consensus nodes are changed, it is ensured that malicious nodes cannot quickly enter the circular node group and become verification nodes to control the entire blockchain network, thereby reducing the time cost of malicious nodes attacking the blockchain network and further improving the security of the blockchain network.

[0070] For ease of understanding, a specific embodiment is shown below:

[0071] For example, the verification closed-loop chain of a block with a block height of 6 is 6A-5E-4D-3C-2B. At this time, there are four newly initialized consensus nodes E, D, C, and B.

[0072] For example, the verification closed-loop chain of a block with a block height of 7 is 7B-6A-5E-4D-3C. At this time, there are three newly initialized consensus nodes E, D, and C. After node B verifies the block with a block height of 7, it is no longer considered a newly added consensus node.

[0073] For example, the verification closed-loop chain of a block with a block height of 8 is 8C-7B-6A-5E-4D. At this time, there are two newly initialized consensus nodes E and D. After node C verifies the block with a block height of 8, it is no longer considered a newly added consensus node.

[0074] For example, the verification closed-loop chain of a block with a block height of 9 is 9D-8C-7B-6A-5E. At this time, there is a record of 1 newly initialized consensus node E. After node D verifies the block with a block height of 9, it is no longer considered a newly added consensus node.

[0075] For example, the verification closed-loop chain of the block with a block height of 10 is 10E-9D-8C-7B-6A. At this time, no new consensus nodes are recorded. After node E verifies the block with a block height of 10, it is no longer considered a new consensus node.

[0076] For the candidate block with an estimated block height of 11, its verification node is A. Therefore, during this verification cycle, the temporary verification closed-loop chain is 11A-10E-9D-8C-7B. At this time, no new consensus nodes are recorded.

[0077] Therefore, if the first preset number is 1, the last newly added consensus node in the cycle node group is not recorded in the temporary verification closed-loop chain 11A-10E-9D-8C-7B and the verification closed-loop chain 10E-9D-8C-7B-6A of the previous block with a block height of 10. At this time, the judgment result is yes, and the consensus node in the cycle node group can be changed.

[0078] At this point, the consensus node of the circulating node group can be changed after the newly added consensus node has gone through a round of verification cycle.

[0079] Therefore, see Figure 3, if the first preset number is 3, until the candidate block with a block height of 13 is expected, its verification node is C. Therefore, during this verification cycle, the temporary verification closed-loop chain is 13C-12B-11A-10E-9D. At this time, the temporary verification closed-loop chain 13C-12B-11A-10E-9D, the verification closed-loop chain 12B-11A-10E-9D-8C of the previous block with a block height of 12, the verification closed-loop chain 11A-10E-9D-8C-7B of the second block with a block height of 11, and the verification closed-loop chain 10E-9D-8C-7B-6A of the third block with a block height of 10 do not record the last newly added consensus node in the cycle node group. At this time, if the judgment result is yes, the consensus node in the cycle node group can be changed.

[0080] At this time, after the newly added consensus node has gone through a round of verification cycle, it is necessary to wait for 2 new blocks to be added before the consensus node of the cycle node group can be changed.

[0081] Changing the consensus node in the circulation node group can be done by selecting a new node from the rest of the blockchain nodes to join the circulation node group. Alternatively, the consensus node can be deleted from the circulation node group.

[0082] After the cycle node group change is completed, the current verification cycle ends and enters the next verification cycle. In a verification cycle, multiple consensus nodes still serve as verification nodes to verify candidate blocks in turn.

[0083] In order to delay malicious nodes from becoming consensus nodes, the first preset number is set to a larger value, but in order to avoid the rigidity of consensus nodes and the formation of a cartel (monopoly organization), the first preset number is easily set to a smaller value. Optionally, the first preset number can be set to 3.

[0084] Based on the first embodiment of the method for changing the blockchain consensus node of the present invention, a second embodiment of the method for changing the blockchain consensus node of the present invention is proposed. Figure 5 , Figure 5 This is a flow chart of the second embodiment of the method for changing a blockchain consensus node of the present invention.

[0085] In this embodiment, when the consensus node in the circular node group is changed to a newly added consensus node, step S300 includes the following steps:

[0086] Step S301: randomly select a candidate node from the remaining nodes of the blockchain system.

[0087] The rest of the nodes in the blockchain system are waiting to become consensus nodes.

[0088] In order to prevent malicious nodes from becoming consensus nodes too quickly, in step S301, candidate nodes need to be randomly selected from the candidate nodes of the blockchain system. The candidate nodes are nodes that have existed in the blockchain system for longer than a preset time.

[0089] If the preset duration is 30 days, a node will start tracking the blockchain and its status after the first initialization. The node will notify the cyclic node group of its existence, and the cyclic node group will record the existence of the node with a timestamp. After the 30-day waiting period, the node becomes a candidate node and is eligible to be randomly selected as a candidate node.

[0090] Step S302: If the candidate node verifies the candidate block and the verification is successful, the candidate node is determined as a new consensus node and added to the circular node group.

[0091] Candidate nodes are not added to the cycle node group directly, but are added to the cycle node group after the candidate is successfully verified and ensured to have the corresponding computing power.

[0092] For example, see Figure 4 , for the candidate block with an estimated block height of 13, its verification node is C. After the judgment in step S300 is passed, the candidate block F successfully verifies the candidate block and adds it to the blockchain. At this time, the candidate block F is added to the circular node group as a consensus node. The order of the circular node group is F, C, D, E, A, B.

[0093] In this embodiment, based on the above steps, the time it takes for a malicious node to become a consensus node can be further extended, thereby improving security.

[0094] In one embodiment, in order to prevent the addition of a new consensus node from affecting the order of existing consensus nodes, if a candidate node verifies a new block and verifies successfully, the candidate node is determined as a new consensus node, and the new consensus node is added to the cycle node group as the current verification node. Then the next verification cycle is entered.

[0095] For example, after adding block F as the current verification node to the cycle node group, the next verification cycle begins. The first verification step of the verification cycle has been completed, that is, block F verifies the verification step of block height 13, and it is the turn of block C to become a verification node. At this time, the length of the verification cycle is 6.

[0096] Based on the first and second embodiments of the method for changing a blockchain consensus node of the present invention, a third embodiment of the method for changing a blockchain consensus node of the present invention is proposed. Figure 6 , Figure 6 This is a flow chart of the third embodiment of the method for changing a blockchain consensus node of the present invention.

[0097] When the cyclic node group is changed to delete the consensus node, after step S300, the method further includes the following steps:

[0098] Step S400: If the length value of the next verification cycle is greater than half of the maximum value of the multiple length values ​​of the previous second preset number of verification cycles plus one, cancel the change of the consensus node in the cycle node group and return to the current verification cycle.

[0099] Since malicious nodes can only control the blockchain network if they control more than 50% of the consensus nodes after joining the circulating node group, in order to ensure that attackers who are trying to control the blockchain cannot exclude the majority of secure consensus nodes in the circulating node group, it is necessary to limit the number of consensus nodes that can be deleted at a time. Understandably, the existing consensus nodes in the first few verification cycles are proven to be secure, which can effectively prevent attackers from attacking the blockchain network.

[0100] For example, the first verification cycle includes 5 consensus nodes A, B, C, D, and E, and the length of the verification cycle is 5. The second verification cycle includes 6 consensus nodes A, B, C, D, E, and F, and the length of the verification cycle is 6. The third verification cycle includes 7 consensus nodes A, B, C, D, E, F, and G, and the length of the verification cycle is 7. For the fourth verification cycle, its length value needs to meet the preset conditions, otherwise the change operation is canceled.

[0101] If the second preset number is 3, the preset conditions are:

[0102] The length value Cn+1 of the current verification cycle is greater than half of the maximum value of the multiple length values ​​of the previous three verification cycles+1.

[0103] That is, Cn+1 > ½ [ max(Cn-2,Cn-1,Cn) + 1 ]

[0104] If the change is completed, when the fourth verification cycle is the next verification cycle, the length value Cn+1 must be greater than 4. If the attacker deletes 3 consensus nodes from 7 consensus nodes, resulting in only 4 consensus nodes remaining in the current verification cycle, ensuring that the 2 consensus nodes controlled by him control 50% of the computing power, then in order to ensure the security of the blockchain network, the operation of deleting 3 consensus nodes from 7 consensus nodes is canceled and returned to the current verification cycle, that is, there are still 7 consensus nodes.

[0105] In other embodiments, the second preset number may also be 2 or 4, etc., which is not limited in this embodiment.

[0106] In addition, the present invention provides a first embodiment of a device for changing a blockchain consensus node. Figure 7 , Figure 7 This is a functional module diagram of the first embodiment of the device for changing the blockchain consensus node of the present invention.

[0107] In this embodiment, the block chain consensus node changing device includes:

[0108] The record acquisition module 10 is used to obtain the temporary verification closed-loop chain of the candidate block in the current verification cycle and multiple verification closed-loop chains of the previous preset number of blocks; wherein the starting node of the verification closed-loop chain of any block is the verification node of the block, and the terminal node is the next verification node in the current verification cycle;

[0109] The result judgment module 20 is used to judge whether the last newly added consensus node in the loop node group is not recorded in the temporary verification closed-loop chain and all verification closed-loop chains; wherein the newly added consensus node does not perform the verification operation after joining the loop node group;

[0110] The node change module 30 is used to change the consensus node in the cycle node group and enter the next cycle verification cycle.

[0111] In one embodiment, the node change module 30 includes:

[0112] A random selection unit, used to randomly select candidate nodes from the remaining nodes of the blockchain system;

[0113] The node adding unit is used to determine the candidate node as a new consensus node and add it to the circular node group if the candidate node verifies the candidate block and the verification is successful.

[0114] In one embodiment, the random selection unit is used to randomly select a candidate node from the candidate nodes of the blockchain system; wherein the candidate node is a node whose existence time in the blockchain system is greater than a preset time.

[0115] In one embodiment, the node adding unit is used to determine the candidate node as a new consensus node if the candidate node verifies the candidate block and the verification is successful, and add the new consensus node to the circular node group as the current verification node.

[0116] In one embodiment, the device for changing the blockchain consensus node further includes:

[0117] The length verification module is used to cancel the change of the consensus node in the cycle node group and return to the current verification cycle if the length value of the next verification cycle is greater than half of the maximum value of the multiple length values ​​of the previous second preset number of verification cycles plus one.

[0118] Reference Figure 8 , Figure 8 It is a schematic diagram of the structure of a recommended electronic device involved in an embodiment of the present invention.

[0119] The electronic device includes: at least one processor 301, a memory 302, and a blockchain consensus node change program stored in the memory and executable on the processor, wherein the blockchain consensus node change program is configured to implement the steps of the blockchain consensus node change method as described above.

[0120] The processor 301 may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor 301 may be implemented in at least one hardware form of DSP (Digital Signal Processing), FPGA (Field-Programmable Gate Array), and PLA (Programmable Logic Array). The processor 301 may also include a main processor and a coprocessor. The main processor is a processor for processing data in the awake state, also known as a CPU (Central Processing Unit); the coprocessor is a low-power processor for processing data in the standby state. In some embodiments, the processor 301 may be integrated with a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content to be displayed on the display screen.

[0121] The memory 302 may include one or more computer-readable storage media, which may be non-transitory. The memory 302 may also include a high-speed random access memory, and a non-volatile memory, such as one or more disk storage devices, flash memory storage devices. In some embodiments, the non-transitory computer-readable storage medium in the memory 302 is used to store at least one instruction, which is used to be executed by the processor 301 to implement the method for changing the blockchain consensus node provided in the method embodiment of the present application.

[0122] The electronic device further includes: a communication interface 303. The processor 301, the memory 302 and the communication interface 303 may be connected via a bus or a signal line. Each peripheral device may be connected to the communication interface 303 via a bus, a signal line or a circuit board.

[0123] The communication interface 303 may be used to connect at least one peripheral device related to I / O (Input / Output) to the processor 301 and the memory 302. In some embodiments, the processor 301, the memory 302, and the communication interface 303 are integrated on the same chip or circuit board; in some other embodiments, any one or two of the processor 301, the memory 302, and the communication interface 303 may be implemented on a separate chip or circuit board, which is not limited in this embodiment.

[0124] Those skilled in the art will understand that Figure 8 The structure shown in does not constitute a limitation on the recommended electronic device for changing the blockchain consensus node, and may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently.

[0125] In addition, an embodiment of the present invention further proposes a computer program product, including an executable program code, and when the computer program product is executed by a processor, the steps of the method of the method embodiment above are implemented. Therefore, it will not be repeated here. In addition, the description of the beneficial effects of adopting the same method will not be repeated. For technical details not disclosed in the computer program product embodiment involved in this application, please refer to the description of the method embodiment of this application. As an example, the program instructions can be deployed to be executed on one computing device, or on multiple computing devices located at one location, or on multiple computing devices distributed at multiple locations and interconnected by a communication network.

[0126] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program, and the above-mentioned program can be stored in a computer-readable storage medium, and when the program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, the above-mentioned storage medium can be a disk, an optical disk, a read-only memory (ROM) or a random access memory (RAM), etc.

[0127] It should also be noted that the device embodiments described above are merely schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. In addition, in the accompanying drawings of the device embodiments provided by the present invention, the connection relationship between the modules indicates that there is a communication connection between them, which may be specifically implemented as one or more communication buses or signal lines. A person of ordinary skill in the art may understand and implement it without paying any creative effort.

[0128] Through the description of the above implementation mode, the technicians in the field can clearly understand that the present invention can be implemented by means of software plus necessary general hardware, and of course, it can also be implemented by special hardware including special integrated circuits, special CPUs, special memories, special components, etc. In general, all functions completed by computer programs can be easily implemented by corresponding hardware, and the specific hardware structure used to implement the same function can also be various, such as analog circuits, digital circuits or special circuits. However, for the present invention, software program implementation is a better implementation mode in more cases. Based on such an understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a readable storage medium, such as a computer floppy disk, a U disk, a mobile hard disk, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), a disk or an optical disk, etc., including a number of instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform the methods of various embodiments of the present invention.

[0129] The above are only preferred embodiments of the present invention, and are not intended to limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made using the contents of the present invention specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.

Claims

1. A method for changing a blockchain consensus node, characterized in that: The blockchain system includes a cycle node group, the cycle node group includes a plurality of consensus nodes, and the plurality of consensus nodes sequentially serve as verification nodes to verify new blocks during a verification cycle; The method comprises the following steps: Obtaining a temporary verification closed-loop chain of the candidate block in the current verification cycle and a verification closed-loop chain of the first preset number of blocks; wherein the starting node of the verification closed-loop chain of any block is the verification node of the block, and the terminal node is the next verification node in the current verification cycle; Determine whether the last newly added consensus node in the cycle node group is not recorded in the temporary verification closed-loop chain and all the verification closed-loop chains; wherein the newly added consensus node performs a verification step when joining the cycle node group, and does not perform a verification operation after joining the cycle node group; If so, the consensus node in the cycle node group is changed and the next verification cycle is entered.

2. The method for changing a blockchain consensus node according to claim 1, characterized in that: The step of changing the consensus node in the circulation node group includes: Randomly select a candidate node from the remaining nodes of the blockchain system; If the candidate node verifies the candidate block and the verification is successful, the candidate node is determined as a new consensus node and added to the circulation node group.

3. The method for changing a blockchain consensus node according to claim 2, characterized in that: The step of randomly selecting a candidate node from the remaining nodes of the blockchain system comprises: A candidate node is randomly selected from the candidate nodes of the blockchain system; wherein the candidate node is a node whose existence time in the blockchain system is greater than a preset time.

4. The method for changing a blockchain consensus node according to claim 2, characterized in that: If the candidate node verifies the candidate block and the verification is successful, the step of determining the candidate node as a new consensus node and adding it to the circular node group includes: If the candidate node verifies the candidate block and the verification is successful, the candidate node is determined as a new consensus node, and the new consensus node is added to the cycle node group as a current verification node.

5. The method for changing a blockchain consensus node according to claim 1, characterized in that: After the step of changing the consensus node in the cycle node group and entering the next verification cycle, the method further includes: If the length value of the next verification cycle is greater than half of the maximum value of the multiple length values ​​of the previous second preset number of verification cycles plus one, the change of the consensus node in the cycle node group is canceled and the cycle is returned to the current verification cycle.

6. The method for changing a blockchain consensus node according to claim 5, characterized in that: When the genesis block is generated, the cycle node group includes 5 initial consensus nodes; The first preset number is 3; and / or The second preset number is 3.

7. A device for changing a blockchain consensus node, characterized in that: The blockchain system includes a cycle node group, the cycle node group includes a plurality of consensus nodes, and the plurality of consensus nodes sequentially serve as verification nodes to verify new blocks during a verification cycle; The blockchain consensus node changing device includes: A record acquisition module, used to acquire a temporary verification closed-loop chain of the candidate block in the current verification cycle and multiple verification closed-loop chains of a preset number of blocks before; wherein the starting node of the verification closed-loop chain of any block is the verification node of the block, and the terminal node is the next verification node in the current verification cycle; A result judgment module is used to judge whether the temporary verification closed-loop chain and the verification closed-loop chain do not record the last newly added consensus node in the cycle node group; wherein the newly added consensus node performs a verification step when joining the cycle node group, and does not perform a verification operation after joining the cycle node group; The node change module is used to change the consensus node in the cycle node group and enter the next verification cycle.

8. A blockchain system, characterized in that: It includes a cycle node group, the cycle node group includes a plurality of consensus nodes, and the plurality of consensus nodes sequentially serve as verification nodes to verify a new block during a verification cycle; The consensus node of the cyclic node group is changed by the method described in any one of claims 1-6.

9. An electronic device, characterized in that: The method comprises a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the method according to any one of claims 1 to 6.

10. A computer program product, characterized in that The method comprises an executable program code, wherein when the program code is executed by a processor, the method according to any one of claims 1 to 6 is performed.

Citation Information

Patent Citations

  • Method and device for managing blockchain nodes and computer readable medium

    CN111291060A

  • System and method for adding node in blockchain network

    CN111480157A