CN114221961B - Hierarchical DAG blockchain generation method, apparatus, medium, and program product - Google Patents

Hierarchical DAG blockchain generation method, apparatus, medium, and program product Download PDF

Info

Publication number
CN114221961B
CN114221961B CN202111529603.7A CN202111529603A CN114221961B CN 114221961 B CN114221961 B CN 114221961B CN 202111529603 A CN202111529603 A CN 202111529603A CN 114221961 B CN114221961 B CN 114221961B
Authority
CN
China
Prior art keywords
block
blocks
executed
blockchain
parallel
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202111529603.7A
Other languages
Chinese (zh)
Other versions
CN114221961A (en
Inventor
石翔
李辉忠
张开翔
范瑞彬
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
WeBank Co Ltd
Original Assignee
WeBank Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by WeBank Co Ltd filed Critical WeBank Co Ltd
Priority to CN202111529603.7A priority Critical patent/CN114221961B/en
Publication of CN114221961A publication Critical patent/CN114221961A/en
Application granted granted Critical
Publication of CN114221961B publication Critical patent/CN114221961B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/901Indexing; Data structures therefor; Storage structures
    • G06F16/9024Graphs; Linked lists
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q40/00Finance; Insurance; Tax strategies; Processing of corporate or income taxes
    • G06Q40/04Trading; Exchange, e.g. stocks, commodities, derivatives or currency exchange

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Business, Economics & Management (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Finance (AREA)
  • Accounting & Taxation (AREA)
  • Data Mining & Analysis (AREA)
  • General Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Computing Systems (AREA)
  • Signal Processing (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Development Economics (AREA)
  • Economics (AREA)
  • Marketing (AREA)
  • Strategic Management (AREA)
  • Technology Law (AREA)
  • General Business, Economics & Management (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

The application provides a hierarchical DAG blockchain generation method, equipment, medium and program product, wherein when a blockchain node is determined to be a packaging node corresponding to a new parallel blocklayer, a plurality of blocks to be executed which can be executed in parallel are packaged from a transaction pool; then combining a plurality of blocks to be executed into a new parallel block layer; and broadcasting the new parallel block layer in the block chain network, so that all nodes in the block chain network independently start corresponding execution flow, consensus flow and disk-dropping flow for each block to be executed. The method of circularly and alternately packing blocks which can be executed in parallel by the chain link points of each block solves the technical problem that the processing efficiency is reduced due to the fact that the blocks are repeatedly packed and repeatedly executed in the prior art. The method and the device have the advantages of avoiding parallel packing of blocks by the link points of each block, enabling the blocks not to meet the requirement of the DAG directed acyclic graph, and avoiding repeated packing and repeated execution of the blocks.

Description

Hierarchical DAG blockchain generation method, apparatus, medium, and program product
Technical Field
The present application relates to the field of financial technology (Fintech), and in particular, to a hierarchical DAG blockchain generation method, apparatus, medium, and program product.
Background
With the development of computer technology, more and more technology is applied to the financial field, and the traditional financial industry is gradually changing to financial technology (Fintech). Blockchain technology has also found widespread use in the field of financial technology.
Currently, the blockchain generally stores blocks corresponding to each transaction through a chain structure, but as the requirement on the processing efficiency of the blockchain system is continuously increased, the chain structure cannot meet the efficiency requirement, and further, DAG (Directed Acyclic Graph ) blockchains appear, so that the processing efficiency of the blockchain system is improved by simultaneously executing a plurality of blocks in parallel.
However, when the existing blockchain network generates the DAG blockchain, all blocks packaged in parallel by each block link point cannot be avoided to meet the requirement of the DAG directed acyclic graph, that is, the corresponding transaction parties in each block have no intersection, so that the blocks with the intersection are executed simultaneously, but when the final disk is dropped, only one block is dropped, and other blocks are discarded, so that the problems of repeated packaging, repeated execution and the like of the blocks are caused, and further improvement of the processing efficiency of the DAG blockchain is restricted. That is, in the prior art, each blockchain node has a technical problem that processing efficiency is reduced due to repeated packing blocks, repeated execution blocks and the like.
Disclosure of Invention
The application provides a hierarchical DAG blockchain generation method, equipment, medium and program product, which are used for solving the technical problem that processing efficiency is reduced due to the fact that repeated packing blocks, repeated execution blocks and the like exist in each blockchain node in the prior art.
In a first aspect, the present application provides a hierarchical DAG blockchain generation method applied to any blockchain node of a blockchain network, including:
when determining that the blockchain node is a packaging node corresponding to a new parallel blocklayer, packaging a plurality of blocks to be executed which can be executed in parallel from a transaction pool;
combining a plurality of blocks to be executed into a new parallel block layer;
broadcasting the new parallel block layer in the block chain network, so that all nodes in the block chain network independently start corresponding execution flow, consensus flow and disk drop flow for each block to be executed.
In one possible design, determining a blockchain node as a packaging node corresponding to a new parallel blocklayer includes:
and determining the blockchain node as a packaging node through a consensus algorithm and a preset sequence requirement.
In one possible design, the preset sequence requirements include: a predetermined round robin packing order and only allowing nodes in one blockchain network to perform blockpacking at a time.
In one possible design, combining a plurality of blocks to be performed into a new parallel block layer includes:
and setting the dropped blocks in the last parallel block layer as parent blocks corresponding to the blocks to be executed, and combining the blocks to be executed into a new parallel block layer.
In one possible design, before packaging the plurality of blocks to be executed, which can be executed in parallel, from the transaction pool, the method further comprises:
judging whether the residual quantity of the processing blocks in the block chain nodes reaches the single-layer quantity upper limit, wherein the processing blocks comprise: blocks in any one of an execution flow, a consensus flow and a tray-drop flow;
if not, packing at least one block to be executed from the transaction pool, wherein the total number of the blocks to be executed and the blocks to be processed is smaller than or equal to the single-layer upper limit;
if yes, determining the new parallel block layer as an empty layer without blocks so as to avoid overload of the block chain nodes.
In one possible design, if not, packaging at least one block to be executed from the transaction pool, including:
judging whether the residual quantity is zero;
if yes, packing a first number of blocks to be executed from the transaction pool, wherein the first number is equal to the upper limit of the single-layer number;
if not, packing a second number of blocks to be executed from the transaction pool, wherein the second number is the difference value between the upper limit of the single-layer number and the residual number.
In one possible design, before broadcasting the new parallel block layer in the blockchain network, the method further includes:
judging whether the block chain node comprises a timeout block or not, wherein the timeout block comprises: blocks which are not executed yet through a preset number of parallel block layers;
if yes, adding a timeout mark on the head of the timeout block, and directly starting a landing flow for the timeout block to finish landing of the timeout block.
In one possible design, broadcasting the new parallel block layer in the blockchain network includes:
and commonly identifying all blocks to be executed in the new parallel block layer and transactions corresponding to the blocks to be executed to all nodes in the block chain network.
Optionally, the method further comprises:
and deleting the transaction corresponding to the dropped block in the block chain node from the transaction pool.
In a second aspect, the present application provides a hierarchical DAG blockchain generation device, comprising:
the packaging module is used for packaging a plurality of blocks to be executed which can be executed in parallel from the transaction pool when determining that the blockchain node is a packaging node corresponding to the new parallel block layer;
a processing module for:
combining a plurality of blocks to be executed into a new parallel block layer;
broadcasting the new parallel block layer in the block chain network, so that all nodes in the block chain network independently start corresponding execution flow, consensus flow and disk drop flow for each block to be executed.
In a third aspect, the present application provides an electronic device, comprising:
a memory for storing program instructions;
a processor for invoking and executing program instructions in memory to perform any one of the possible article storage information determining methods provided in the first aspect.
In a fourth aspect, the present application provides a storage medium having stored therein a computer program for performing any one of the possible hierarchical DAG blockchain generation methods provided in the first aspect.
In a fifth aspect, the present application also provides a computer program product comprising a computer program which, when executed by a processor, implements any one of the possible hierarchical DAG blockchain generation methods provided in the first aspect.
The application provides a hierarchical DAG blockchain generation method, equipment, medium and program product, wherein when a blockchain node is determined to be a packaging node corresponding to a new parallel blocklayer, a plurality of blocks to be executed which can be executed in parallel are packaged from a transaction pool; then combining a plurality of blocks to be executed into a new parallel block layer; and broadcasting the new parallel block layer in the block chain network, so that all nodes in the block chain network independently start corresponding execution flow, consensus flow and disk-dropping flow for each block to be executed. The method of circularly and alternately packing blocks which can be executed in parallel by the chain link points of each block solves the technical problem that the processing efficiency is reduced due to the fact that the blocks are repeatedly packed and repeatedly executed in the prior art. The method and the device have the advantages of avoiding parallel packing of blocks by the link points of each block, enabling the blocks not to meet the requirement of the DAG directed acyclic graph, and avoiding repeated packing and repeated execution of the blocks.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the application and together with the description, serve to explain the principles of the application.
FIG. 1 is a schematic illustration of a directed acyclic graph provided herein;
FIG. 2 is a schematic diagram of a generation scheme of a prior DAG blockchain provided herein;
FIG. 3 is a flow chart of a hierarchical DAG blockchain generation method provided by the present application;
FIG. 4 is a flowchart illustrating another hierarchical DAG blockchain generation method provided by the present application;
FIG. 5 is a schematic diagram of a hierarchical DAG blockchain generation device according to an embodiment of the present disclosure;
fig. 6 is a schematic structural diagram of an electronic device provided in the present application.
Specific embodiments thereof have been shown by way of example in the drawings and will herein be described in more detail. These drawings and the written description are not intended to limit the scope of the inventive concepts in any way, but to illustrate the concepts of the present application to those skilled in the art by reference to specific embodiments.
Detailed Description
For the purposes of making the objects, technical solutions and advantages of the embodiments of the present application more clear, the technical solutions of the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is apparent that the described embodiments are only some embodiments of the present application, but not all embodiments. All other embodiments, including but not limited to combinations of embodiments, which can be made by one of ordinary skill in the art without inventive faculty, are intended to be within the scope of the present application, based on the embodiments herein.
The terms "first," "second," "third," "fourth" and the like in the description and in the claims of this application and in the above-described figures, if any, are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that embodiments of the present application described herein may be capable of operation in sequences other than those illustrated or described herein, for example. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
The following explains the terms referred to in the present application:
DAG (Directed Acyclic Graph) directed acyclic graph: is a special structure in the graph data structure. If a directed graph, starting from any vertex, cannot go back to the point through several edges, then the graph is a directed acyclic graph.
Fig. 1 is a schematic diagram of a directed acyclic graph provided herein. As shown in fig. 1, a DAG directed acyclic graph includes: block a, block b, block c, block d and block e. The arrow ends represent whether there is a dependency between the two blocks and from block a to block e it cannot return to block e, i.e. no loop can be formed.
DAG blockchain: is an extended data structure of the blockchain. In the DAG blockchain, a block is a vertex of the DAG directed acyclic graph, and the dependency of the block on its parent block is an edge in the DAG directed acyclic graph. The number of blocks in the DAG blockchain that can correspond to parent blocks is not limited to 1. The block chain is described by adopting the DAG block chain mode, so that blocks without mutual dependence can be executed in parallel, and the execution speed of the block chain is improved. As shown in fig. 1, the blocks b and c have no association relationship, and may be performed in parallel, instead of sequentially performing the blocks in sequence as in the conventional block chain.
The inventor of the application has long-term working practice found that: when the DAG block chain is generated by the existing block chain network, all blocks packaged in parallel cannot be prevented from meeting the requirement of a DAG directed acyclic graph by each block link point, namely, each transaction corresponding to each block has no intersection, so that the blocks with the intersection are executed simultaneously, but when the block is finally dropped, only one block is dropped, and other blocks are discarded, so that the problems of repeated packaging, repeated execution and the like of the blocks are caused, and the further improvement of the processing efficiency of the DAG block chain is restricted.
The main reasons for this problem are:
each blockchain node packs blocks independently, and although each blockchain node packs blocks according to the requirement of the DAG directed acyclic graph when packing the blocks, the plurality of blockchain nodes do not communicate when packing the blocks, so that transaction double sides corresponding to a plurality of blocks which are packed in parallel finally can have intersections. However, although there is an intersection, it does not affect each blockchain node to execute the blocks independently until the blocks need to be dropped, since the drop rule corresponding to the DAG blockchain requires that each block with an intersection can only drop one of the blocks at the same time, and the other blocks can be discarded, which causes the discarded blocks to be repackaged and re-executed.
Fig. 2 is a schematic diagram of a generation scheme of a conventional DAG blockchain provided in the present application. As shown in fig. 2, the block 200 is a block that has been dropped, and the corresponding transaction parties include: transaction part A and transaction part B, block 201 and block 202 are the blocks to be agreed, and the transaction part corresponding to block 201 comprises: transaction part a and transaction part D, the transaction parts corresponding to block 202 include: transaction party B and transaction party D, which causes block 201 and block 202 to have an intersection, transaction party D. This allows for blocks 201 and 202, after being executed, only one to eventually drop and the other to be discarded. However, when the blocks 201 and 202 are executed, it cannot be predicted whether they are discarded, and only when the disc is dropped, random discarding occurs, which causes resource waste of repeated packing and repeated block execution, and further affects the performance of the blockchain system.
To solve the above problems, the inventive concept of the present application is:
only one blockchain node is arranged for packaging at the same time, a plurality of blocks are packaged by the blockchain node at one time, and the packaged set of the plurality of blocks is called as a parallel blocklayer. Since all blocks are packed in one node at a time, the transaction with the association relationship can be prevented from being packed in different blocks. The inter-dependent transaction among the blocks in the parallel block layer does not exist, all the blocks can fall down after being executed and cannot be discarded, so that the resource waste caused by repeated packing and repeated execution of the blocks is avoided, and the processing efficiency of the system is improved.
Fig. 3 is a flowchart of a hierarchical DAG blockchain generation method according to an embodiment of the present application. As shown in fig. 3, the hierarchical DAG blockchain generation method is applied to any blockchain node of the blockchain network, and specifically includes the following steps:
s301, when the blockchain node is determined to be a packaging node corresponding to a new parallel blocklayer, packaging a plurality of blocks to be executed which can be executed in parallel from a transaction pool.
In the step, the block chain node is determined to be a packaging node through a consensus algorithm and a preset sequence requirement.
In this embodiment, the preset sequence requirement includes: a predetermined round robin packing order and only allowing nodes in one blockchain network to perform blockpacking at a time.
For example, the blockchain network includes: the blockchain node 0, the blockchain node 1, the blockchain node 2, and the blockchain node 3, then the predetermined round robin packing order may be: 0- > 1- > 2- > 3- > 0, or 2- > 3- > 1- > 0- > 2, etc.
S302, combining a plurality of blocks to be executed into a new parallel block layer.
In this step, the dropped blocks in the previous parallel block layer are set as parent blocks corresponding to the blocks to be executed, and each block to be executed is combined into a new parallel block layer.
Specifically, for steps S301 to S302, only one blockchain node performs blockwise packing at a time, and when blockwise packing is performed on a blockwise link node, the blockwise packing generates a parallel blockwise layer from a transaction pool corresponding to the blockwise link node according to a transaction interdependence relationship, where the parallel blockwise layer includes a plurality of unassociated blocks that can be performed in parallel, i.e., blocks to be performed. In order for each parallel block layer in the DAG blockchain to be connected, the parent block of the block to be executed needs to be set to the dropped block in the last parallel block layer.
It should be noted that when the next blockchain node is turned to pack, there may be a non-dropped block (also referred to as a legacy block) in the previous parallel block layer. The packing node will re-pack a new parallel block layer based on the legacy blocks, wherein the new parallel block layer contains the legacy blocks in the previous layer, and a plurality of new blocks to be executed which are packed based on the legacy blocks and are not related to each other.
In one possible implementation, when a new parallel block layer is packed based on a legacy block, a plurality of blocks to be executed are newly packed in the new parallel block layer, and the parent blocks are all blocks that have been dropped from the previous layer.
S303, broadcasting the new parallel block layer in the block chain network, so that all nodes in the block chain network independently start corresponding execution flow, consensus flow and disk-dropping flow for each block to be executed.
In this step, all nodes in the blockchain network share the parallel block layer, and the shared content includes all blocks to be executed included in the parallel block layer and each transaction corresponding to the blocks to be executed. Then, the nodes in each blockchain network execute, consensus and drop each block to be executed of the parallel block layer in parallel.
It should be noted that, each block to be executed can be independently executed, agreed and dropped, and the blocks are not mutually affected; if the processes corresponding to a block to be executed are too slow, the block to be executed becomes a legacy block to be merged into the next parallel block layer to be continuously executed.
After the step is performed, the process returns to S301 again, and the next packing node performs block packing according to the preset cyclic block packing sequence.
The beneficial effects of the hierarchical DAG blockchain generation method provided by embodiments of the present application can be understood through experiments in which pellets are drawn from a narrow-mouth bottle:
a plurality of balls connected with the line are placed in a fine-mouth bottle, and the diameters of the balls are consistent with the diameters of bottle mouths, namely, only one ball can be pulled out of the fine-mouth bottle at a time. If a plurality of pellets are simultaneously drawn out together, the phenomenon that the pellets are blocked at the bottle mouth is caused, and the blocked pellets can only pass through one pellet, and other pellets need to be put down for re-drawing, thus the problem corresponding to the prior art is that the speed of drawing out the pellets is seriously influenced. By reasonably arranging the extraction sequence and performing the mercy fit, the extraction of all the pellets can be completed in a very short time, which is the beneficial effect corresponding to the embodiment of the application.
The embodiment of the application provides a hierarchical DAG blockchain generation method, which is characterized in that when a blockchain node is determined to be a packaging node corresponding to a new parallel blocklayer, a plurality of blocks to be executed which can be executed in parallel are packaged from a transaction pool; then combining a plurality of blocks to be executed into a new parallel block layer; and broadcasting the new parallel block layer in the block chain network, so that all nodes in the block chain network independently start corresponding execution flow, consensus flow and disk-dropping flow for each block to be executed. The method of circularly and alternately packing blocks which can be executed in parallel by the chain link points of each block solves the technical problem that the processing efficiency is reduced due to the fact that the blocks are repeatedly packed and repeatedly executed in the prior art. The method and the device have the advantages of avoiding parallel packing of blocks by the link points of each block, enabling the blocks not to meet the requirement of the DAG directed acyclic graph, and avoiding repeated packing and repeated execution of the blocks.
FIG. 4 is a flowchart illustrating another hierarchical DAG blockchain generation method according to the present application. As shown in fig. 4, the hierarchical DAG blockchain generation method is applied to any blockchain node of the blockchain network, and specifically includes the following steps:
s401, determining the block chain node as a packaging node through a consensus algorithm and a preset sequence requirement.
In this step, the blockchain nodes are packaged in a corresponding preset packaging time range, and after reaching the upper limit of the preset packaging time range, each blockchain node in the blockchain network reconfirms whether the blockchain node has the blockpackaging authority or not, namely whether the blockchain node is the packaging node or not through a consensus algorithm.
In this embodiment, the preset sequence requirement includes: a predetermined round robin packing order and only allowing nodes in one blockchain network to perform blockpacking at a time.
For example, the blockchain network includes: the blockchain node 0, the blockchain node 1, the blockchain node 2, and the blockchain node 3, then the predetermined round robin packing order may be: 0- > 1- > 2- > 3- > 0, or 2- > 3- > 1- > 0- > 2, etc.
S402, judging whether the residual quantity of the processing blocks in the block chain nodes reaches the single-layer quantity upper limit.
In this step, the processing block includes: blocks in any one of the execution flow, consensus flow, and landing flow. If not, at least one block to be executed is packed from the transaction pool, and the total number of the blocks to be executed and the processing blocks is smaller than or equal to the single-layer upper limit, namely, the steps S403 to S405 are executed, if yes, the step S408 is executed.
S403, judging whether the residual quantity is zero.
In this step, if yes, step S404 is executed, and if not, step S405 is executed.
S404, packaging the first number of blocks to be executed from the transaction pool.
In this step, the first number is equal to the upper limit of the number of monolayers.
S405, packing a second number of blocks to be executed from the transaction pool.
In this step, the second number is the difference between the upper limit of the number of monolayers and the remaining number.
In this embodiment, the parent block information of the to-be-executed blocks is set to be all the blocks of the previous layer that have been dropped.
S406, judging whether the block chain node comprises a timeout block.
In this step, the timeout block includes: if the number of blocks which are not executed yet by the preset number of parallel block layers is not executed, step S407 is executed, and if not, step S409 is executed.
S407, adding a timeout mark to the head of the timeout block, and directly starting a landing flow for the timeout block to finish landing of the timeout block.
S408, determining the new parallel block layer as an empty layer without blocks.
In this step, an empty layer, i.e. a new parallel block layer without blocks, is created, so that the blockchain node can continue to process the legacy blocks left by the previous parallel block layer, so as to avoid overload of the blockchain node, or avoid causing block congestion, and cannot be processed in time.
S409, broadcasting the new parallel block layer in the block chain network, so that all nodes in the block chain network independently start corresponding execution flow, consensus flow and disk-dropping flow for each block to be executed.
In this step, all nodes in the blockchain network share the parallel block layer, and the shared content includes all blocks to be executed included in the parallel block layer and each transaction corresponding to the blocks to be executed. Then, the nodes in each blockchain network execute, consensus and drop each block to be executed of the parallel block layer in parallel.
S410, deleting the transaction corresponding to the dropped block in the blockchain node from the transaction pool.
In this step, the packing node deletes the transaction corresponding to the dropped block from the transaction pool, and avoids repeated packing and repeated execution of the block, so as to save computing resources.
After the upper limit of the preset packing time range corresponding to the current packing node is reached, the blockchain network returns to S401 to perform the next block packing of the packing node, and the block packing is repeated.
For ease of understanding, the above-described cyclic process is exemplified below.
Suppose that a blockchain network includes four nodes that can perform blockwise packing: packing node 0, packing node 1, packing node 2, packing node 3. The preset packing sequence is: from the packing node 0, the blocks are orderly rotated to the packing node 1, the packing node 2 and the packing node 3, and after the packing node 3 finishes block packing, the blocks are returned to the packing node 0 again to start block packing.
The following assumes that, after initialization from the blockchain, the packing node 0 starts to perform blockpacking:
the packing node 0 packs three blocks from its corresponding transaction pool 0: block 1, block 2 and block 3, which are commonly dependent on block 0 (i.e. the initial block of the blockchain), i.e. block 0 is the parent block of the three blocks, but the three blocks have no association with each other and can be executed in parallel, and the three blocks are independently recognized and dropped, so that the three blocks form the first parallel block layer, i.e. the parallel block layer 1.
Assuming that the block 3 of the parallel block layer 1 is not dropped in the packing time range corresponding to the packing node 0 and is left, the block 3 automatically enters the next parallel block layer, that is, the parallel block layer 2 includes the block 3 left by the parallel block layer 1.
The following turns to the packing node 1 to carry out block packing:
assume that the packing node 1 finds two blocks that can be executed in parallel, namely block 4 and block 5, in its corresponding transaction pool 1 based on the legacy block, namely block 3. It should be noted that, there is no intersection between the transaction parties corresponding to the block 3, the block 4 and the block 5, i.e. the three can be executed in parallel.
It should also be noted that the parent blocks of block 4 and block 5 are set as dropped blocks in parallel block layer 1, i.e., both block 1 and block 2 are parent blocks of block 4 and also parent blocks of block 5. This establishes the dependency of the DAG directed acyclic graph, i.e., the DAG blockchain is established instead of the traditional single-chain version of the blockchain.
The following turns to the packing node 2 to carry out block packing:
assuming that block 5 is a legacy block in parallel block layer 2 that has not dropped, then it automatically enters parallel block layer 3. At this time, when the packing node 2 is packing, if a large number of transaction requests are suddenly received, a large number of transactions are owned in the corresponding transaction pool 2, and meanwhile, assuming that the upper limit of the number of monolayers of the number of blocks that can be contained corresponding to each parallel block layer is 5, the packing node 2 can only pack 4 blocks to be executed, namely, the block 6, the block 7, the block 8 and the block 9, which can be executed in parallel in the transaction pool. And, the parent blocks of block 6, block 7, block 8 and block 9 are all set as block 3 and block 4.
The following turns to the packing node 3 to carry out block packing:
assuming that the blocks 5, 7 and 8 in the parallel block layer 3 are not dropped, the legacy blocks automatically enter the parallel block layer 4, the packing node 3 can only pack up to 2 blocks to be executed, namely the blocks 10 and 11, which can be executed in parallel from the corresponding transaction pool 3, and set the parent blocks of the blocks 10 and 11 as the blocks 6 and 9.
The following is also carried out by turning to the packing node 0 for block packing:
assuming that the blocks 5 and 11 in the parallel block layer 4 do not fall, the legacy blocks automatically enter the parallel block layer 5, and since the blocks 5 have not fallen for a long time, they have already undergone 4 parallel block layers, the blocks can be identified as timeout blocks according to the identification requirement of timeout blocks commonly known in advance by each node in the blockchain network, for example, when 4 parallel block layers are continued. Then the timeout flag is added to the block header of the block 5, such as invalid, and the block is dropped between the packing nodes 0, so that the transaction corresponding to the block 5 is not executed. Therefore, the problem that the user cannot get feedback for a long time to influence the user experience can be avoided because the block occupies resources for a long time. For the transaction corresponding to the block 5, corresponding prompt information can be sent to the transaction initiating terminal thereof to prompt the user to resubmit the transaction application. And meanwhile, deleting the transaction corresponding to the block 5 in the transaction pool. The parallel block layer 6 after this will not contain blocks 5 anymore.
Suppose that packing node 0 packs 4 blocks that can be executed in parallel block layer 5: block 12, block 13, block 14, block 15, and the parent blocks of these four blocks are all set as block 10 and block 11.
The following is also taken turns to the packing node 1 to carry out block packing:
assuming that all of the blocks 12, 13, 14, 15 are left behind, the packetizing node 1 can only repack one block, i.e. only the block 16 in the parallel block layer 6, and set the parent node of the block 16 as the block 10 and the block 11.
The following is also taken turns to the packing node 2 to carry out block packing:
assuming that all of block 12, block 13, block 14, block 15 and block 16 are left behind, the parallel block layer 7 can only be set to an empty layer, i.e. the packing node 2 cannot newly pack out the blocks. Thus, the block chain node has time to process the legacy blocks, and block congestion is avoided.
The embodiment of the application provides a hierarchical DAG blockchain generation method, which is characterized in that when a blockchain node is determined to be a packaging node corresponding to a new parallel blocklayer, a plurality of blocks to be executed which can be executed in parallel are packaged from a transaction pool; then combining a plurality of blocks to be executed into a new parallel block layer; and broadcasting the new parallel block layer in the block chain network, so that all nodes in the block chain network independently start corresponding execution flow, consensus flow and disk-dropping flow for each block to be executed. The method of circularly and alternately packing blocks which can be executed in parallel by the chain link points of each block solves the technical problem that the processing efficiency is reduced due to the fact that the blocks are repeatedly packed and repeatedly executed in the prior art. The method and the device have the advantages of avoiding parallel packing of blocks by the link points of each block, enabling the blocks not to meet the requirement of the DAG directed acyclic graph, and avoiding repeated packing and repeated execution of the blocks.
Fig. 5 is a schematic structural diagram of a hierarchical DAG blockchain generation device according to an embodiment of the present application. The hierarchical DAG blockchain generation device 500 may be implemented in software, hardware, or a combination of both.
As shown in fig. 5, the hierarchical DAG blockchain generation device 500 includes:
the packing module 501 is configured to, when determining that the blockchain node is a packing node corresponding to a new parallel blocklayer, pack a plurality of blocks to be executed that can be executed in parallel from the transaction pool;
a processing module 502, configured to:
combining a plurality of blocks to be executed into a new parallel block layer;
broadcasting the new parallel block layer in the block chain network, so that all nodes in the block chain network independently start corresponding execution flow, consensus flow and disk drop flow for each block to be executed.
In one possible design, the processing module 502 is further configured to determine that the blockchain node is a packed node through a consensus algorithm and a preset order requirement.
In one possible design, the preset sequence requirements include: a predetermined round robin packing order and only allowing nodes in one blockchain network to perform blockpacking at a time.
In one possible design, the processing module 502 is configured to:
and setting the dropped blocks in the last parallel block layer as parent blocks corresponding to the blocks to be executed, and combining the blocks to be executed into a new parallel block layer.
In one possible design, the processing module 502 is further configured to:
judging whether the residual quantity of the processing blocks in the block chain nodes reaches the single-layer quantity upper limit, wherein the processing blocks comprise: blocks in any one of an execution flow, a consensus flow and a tray-drop flow;
if not, packing at least one block to be executed from the transaction pool, wherein the total number of the blocks to be executed and the blocks to be processed is smaller than or equal to the single-layer upper limit;
if yes, determining the new parallel block layer as an empty layer without blocks so as to avoid overload of the block chain nodes.
In one possible design, the processing module 502 is further configured to:
judging whether the residual quantity of the processing blocks in the block chain nodes is zero or not;
if yes, packing a first number of blocks to be executed from the transaction pool, wherein the first number is equal to the upper limit of the single-layer number;
if not, packing a second number of blocks to be executed from the transaction pool, wherein the second number is the difference value between the upper limit of the single-layer number and the residual number.
In one possible design, the processing module 502 is further configured to:
judging whether the block chain node comprises a timeout block or not, wherein the timeout block comprises: blocks which are not executed yet through a preset number of parallel block layers;
if yes, adding a timeout mark on the head of the timeout block, and directly starting a landing flow for the timeout block to finish landing of the timeout block.
In one possible design, the processing module 502 is configured to:
and commonly identifying all blocks to be executed in the new parallel block layer and transactions corresponding to the blocks to be executed to all nodes in the block chain network.
Optionally, the packaging module 501 is further configured to:
and deleting the transaction corresponding to the dropped block in the block chain node from the transaction pool.
It should be noted that, the apparatus provided in the embodiment shown in fig. 5 may perform the method provided in any of the above method embodiments, and the specific implementation principles, technical features, explanation of terms, and technical effects are similar, and are not repeated herein.
Fig. 6 is a schematic structural diagram of an electronic device according to an embodiment of the present application. As shown in fig. 6, the electronic device 600 may include: at least one processor 601 and a memory 602. Fig. 6 shows an electronic device, for example a processor.
A memory 602 for storing programs. In particular, the program may include program code including computer-operating instructions.
The memory 602 may include high-speed RAM memory or may further include non-volatile memory (non-volatile memory), such as at least one disk memory.
The processor 601 is configured to execute computer-executable instructions stored in the memory 602 to implement the methods described in the method embodiments above.
The processor 601 may be a central processing unit (central processing unit, abbreviated as CPU), or an application specific integrated circuit (application specific integrated circuit, abbreviated as ASIC), or one or more integrated circuits configured to implement embodiments of the present application.
Alternatively, the memory 602 may be separate or integrated with the processor 601. When the memory 602 is a device separate from the processor 601, the electronic device 600 may further include:
a bus 603 for connecting the processor 601 and the memory 602. The bus may be an industry standard architecture (industry standard architecture, abbreviated ISA) bus, an external device interconnect (peripheral component, PCI) bus, or an extended industry standard architecture (extended industry standard architecture, EISA) bus, among others. Buses may be divided into address buses, data buses, control buses, etc., but do not represent only one bus or one type of bus.
Alternatively, in a specific implementation, if the memory 602 and the processor 601 are integrated on a chip, the memory 602 and the processor 601 may complete communication through an internal interface.
Embodiments of the present application also provide a computer-readable storage medium, which may include: various media capable of storing program codes, such as a usb disk, a removable hard disk, a read-only memory (ROM), a random access memory (random access memory, RAM), a magnetic disk, or an optical disk, and specifically, the computer readable storage medium stores program instructions for the methods in the above method embodiments.
The present application also provides a computer program product comprising a computer program which, when executed by a processor, implements the method of the above-described method embodiments.
Other embodiments of the present application will be apparent to those skilled in the art from consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the application following, in general, the principles of the application and including such departures from the present disclosure as come within known or customary practice within the art to which the application pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the application being indicated by the following claims.
It is to be understood that the present application is not limited to the precise arrangements and instrumentalities shown in the drawings, which have been described above, and that various modifications and changes may be effected without departing from the scope thereof. The scope of the application is limited only by the appended claims.

Claims (11)

1. A hierarchical DAG blockchain generation method, applied to any blockchain node of a blockchain network, comprising:
when the blockchain node is determined to be a packaging node corresponding to a new parallel blocklayer through a consensus algorithm and a preset sequence requirement, a plurality of blocks to be executed which can be executed in parallel are packaged from a transaction pool, wherein the preset sequence requirement comprises the following steps: a preset cyclic packing sequence, and only allowing the nodes in the block chain network to carry out block packing at a time;
combining a plurality of blocks to be executed into the new parallel block layer;
broadcasting the new parallel block layer in the block chain network, so that all nodes in the block chain network independently start corresponding execution flow, consensus flow and disk dropping flow for each block to be executed.
2. The hierarchical DAG blockchain generation method of claim 1, wherein the combining the plurality of the blocks to be executed into the new parallel block layer comprises:
and setting a dropped block in a previous parallel block layer as a parent block corresponding to the block to be executed, and combining each block to be executed into the new parallel block layer.
3. The hierarchical DAG blockchain generation method of claim 1 or 2, further comprising, prior to said packaging of the plurality of parallel executable blocks to be executed from the transaction pool:
judging whether the residual quantity of the processing blocks in the block chain node reaches the single-layer quantity upper limit, wherein the processing blocks comprise: blocks in any one of the execution flow, the consensus flow and the tray drop flow;
if not, packing at least one block to be executed from a transaction pool, wherein the total number of the block to be executed and the processing block is smaller than or equal to the single-layer upper limit;
if yes, determining the new parallel block layer as an empty layer without blocks so as to avoid overload of the block chain nodes.
4. The method of claim 3, wherein if not, packaging at least one of the blocks to be executed from a transaction pool comprises:
judging whether the residual quantity is zero or not;
if yes, packing a first number of blocks to be executed from a transaction pool, wherein the first number is equal to the upper limit of the single-layer number;
if not, packing a second number of blocks to be executed from the transaction pool, wherein the second number is the difference value between the upper limit of the single-layer number and the residual number.
5. The hierarchical DAG blockchain generation method of claim 1, further comprising, prior to said broadcasting the new parallel blockchain layer in the blockchain network:
judging whether the blockchain node comprises a timeout block or not, wherein the timeout block comprises: blocks which are not executed yet through a preset number of parallel block layers;
if yes, adding a timeout mark on the block head of the timeout block, and directly starting the landing flow for the timeout block to finish landing of the timeout block.
6. The hierarchical DAG blockchain generation method of any of claims 1, 2, 5, wherein the broadcasting the new parallel blockchain layer in the blockchain network comprises:
and commonly identifying all the blocks to be executed in the new parallel block layer and the transactions corresponding to the blocks to be executed to all the nodes in the block chain network.
7. The hierarchical DAG blockchain generation method of claim 1, further comprising:
and deleting the transaction corresponding to the dropped block in the blockchain node from the transaction pool.
8. A hierarchical DAG blockchain generation device, comprising:
the packaging module is used for packaging a plurality of blocks to be executed which can be executed in parallel from the transaction pool when the blockchain node of the blockchain network is determined to be a packaging node corresponding to a new parallel block layer through a consensus algorithm and a preset sequence requirement, wherein the preset sequence requirement comprises the following steps: a preset cyclic packing sequence, and only allowing the nodes in the block chain network to carry out block packing at a time;
a processing module for:
combining a plurality of blocks to be executed into the new parallel block layer;
broadcasting the new parallel block layer in the block chain network, so that all nodes in the block chain network independently start corresponding execution flow, consensus flow and disk dropping flow for each block to be executed.
9. An electronic device, comprising:
a processor; the method comprises the steps of,
a memory for storing a computer program of the processor;
wherein the processor is configured to perform the hierarchical DAG blockchain generation method of any of claims 1 to 7 via execution of the computer program.
10. A computer readable storage medium having stored thereon a computer program, which when executed by a processor implements the hierarchical DAG blockchain generation method of any of claims 1 to 7.
11. A computer program product comprising a computer program which, when executed by a processor, implements the hierarchical DAG blockchain generation method of any of claims 1 to 7.
CN202111529603.7A 2021-12-14 2021-12-14 Hierarchical DAG blockchain generation method, apparatus, medium, and program product Active CN114221961B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111529603.7A CN114221961B (en) 2021-12-14 2021-12-14 Hierarchical DAG blockchain generation method, apparatus, medium, and program product

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111529603.7A CN114221961B (en) 2021-12-14 2021-12-14 Hierarchical DAG blockchain generation method, apparatus, medium, and program product

Publications (2)

Publication Number Publication Date
CN114221961A CN114221961A (en) 2022-03-22
CN114221961B true CN114221961B (en) 2024-03-26

Family

ID=80701975

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111529603.7A Active CN114221961B (en) 2021-12-14 2021-12-14 Hierarchical DAG blockchain generation method, apparatus, medium, and program product

Country Status (1)

Country Link
CN (1) CN114221961B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114416765B (en) * 2022-03-28 2022-06-14 北京微芯感知科技有限公司 Block chain transaction stepless prediction execution method and system

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109508432A (en) * 2018-11-28 2019-03-22 段红 A kind of high-performance FAAS system based on block chain
CN111049658A (en) * 2019-12-12 2020-04-21 北京信息科技大学 DAG-based whole-network unified trust anchor system, establishment method and authentication method
AU2020202793A1 (en) * 2017-09-29 2020-05-21 Leverage Rock Llc Scalable distributed ledger system, transaction privacy and combating fraud, theft and loss
CN111369358A (en) * 2020-02-10 2020-07-03 杭州溪塔科技有限公司 Block chain consensus method and device and electronic equipment
CN111414373A (en) * 2020-03-18 2020-07-14 深圳市网心科技有限公司 Consensus method and consensus system
CN112037058A (en) * 2020-08-28 2020-12-04 平安科技(深圳)有限公司 Data verification method, device and storage medium
CA3141042A1 (en) * 2019-06-13 2020-12-17 Luis Eduardo Gutierrez-Sheris System and method using a fitness-gradient blockchain consensus and providing advanced distributed ledger capabilities via specialized data records
CN113516557A (en) * 2021-07-14 2021-10-19 桂林电子科技大学 Block chain with directed acyclic graph structure and implementation method thereof
CN113743951A (en) * 2021-11-04 2021-12-03 北京微芯感知科技有限公司 Intelligent contract transaction processing method and device for block chain

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10255108B2 (en) * 2016-01-26 2019-04-09 International Business Machines Corporation Parallel execution of blockchain transactions

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
AU2020202793A1 (en) * 2017-09-29 2020-05-21 Leverage Rock Llc Scalable distributed ledger system, transaction privacy and combating fraud, theft and loss
CN109508432A (en) * 2018-11-28 2019-03-22 段红 A kind of high-performance FAAS system based on block chain
CA3141042A1 (en) * 2019-06-13 2020-12-17 Luis Eduardo Gutierrez-Sheris System and method using a fitness-gradient blockchain consensus and providing advanced distributed ledger capabilities via specialized data records
CN111049658A (en) * 2019-12-12 2020-04-21 北京信息科技大学 DAG-based whole-network unified trust anchor system, establishment method and authentication method
CN111369358A (en) * 2020-02-10 2020-07-03 杭州溪塔科技有限公司 Block chain consensus method and device and electronic equipment
CN111414373A (en) * 2020-03-18 2020-07-14 深圳市网心科技有限公司 Consensus method and consensus system
CN112037058A (en) * 2020-08-28 2020-12-04 平安科技(深圳)有限公司 Data verification method, device and storage medium
CN113516557A (en) * 2021-07-14 2021-10-19 桂林电子科技大学 Block chain with directed acyclic graph structure and implementation method thereof
CN113743951A (en) * 2021-11-04 2021-12-03 北京微芯感知科技有限公司 Intelligent contract transaction processing method and device for block chain

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
区块链性能扩展与安全研究;毛志来;刘亚楠;孙惠平;陈钟;;信息网络安全;20200310(第03期);全文 *

Also Published As

Publication number Publication date
CN114221961A (en) 2022-03-22

Similar Documents

Publication Publication Date Title
JP6876806B2 (en) Blockchain Consensus Formation Methods and Devices
CN110990516A (en) Map data processing method and device and server
CN106570097A (en) Sequence generating method and device
CN114221961B (en) Hierarchical DAG blockchain generation method, apparatus, medium, and program product
US20160350341A1 (en) Merging of sorted lists using array pair
US9105208B2 (en) Method and apparatus for graphic processing using multi-threading
CN111932257A (en) Block chain parallelization processing method and device
CN108304272B (en) Data IO request processing method and device
CN111882322A (en) Method and device for packaging transactions in sequence and electronic equipment
US20240144582A1 (en) Intersection testing for ray tracing
US9417878B2 (en) Instruction scheduling for reducing register usage based on dependence depth and presence of sequencing edge in data dependence graph
CN111709748A (en) Transaction execution method and device with service attribute and electronic equipment
CN116185545A (en) Page rendering method and device
CN106100790B (en) A kind of data transmission method and system
CN109379284B (en) Route execution method, storage medium, and terminal device
CN110825528B (en) Resource management method, device and equipment
CN116149573B (en) Method, system, equipment and medium for processing queue by RAID card cluster
CN110955612B (en) Data caching method and related device
CN114217710B (en) Bullet frame control method, device, storage medium and system
JP6333370B2 (en) Method for implementing dynamic array data structures in cache lines
CN112596889B (en) Method for managing chained memory based on state machine
CN116579912A (en) Three-dimensional scene rendering method, device, equipment and storage medium
CN115794327A (en) Line distribution method, computing device and storage medium
CN104008140B (en) It is a kind of for handling the method and apparatus of the data set in network application
CN114328453A (en) KV database data management method and device, computing equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant