Block generation and verification method, device, electronic device and readable storage medium

By introducing the delay factor d and parallel processing transaction execution and consensus logic into the blockchain, the problem of transaction execution time dominant during block generation and verification is solved, and the performance of blockchain is improved.

CN112508577BActive Publication Date: 2025-01-14BEIJING HOLOGRAM TECH CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202110152870.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-02-04
Publication Date
2025-01-14
Estimated Expiration
2041-02-04

AI Technical Summary

Technical Problem

In the blockchain network, the time required for transaction execution during block generation and verification accounts for most of the entire block consensus process, especially when transactions are complex and time-consuming, affecting the performance of the blockchain.

Method used

By introducing the delay factor d, the composition of the block in the blockchain is modified to include WSx-d, which realizes parallel processing of block transaction execution and consensus logic, and uses two threads to process transaction execution and consensus processes separately to ensure that the world state is instantly available , avoid waiting for transaction execution.

Benefits of technology

The performance of the blockchain is significantly improved and the time required for block generation and verification is reduced. The performance of the blockchain is independent of the complexity of the transaction time, and the number of transactions is no longer subject to the transaction execution time, which improves the overall performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112508577B_ABST
    Figure CN112508577B_ABST
Patent Text Reader

Abstract

The present invention provides a method, device, electronic device and readable storage medium for block generation and verification, which modifies the block structure of the blockchain so that the x-th block contains the world state achieved after the transaction in the x-d-th block is executed, and the parallel processing of the block transaction execution logic and the consensus logic is realized (although it is delayed execution), so that the world state is immediately available when the block is generated and verified in the consensus process, without waiting. In this way, the performance of the entire blockchain is not only basically unrelated to the transaction time complexity, and the number of transactions contained in the block is no longer subject to the time complexity of transaction execution, but also because there is no need to wait for transaction execution, the performance of the entire blockchain can be greatly improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of blockchain technology, in particular to the field of block composition, block generation and block verification technology. Background Art

[0002] Regardless of the consensus algorithm, when a block generation node on a blockchain network generates a block, it starts from the world state achieved by executing the transactions in the previous block, selects a batch of pending transactions from the waiting transaction queue, and then generates a new block with these transactions, the new world state (or its hash value) achieved by executing these transactions, the hash value of the previous block, and other necessary information, and sends the block to other nodes on the blockchain network, thereby completing explicit or implicit consensus on the block.

[0003] When a block verification node on a blockchain network receives a new block, it will initially verify the validity of the block and the transactions therein, and then start from the world state achieved by executing the transactions in the previous block, execute all the transactions contained in the block and reach a new world state (or its hash value), and then compare it with the new world state claimed in the block. After the comparison is successful, the blockchain node will complete an explicit or implicit consensus on the block according to the consensus process (i.e. accept or reject the block).

[0004] During block generation and verification, the time required to execute transactions accounts for a large part of the total time required for the entire block consensus process, especially in real-world scenarios where transactions are usually more complex and time-consuming to execute. Summary of the invention

[0005] In order to solve at least one of the above technical problems, the present invention provides a method, device, electronic device and readable storage medium for block generation and verification.

[0006] A first aspect of the present invention provides a block generation method, comprising:

[0007] Obtaining a set of transactions to be executed; the set of transactions to be executed is used to generate a first block;

[0008] Obtaining the world state corresponding to the second block; the number of blocks between the second block and the first block is a preset value;

[0009] Generate the first block; the first block includes the set of transactions to be executed and the world state corresponding to the second block.

[0010] Optionally, after generating the first block, the method further includes:

[0011] Starting from the world state of the third block, executing the set of transactions to be executed included in the first block; the third block is the previous block of the first block;

[0012] Generate a world state corresponding to the first block.

[0013] Optionally, obtaining the world state corresponding to the second block includes:

[0014] Get the world state corresponding to the second block from the head of the block state queue;

[0015] After generating the world state corresponding to the first block, the method further includes:

[0016] Submit the world state corresponding to the first block to the end of the block state queue.

[0017] Optionally, after generating the first block, the method further includes:

[0018] Submit the first block to the end of the block execution queue;

