CN114221961A - Hierarchical DAG block chain generation method, apparatus, medium, and program product - Google Patents

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

Info

Publication number
CN114221961A
CN114221961A CN202111529603.7A CN202111529603A CN114221961A CN 114221961 A CN114221961 A CN 114221961A CN 202111529603 A CN202111529603 A CN 202111529603A CN 114221961 A CN114221961 A CN 114221961A
Authority
CN
China
Prior art keywords
block
blocks
executed
layer
block chain
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.)
Granted
Application number
CN202111529603.7A
Other languages
Chinese (zh)
Other versions
CN114221961B (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

Images

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

Abstract

The application provides a hierarchical DAG block chain generation method, equipment, a medium and a program product, wherein when a block chain node is determined to be a packaging node corresponding to a new parallel block layer, 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 flows, consensus flows and disk-dropping flows for each block to be executed. The method for circularly and alternately packing the blocks which can be executed in parallel by using each block chain link point solves the technical problem that the processing efficiency is reduced due to the repeated packing blocks, the repeated execution blocks and the like of each block chain link point in the prior art. The technical effects of avoiding parallel packing of the blocks by the link points of each block, enabling the blocks not to meet the requirement of a Directed Acyclic Graph (DAG), and avoiding repeated packing and repeated execution of the blocks are achieved.

Description

Hierarchical DAG block chain 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 technologies are applied in the financial field, and the traditional financial industry is gradually shifting to financial technology (Fintech). Block chain technology has also found widespread use in the field of financial technology.
At present, a blockchain generally stores blocks corresponding to each exchange through a chain structure, but as the requirement on the processing efficiency of a blockchain system is continuously improved, the chain structure cannot meet the efficiency requirement, and then a DAG (direct Acyclic Graph) blockchain appears, and the processing efficiency of the blockchain system is improved by executing a plurality of blocks simultaneously and in parallel.
However, when the existing block chain network generates a DAG block chain, the block chain link points cannot avoid that all blocks packed in parallel meet the requirement of a DAG directed acyclic graph, that is, there is no intersection between two corresponding transaction parties in each block, which enables the blocks with the intersection to be executed simultaneously, but only one block can be landed when final landing is performed, and other blocks can be abandoned, thereby causing the problems of block repeated packing, repeated execution and the like, and restricting further improvement of DAG block chain processing efficiency. Namely, each block link point in the prior art has the technical problem of reduced processing efficiency caused by repeated packing blocks, repeated execution blocks and the like.
Disclosure of Invention
The application provides a hierarchical DAG block chain generation method, device, medium and program product, which are used for solving the technical problem that processing efficiency is reduced due to the fact that each block chain link point in the prior art is provided with a repeated packing block, a repeated execution block and the like.
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 the block chain node is determined to be a packaging node corresponding to the new parallel block layer, packaging a plurality of blocks to be executed which can be executed in parallel from the transaction pool;
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 flows, consensus flows and disk-dropping flows for each block to be executed.
In one possible design, determining a blockchain node as a packing node corresponding to the new parallel block layer includes:
and determining the block chain node as a packaging node through a consensus algorithm and a preset sequence requirement.
In one possible design, the predetermined order requirement includes: and presetting a cyclic packing sequence, and only allowing nodes in one block chain network to carry out block packing at a time.
In one possible design, combining multiple blocks to be executed into a new parallel block layer includes:
setting the dropped blocks in the previous parallel block layer as parent blocks corresponding to the blocks to be executed, and combining all the blocks to be executed into a new parallel block layer.
In one possible design, before packing out a plurality of blocks to be executed that can be executed in parallel from the transaction pool, the method further includes:
judging whether the residual quantity of the processing blocks in the block chain nodes reaches the upper limit of the single-layer quantity, wherein the processing blocks comprise: a block in any one of an execution flow, a consensus flow and a tray falling flow;
if not, packaging at least one block to be executed from the transaction pool, wherein the total number of the block to be executed and the block to be processed is less than or equal to the upper limit of the single-layer number;
if yes, determining the new parallel block layer as an empty layer without blocks so as to avoid overload of the block chain node.
In a possible design, if not, packing at least one block to be executed from the transaction pool includes:
judging whether the residual quantity is zero or not;
if yes, packaging 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;
and if not, packaging a second number of blocks to be executed from the transaction pool, wherein the second number is the difference 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 block chain network, the method further includes:
judging whether the block chain node contains a timeout block, 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 at the head of the block of the timeout block, and directly starting a disk-dropping process for the timeout block to complete the disk-dropping of the timeout block.
In one possible design, broadcasting the new parallel block layer in a blockchain network includes:
and identifying all the blocks to be executed in the new parallel block layer and the transaction corresponding to the blocks to be executed to all the nodes in the block chain network.
Optionally, the method further includes:
and deleting the transaction corresponding to the landed block in the block chain node from the transaction pool.
In a second aspect, the present application provides a hierarchical DAG blockchain generation apparatus, including:
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 block chain node is determined to be the packaging node corresponding to the new parallel block layer;
a processing module to:
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 flows, consensus flows and disk-dropping flows for each block to be executed.
In a third aspect, the present application provides an electronic device comprising:
a memory for storing program instructions;
and the processor is used for calling and executing the program instructions in the memory to execute any one of the possible item storage information determination methods provided by the first aspect.
In a fourth aspect, the present application provides a storage medium, which can be read by a computer program stored in the storage medium, where the computer program is configured to execute any one of the possible hierarchical DAG blockchain generation methods provided in the first aspect.
In a fifth aspect, the present application further provides a computer program product, including 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 block chain generation method, equipment, a medium and a program product, wherein when a block chain node is determined to be a packaging node corresponding to a new parallel block layer, 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 flows, consensus flows and disk-dropping flows for each block to be executed. The method for circularly and alternately packing the blocks which can be executed in parallel by using each block chain link point solves the technical problem that the processing efficiency is reduced due to the repeated packing blocks, the repeated execution blocks and the like of each block chain link point in the prior art. The technical effects of avoiding parallel packing of the blocks by the link points of each block, enabling the blocks not to meet the requirement of a Directed Acyclic Graph (DAG), and avoiding repeated packing and repeated execution of the blocks are achieved.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and together with the description, serve to explain the principles of the application.
FIG. 1 is a schematic diagram of a directed acyclic graph provided herein;
FIG. 2 is a schematic diagram of an existing DAG blockchain generation scheme provided herein;
fig. 3 is a schematic flow chart of a hierarchical DAG blockchain generation method provided in the present application;
FIG. 4 is a schematic flow chart diagram illustrating another hierarchical DAG blockchain generation method provided in an implementation of the present application;
fig. 5 is a schematic structural diagram of a hierarchical DAG blockchain generation apparatus according to an embodiment of the present disclosure;
fig. 6 is a schematic structural diagram of an electronic device provided in the present application.
With the above figures, there are shown specific embodiments of the present application, which will be described in more detail below. These drawings and written description are not intended to limit the scope of the inventive concepts in any manner, but rather to illustrate the inventive concepts to those skilled in the art by reference to specific embodiments.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in 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 obvious that the described embodiments are only a part of the embodiments of the present application, and not all the embodiments. All other embodiments, including but not limited to combinations of embodiments, which can be derived by a person skilled in the art from the embodiments disclosed herein without making any inventive step are within the scope of the present application.
The terms "first," "second," "third," "fourth," and the like in the description and in the claims of the present application and in the drawings described above, if any, are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the application described herein are, for example, capable of operation in sequences other than those illustrated or otherwise described herein. 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 explanations are made for terms to which this application refers:
DAG (directed Acyclic graph) directed Acyclic graph: is a special structure in graph data structures. If a directed graph starts from any vertex and can not go back to the point through a plurality of edges, the graph is a directed acyclic graph.
Fig. 1 is a schematic diagram of a directed acyclic graph provided in the present application. As shown in FIG. 1, a DAG directed acyclic graph includes: block a, block b, block c, block d, and block e. The two ends of the arrow represent whether the two blocks have dependency relationship, and the two blocks from block a to block e cannot return to block e any more, i.e. a loop cannot be formed.
DAG blockchain: is an extended data structure of a blockchain. In a DAG blockchain, a block is a vertex of a 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 block chain, whose parent blocks can correspond to, is not limited to 1. The block chain is described in a DAG block chain mode, so that blocks without mutual dependency relationship 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 relationship and can be executed in parallel, rather than sequentially as in the conventional blockchain.
The inventor of the application finds that through long-term working practice: when the existing block chain network generates a DAG block chain, all blocks packed in parallel by each block chain node point cannot be avoided to meet the requirement of a DAG directed acyclic graph, namely, intersection does not exist between two corresponding transaction sides in each block, so that the blocks with intersection are executed simultaneously, but only one block can be landed when final landing is performed, and other blocks can be abandoned, so that the problems of block repeated packing, repeated execution and the like 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 block chain node is a block which is packed independently, and although each block chain node is packed according to the requirement of a DAG directed acyclic graph when being packed, a plurality of block chain nodes are not communicated when being packed, so that two transaction parties corresponding to a plurality of blocks which are packed in parallel finally may have intersection. However, although there is intersection, it does not affect each blockchain node to independently execute these blocks until the blocks need to be landed, since the landing rule corresponding to the DAG blockchain requires that each block with intersection can only land one of the blocks at the same time, and other blocks will be discarded, which causes the discarded blocks to be repackaged and re-executed.
Fig. 2 is a schematic diagram of a generation scheme of an existing DAG block chain provided in the present application. As shown in fig. 2, the block 200 is a block that has been landed, and the two corresponding transaction parties include: transaction part a and transaction part B, block 201 and block 202 are blocks to be identified, and the transaction part corresponding to block 201 includes: transaction party a and transaction party D, the transaction parties corresponding to block 202 include: party B and party D, which causes block 201 and block 202 to intersect, party D. This allows only one of the blocks 201 and 202 to eventually land after being executed, while the other is discarded. However, when the blocks 201 and 202 are executed, it cannot be predetermined whether they are discarded, and only when the execution is performed, the random discarding phenomenon occurs, which causes resource waste of repeated packing and repeated block execution, and further affects the performance of the blockchain system.
In order to solve the above problems, the inventive concept of the present application is:
and setting that only one block link point is packed at the same time, wherein the block link point packs a plurality of blocks at one time, and the packed aggregate of the plurality of blocks is called a parallel block layer. Since all blocks are packed in one node each time, it is possible to avoid related transactions being packed in different blocks. The blocks in the parallel block layer do not have interdependent transactions, all the blocks can be dropped after being executed, and cannot be discarded, so that resource waste caused by repeated packaging and repeated execution of the blocks is avoided, and the processing efficiency of the system is improved.
Fig. 3 is a flowchart illustrating a hierarchical DAG blockchain generation method according to an embodiment of the present disclosure. As shown in fig. 3, the hierarchical DAG blockchain generation method is applied to any blockchain node of a blockchain network, and includes the specific steps of:
s301, when the block chain node is determined to be the packing node corresponding to the new parallel block layer, a plurality of blocks to be executed which can be executed in parallel are packed from the transaction pool.
In this step, the block chain node is determined to be a packing node through a consensus algorithm and a preset sequence requirement.
In this embodiment, the preset sequence requirement includes: and presetting a cyclic packing sequence, and only allowing nodes in one block chain network to carry out block packing at a time.
For example, a blockchain network includes: block chain node 0, block link point 1, block link point 2, and block link point 3, then the preset cyclic 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 block in the previous parallel block layer is set as the parent block corresponding to the block 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 block chain node performs block packing each time, and when the block chain node performs block packing, it generates a parallel block layer from the transaction pool corresponding to the block chain node according to the interdependence relationship of transactions, where the parallel block layer includes a plurality of unrelated blocks that can be executed in parallel, i.e., blocks to be executed. In order to connect the parallel block layers in the DAG block chain, the parent block of the block to be executed needs to be set as the landed block in the previous parallel block layer.
It should be noted that when it is time to pack the next block link point, there may be an un-landed block (also called a legacy block) in the previous parallel block layer. The packing node packs a new parallel block layer again based on the legacy block, wherein the new parallel block layer comprises the legacy block 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 the legacy blocks, the newly packed multiple to-be-executed blocks in the new parallel block layer have their parent blocks being all blocks that have been landed from the previous layer.
And 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 processes, consensus processes and disk-dropping processes for each block to be executed.
In this step, all nodes in the blockchain network perform consensus on the parallel block layer, where the consensus includes all blocks to be executed included in the parallel block layer and transactions corresponding to the blocks to be executed. Then, the node in each block chain network executes, recognizes and disfigures each block to be executed in the parallel block layer in parallel.
It should be noted that each block to be executed can be independently executed, identified and landed without mutual influence; if the processes corresponding to a block to be executed are too slow, the remaining blocks are merged into the next parallel block layer for continuous execution.
After the step is executed, the process returns to S301 again, and block packing is performed by the next packing node according to the preset cyclic block packing sequence.
The beneficial effects of the hierarchical DAG blockchain generation method provided by the embodiments of the present application can be understood through experiments in which pellets are drawn from flasks:
a narrow-mouth bottle is filled with a plurality of small balls connected with wires, the diameter of the small balls is consistent with that of the bottle mouth, namely, only one small ball can be drawn out of the narrow-mouth bottle at a time. If a plurality of small balls are simultaneously drawn out together, the small balls are blocked at the bottle opening, the blocked small balls can only pass through one small ball, other small balls need to be put down and drawn out again, and the problem corresponding to the prior art is that the speed of drawing out the small balls is seriously influenced. And through reasonable arrangement of the extraction sequence, all small balls can be extracted in a very short time in tacit cooperation, which is the corresponding beneficial effect of the embodiment of the application.
The embodiment of the application provides a hierarchical DAG block chain generation method, which is characterized in that when a block chain node is determined to be a packaging node corresponding to a new parallel block layer, 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 flows, consensus flows and disk-dropping flows for each block to be executed. The method for circularly and alternately packing the blocks which can be executed in parallel by using each block chain link point solves the technical problem that the processing efficiency is reduced due to the repeated packing blocks, the repeated execution blocks and the like of each block chain link point in the prior art. The technical effects of avoiding parallel packing of the blocks by the link points of each block, enabling the blocks not to meet the requirement of a Directed Acyclic Graph (DAG), and avoiding repeated packing and repeated execution of the blocks are achieved.
Fig. 4 is a schematic flow chart of another hierarchical DAG blockchain generation method provided in this application. As shown in fig. 4, the hierarchical DAG blockchain generation method is applied to any blockchain node of a blockchain network, and includes the specific steps of:
s401, determining the block chain node as a packaging node through a consensus algorithm and a preset sequence requirement.
In this step, the block link points are packed in the corresponding preset packing time range, and after the upper limit of the preset packing time range is reached, each block chain node in the block chain network reconfirms whether the block chain node has the block packing authority or not through a consensus algorithm, namely whether the block chain node is a packing node or not.
In this embodiment, the preset sequence requirement includes: and presetting a cyclic packing sequence, and only allowing nodes in one block chain network to carry out block packing at a time.
For example, a blockchain network includes: block chain node 0, block link point 1, block link point 2, and block link point 3, then the preset cyclic 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 node reaches the upper limit of the single-layer quantity.
In this step, the processing block includes: and the blocks in any one of the execution flow, the consensus flow and the disk dropping flow. If not, packaging at least one block to be executed from the transaction pool, and if the total number of the block to be executed and the processed block is less than or equal to the upper limit of the single-layer number, executing steps S403 to S405, and if so, executing step S408.
And S403, judging whether the residual quantity is zero or not.
In this step, if yes, step S404 is executed, otherwise, step S405 is executed.
S404, packing a 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 amount is the difference between the upper limit of the number of monolayers and the remaining amount.
In this embodiment, the parent block information of the block to be executed is set as all blocks that have been landed in the previous layer.
S406, whether the block chain node contains the timeout block is judged.
In this step, the timeout block includes: if the number of blocks in the preset number of parallel block layers is not yet executed, step S407 is executed, otherwise step S409 is executed.
S407, add the timeout flag to the header of the timeout block, and directly start the disk-dropping procedure for the timeout block to complete the disk-dropping of the timeout block.
S408, determining the new parallel block layer as an empty layer without blocks.
In this step, an empty layer, that is, a new parallel block layer without a block, is established, so that the blockchain node can continue to process the left-over block left by the previous parallel block layer, thereby avoiding overload of the load of the blockchain node, or avoiding block congestion and failing to obtain timely processing.
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 processes, consensus processes and disk-dropping processes for each block to be executed.
In this step, all nodes in the blockchain network perform consensus on the parallel block layer, where the consensus includes all blocks to be executed included in the parallel block layer and transactions corresponding to the blocks to be executed. Then, the node in each block chain network executes, recognizes and disfigures each block to be executed in the parallel block layer in parallel.
And S410, deleting the transaction corresponding to the landed block in the block chain node from the transaction pool.
In this step, the packaging node deletes the transaction corresponding to the dropped block from the transaction pool, thereby avoiding repeated packaging and repeated execution of the block and saving the computing resources.
After the upper limit of the preset packing time range corresponding to the current packing node is reached, the block chain network returns to S401 to perform block packing of the next packing node, and the process is repeated in a circulating manner.
For ease of understanding, the above-described cyclic process is exemplified below.
Assume that the blockchain network includes four nodes that can perform block packing: packing node 0, packing node 1, packing node 2, packing node 3. The preset packing sequence is as follows: and sequentially rotating to a packing node 1, a packing node 2 and a packing node 3 from the packing node 0, and returning to the packing node 0 again to start block packing after the packing node 3 finishes block packing.
It is assumed that after initialization of the blockchain, packing node 0 starts to perform block packing:
packaging node 0 packages three blocks from its corresponding transaction pool 0: block 1, block 2, and block 3, which all depend on block 0 (i.e., the initial block of the blockchain), i.e., block 0 is the parent block of these three blocks, but these three blocks have no relationship to each other, and can be executed in parallel, and perform consensus and landing independently, so that these three blocks constitute the first parallel block layer, i.e., parallel block layer 1.
Assuming that the block 3 of the parallel block layer 1 is left without a tray drop within the packing time range corresponding to the packing node 0, the block 3 automatically enters the next parallel block layer, i.e., the parallel block layer 2 includes the block 3 left by the parallel block layer 1.
The following turns to packing node 1 for block packing:
assume that the packing node 1 finds two blocks, block 4 and block 5, that can be executed in parallel in its corresponding transaction pool 1 according to the legacy block, block 3. It should be noted that there is no intersection between the two corresponding transaction parties of tile 3, tile 4 and tile 5, i.e. the three may be executed in parallel.
It should also be noted that the parent blocks of block 4 and block 5 are set as landed blocks in the 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. Thus, the dependency relationship of the DAG directed acyclic graph is established, namely, a DAG block chain is established instead of the traditional single-chain type block chain.
The following turns to packing node 2 for block packing:
assuming that tile 5 is a legacy tile that has not dropped in parallel tile layer 2, it is automatically entered in parallel tile layer 3. At this time, when the packing node 2 packs, if a large number of transaction requests are received suddenly, the corresponding transaction pool 2 holds a large number of transactions, and meanwhile, if the upper limit of the single-layer number of the number of blocks that can be contained corresponding to each parallel block layer is 5, the packing node 2 can pack only 4 blocks to be executed in parallel, namely, a block 6, a block 7, a block 8, and a block 9, in the transaction pool. Also, 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 packing node 3 for block packing:
assuming that the tile 5, the tile 7 and the tile 8 in the parallel tile layer 3 do not fall off, and then the legacy tile automatically enters the parallel tile layer 4, the packing node 3 can only pack up to 2 tiles to be executed, i.e. the tile 10 and the tile 11, which can be executed in parallel from the corresponding transaction pool 3, and sets the parent tiles of the tile 10 and the tile 11 as the tile 6 and the tile 9.
The following turns to packing node 0 for block packing:
assuming that the tile 5 and the tile 11 in the parallel tile layer 4 do not fall, the left tile automatically enters the parallel tile layer 5, and since the tile 5 has not fallen for a long time and has already gone through 4 parallel tile layers, the tile can be identified as a timeout tile according to the identification requirement of the timeout tile commonly recognized by each node in the blockchain network in advance, for example, when 4 parallel tile layers are continued. Then, a timeout flag, such as invalid, is added to the block header of block 5, and the block is dropped between packing nodes 0, and the transaction corresponding to block 5 is not executed. Therefore, the block can be prevented from occupying resources for a long time, and the problem that the user experience is influenced because the user cannot get feedback for a long time can also be avoided. For the transaction corresponding to the block 5, corresponding prompt information may be sent to the transaction initiating terminal thereof to prompt the user to resubmit the transaction application. Meanwhile, the transaction corresponding to the block 5 is deleted in the transaction pool. So that the subsequent parallel block layer 6 does not contain blocks 5 anymore.
Assume that packing node 0 packs 4 blocks in parallel block layer 5 that can be executed in parallel: block 12, block 13, block 14, block 15, and the parent blocks of these four blocks are all set to be block 10 and block 11.
The following turns to packing node 1 for block packing:
assuming that block 12, block 13, block 14, and block 15 are all left, then packing node 1 can only pack one more block, i.e. only block 16 in parallel block layer 6, and set the parent node of block 16 as block 10 and block 11.
The following turns to packing node 2 for block packing:
assuming that block 12, block 13, block 14, block 15 and block 16 are left, then parallel block layer 7 can only be set to an empty layer, i.e. packing node 2 cannot pack out a block newly. This allows the block links some time to handle the legacy blocks, avoiding block congestion.
The embodiment of the application provides a hierarchical DAG block chain generation method, which is characterized in that when a block chain node is determined to be a packaging node corresponding to a new parallel block layer, 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 flows, consensus flows and disk-dropping flows for each block to be executed. The method for circularly and alternately packing the blocks which can be executed in parallel by using each block chain link point solves the technical problem that the processing efficiency is reduced due to the repeated packing blocks, the repeated execution blocks and the like of each block chain link point in the prior art. The technical effects of avoiding parallel packing of the blocks by the link points of each block, enabling the blocks not to meet the requirement of a Directed Acyclic Graph (DAG), and avoiding repeated packing and repeated execution of the blocks are achieved.
Fig. 5 is a schematic structural diagram of a hierarchical DAG blockchain generation apparatus according to an embodiment of the present disclosure. The hierarchical DAG blockchain generation apparatus 500 may be implemented by software, hardware, or a combination of both.
As shown in fig. 5, the hierarchical DAG blockchain generation apparatus 500 includes:
a packing module 501, configured to pack a plurality of blocks to be executed that can be executed in parallel from the transaction pool when it is determined that the block chain node is a packing node corresponding to the new parallel block layer;
a processing module 502 for:
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 flows, consensus flows and disk-dropping flows for each block to be executed.
In one possible design, the processing module 502 is further configured to determine the blockchain node as a packing node through a consensus algorithm and a preset order requirement.
In one possible design, the predetermined order requirement includes: and presetting a cyclic packing sequence, and only allowing nodes in one block chain network to carry out block packing at a time.
In one possible design, the processing module 502 is configured to:
setting the dropped blocks in the previous parallel block layer as parent blocks corresponding to the blocks to be executed, and combining all 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 upper limit of the single-layer quantity, wherein the processing blocks comprise: a block in any one of an execution flow, a consensus flow and a tray falling flow;
if not, packaging at least one block to be executed from the transaction pool, wherein the total number of the block to be executed and the block to be processed is less than or equal to the upper limit of the single-layer number;
if yes, determining the new parallel block layer as an empty layer without blocks so as to avoid overload of the block chain node.
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, packaging 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;
and if not, packaging a second number of blocks to be executed from the transaction pool, wherein the second number is the difference 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 contains a timeout block, 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 at the head of the block of the timeout block, and directly starting a disk-dropping process for the timeout block to complete the disk-dropping of the timeout block.
In one possible design, the processing module 502 is configured to:
and identifying all the blocks to be executed in the new parallel block layer and the transaction corresponding to the blocks to be executed to all the nodes in the block chain network.
Optionally, the packing module 501 is further configured to:
and deleting the transaction corresponding to the landed 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 can execute the method provided in any of the above method embodiments, and the specific implementation principle, technical features, term explanation and technical effects thereof are similar and will not be described herein again.
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 memory 602. Fig. 6 shows an electronic device as an example of a processor.
A memory 602 for storing programs. In particular, the program may include program code including computer operating instructions.
The memory 602 may comprise high-speed RAM memory, and may also 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 above method embodiments.
The processor 601 may be a Central Processing Unit (CPU), an Application Specific Integrated Circuit (ASIC), or one or more integrated circuits configured to implement the 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 independent 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 (ISA) bus, a Peripheral Component Interconnect (PCI) bus, an Extended ISA (EISA) bus, or the like. Buses may be classified as address buses, data buses, control buses, etc., but do not represent only one bus or type of bus.
Alternatively, in a specific implementation, if the memory 602 and the processor 601 are integrated into a single chip, the memory 602 and the processor 601 may communicate via an internal interface.
An embodiment of the present application further provides a computer-readable storage medium, where the computer-readable storage medium may include: various media that can store program codes, such as a usb disk, a removable hard disk, a read-only memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and in particular, the computer-readable storage medium stores program instructions for the methods in the above method embodiments.
An embodiment of the present application further provides a computer program product, which includes a computer program, and when the computer program is executed by a processor, the computer program implements the method in the foregoing 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 invention 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 invention 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 will be understood that the present application is not limited to the precise arrangements described above and shown in the drawings and that various modifications and changes may be made without departing from the scope thereof. The scope of the application is limited only by the appended claims.

Claims (13)

1. A hierarchical DAG blockchain generation method is applied to any blockchain node of a blockchain network, and comprises the following steps:
when the block chain node is determined to be a packaging node corresponding to the new parallel block layer, packaging a plurality of blocks to be executed which can be executed in parallel from a transaction pool;
combining a plurality of the 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 flows, consensus flows and dial-down flows for each block to be executed.
2. The method of claim 1, wherein the determining the blockchain node as a packed node corresponding to a new parallel layer of blocks comprises:
and determining the block chain node as the packing node through a consensus algorithm and a preset sequence requirement.
3. The method of claim 2, wherein the predetermined order requirement comprises: a predetermined cyclic packing sequence, and only allowing the nodes in one of the blockchain networks to perform block packing at a time.
4. The method of claim 1, wherein combining the plurality of blocks to be executed into the new parallel block layer comprises:
setting the dropped blocks in the previous parallel block layer as parent blocks corresponding to the blocks to be executed, and combining the blocks to be executed into the new parallel block layer.
5. The hierarchical DAG blockchain generation method of claim 1 or 4, further comprising, prior to the packing out of the transaction pool a plurality of concurrently executable blocks to be executed, the method further comprising:
determining whether a remaining number of in-process blocks in the block chain node reaches a single-layer number upper limit, the in-process blocks including: a block in any one of the execution flow, the consensus flow and the tray falling flow;
if not, packaging at least one block to be executed from the transaction pool, wherein the total number of the block to be executed and the block in processing is less than or equal to the upper limit of the single-layer number;
and if so, determining the new parallel block layer as an empty layer without blocks so as to avoid the overload of the block chain node.
6. The method of claim 5, wherein the step of packaging at least one block to be executed from a transaction pool if not comprises:
judging whether the residual quantity is zero or not;
if yes, packing a first number of the blocks to be executed from a transaction pool, wherein the first number is equal to the upper limit of the single-layer number;
and if not, packaging a second number of the 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.
7. The method of claim 1, wherein prior to broadcasting the new parallel block layer in the blockchain network, further comprising:
judging whether the block chain node comprises a timeout block, 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 at the head of the block of the timeout block, and directly starting the tray falling process for the timeout block to complete the tray falling of the timeout block.
8. The method for hierarchical DAG blockchain generation according to any one of claims 1 to 4 or 7, wherein the broadcasting the new parallel blockchain layer in the blockchain network comprises:
and identifying all the blocks to be executed in the new parallel block layer and the transaction corresponding to the blocks to be executed to all the nodes in the block chain network.
9. The method for hierarchical DAG blockchain generation according to claim 1, further comprising:
and deleting the transaction corresponding to the landed block in the block chain node from the transaction pool.
10. A hierarchical DAG blockchain generation apparatus, 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 block chain node is determined to be the packaging node corresponding to the new parallel block layer;
a processing module to:
combining a plurality of the 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 flows, consensus flows and dial-down flows for each block to be executed.
11. An electronic device, comprising:
a processor; and the number of the first and second groups,
a memory for storing a computer program for the processor;
wherein the processor is configured to perform the method of hierarchical DAG blockchain generation of any of claims 1 to 9 via execution of the computer program.
12. A computer readable storage medium having stored thereon a computer program, wherein the computer program, when executed by a processor, implements the hierarchical DAG blockchain generation method of any of claims 1 to 9.
13. A computer program product comprising a computer program, wherein the computer program when executed by a processor implements the hierarchical DAG blockchain generation method of any of claims 1 to 9.
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 true CN114221961A (en) 2022-03-22
CN114221961B 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)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114416765A (en) * 2022-03-28 2022-04-29 北京微芯感知科技有限公司 Stepless prediction execution method and system for block chain transaction

Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20170212781A1 (en) * 2016-01-26 2017-07-27 International Business Machines Corporation Parallel execution of blockchain transactions
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

