Parallel chain verification method, computer device and storage medium

By adding verification units and storing md5 information in the parallel chain consensus node, the bifurcation problem during the parallel chain version update is solved, the automated verification process is realized, resource waste and fork risks are avoided, and verification efficiency is improved.

CN114781001B8Active Publication Date: 2025-09-09李荟梅
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210370547.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-04-10
Publication Date
2025-09-09
Estimated Expiration
2042-04-10

AI Technical Summary

Technical Problem

When the parachain version is updated, users may forget to perform manual verification, causing the parachain consensus and self-consensus to be lost on the road of forking, resulting in a waste of resources.

Method used

A verification unit is added to the parallel chain consensus node. After the node is started, the execution unit is suspended to determine the height interval that needs to be verified. Each parallel chain block in the interval is verified and an error message is output when a fork occurs. The availability is verified by storing the verified height and md5 information to avoid repeated verification.

Benefits of technology

This ensures that the parallel chain will not fork due to version updates without manual verification, reducing the waste of time and system resources and improving verification efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114781001B8_ABST
    Figure CN114781001B8_ABST
Patent Text Reader

Abstract

The present invention provides a parachain verification method, computer device, and storage medium. The method includes: in response to the startup of the current parachain consensus node, starting a download unit and a verification unit, and pausing an execution unit; the verification unit determines a verification starting height, and verifies each first parachain block from the verification starting height to the current parachain block height one by one from the verification starting height; if all verifications are successful, the verification unit is stopped and the execution unit is started; if any first parachain block fails to be verified, the verification unit is stopped, and an error message is generated and output. The present invention ensures that a parachain will not fork due to version updates without manual verification.
Need to check novelty before this filing date? Find Prior Art

Description

Parallel chain verification method, computer device and storage medium Technical Field

[0001] The present application relates to the field of blockchain technology, and specifically to a parallel chain verification method, computer equipment, and storage medium. Background Art

[0002] In the parallel chain system proposed by the applicant (the specific scheme can refer to a series of parallel chain-related patent applications submitted by the applicant), the parallel chain conducts parallel chain consensus on the main chain side with the help of the main chain consensus, and conducts corresponding parallel chain self-consensus on the parallel chain side.

[0003] In the above solution, when parachain code modifications and version updates occur, they may cause block forks. Users who need to update the parachain version must perform manual verification during the update to avoid forks. If users forget to perform manual verification, parachain consensus and self-consensus may be lost on the road to forks, resulting in a waste of various resources. Summary of the Invention

[0004] In view of the above-mentioned defects or deficiencies in the prior art, it is desired to provide a parallel chain verification method, computer equipment and storage medium that can ensure that the parallel chain will not fork due to version updates without manual verification.

[0005] In a first aspect, the present invention provides a parachain verification method applicable to a parachain consensus node, wherein the parachain consensus node is configured with a download unit, an execution unit, and a verification unit, wherein the download unit is configured to download parachain transactions and main chain block header information from the main chain, and the execution unit is configured to execute parachain transactions, generate parachain blocks, and perform parachain consensus and parachain self-consensus, the method comprising:

[0006] In response to the startup of the current parallel chain consensus node, the download unit and the verification unit are started, and the execution unit is suspended;

[0007] The verification unit determines the verification starting height and verifies each first parachain block from the verification starting height to the current parachain block height one by one:

[0008] If all verifications are successful, the verification unit is stopped and the execution unit is started;

[0009] If any first parallel chain block fails to be verified, the verification unit will stop, generate and output an error message.

[0010] Among them, verifying the first parallel chain block includes: executing the first parallel chain block to obtain a first block hash, and comparing the first block hash with the second block hash already existing in the first parallel chain block to see whether they are consistent: if yes, the verification is successful; if not, the verification fails.

[0011] In a second aspect, the present invention also provides a computer device comprising one or more processors and a memory, wherein the memory contains instructions executable by the one or more processors so that the one or more processors execute the parallel chain verification method provided according to various embodiments of the present invention.

[0012] In a third aspect, the present invention also provides a storage medium storing a computer program, which enables a computer to execute the parallel chain verification method provided according to various embodiments of the present invention.

[0013] The parachain verification method, computer device, and storage medium provided by various embodiments of the present invention add a verification unit to the parachain consensus node. After the node is started, the execution unit is first paused, the height interval that needs to be verified is determined, and each parachain block in the height interval is verified to determine whether a fork will occur. If a fork occurs, an error message is output. This ensures that the parachain will not fork due to a version update without manual verification.

[0014] The parallel chain verification method, computer equipment and storage medium provided by some embodiments of the present invention further reduce the repeated verification of parallel chain blocks by storing the verified height and corresponding md5 information, and verifying whether the verified height is available when determining the verification starting height. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0016] FIG1 is a flowchart of a parallel chain verification method provided by an embodiment of the present invention.

[0017] FIG2 is a flow chart of a preferred embodiment of the method shown in FIG1 .