[0019] Starting from the world state of the third block, before executing the set of transactions to be executed included in the first block, the method further includes:

[0020] The first block is extracted from the head of the block execution queue.

[0021] Optionally, after generating the first block, the method further includes:

[0022] Propagate the first block to other nodes of the blockchain.

[0023] Optionally, the method further comprises:

[0024] Create a first thread and a second thread;

[0025] The first thread is used to obtain a group of transactions to be executed; the group of transactions to be executed is used to generate a first block; obtain a world state corresponding to a second block; the number of blocks between the second block and the first block is a preset value; generate the first block; the first block includes the group of transactions to be executed and the world state corresponding to the second block;

[0026] The second thread is used to execute the set of transactions to be executed included in the first block based on the world state of the third block; the third block is the previous block of the first block; and generate the world state corresponding to the first block.

[0027] Optionally, the first thread is further used to obtain the world state corresponding to the second block from the head of the block state queue;

[0028] The second thread is further used to submit the world state corresponding to the first block to the end of the block state queue.

[0029] Optionally, the first thread is further configured to submit the first block to the tail of a block execution queue after generating the first block;

[0030] The second thread is further configured to extract the first block from the head of the block execution queue.

[0031] Optionally, the first thread is further used to propagate the first block to other nodes of the blockchain after generating the first block.

[0032] Optionally, the preset value is 0 or an integer greater than or equal to 1;

[0033] When the first block belongs to the integer number of blocks greater than or equal to 1 starting from the beginning of the blockchain, the preset value is 0;

[0034] When the first block belongs to a block after the integer number of blocks greater than or equal to 1 from the beginning of the blockchain, the preset value is the integer greater than or equal to 1.

[0035] A second aspect of the present invention provides a block verification method, comprising:

[0036] Receive the first block propagated by other nodes of the blockchain;

[0037] Obtaining the world state corresponding to the second block; the number of blocks between the second block and the first block is a preset value;

[0038] Verify whether the world state corresponding to the second block is consistent with the world state included in the first block; if they are consistent, the verification succeeds; otherwise, the verification fails.

[0039] Optionally, after the verification is successful, the method further includes:

[0040] Starting from the world state of the third block, executing a set of transactions included in the first block; the third block is the previous block of the first block;

[0041] Generate a world state corresponding to the first block.

[0042] Optionally, obtaining the world state corresponding to the second block includes:

[0043] Get the world state corresponding to the second block from the head of the block state queue;

[0044] After generating the world state corresponding to the first block, the method further includes:

[0045] Submit the world state corresponding to the first block to the end of the block state queue.

[0046] Optionally, after the verification is successful, the method further includes:

[0047] Submit the first block to the end of the block execution queue;

[0048] Starting from the world state of the third block, before executing a set of transactions included in the first block, it also includes:

[0049] The first block is extracted from the head of the block execution queue.

[0050] Optionally, after the verification is successful, the method further includes:

[0051] Propagate the first block to other nodes of the blockchain.

[0052] Optionally, the method further comprises:

[0053] Create a first thread and a second thread;

[0054] The first thread is used to receive the first block propagated by other nodes of the blockchain; obtain the world state corresponding to the second block; the number of blocks between the second block and the first block is a preset value; verify whether the world state corresponding to the second block is consistent with the world state included in the first block; if they are consistent, the verification is successful; otherwise, the verification fails;

[0055] The second thread is used to execute a group of transactions included in the first block based on the world state of the third block after the first thread successfully verifies, and generate a world state corresponding to the first block.

[0056] Optionally, the first thread is further used to obtain the world state corresponding to the second block from the head of the block state queue;

[0057] The second thread is further configured to submit the world state corresponding to the first block to the tail of the block state queue after generating the world state corresponding to the first block.

[0058] Optionally, the first thread is further used to submit the first block to the end of the block execution queue after successful verification;

[0059] The second thread is further configured to extract the first block from the head of the block execution queue.

[0060] Optionally, the first thread is also used to propagate the first block to other nodes of the blockchain.

[0061] Optionally, the preset value is 0 or an integer greater than or equal to 1;