Patent Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20170212781A1 (en) * 2016-01-26 2017-07-27 International Business Machines Corporation Parallel execution of blockchain transactions
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
毛志来;刘亚楠;孙惠平;陈钟;: "区块链性能扩展与安全研究", 信息网络安全, no. 03, 10 March 2020 (2020-03-10) *

Cited By (2)

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

Also Published As

Publication number Publication date
CN114221961B (en) 2024-03-26

Similar Documents

Publication Publication Date Title
US8381230B2 (en) Message passing with queues and channels
CN104978321B (en) Construct the method, apparatus of data queue and the method from its insertion and consumer objects
CN109213594A (en) Method, apparatus, equipment and the computer storage medium that resource is seized
CN104008013A (en) Core resource allocation method and apparatus and multi-core system
CN112214319B (en) Task scheduling method for sensing computing resources
US10846245B2 (en) Minimizing usage of hardware counters in triggered operations for collective communication
CN107562685B (en) Method for data interaction between multi-core processor cores based on delay compensation
CN110020859A (en) A kind of block chain common recognition method, apparatus and electronic equipment executed parallel
CN115829017B (en) Method, device, medium and equipment for processing data based on core particles
US9105208B2 (en) Method and apparatus for graphic processing using multi-threading
CN114221961A (en) Hierarchical DAG block chain generation method, apparatus, medium, and program product
WO2014186242A1 (en) Merging of sorted lists using array pair
CN115658277A (en) Task scheduling method and device, electronic equipment and storage medium
CN108062235A (en) Data processing method and device
CN104731562A (en) Task Execution In Simd Processing Unit
WO2022042368A1 (en) Logical node layout method and apparatus, computer device, and storage medium
US8543722B2 (en) Message passing with queues and channels
US20240144582A1 (en) Intersection testing for ray tracing
CN106100790B (en) A kind of data transmission method and system
CN104270262B (en) A kind of method and apparatus of data processing gateway service information reporting
CN116149573B (en) Method, system, equipment and medium for processing queue by RAID card cluster
CN104008140B (en) It is a kind of for handling the method and apparatus of the data set in network application
WO2023207502A1 (en) Order packaging method and apparatus, device, and storage medium
CN115051980B (en) HTCondor super-calculation grid file transmission method and system
CN112596889B (en) Method for managing chained memory based on state machine

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