A method and device for block consensus conversion
By obtaining and verifying the blocks to be mirrored in the blockchain system, and using different consensus algorithms for consensus processing, the cross-chain problem between different types of consensus algorithms is solved, the security and real-time performance of the blockchain are improved, and the Reliable transformation of block consensus.
Patent Information
- Application Number
- CN202011059480.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-09-30
- Publication Date
- 2024-10-15
- Estimated Expiration
- 2040-09-30
AI Technical Summary
Existing technology is difficult to implement cross-chain blockchain between different types of consensus algorithms, especially in cross-chain scenarios between eventual consistency and immediate consistency consensus algorithms, resulting in the security and real-time performance of the blockchain. Needs are not effectively met.
Obtain the block to be mirrored through the consensus participating nodes in the mirror chain system, and determine whether the block to be mirrored meets the mirroring requirements based on the second block in the second blockchain, using a second consensus algorithm that is different from the first consensus algorithm. Carry out consensus to ensure that the blocks to be mirrored are added to the mirror chain after meeting the consensus requirements to achieve block consensus transformation under different types of consensus algorithms.
It improves the reliability of blocks when cross-chain, reduces the possibility of block rollback, avoids soft fork rollback caused by forks, realizes block consensus conversion between different types of consensus algorithms, and enhances financial Security and real-time needs of the payment industry.
Smart Images