[0062] When the first block belongs to the integer number of blocks greater than or equal to 1 starting from the beginning of the blockchain, the preset value is 0;

[0063] When the first block belongs to a block after the integer number of blocks greater than or equal to 1 from the beginning of the blockchain, the preset value is the integer greater than or equal to 1.

[0064] A third aspect of the present invention provides a block generation device, including a blockchain generation module;

[0065] The blockchain generation module includes:

[0066] A transaction selection submodule, used to obtain a group of transactions to be executed; the group of transactions to be executed is used to generate a first block;

[0067] A world state acquisition submodule, used to acquire the world state corresponding to the second block; the number of blocks between the second block and the first block is a preset value;

[0068] The block generation submodule is used to generate the first block; the first block includes the set of transactions to be executed and the world state corresponding to the second block.

[0069] Optionally, it also includes: a block execution module;

[0070] The block execution module includes:

[0071] A transaction execution submodule, configured to execute the set of transactions to be executed included in the first block based on the world state of the third block; the third block is a previous block of the first block;

[0072] The world state generation submodule is used to generate the world state corresponding to the first block.

[0073] Optionally, the blockchain generation module further includes:

[0074] The block propagation submodule is used to propagate the first block to other nodes of the blockchain.

[0075] A fourth aspect of the present invention provides a block verification device, comprising a block verification module;

[0076] The block verification module includes:

[0077] A block receiving submodule, used to receive the first block propagated by other nodes of the blockchain;

[0078] A world state acquisition submodule, used to acquire the world state corresponding to the second block; the number of blocks between the second block and the first block is a preset value;

[0079] The block verification submodule is used to verify whether the world state corresponding to the second block is consistent with the world state included in the first block; if they are consistent, the verification is successful; otherwise, the verification fails.

[0080] Optionally, a block execution module is also included;

[0081] The block execution module includes:

[0082] A transaction execution submodule, configured to execute a group of transactions included in the first block based on the world state of a third block; the third block is a previous block of the first block;

[0083] The world state generation submodule is used to generate the world state corresponding to the first block.

[0084] Optionally, the block verification module further includes:

[0085] The block propagation submodule is used to propagate the first block to other nodes of the blockchain.

[0086] In a fifth aspect of the present invention, an electronic device is provided, comprising a memory and a processor, wherein the memory is used to store computer instructions, and the computer instructions are executed by the processor to implement the method as described in the first aspect of the present invention, or the computer instructions are executed by the processor to implement the method as described in the second aspect of the present invention.

[0087] According to a sixth aspect of the present invention, a readable storage medium is provided, on which computer instructions are stored. When the computer instructions are executed by a processor, the method described in the first aspect of the present invention is implemented; or, when the computer instructions are executed by a processor, the method described in the second aspect of the present invention is implemented. BRIEF DESCRIPTION OF THE DRAWINGS

[0088] The accompanying drawings illustrate exemplary embodiments of the present invention and together with the description serve to explain the principles of the present invention. These drawings are included to provide a further understanding of the present invention and are incorporated in and constitute a part of this specification.

[0089] FIG. 1 is a diagram showing an example of the composition of the xth block (Bx) in a blockchain of the prior art.

[0090] FIG2 is a diagram showing an example of the composition of the xth block (Bx) in the blockchain implemented by the present invention.

[0091] Figure 3It is a schematic diagram of the interaction between asynchronous and parallel transaction execution threads and block consensus threads. DETAILED DESCRIPTION

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

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

[0094] The most famous data structure in blockchain technology is probably the "distributed ledger". A distributed ledger is a list of blocks, each of which contains a set of transactions, a hash value of the world state achieved after the transactions in that block are executed, and a hash value of the previous block. Figure 1 As shown in block 100, before the present invention, the xth block (i.e., Bx) contains the following information:

[0095] (1) The hash value of the previous block (i.e., Bx-1), represented by BHx-1 (block 101);

[0096] (2) A transaction list, where each transaction is signed by the initiator. For example, TX1 (block 102) & TXn (block 103);

[0097] (3) The hash value of the world state achieved after the transaction in Bx is executed, WSx (block 104);

[0098] (4) Other information related to specific blockchain technology, such as block signatures.