[0018] FIG3 is a schematic structural diagram of a computer device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0019] The present application will be further described in detail below with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are merely for the purpose of explaining the relevant invention and are not intended to limit the invention. It should also be noted that, for ease of description, only portions relevant to the invention are shown in the accompanying drawings.

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

[0021] FIG1 is a flowchart of a parallel chain verification method provided by an embodiment of the present invention.

[0022] As shown in FIG1 , in this embodiment, the present invention provides a parachain verification method applicable to a parachain consensus node. The parachain consensus node is configured with a download unit, an execution unit, and a verification unit. The download unit is configured to download parachain transactions and main chain block header information from the main chain. The execution unit is configured to execute parachain transactions, generate parachain blocks, and perform parachain consensus and parachain self-consensus. The method includes:

[0023] S11: In response to the current parallel chain consensus node starting, the download unit and the verification unit are started, and the execution unit is suspended;

[0024] S13: The verification unit determines the verification starting height, and verifies each first parachain block from the verification starting height to the current parachain block height one by one:

[0025] If all verifications are successful, step S15 is executed: the verification unit is stopped and the execution unit is started;

[0026] If any first parallel chain block fails to be verified, step S17 is executed: the verification unit is stopped, and an error message is generated and output.

[0027] Among them, verifying the first parallel chain block includes: executing the first parallel chain block to obtain a first block hash, and comparing the first block hash with the second block hash already existing in the first parallel chain block to see whether they are consistent: if yes, the verification is successful; if not, the verification fails.

[0028] Specifically, the above method is exemplified below by taking the startup of parallel chain consensus node a1 after user A updates the version of parallel chain A as an example.

[0029] In step S11, in response to the startup of the parallel chain consensus node a1, node a1 starts the download unit to download the parallel chain transactions and main chain block header information from the main chain, starts the verification unit to perform the verification of steps S13-S15 / S17, and suspends the execution unit to avoid possible parallel chain forks.

[0030] In step S3, the verification unit of node a1 first determines the verification starting height, thereby determining the height interval from the verification starting height to the current parallel chain block height as the interval that needs to be verified, and then verifies each first parallel chain block in the interval one by one starting from the verification starting height.

[0031] Specifically, in this embodiment, the verification starting height is 0, that is, the block height of the starting block of the current parachain. In the embodiment shown in Figure 2, the verification starting height can be further optimized.

[0032] For example, if the current parachain block height is 500, the verification unit of node a1 needs to start from parachain block 0 and verify each parachain block with a block height of 0-500 one by one:

[0033] Execute parachain block 0 to get the first block hash 0-2 , compare the hash of the first block 0-2 Hash of the second block already in parachain block 0 0-1 Is it consistent?

[0034] If not, step S17 is executed to stop the verification unit, generate and output an error message;

[0035] If yes, continue to verify Parachain Block 1 and execute Parachain Block 1 to obtain the first block hash. 1-2 , compare the hash of the first block 1-2 Hash of the second block already in parachain block 1 1-1 Is it consistent?

[0036] If not, step S17 is executed to stop the verification unit, generate and output an error message;

[0037] If yes, continue to verify parachain block 2...

[0038]

[0039] When all parallel chain blocks 0-500 are verified successfully, step S15 is executed, the verification unit is stopped, and the execution unit is started to perform parallel chain consensus and parallel chain self-consensus.

[0040] The above embodiment adds a verification unit in the parallel chain consensus node. After the node is started, the execution unit is first paused, the height interval that needs to be verified is determined, and each parallel chain block in the height interval is verified to determine whether a fork will occur. An error message is output when a fork occurs, thereby ensuring that the parallel chain will not fork due to version updates without manual verification.

[0041] FIG2 is a flow chart of a preferred embodiment of the method shown in FIG1 .

[0042] As shown in FIG2 , in a preferred embodiment, step S13 includes:

[0043] S131: Determine whether the verified height is empty:

[0044] If yes, then execute step S132: set the calibration starting height to 0;

[0045] If not, execute step S133: generate the second md5 information of the bin file with verified height, and compare the second md5 information with the first md5 information to see if they are consistent:

[0046] If no, then execute step S132: set the calibration starting height to 0;

[0047] If yes, then execute step S134: determine the calibration starting altitude as the calibrated altitude plus 1;

[0048] S135: Starting from the verification starting height, verify each first parallel chain block from the verification starting height to the current parallel chain block height one by one.

[0049] After step S15, the following steps are also included:

[0050] S16: Update the verified height to the current parachain block height, generate the first md5 information of the bin file of the current parachain block height and save it.

[0051] Specifically, in the above-mentioned scheme of setting the verification starting height to 0, when the parallel chain consensus node often needs to be restarted due to various reasons, it will result in the need to repeatedly verify many parallel chain blocks, which is a great waste of time and system resources.

[0052] In this embodiment, every time the verification unit completes a round of successful verification, the verified height is updated in step S16 and the md5 information of the bin file of the height is saved.

[0053] When the node is restarted again, when the saved verified height is found, the verified height can be verified to be usable based on whether the MD5 information of the verified height is consistent with the saved MD5 information:

[0054] If they are inconsistent, the calibrated height is unusable and needs to be calibrated from the beginning;

[0055] If they are consistent, the verified height is available and verification can be continued from the next block height.

[0056] The above embodiment further reduces the repeated verification of parallel chain blocks by storing the verified height and the corresponding md5 information, and verifying whether the verified height is available when determining the verification starting height.

[0057] FIG3 is a schematic structural diagram of a computer device provided by an embodiment of the present invention.

[0058] As shown in FIG3 , as another aspect, the present application also provides a computer device, including one or more central processing units (CPUs) 301, which can perform various appropriate actions and processes according to programs stored in a read-only memory (ROM) 302 or programs loaded from a storage portion 308 into a random access memory (RAM) 303. Various programs and data required for the operation of the device 300 are also stored in the RAM 303. The CPU 301, ROM 302, and RAM 303 are connected to each other via a bus 304. An input / output (I / O) interface 305 is also connected to the bus 304.

[0059] The following components are connected to the I / O interface 305: an input section 306 including a keyboard, a mouse, and the like; an output section 307 including devices such as a cathode ray tube (CRT), a liquid crystal display (LCD), and a speaker; a storage section 308 including a hard disk; and a communication section 309 including a network interface card such as a LAN card or a modem. The communication section 309 performs communication processing via a network such as the Internet. A drive 310 is also connected to the I / O interface 305 as needed. Removable media 311, such as a magnetic disk, an optical disk, a magneto-optical disk, or a semiconductor memory, is installed in the drive 310 as needed, so that computer programs read therefrom can be installed into the storage section 308 as needed.

[0060] In particular, according to embodiments of the present disclosure, the methods described in any of the above embodiments can be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program tangibly embodied on a machine-readable medium, the computer program comprising program code for executing any of the above methods. In such embodiments, the computer program can be downloaded and installed from a network via the communication portion 309 and / or installed from the removable medium 311.

[0061] As another aspect, the present application further provides a computer-readable storage medium, which may be the computer-readable storage medium included in the apparatus of the above-described embodiment; or a computer-readable storage medium that exists independently and is not incorporated into the apparatus. The computer-readable storage medium stores one or more programs, which are used by one or more processors to execute the methods described in the present application.

[0062] The flow charts and block diagrams in the accompanying drawings illustrate the possible architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present invention. In this regard, each box in the flow chart or block diagram can represent a module, program segment or a part of code, and the module, program segment or a part of code contains one or more executable instructions for realizing the prescribed logical functions. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a sequence different from that marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flow chart, and the combination of the boxes in the block diagram and / or flow chart can be implemented by a dedicated hardware-based system that performs the prescribed function or operation, or can be implemented by a combination of dedicated hardware and computer instructions.

[0063] The units or modules described in the embodiments of the present application may be implemented in software or hardware. The units or modules described may also be provided in a processor. For example, each unit may be a software program provided in a computer or mobile smart device, or a separately configured hardware device. The names of these units or modules do not, in certain circumstances, constitute limitations on the units or modules themselves.

[0064] The above description is merely a preferred embodiment of the present application and an illustration of the technical principles employed. Those skilled in the art should understand that the scope of the invention involved in this application is not limited to the technical solutions formed by the specific combination of the above-mentioned technical features, but also encompasses other technical solutions formed by any combination of the above-mentioned technical features or their equivalents without departing from the concept of this application. For example, a technical solution formed by replacing the above-mentioned features with (but not limited to) technical features with similar functions disclosed in this application.

Claims

1. A parallel chain verification method, characterized in that: The method is applicable to a parallel chain consensus node, which is configured with a download unit, an execution unit and a verification unit. The download unit is configured to download parallel chain transactions and main chain block header information from the main chain, and the execution unit is configured to execute parallel chain transactions, generate parallel chain blocks and perform parallel chain consensus and parallel chain self-consensus. The method includes: in response to the current parallel chain consensus node being started, starting the download unit and the verification unit, and pausing the execution unit; the verification unit determines a verification starting height, and verifies each first parallel chain block from the verification starting height to the current parallel chain block height one by one from the verification starting height: if all verifications are successful, the verification unit is stopped and the execution unit is started; if any of the first parallel chain blocks fails to be verified, the verification unit is stopped, an error message is generated and output; wherein, verifying the first parallel chain block includes: executing the first parallel chain block to obtain a first block hash, and comparing the first block hash with the second block hash already existing in the first parallel chain block to see whether they are consistent: if yes, the verification is successful; if not, the verification fails.

2. The method according to claim 1, characterized in that Determining the calibration starting height includes: determining the calibration starting height to be 0.

3. A computer device, characterized in that: The device includes: one or more processors; and a memory for storing one or more programs, which, when executed by the one or more processors, enables the one or more processors to perform the method according to any one of claims 1 to 2.

4. A storage medium storing a computer program, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 2 is implemented.

Citation Information

Patent Citations

  • REPB consensus based on block chain backbone plus parallel multi-subchains

    CN109508982A

  • Mobile terminal blocking method and system for block chain

    CN111444512A