Figure CN112162760B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of financial technology (Fintech), and in particular to a method and device for block consensus conversion. Background Art
[0002] With the development of computer technology, more and more technologies (such as blockchain, cloud computing or big data) are being applied in the financial field. The traditional financial industry is gradually transforming into financial technology, and big data technology is no exception. However, due to the security and real-time requirements of the financial and payment industries, higher requirements are also placed on big data technology.
[0003] The consensus algorithms of blockchain can be divided into consensus algorithms with eventual consistency (such as POW (Proof Of Work) algorithm) and consensus algorithms with immediate consistency (such as PBFT (Practical Byzantine Fault Tolerance) algorithm). At present, cross-chain solutions of blockchain generally occur between consensus algorithms of the same type. For example, the cross-chain scenario between blockchains with eventual consistency consensus algorithm is the cross-chain scenario of public chain; the cross-chain scenario between blockchains with immediate consistency consensus algorithm is the cross-chain scenario of alliance chain. Before cross-chain between two different types of consensus algorithms, the results of different types of consensus algorithms need to be converted into the results of the same type of consensus algorithms. After the algorithm is unified, cross-chain can be performed.
[0004] Therefore, there is an urgent need for a method for block consensus conversion based on different types of consensus algorithms. Summary of the invention
[0005] The embodiment of the present invention provides a method for block consensus conversion, which is used to realize block consensus conversion based on different types of consensus algorithms.
[0006] In a first aspect, an embodiment of the present invention provides a method for block consensus conversion, including: a consensus participating node in a mirror chain system obtains a second block corresponding to the block to be mirrored from a second blockchain of a second node based on a consensus process triggered by a block-producing node for the block to be mirrored; the block to be mirrored is generated by the block-producing node according to a first block that meets the mirroring requirement; the first block is obtained from a first blockchain of a first node; the first node and the second node are any nodes in a first blockchain system; the first blockchain system adopts a first consensus algorithm; the mirroring requirement is used to indicate that the probability of block rollback is lower than a set threshold;
[0007] The consensus participating nodes reach a consensus on the block to be mirrored according to a second consensus algorithm;
[0008] After the block to be mirrored meets the consensus requirement, the consensus participating node adds the block to be mirrored to the mirror chain of the consensus participating node.
[0009] In the above technical solution, by obtaining the block to be mirrored in the blockchain, and obtaining the second block corresponding to the block to be mirrored according to the block to be mirrored, it is determined through the second block that the block to be mirrored meets the mirroring requirements, so as to avoid the rollback of the block to be mirrored, and a second consensus algorithm different from the first consensus algorithm is used to reach a consensus on the block to be mirrored. After the consensus requirements are met, the block to be mirrored is chained to the mirror chain, so as to realize the block consensus conversion under different types of consensus algorithms.
[0010] Optionally, the consensus participating nodes reach a consensus on the block to be mirrored according to a second consensus algorithm, including:
[0011] The consensus participating node determines whether it meets the consensus premise; the consensus premise is that the block body of the second block is the same as the block body of the block to be mirrored and the second block meets the mirroring requirement;
[0012] After the consensus participating node determines that there are multiple consensus participating nodes that meet the consensus prerequisite, consensus is reached on the block to be mirrored according to the second consensus algorithm.
[0013] In the above technical solution, according to the second block satisfying the mirroring requirement, the second block is avoided from rolling back, and the possibility of rolling back of the second block is reduced. According to determining that the block body of the second block is the same as the block body of the block to be mirrored, when the first blockchain is forked, the block on the obtained soft fork is avoided as the block to be mirrored, thereby avoiding the rollback of the block to be mirrored.
[0014] Optionally, if the consensus participating node determines that it does not meet the consensus prerequisite, it exits the consensus process.
[0015] Optionally, before obtaining the second block corresponding to the block to be mirrored from the second blockchain of the second node, the method further includes:
[0016] The consensus participating node randomly determines the second node from the first blockchain system.
[0017] Optionally, the mirror requirement is used to indicate that the probability of block rollback is lower than a set threshold, including: determined according to the block generation attributes of the first blockchain system; the block generation attributes include at least one of the following: block generation time, block generation difficulty, and block generation efficiency.
[0018] In a second aspect, an embodiment of the present invention provides a method for block consensus conversion, including:
[0019] The block-producing node in the mirror chain system determines that the first block meets the mirroring requirement, and then generates a block to be mirrored according to the first block; the first block is obtained from the first blockchain of the first node in the first blockchain system; the first blockchain system adopts a first consensus algorithm; the mirroring requirement is used to indicate that the probability of block rollback is lower than a set threshold;
[0020] The block-producing node initiates a consensus process for the block to be mirrored in the mirror chain system; the consensus process is used by the consensus participating nodes in the mirror chain system to determine whether the block to be mirrored meets the consensus requirements according to the second consensus algorithm;
[0021] After the block to be mirrored meets the consensus requirement, the block-producing node adds the block to be mirrored to the mirror chain of the block-producing node.
[0022] In the above technical solution, based on the first block in the first blockchain of the first consensus algorithm obtained, the block to be mirrored determined by the consensus participating nodes in the mirror chain system of the second consensus algorithm different from the first consensus algorithm is obtained, so as to realize the conversion of the block from the first consensus algorithm to the second consensus algorithm.
[0023] Optionally, the first blockchain system and the second blockchain system form a cross-chain relationship, and the second blockchain system adopts the second consensus algorithm;
[0024] After adding the block to be mirrored to the mirror chain of the block-producing node, the process further includes:
[0025] The block-producing node sends the block to be mirrored to the second blockchain system; the second blockchain system is used to put the block to be mirrored on the chain after reaching a consensus on the block to be mirrored.
[0026] Optionally, determining whether the block to be mirrored meets the consensus requirement includes:
[0027] Any consensus participating node obtains a second block corresponding to the block to be mirrored from a second blockchain of a second node; the second node is any node in the first blockchain system;
[0028] The consensus participating node determines that the block body of the second block is the same as the block body of the block to be mirrored and that the second block meets the mirroring requirement.
[0029] In the above technical solution, the block to be mirrored is determined according to the second block in the second blockchain of the second node, so as to avoid using the block on the soft fork obtained as the block to be mirrored when the first blockchain is forked, thereby reducing the rollback of the block to be mirrored.
[0030] Optionally, before the block producing node determines that the first block meets the mirroring requirement, the process further includes:
[0031] The block producing node randomly determines the first node from the first blockchain system;
[0032] Before any consensus participating node obtains the second block corresponding to the block to be mirrored from the second blockchain of the second node, the process further includes:
[0033] Any consensus participating node randomly determines the second node from the first blockchain system.
[0034] In a third aspect, the present invention provides a device for block consensus conversion, including:
[0035] An acquisition module is used to acquire a second block corresponding to the block to be mirrored from a second blockchain of a second node based on a consensus process triggered by a block-producing node for the block to be mirrored; the block to be mirrored is generated by the block-producing node according to a first block that meets the mirroring requirement; the first block is acquired from a first blockchain of the first node; the first node and the second node are any nodes in a first blockchain system; the first blockchain system adopts a first consensus algorithm; the mirroring requirement is used to indicate that the probability of block rollback is lower than a set threshold;
[0036] A processing module, used for reaching consensus on the block to be mirrored according to a second consensus algorithm;
[0037] After the block to be mirrored meets the consensus requirements, the block to be mirrored is added to the mirror chain.
[0038] Optionally, the processing module is specifically used for:
[0039] Determine whether it meets the consensus premise; the consensus premise is that the block body of the second block is the same as the block body of the block to be mirrored and the second block meets the mirroring requirement;
[0040] After determining that there are multiple consensus participating nodes that meet the consensus prerequisite, consensus is reached on the block to be mirrored according to the second consensus algorithm.
[0041] Optionally, the processing module is specifically used for:
[0042] If it is determined that it does not meet the consensus prerequisite, it will exit the consensus process.
[0043] Optionally, the processing module is specifically used for:
[0044] Before obtaining the second block corresponding to the block to be mirrored from the second blockchain of the second node, the second node is randomly determined from the first blockchain system.
[0045] Optionally, the mirroring requirement is determined according to the block generation attributes of the first blockchain system; the block generation attributes include at least one of the following: block generation time, block generation difficulty, and block generation efficiency.
[0046] In a fourth aspect, the present invention provides a device for block consensus conversion, including:
[0047] A processing unit, configured to determine that a first block satisfies a mirroring requirement, and then generate a block to be mirrored according to the first block; the first block is obtained from a first blockchain of a first node in a first blockchain system; the first blockchain system adopts a first consensus algorithm; the mirroring requirement is used to indicate that a probability of block rollback is lower than a set threshold;
[0048] A consensus unit, used to initiate a consensus process of the block to be mirrored in the mirror chain system; the consensus process is used for the consensus participating nodes in the mirror chain system to determine whether the block to be mirrored meets the consensus requirements according to the second consensus algorithm;
[0049] After the block to be mirrored meets the consensus requirements, the block to be mirrored is added to the mirror chain of the block-producing node.
[0050] Optionally, the first blockchain system and the second blockchain system form a cross-chain relationship, and the second blockchain system adopts the second consensus algorithm;
[0051] The consensus unit is also used to:
[0052] After adding the block to be mirrored to the mirror chain of the block-producing node, the block to be mirrored is sent to the second blockchain system; the second blockchain system is used to put the block to be mirrored on the chain after reaching a consensus on the block to be mirrored.
[0053] Optionally, the consensus unit is further used to:
[0054] Before determining that the first block satisfies the mirroring requirement, the first node is randomly determined from the first blockchain system.
[0055] In a third aspect, an embodiment of the present invention further provides a computing device, including:
[0056] A memory for storing program instructions;
[0057] The processor is used to call the program instructions stored in the memory and execute the above-mentioned block consensus conversion method according to the obtained program.
[0058] In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions, and the computer-executable instructions are used to enable a computer to execute the above-mentioned block consensus conversion method. BRIEF DESCRIPTION OF THE DRAWINGS
[0059] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0060] Figure 1 A schematic diagram of a system architecture provided for an embodiment of the present invention;
[0061] Figure 2 A flowchart of a method for block consensus conversion provided by an embodiment of the present invention;
[0062] Figure 3 A schematic diagram of a method for satisfying a consensus premise provided by an embodiment of the present invention;
[0063] Figure 4 A schematic diagram of a block to be mirrored on a chain provided by an embodiment of the present invention;
[0064] Figure 5 A flowchart of a method for block consensus conversion provided by an embodiment of the present invention;
[0065] Figure 6 A schematic diagram of the structure of a device for block consensus conversion provided by an embodiment of the present invention;
[0066] Figure 7 A schematic diagram of the structure of a device for block consensus conversion provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0067] In order to make the purpose, technical scheme and advantages of the present invention clearer, the present invention will be further described in detail below with reference to the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0068] In the blockchain, each node's blockchain maintains a consistent algorithm. In the network composed of nodes, each node independently stores a complete copy of the blockchain. The blockchain continuously generates new blocks, which requires the nodes to use a consensus algorithm to ensure the consistency of the data content of the new blocks. Among them, the consensus algorithm is a common algorithm that nodes follow to maintain block consistency. When the consensus algorithm is executed, the nodes will send data to each other for interaction. Only blocks that have been successfully agreed upon by the consensus algorithm can become new blocks and be connected to the existing blockchain.
[0069] Specifically, consensus algorithms are divided into those based on eventual consistency and those based on immediate consistency. Consensus algorithms based on immediate consistency have absolutely consistent consensus results, such as PBFT and Raft. When the nodes reach a consensus through the consensus algorithm, the results are immediately consistent and will not change. If the result of a node is inconsistent with the consensus result, it indicates that the node has an error and will stop running. When the node eliminates the error and restarts, it will synchronize blocks from other nodes to make the data of this node consistent with the consensus result.
[0070] However, consensus algorithms based on eventual consistency, such as POW and POS, may have inconsistent results and may have the possibility of result replacement (result rollback). Therefore, there is no absolute consistency in the consensus results of such algorithms. When the blockchain reaches consensus, the probability of inconsistent consensus results of a certain historical block gradually decreases. In actual production, after a period of operation of the blockchain, the probability of inconsistent consensus results of a certain block drops to less than the preset "final consistency" threshold. Such algorithms accept the longest chain as the consensus result. When the data of a node is inconsistent with the result of the longest chain, it will actively synchronize the data to the data of the longest chain and keep it consistent with the longest chain. Each time a new block is generated, multiple nodes compete with each other. There is a possibility that two correct blocks are generated between nodes at the same time. Therefore, it is necessary to continue to generate the next block to determine the party with a longer blockchain height and the party with a shorter blockchain height. Among them, the party with a shorter blockchain height will roll back its own blockchain data and synchronize it with the data of the party with a longer blockchain height. Therefore, there is uncertainty in the consensus results of such algorithms. In order to avoid the rollback of blockchain results during cross-chain operations, an embodiment of the present invention provides a method for block consensus conversion to achieve block consensus conversion under different types of consensus algorithms, thereby improving the reliability of blocks during cross-chain operations.
[0071] Figure 1 A system architecture applicable to an embodiment of the present invention is exemplarily shown, and the system architecture includes a first blockchain system 110, a mirror chain system 120 and a second blockchain system 130.
[0072] There are multiple nodes in the first blockchain system 110, and each node independently stores a copy of the blockchain.
[0073] The mirror chain system 120 includes multiple nodes, each of which independently stores a mirror chain copy of the blockchain based on the first blockchain system 110. When a node obtains a block to be added to the mirror chain, it acts as a block-generating node and obtains a block with the same block height as the block to be added from any node in the first blockchain system 110, then generates a block to be mirrored based on the block, and initiates a consensus process. When a node reaches a consensus on a block to be mirrored, it acts as a consensus participating node and obtains a block with the same block height as the block to be mirrored from any node, and determines that the block to be mirrored meets the consensus prerequisite based on the obtained block with the same block height as the block to be mirrored, and then reaches a consensus on the block to be mirrored, and links the block to be mirrored to the mirror chain after the block to be mirrored meets the consensus requirements.
[0074] The second blockchain system 130 is used to perform cross-chain interoperation on the mirrored block upon receiving the authentication instruction or block height information sent by the mirrored chain system 120.
[0075] It should be noted that the above Figure 1 The structure shown is only an example and is not limited to this embodiment of the present invention.
[0076] Based on the above description, Figure 2 The process of a method for block consensus conversion provided by an embodiment of the present invention is exemplarily shown, and the process can be executed by a device for block consensus conversion.
[0077] like Figure 2 As shown in the figure, the process specifically includes:
[0078] Step 201, the consensus participating node in the mirror chain system obtains the second block corresponding to the block to be mirrored from the second blockchain of the second node based on the consensus process triggered by the block-producing node for the block to be mirrored.
[0079] In an embodiment of the present invention, the block to be mirrored is generated by a block-producing node in a mirror chain system according to a first block that meets the mirroring requirements. The first block is obtained from a first blockchain of a first node. The first node and the second node are any nodes in the first blockchain system. The first blockchain system adopts a first consensus algorithm. The mirroring requirements are used to indicate that the probability of block rollback is lower than a set threshold.
[0080] Furthermore, the mirroring requirement is determined according to the block generation attributes of the first blockchain system, wherein the block generation attributes include at least one of the following: block generation time, block generation difficulty, and block generation efficiency.
[0081] For example, the first blockchain system is a POW consensus algorithm, and the block time of each block of the first blockchain is determined. The preset time threshold is 1 hour. If the difference between the block time of the highest block in the first blockchain and the block time of the block to be mirrored is greater than the time threshold, the block to be mirrored meets the mirroring requirements, otherwise it does not meet the requirements. Among them, the time threshold can be set according to the block time of the consensus algorithm, such as 1 hour, 1.5 hours, etc.
[0082] For another example, if the difference between the current world time and the block time of the block to be mirrored is greater than 1 hour (time threshold), the block to be mirrored meets the mirroring requirement, otherwise it does not meet the requirement.
[0083] For another example, the preset block height difference threshold is 5. If the difference between the highest block height in the first blockchain and the block height to be mirrored is greater than the block height difference threshold, the block to be mirrored meets the mirroring requirement, otherwise it does not meet the requirement.
[0084] Step 202: The consensus participating nodes reach a consensus on the block to be mirrored according to a second consensus algorithm.
[0085] In the embodiment of the present invention, when consensus is reached on the mirror block, it is also necessary to reach consensus on the mirror block after the consensus participating nodes determine that they meet the consensus prerequisite.
[0086] Specifically, the consensus participating node determines whether it meets the consensus premise, where the consensus premise is that the block body of the second block is the same as the block body of the block to be mirrored and the second block meets the mirroring requirements. After the consensus participating node determines that there are multiple consensus participating nodes that meet the consensus premise, it reaches a consensus on the mirrored block according to the second consensus algorithm.
[0087] In the embodiment of the present invention, the consensus participating node randomly determines the second node from the first blockchain system, obtains the second block with the same block height as the block to be mirrored in the determined second node, and then when the second block meets the above-mentioned mirroring requirements and it is determined that the block body of the second block is consistent with the block to be mirrored, it is determined that the consensus participating node meets the consensus premise. Then, the multiple consensus participating nodes that meet the consensus premise reach a consensus on the mirrored block according to the second consensus algorithm. Figure 3 An exemplary schematic diagram of a consensus-satisfying premise is shown, such as Figure 3 As shown, the second block is consistent with the block to be mirrored, but the block header is inconsistent, then the consensus participating nodes meet the consensus prerequisite.
[0088] It should be noted that after determining the consensus participating nodes that meet the consensus prerequisite, the mirror block can also be consensused according to the number of consensus participating nodes that meet the consensus prerequisite. For example, the preset number threshold is 15. If the number of consensus participating nodes that meet the consensus prerequisite is greater than 15 (the number threshold), the consensus participating nodes that meet the consensus prerequisite will consensus the mirror block according to the second consensus algorithm, otherwise exit the consensus process triggered by the mirror block. The number threshold is a value that can be set according to the number of nodes in the mirror chain system, for example, it can be 20, 30, etc.
[0089] Exemplarily, if a consensus participating node determines that it does not meet the consensus prerequisite, it exits the consensus process.
[0090] Step 203: After the block to be mirrored meets the consensus requirement, the consensus participating node adds the block to be mirrored to the mirror chain of the consensus participating node.
[0091] In the embodiment of the present invention, after the block to be mirrored meets the consensus requirements of the second consensus algorithm, the consensus participating node adds the block to be mirrored to the mirror chain of the consensus participating node. For example, the second consensus algorithm is the PBFT consensus algorithm, the number of consensus participating nodes that meet the consensus requirements is 7, and when the number of consensus results that are consistent is not less than 3, it is determined that the block to be mirrored meets the consensus requirements, and the block to be mirrored is chained to the mirror chain. Figure 4 The following is a schematic diagram showing a block to be mirrored on the chain: Figure 4 As shown, the first block with a block height of 5 in the first blockchain generates a to-be-mirrored block 5' with the same block height after meeting the mirroring requirements. After the to-be-mirrored block 5' meets the consensus requirements, the to-be-mirrored block 5' is added to the mirror chain.
[0092] In the embodiment of the present invention, by obtaining the block to be mirrored in the blockchain, and obtaining the second block corresponding to the block to be mirrored according to the block to be mirrored, the second block is prevented from rolling back according to the second block satisfying the mirroring requirements, thereby reducing the possibility of rolling back the second block. By determining that the block body of the second block is the same as the block body of the block to be mirrored, it is avoided that the block on the obtained soft fork is used as the block to be mirrored when the first blockchain is forked, thereby avoiding the rollback of the block to be mirrored. A second consensus algorithm different from the first consensus algorithm is used to reach a consensus on the block to be mirrored, and after the consensus requirements are met, the block to be mirrored is chained to the mirror chain, thereby realizing block consensus conversion under different types of consensus algorithms.
[0093] Figure 5 The following is a flow chart showing a method for converting a block consensus: Figure 5 As shown, the specific process includes:
[0094] Step 501: A block-producing node in the mirroring chain system determines that a first block meets the mirroring requirements, and then generates a block to be mirrored according to the first block.
[0095] In an embodiment of the present invention, the first block is obtained from the first blockchain of the first node in the first blockchain system. The first blockchain system adopts the first consensus algorithm, and the mirror requirement is used to indicate that the probability of block rollback is lower than a set threshold. Specifically, the block-producing node in the mirror chain system determines the mirror block to be chained according to the mirror chain, obtains the first block from the first blockchain of the first node in the first blockchain system according to the block height of the mirror block to be chained, and after determining that the first block meets the mirror requirement described in the above embodiment, generates the block to be mirrored according to the first block. For example, the block body of the first block is copied to obtain the block to be mirrored.
[0096] It should be noted that before the block producing node determines that the first block meets the mirroring requirement, the block producing node randomly determines the first node from the first blockchain system.
[0097] Step 502: the block producing node initiates a consensus process of the block to be mirrored in the mirror chain system.
[0098] In an embodiment of the present invention, the consensus process is used by consensus participating nodes in the mirror chain system to determine whether the block to be mirrored meets the consensus requirements according to the second consensus algorithm.
[0099] Step 503: After the block to be mirrored meets the consensus requirement, the block-producing node adds the block to be mirrored to the mirror chain of the block-producing node.
[0100] In an embodiment of the present invention, after the block-producing node initiates the consensus process of the block to be mirrored in the mirror chain system, the consensus participating nodes in the mirror chain system (i.e., other nodes except the block-producing node in the mirror chain system) randomly determine the second node from the first blockchain system, obtain the second block with the same block height as the block to be mirrored in the determined second node, and then when the second block meets the mirroring requirements and it is determined that the second block is consistent with the block body of the block to be mirrored, it is determined that the consensus participating nodes meet the consensus premise, and then the multiple consensus participating nodes that meet the consensus premise reach a consensus on the block to be mirrored according to the second consensus algorithm. After meeting the consensus requirements of the second consensus algorithm, the consensus participating nodes add the block to be mirrored to the mirror chain of the consensus participating nodes.
[0101] In order to better explain the above method, the method of block consensus conversion will be explained in a specific example below.
[0102] Example 1
[0103] There are four nodes A, B, C, and D in the mirror chain system. On the PBFT mirror chain in the mirror chain system, node A is used as a block generation node to generate blocks for the PBFT mirror chain. If the block height of the mirror block to be generated is 100, the block generation node A obtains the first block X with a block height of 100 from the POW first blockchain of the first node in the first blockchain system. After the block generation node A obtains the first block X, it determines whether the first block X meets the mirror requirements. If the first block X does not meet the mirror requirements, it ends directly.
[0104] If the first block X meets the mirroring requirements, the block-producing node A generates the block Y to be mirrored, and initiates the consensus process on the PBFT mirror chain in the mirror chain system. At this time, nodes A, B, C, and D act as consensus participating nodes to carry out the consensus process. Among them, the block body of the block Y to be mirrored is the same as the block body of the first block X, and the block header of the block Y to be mirrored is replaced with the block header of PBFT, and the signature information is filled in after the consensus participating nodes A, B, C, and D reach consensus.
[0105] When consensus participating nodes A, B, C, and D are conducting PBFT consensus, consensus participating nodes B, C, and D obtain the second block Z from the POW blockchain of any node in the first blockchain system according to the block height of the block Y to be mirrored, and determine whether the block body of the second block Z is the same as the block body of the block Y to be mirrored. If not, the consensus process ends.
[0106] If the consensus participating nodes B, C, and D determine that the block body of the second block Z is the same as the block body of the block to be mirrored Y, the consensus participating nodes A, B, C, and D each determine whether the blocks with the same block height as the block to be mirrored Y (such as the first block X obtained by the consensus participating node A and the second block Y obtained by the consensus participating node B) meet the mirroring requirements. If not, the consensus process ends.
[0107] If the blocks obtained by consensus participating nodes A, B, C, and D at the same block height as the block to be mirrored Y meet the mirroring requirements, the PBFT consensus algorithm is executed and the PBFT signature is filled in the block header of Y. If the consensus participating nodes A, B, C, and D determine that the block to be mirrored Y does not meet the consensus requirements (that is, the consensus results of the consensus participating nodes A, B, C, and D do not meet the consensus performance of the PBFT algorithm), the consensus process is exited.
[0108] If the consensus participating nodes A, B, C, and D determine that the block Y to be mirrored meets the consensus requirements, the block Y to be mirrored will be linked to the mirror chain and become a new block of the mirror chain. Among them, the block header of the block Y to be mirrored is the consensus result information of PBFT, that is, the signature of PBFT, and the block body is the same as the first block X or the second block Y, so that the POW block in the first blockchain system is converted into a PBFT block.
[0109] In an embodiment of the present invention, according to the first block in the first blockchain of the acquired POW, the block to be mirrored Y determined by the consensus participating node A in the mirror chain system of the PBFT different from the POW algorithm is obtained, and the second block Z corresponding to the block to be mirrored Y is obtained according to the block to be mirrored Y. It is determined through the second block Z that the block to be mirrored Y meets the mirroring requirements to avoid the rollback of the block to be mirrored. A second consensus algorithm different from the first consensus algorithm is used to reach a consensus on the block to be mirrored. After the consensus requirements are met, the block to be mirrored is chained to the mirror chain to achieve block consensus conversion under different types of consensus algorithms.
[0110] Based on the same technical concept, Figure 6 The structure of a block consensus conversion device provided by an embodiment of the present invention is exemplarily shown, and the device can execute the process of the block consensus conversion method.
[0111] like Figure 6 As shown, the device specifically includes:
[0112] The acquisition module 601 is used to acquire a second block corresponding to the block to be mirrored from the second blockchain of the second node based on the consensus process triggered by the block-producing node for the block to be mirrored; the block to be mirrored is generated by the block-producing node according to the first block that meets the mirroring requirement; the first block is acquired from the first blockchain of the first node; the first node and the second node are any nodes in the first blockchain system; the first blockchain system adopts a first consensus algorithm; the mirroring requirement is used to indicate that the probability of block rollback is lower than a set threshold;
[0113] Processing module 602, used for reaching consensus on the block to be mirrored according to a second consensus algorithm;
[0114] After the block to be mirrored meets the consensus requirements, the block to be mirrored is added to the mirror chain.
[0115] Optionally, the processing module 602 is specifically used for:
[0116] Determine whether it meets the consensus premise; the consensus premise is that the block body of the second block is the same as the block body of the block to be mirrored and the second block meets the mirroring requirement;
[0117] After determining that there are multiple consensus participating nodes that meet the consensus prerequisite, consensus is reached on the block to be mirrored according to the second consensus algorithm.
[0118] Optionally, the processing module 602 is specifically used for:
[0119] If it is determined that it does not meet the consensus prerequisite, it will exit the consensus process.
[0120] Optionally, the processing module 602 is specifically used for:
[0121] Before obtaining the second block corresponding to the block to be mirrored from the second blockchain of the second node, the second node is randomly determined from the first blockchain system.
[0122] Optionally, the mirroring requirement is determined according to the block generation attributes of the first blockchain system; the block generation attributes include at least one of the following: block generation time, block generation difficulty, and block generation efficiency.
[0123] Based on the same technical concept, Figure 7 The structure of a block consensus conversion device provided by an embodiment of the present invention is exemplarily shown, and the device can execute the process of the block consensus conversion method.
[0124] like Figure 7 As shown, the device specifically includes:
[0125] The processing unit 701 is used to determine that the first block meets the mirroring requirement, and then generate a block to be mirrored according to the first block; the first block is obtained from the first blockchain of the first node in the first blockchain system; the first blockchain system adopts a first consensus algorithm; the mirroring requirement is used to indicate that the probability of block rollback is lower than a set threshold;
[0126] A consensus unit 702 is used to initiate a consensus process of the block to be mirrored in the mirror chain system; the consensus process is used for the consensus participating nodes in the mirror chain system to determine whether the block to be mirrored meets the consensus requirements according to the second consensus algorithm;
[0127] After the block to be mirrored meets the consensus requirements, the block to be mirrored is added to the mirror chain of the block-producing node.
[0128] Optionally, the first blockchain system and the second blockchain system form a cross-chain relationship, and the second blockchain system adopts the second consensus algorithm;
[0129] The consensus unit 702 is also used for:
[0130] After adding the block to be mirrored to the mirror chain of the block-producing node, the block to be mirrored is sent to the second blockchain system; the second blockchain system is used to put the block to be mirrored on the chain after reaching a consensus on the block to be mirrored.
[0131] Optionally, the consensus unit 702 is further used for:
[0132] Before determining that the first block satisfies the mirroring requirement, the first node is randomly determined from the first blockchain system.
[0133] Based on the same technical concept, an embodiment of the present invention further provides a computing device, including:
[0134] A memory for storing program instructions;
[0135] The processor is used to call the program instructions stored in the memory and execute the block consensus conversion method according to the obtained program.
[0136] Based on the same technical concept, an embodiment of the present invention also provides a computer-readable storage medium, which stores computer-executable instructions, and the computer-executable instructions are used to enable a computer to execute a method for block consensus conversion.
[0137] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.
[0138] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0139] These computer program instructions may also be stored in a computer readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0140] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process in the computer or other programmable device. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0141] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.
Claims
1. A method for block consensus conversion, characterized in that: include: The consensus participating node in the mirror chain system obtains the second block corresponding to the block to be mirrored from the second blockchain of the second node based on the consensus process triggered by the block-producing node for the block to be mirrored; The block to be mirrored is generated by the block-producing node according to the first block that meets the mirroring requirement; the first block is obtained from the first blockchain of the first node; the first node and the second node are any nodes in the first blockchain system; the first blockchain system adopts a first consensus algorithm; the mirroring requirement is used to indicate that the probability of block rollback is lower than a set threshold, and the mirroring requirement is determined according to the block-producing attributes of the first blockchain system; the block-producing attributes include at least one of the following: block-producing time, block-producing difficulty, and block-producing efficiency; The consensus participating node determines whether it meets the consensus requirement; the consensus requirement is that the block body of the second block is the same as the block body of the block to be mirrored and the second block meets the mirroring requirement; After the consensus participating node determines that there are multiple consensus participating nodes that meet the consensus requirement, consensus is reached on the block to be mirrored according to the second consensus algorithm; After the block to be mirrored meets the consensus requirement, the consensus participating node adds the block to be mirrored to the mirror chain of the consensus participating node.
2. The method according to claim 1, characterized in that If the consensus participating node determines that it does not meet the consensus requirements, it will exit the consensus process.
3. The method according to claim 1, characterized in that Before obtaining the second block corresponding to the block to be mirrored from the second blockchain of the second node, the method further includes: The consensus participating node randomly determines the second node from the first blockchain system.
4. A method for block consensus conversion, characterized in that: include: The block producing node in the mirror chain system determines that the first block meets the mirroring requirements, and then generates a block to be mirrored according to the first block; The first block is obtained from a first blockchain of a first node in a first blockchain system; the first blockchain system adopts a first consensus algorithm; The mirror requirement is used to indicate that the probability of block rollback is lower than a set threshold, and the mirror requirement is determined according to the block generation attribute of the first blockchain system; the block generation attribute includes at least one of the following: block generation time, block generation difficulty, and block generation efficiency; The block-producing node initiates a consensus process for the block to be mirrored in the mirror chain system; the consensus process is used by the consensus participating nodes in the mirror chain system to determine whether the block to be mirrored meets the consensus requirements according to the second consensus algorithm, and determines whether the block to be mirrored meets the consensus requirements in the following manner: any consensus participating node obtains a second block corresponding to the block to be mirrored from a second blockchain of a second node; the second node is any node in the first blockchain system; the consensus participating node determines that the block body of the second block is the same as the block body of the block to be mirrored and the second block meets the mirroring requirements; After the block to be mirrored meets the consensus requirement, the block-producing node adds the block to be mirrored to the mirror chain of the block-producing node.
5. The method according to claim 4, characterized in that The first blockchain system and the second blockchain system form a cross-chain relationship, and the second blockchain system adopts the second consensus algorithm; After adding the block to be mirrored to the mirror chain of the block-producing node, the process further includes: The block producing node sends the block to be mirrored to the second blockchain system; The second blockchain system is used to put the block to be mirrored on the chain after reaching a consensus on the block to be mirrored.
6. The method according to claim 5, characterized in that Before the block producing node determines that the first block meets the mirroring requirements, it also includes: The block producing node randomly determines the first node from the first blockchain system; Before any consensus participating node obtains the second block corresponding to the block to be mirrored from the second blockchain of the second node, the process further includes: Any consensus participating node randomly determines the second node from the first blockchain system.
7. A device for block consensus conversion, characterized in that: include: An acquisition module, configured to acquire a second block corresponding to the block to be mirrored from a second blockchain of a second node based on a consensus process triggered by a block-producing node for the block to be mirrored; The block to be mirrored is generated by the block-producing node according to the first block that meets the mirroring requirement; the first block is obtained from the first blockchain of the first node; the first node and the second node are any nodes in the first blockchain system; the first blockchain system adopts a first consensus algorithm; the mirroring requirement is used to indicate that the probability of block rollback is lower than a set threshold, and the mirroring requirement is determined according to the block-producing attributes of the first blockchain system; the block-producing attributes include at least one of the following: block-producing time, block-producing difficulty, and block-producing efficiency; A processing module, configured for a consensus participating node to determine whether it satisfies a consensus requirement; the consensus requirement is that the block body of the second block is the same as the block body of the block to be mirrored and the second block satisfies the mirroring requirement; After the consensus participating node determines that there are multiple consensus participating nodes that meet the consensus requirement, consensus is reached on the block to be mirrored according to the second consensus algorithm; After the block to be mirrored meets the consensus requirement, the block to be mirrored is added to the mirror chain.
8. A computing device, characterized in that include: A memory for storing program instructions; A processor, configured to call the program instructions stored in the memory, and execute the method according to any one of claims 1 to 3 or 4 to 6 according to the obtained program.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, and the computer-executable instructions are used to enable a computer to execute the method according to any one of claims 1 to 3 or 4 to 6.