[0099] When generating the xth block, Bx, a block generation node on a blockchain network starts based on the world state (WSx-1) achieved by executing transactions in the previous block. It first selects a set of pending transactions from the waiting transaction pool, executes and reaches a new world state (WSx), and then generates Bx, sends it to the entire blockchain network, and completes the consensus process with other nodes.

[0100] When verifying the xth block, Bx, a block verification node on a blockchain network, after completing the preliminary block correctness check, starts to execute the transactions in the block based on the world state (WSx-1) achieved by executing the transactions in the previous block, and reaches a new world state (WSx) and compares it with the world state claimed in the block. If they are consistent, they will participate in the subsequent consensus process.

[0101] The time required to execute transactions during block generation and verification accounts for a significant portion of the time required for the entire blockchain consensus process, especially in real-world scenarios where transactions are complex and time-consuming and when many transactions are included in a block for better concurrency and throughput. The transaction execution time has such a significant impact on the performance of the entire blockchain that it may be comparable to or even longer than the time it takes to send a block to most nodes in the entire blockchain network and reach explicit or implicit consensus.

[0102] In blockchain networks, minimizing the impact of the execution time of transactions in a block on the consensus process is a huge challenge.

[0103] In this invention, for the convenience of expression, the time required to execute all transactions in a block during block generation and verification is called execution time, represented by Te, and the time required to propagate a block to the entire blockchain network and reach explicit or implicit consensus during the consensus process is called consensus time, represented by Tc. The time required for a block from generation (including transaction execution), propagation, verification (including transaction execution) and consensus is approximately (2*Te + Tc).

[0104] Given the computing power of the nodes, Te is related to the execution time of each transaction and the number of transactions contained in a block, while Tc is related to the number of nodes, connectivity, bandwidth, latency, and efficiency of the consensus algorithm in the blockchain network. Although it is difficult to clearly assert which is greater, Te or Tc, they are both important time factors that affect blockchain performance.

[0105] The present invention creates a new method for block composition, generation and verification, which realizes the parallel processing of the transaction execution logic and consensus logic of the block (although it is delayed execution), so that the world state is immediately available when the block is generated and verified in the consensus process, without waiting (if the delay factor d is configured appropriately). In this way, the performance of the entire blockchain is not only basically independent of the transaction time complexity, and the number of transactions contained in the block is no longer subject to the time complexity of transaction execution, but also because there is no need to wait for transaction execution, the performance of the entire blockchain can be greatly improved.

[0106] First, the present invention modifies the composition of blocks: unlike the xth block (Bx) in the blockchain before the present invention, which contains the world state WSx (the world state achieved after executing the transactions in Bx), the blockchain implemented by the present invention contains WSx-d (see Figure 2 As shown in Figure 1), where d is the delay factor. The first d blocks in the blockchain ledger are specially set to d=0.

[0107] This block composition modification allows block transaction execution and block consensus to be performed asynchronously and in parallel. If d is chosen appropriately, when Bx is generated and verified, WSx-d is ready, or at least there is no need to wait for Te time to complete transaction execution like the blockchain before this invention.

[0108] Then, if Figure 3 As shown, the present invention separates the transaction execution logic in the block from the consensus process and implements it with two threads, one is the block execution thread (block 300) and the other is the block consensus thread (block 303). The former is responsible for executing the transactions in each block to achieve the world state. The latter is responsible for generating, propagating, verifying and consensus blocks based on the world state ready by the block execution thread. Here, the term "thread" specifically refers to one (or a group of the same) program control flow that can be scheduled by the operating system and executed by the CPU, and does not necessarily correspond to one (or a group of) operating system threads or processes in implementation.

[0109] In the block consensus thread, the steps for the block generation node to generate the xth block, Bx, are as follows:

[0110] (0) Select a set of transactions from the local waiting transaction pool (block 302);

[0111] (1) Immediately obtain the world state WSx-d (the world state reached after executing the transactions in block Bx-d) from the block state queue (block 301), and generate Bx together with other necessary processing;

[0112] (2) Submit Bx to the end of the local block execution queue (block 304) for asynchronous processing by the block execution thread (block 300);

[0113] (3) Spread Bx to the blockchain network and complete consensus (acceptance or rejection) on Bx with other nodes.

[0114] In the block consensus thread, the steps for the block verification node to verify the xth block, i.e., Bx, are as follows:

[0115] (1) Immediately obtain the world state WSx-d (the world state achieved after executing the transactions in block Bx-d) from the block state queue (block 301) and compare it with the world state claimed in Bx. If they are inconsistent, verification fails.

[0116] (2) Submit Bx to the end of the local block execution queue (block 304) for asynchronous processing by the block execution thread (block 300);

[0117] (3) Spread Bx to the blockchain network and complete consensus (acceptance or rejection) on Bx with other nodes.

[0118] In parallel with the block consensus thread (block 303), the block execution thread (block 300) on each blockchain node processes each block Bx (the xth block) read from the head of the block execution queue (block 304) and reaches the local world state WSx. The processing flow is as follows:

[0119] (b) Read block Bx from the head of the block execution queue (block 304);

[0120] (b) Starting from the world state of block Bx-1 (i.e., WSx-1), execute the transactions in Bx, reach the local world state WSx, and submit WSx to the end of the block state queue (block 301).

[0121] The present invention is a blockchain block composition and execution (generation and verification) method, which ensures that the world state is ready when the block is generated and verified by delaying and asynchronously pre-executing blockchain transactions, thereby saving time for the entire block consensus process and improving the performance of the entire blockchain.

[0122] Since the block consensus thread (including block generation and verification) and the transaction execution thread are actually executed in parallel without waiting for each other (assuming that the delay factor d is configured appropriately), the present invention can make the consensus process of the blockchain significantly "faster", thereby improving the overall performance of the blockchain.

[0123] With the present invention, on a blockchain network consisting of multi-core CPU blockchain nodes, the time required for block generation (including transaction execution), propagation, verification (including transaction execution) and consensus is reduced from about (2*Te + Tc) before the present invention to about MAX (2*Te, Tc). This is a significant time saving.

[0124] It should be understood that the various techniques described herein can be implemented in combination with hardware or software, or a combination thereof. Thus, the method and apparatus of the present invention, or some aspects or portions of the method and apparatus of the present invention, can take the form of program codes (i.e., instructions) embedded in a tangible medium, such as a floppy disk, a CD-ROM, a hard disk drive, or any other machine-readable storage medium, wherein when the program is loaded into a machine such as a computer and executed by the machine, the machine becomes a device for practicing the present invention.

[0125] In the case where the program code is executed on a programmable computer, the computing device generally includes a processor, a storage medium readable by the processor (including volatile and non-volatile memory and / or storage elements), at least one input device, and at least one output device. The memory is configured to store the program code; the processor is configured to execute various methods of the present invention according to the instructions in the program code stored in the memory.

[0126] By way of example and not limitation, computer readable media include computer storage media and communication media. Computer readable media include computer storage media and communication media. Computer storage media stores information such as computer readable instructions, data structures, program modules or other data. Communication media generally embodies computer readable instructions, data structures, program modules or other data in a modulated data signal such as a carrier wave or other transmission mechanism, and includes any information delivery medium. Any combination of the above is also included within the scope of computer readable media.

[0127] Those skilled in the art will appreciate that the modules or units or components of the devices in the examples invented herein may be arranged in the devices described in the embodiment, or alternatively may be located in one or more devices different from the devices in the examples. The modules in the foregoing examples may be combined into one module or may be divided into a plurality of submodules.

[0128] Those skilled in the art will appreciate that the modules in the devices in the embodiments may be adaptively changed and arranged in one or more devices different from the embodiments. The modules or units or components in the embodiments may be combined into one module or unit or component, and further may be divided into a plurality of submodules or subunits or subcomponents. All features invented in this specification (including the accompanying claims, abstracts and drawings) and all processes or units of any method or device so invented may be combined in any combination, except that at least some of such features and / or processes or units are mutually exclusive. Unless otherwise expressly stated, each feature invented in this specification (including the accompanying claims, abstracts and drawings) may be replaced by an alternative feature providing the same, equivalent or similar purpose.

[0129] In addition, those skilled in the art will appreciate that, although some embodiments described herein include certain features included in other embodiments but not other features, the combination of features of different embodiments is meant to be within the scope of the present invention and form different embodiments. For example, in the claims, any one of the claimed embodiments may be used in any combination.

[0130] As used herein, unless otherwise specified, the use of ordinal numbers "first," "second," "third," etc. to describe common objects merely indicates that different instances of similar objects are involved, and is not intended to imply that the objects so described must have a given order in time, space, order, or in any other manner.

[0131] Although the present invention has been described according to a limited number of embodiments, it will be apparent to those skilled in the art, with the benefit of the above description, that other embodiments may be envisioned within the scope of the invention thus described. In addition, it should be noted that the language used in this specification is selected primarily for readability and didactic purposes, rather than for the purpose of explaining or defining the subject matter of the present invention. Therefore, many modifications and variations will be apparent to those skilled in the art without departing from the scope and spirit of the appended claims. The inventions made to the present invention are illustrative, not restrictive, with respect to the scope of the present invention, which is defined by the appended claims.

Claims

1. A block generation method, characterized in that: include: Obtaining a set of transactions to be executed; the set of transactions to be executed is used to generate a first block; Obtaining the world state reached after the transactions included in the second block are executed; the number of blocks between the second block and the first block is a preset value; Generate the first block; the first block includes the set of transactions to be executed and the world state reached after the transactions included in the second block are executed; After generating the first block, the method further includes: Starting from the world state of the third block, executing the set of transactions to be executed included in the first block; The third block is a previous block of the first block; Generate a world state that is reached after the transactions included in the first block are executed.

2. The method according to claim 1, characterized in that The obtaining of the world state reached after the transactions included in the second block are executed includes: Obtain the world state reached after the transactions included in the second block are executed from the head of the block state queue; After the world state reached after the transactions included in the first block are executed, the process further includes: Submitting the world state achieved after the transactions included in the first block are executed to the end of the block state queue.

3. The method according to claim 1, characterized in that After generating the first block, the method further includes: Submit the first block to the end of the block execution queue; Starting from the world state of the third block, before executing the set of transactions to be executed included in the first block, the method further includes: The first block is extracted from the head of the block execution queue.

4. The method according to claim 1, characterized in that Also includes: Create a first thread and a second thread; The first thread is used to obtain a group of transactions to be executed, the group of transactions to be executed is used to generate a first block, obtain a world state reached by the transactions included in the second block after execution is completed, the number of blocks between the second block and the first block is a preset value, and generate the first block, the first block includes the group of transactions to be executed and the world state reached by the transactions included in the second block after execution is completed; The second thread is used to execute the set of transactions to be executed included in the first block based on the world state of the third block, where the third block is the previous block of the first block, and generate a world state reached after the transactions included in the first block are executed.

5. The method according to claim 1, characterized in that After generating the first block, the method further includes: Propagate the first block to other nodes of the blockchain.

6. The method according to claim 1, characterized in that The preset value is 0 or an integer greater than or equal to 1; When the first block belongs to the integer number of blocks greater than or equal to 1 starting from the beginning of the blockchain, the preset value is 0; When the first block belongs to a block after the integer number of blocks greater than or equal to 1 from the beginning of the blockchain, the preset value is the integer greater than or equal to 1.

7. A block verification method, characterized in that: include: Receive the first block propagated by other nodes of the blockchain; Get the world state reached after the transactions included in the second block are executed; The number of blocks between the second block and the first block is a preset value; Verifying whether the world state reached after the transactions included in the second block are executed is consistent with the world state included in the first block; If they are consistent, the verification is successful; Otherwise, the verification fails; After the verification is successful, the following steps are also included: Starting from the world state of the third block, executing a set of transactions included in the first block; the third block is the previous block of the first block; Generate a world state that is reached after the transactions included in the first block are executed.

8. The method according to claim 7, characterized in that The obtaining of the world state reached after the transactions included in the second block are executed includes: Obtain the world state reached after the transactions included in the second block are executed from the head of the block state queue; After the world state reached after the transactions included in the first block are executed, the process further includes: Submitting the world state achieved after the transactions included in the first block are executed to the end of the block state queue.

9. The method according to claim 7, characterized in that After the verification is successful, the following steps are also included: Submit the first block to the end of the block execution queue; Starting from the world state of the third block, before executing a set of transactions included in the first block, it also includes: The first block is extracted from the head of the block execution queue.

10. The method according to claim 7, characterized in that Also includes: Create a first thread and a second thread; The first thread is used to receive the first block propagated by other nodes of the blockchain, obtain the world state reached by the transactions included in the second block after execution is completed, the number of blocks between the second block and the first block is a preset value, and verify whether the world state reached by the transactions included in the second block after execution is consistent with the world state included in the first block, if they are consistent, the verification is successful, otherwise, the verification fails; The second thread is used to execute a group of transactions included in the first block based on the world state of the third block after the first thread successfully verifies, and generate a world state reached after the transactions included in the first block are executed.

11. The method according to claim 7, characterized in that After the verification is successful, the following steps are also included: Propagate the first block to other nodes of the blockchain.

12. The method according to claim 7, characterized in that The preset value is 0 or an integer greater than or equal to 1; When the first block belongs to the integer number of blocks greater than or equal to 1 starting from the beginning of the blockchain, the preset value is 0; When the first block belongs to a block after the integer number of blocks greater than or equal to 1 from the beginning of the blockchain, the preset value is the integer greater than or equal to 1.

13. A block generation device, characterized in that: Includes blockchain generation module; The blockchain generation module includes: A transaction selection submodule, used to obtain a group of transactions to be executed; the group of transactions to be executed is used to generate a first block; A world state acquisition submodule, used to acquire the world state reached after the transactions included in the second block are executed; the number of blocks between the second block and the first block is a preset value; A block generation submodule, configured to generate the first block; the first block includes the set of transactions to be executed and the world state reached after the transactions included in the second block are executed; Block execution module; The block execution module includes: A transaction execution submodule, configured to execute the set of transactions to be executed included in the first block based on the world state of the third block; the third block is a previous block of the first block; The world state generation submodule is used to generate the world state reached after the transactions included in the first block are executed.

14. The device according to claim 13, characterized in that The blockchain generation module also includes: The block propagation submodule is used to propagate the first block to other nodes of the blockchain.

15. A block verification device, characterized in that: Includes block verification module; The block verification module includes: A block receiving submodule, used to receive the first block propagated by other nodes of the blockchain; A world state acquisition submodule, used to acquire the world state reached after the transactions included in the second block are executed; the number of blocks between the second block and the first block is a preset value; A block verification submodule, used to verify whether the world state reached by the transactions included in the second block after execution is consistent with the world state included in the first block; if they are consistent, the verification is successful; otherwise, the verification fails; Block execution module; The block execution module includes: A transaction execution submodule, configured to execute a group of transactions included in the first block based on the world state of a third block; the third block is a previous block of the first block; The world state generation submodule is used to generate the world state reached after the transactions included in the first block are executed.

16. The device according to claim 15, characterized in that The block verification module also includes: The block propagation submodule is used to propagate the first block to other nodes of the blockchain.

17. An electronic device comprising a memory and a processor, wherein the memory is used to store computer instructions, wherein: The computer instructions are executed by the processor to implement the method according to any one of claims 1 to 6, or the computer instructions are executed by the processor to implement the method according to any one of claims 7 to 12.

18. A readable storage medium having computer instructions stored thereon, characterized in that: When the computer instructions are executed by a processor, the method described in any one of claims 1 to 6 is implemented; when the computer instructions are executed by a processor, the method described in any one of claims 7 to 12 is implemented.

Citation Information

Patent Citations

  • A method and a device for parallel verification processing of block chain data

    CN109285006A

  • Block chain consensus and execution parallel processing method and device and electronic equipment

    CN110659988A

  • System and method for providing shared hash engines architecture for a bitcoin block chain

    US20170300877A1

  • Consensus and transaction synchronization parallel processing method and device and electronic equipment

    CN110648136A

  • Block generation method and device, node equipment and storage medium

    CN111541756A