CN111858773A - Transaction packaging method, device and storage medium - Google Patents

Transaction packaging method, device and storage medium Download PDF

Info

Publication number
CN111858773A
CN111858773A CN202010748641.0A CN202010748641A CN111858773A CN 111858773 A CN111858773 A CN 111858773A CN 202010748641 A CN202010748641 A CN 202010748641A CN 111858773 A CN111858773 A CN 111858773A
Authority
CN
China
Prior art keywords
transaction
subsequent
transactions
block
found
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
CN202010748641.0A
Other languages
Chinese (zh)
Other versions
CN111858773B (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.)
Hangzhou Fuzamei Technology Co Ltd
Original Assignee
Hangzhou Fuzamei Technology 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 Hangzhou Fuzamei Technology Co Ltd filed Critical Hangzhou Fuzamei Technology Co Ltd
Priority to CN202010748641.0A priority Critical patent/CN111858773B/en
Publication of CN111858773A publication Critical patent/CN111858773A/en
Application granted granted Critical
Publication of CN111858773B publication Critical patent/CN111858773B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • 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/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2455Query execution
    • 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
    • G06F16/278Data partitioning, e.g. horizontal or vertical partitioning
    • 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)
  • General Physics & Mathematics (AREA)
  • Physics & Mathematics (AREA)
  • Business, Economics & Management (AREA)
  • General Engineering & Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Computing Systems (AREA)
  • Accounting & Taxation (AREA)
  • Finance (AREA)
  • Economics (AREA)
  • Development Economics (AREA)
  • Marketing (AREA)
  • Strategic Management (AREA)
  • Technology Law (AREA)
  • General Business, Economics & Management (AREA)
  • Computational Linguistics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention provides a transaction packaging method, equipment and a storage medium, wherein the method comprises the following steps: when the first transaction is judged to be a first type transaction with an execution logic sequence, searching each second transaction which should be executed before the first transaction according to the first identification of the first transaction; when all second transactions which are not recorded on the blockchain exist in the memory pool and all second transactions which are not recorded on the blockchain are not packed into the first block, adjusting the packing sequence of all second transactions and a plurality of second type transactions which are not to be packed into the first block and have no execution logic sequence; when all second transactions which are not recorded on the blockchain are in the memory pool and all second transactions which are not recorded on the blockchain are to be packed into the first block, the packing sequence of the first transactions and all second transactions which are not recorded on the blockchain is adjusted to ensure that the packing sequence is identical to the first execution logic sequence. The method and the device enable a plurality of transactions generated by one chain-crossing transfer demand to be packaged according to the execution logic sequence.

Description

Transaction packaging method, device and storage medium
Technical Field
The application relates to the technical field of block chains, in particular to a transaction packaging method, equipment and a storage medium.
Background
In the prior art, a user A is provided with an account A on a main chain, an account a is provided on a first parallel chain, a user B is provided with an account b on the first parallel chain, and a user C is provided with an account c on the first parallel chain; user A wants to transfer 10coin on the main chain to user B, and two transactions are generated, tx1 (transfer 10coin in A to a), tx2 (transfer 10coin in a to b); because of the need to ensure the correctness of the tx1 execution, tx1 cannot be placed into a transaction group for execution with normal parallel chain transfer transactions (including tx 2); since P2P broadcast transactions do not guarantee order, the transaction pool will not order the transactions, and when packing sequentially related transactions into blocks, it is possible to pack tx2 before tx1, with the packing order not consistent with expectations. Since tx1, tx2 are two transactions that are related to each other, the user expects tx1 and tx2 to be packaged in execution logical order.
Disclosure of Invention
In view of the above-mentioned drawbacks and deficiencies of the prior art, it is desirable to provide a transaction packing method, device and storage medium capable of packing multiple transactions generated to fulfill a cross-chain transfer requirement according to an execution logic sequence.
In a first aspect, the present invention provides a transaction packing method for blockchain nodes, where the method includes:
in response to obtaining the packaging right of the first block with the first block height, a plurality of transactions to be packaged into the first block are predetermined from the memory pool, and the following operations are performed on each transaction:
when the first transaction is judged to be a first type transaction with an execution logic sequence, searching each second transaction which should be executed before the first transaction according to the first identification of the first transaction;
judging whether each second transaction is recorded on the blockchain according to a pre-configured first execution logic sequence:
if not, judging whether each second transaction which is not recorded on the block chain is in the memory pool:
if yes, judging whether each second transaction which is not recorded on the block chain is packed into the first block:
if not, adjusting the packaging sequence of each second transaction which is not recorded on the block chain and a plurality of second transactions which are not to be packaged into the first block and have no execution logic sequence, so as to ensure that the first transaction and each second transaction are packaged into the first block together; the adjusted packaging sequence of the first transaction and each second transaction is the same as the first execution logic sequence of the pre-configured first transaction and each second transaction;
if so, when the packaging sequence of the first transaction and each second transaction which is not recorded on the blockchain is different from the first execution logic sequence, adjusting the packaging sequence of the first transaction and each second transaction which is not recorded on the blockchain to ensure that the packaging sequence is the same as the first execution logic sequence;
otherwise, the first transaction is not packaged into the first block for the moment.
In a second aspect, the present invention also provides an apparatus comprising one or more processors and a memory, wherein the memory contains instructions executable by the one or more processors to cause the one or more processors to perform a transaction packing method provided according to embodiments of the present invention.
In a third aspect, the present invention also provides a storage medium storing a computer program that causes a computer to execute the transaction packing method provided according to the embodiments of the present invention.
According to the transaction packaging method, the transaction packaging device and the storage medium provided by the embodiments of the invention, when the first transaction is judged to be the first type transaction with the execution logic sequence, each second transaction which should be executed before the first transaction is searched according to the first identifier of the first transaction; when all second transactions which are not recorded on the blockchain exist in the memory pool and all second transactions which are not recorded on the blockchain are not packed into the first block, adjusting the packing sequence of all second transactions and a plurality of second type transactions which are not to be packed into the first block and have no execution logic sequence; and when the second transactions which are not recorded on the blockchain are in the memory pool and the second transactions which are not recorded on the blockchain are to be packed into the first block, adjusting the packing sequence of the first transactions and the second transactions which are not recorded on the blockchain to ensure that the packing sequence is the same as the first execution logic sequence, so that a plurality of transactions generated by one chain-crossing transfer requirement can be packed according to the execution logic sequence.
Drawings
Other features, objects and advantages of the present application will become more apparent upon reading of the following detailed description of non-limiting embodiments thereof, made with reference to the accompanying drawings in which:
fig. 1 is a flowchart of a transaction packaging method according to an embodiment of the present invention.
Fig. 2 is a flowchart of step S13 in a preferred embodiment of the method shown in fig. 1.
Fig. 3 is a flowchart of step S13 in another preferred embodiment of the method shown in fig. 1.
FIG. 4 is a flow diagram of a preferred embodiment of the method shown in FIG. 1.
Fig. 5 is a schematic structural diagram of an apparatus according to an embodiment of the present invention.
Detailed Description
The present application will be described in further detail with reference to the following drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the relevant invention and not restrictive of the invention. It should be noted that, for convenience of description, only the portions related to the present invention are shown in the drawings.
It should be noted that the embodiments and features of the embodiments in the present application may be combined with each other without conflict. The present application will be described in detail below with reference to the embodiments with reference to the attached drawings.
Fig. 1 is a flowchart of a transaction packaging method according to an embodiment of the present invention. As shown in fig. 1, in this embodiment, the present invention provides a transaction packing method applicable to a blockchain node, where the method includes:
s12: in response to obtaining the packaging right of the first block with the first block height, a plurality of transactions to be packaged into the first block are predetermined from the memory pool, and the following operations are performed on each transaction:
s13: when the first transaction is judged to be a first type transaction with an execution logic sequence, searching each second transaction which should be executed before the first transaction according to the first identification of the first transaction;
s141: judging whether each second transaction is recorded on the blockchain according to a pre-configured first execution logic sequence:
otherwise, step S1421 is executed: judging whether each second transaction which is not recorded on the block chain is in the memory pool:
if yes, go to step S14221: judging whether each second transaction which is not recorded on the block chain is packed into the first block:
otherwise, go to step S14222: adjusting the packaging sequence of each second transaction which is not recorded on the block chain and a plurality of second transactions which are not packaged into the first block and have no execution logic sequence, so as to ensure that the first transaction and each second transaction are packaged into the first block together; the adjusted packaging sequence of the first transaction and each second transaction is the same as the first execution logic sequence of the pre-configured first transaction and each second transaction;
if yes, go to step S14223: when the packaging sequence of the first transaction and each second transaction which is not recorded on the blockchain is different from the first execution logic sequence, adjusting the packaging sequence of the first transaction and each second transaction which is not recorded on the blockchain to ensure that the packaging sequence is the same as the first execution logic sequence;
otherwise, step S143 is executed: the first transaction is not wrapped into the first block.
Specifically, S13 includes:
when the first transaction is judged to be a first type of transaction with an execution logic sequence, searching a corresponding preorder transaction according to first preorder transaction information of the first transaction;
determining whether the preamble transaction information of the found preamble transaction is null:
if not, searching the corresponding preorder transaction according to the preorder transaction information of the found preorder transaction, and returning to judge whether the preorder transaction information of the found preorder transaction is empty or not;
if yes, determining each found preamble transaction as each second transaction which should be executed before the first transaction as an example;
assuming that the first block height is 100, the node for obtaining the packing weight of the block (100) is a node A; the memory pool has transactions tx 1-tx 100, and a plurality of transactions to be packed into the block (100) which are predetermined from the memory pool are tx 1-tx 11; tx1, tx8, tx9, tx10, tx11, tx25 and tx30 are the first type of transactions with execution logic order, and the other transactions are the second type of transactions without execution logic order; the preorder transaction information of tx1' is null, the next transaction information is hash (tx1), the preorder transaction information of tx1 is hash (tx1'), the next transaction information is hash (tx25), the preorder transaction information of tx25 is hash (tx1), the next transaction information is null (i.e., the execution logic sequence of tx1', tx1, tx25 should be { tx1', tx1, tx25}), and tx1' is recorded on the block chain; the preorder transaction information of tx8 is hash (tx9), the subsequent transaction information is null, the preorder transaction information of tx9 is null, and the subsequent transaction information is hash (tx8) (i.e., the execution logic sequence of tx8 and tx9 should be { tx9, tx8 }); the preorder transaction information of tx10 is hash (tx30), the successor transaction information is null, the preorder transaction information of tx30 is null, and the successor transaction information is hash (tx10) (i.e., the execution logic order of tx10 and tx30 should be { tx30, tx10 }); the preceding transaction information of tx11 is hash (tx150) and the following transaction information is null (i.e., the logical order of execution of tx11, tx150 should be { tx150, tx11 }).
In response to obtaining the packaging right of the block (100), the node a performs step S12, pre-determines a number of transactions tx1 tx11 to be packaged into the block (100) from the memory pool, and performs the following operations on tx1 tx11 respectively:
the node a performs step S13, since the preamble transaction information of tx1 is hash (tx1'), the subsequent transaction information is hash (tx25), tx1 is a first type transaction, and searches for a corresponding preamble transaction tx1' according to the preamble transaction information of tx 1;
judging whether the preamble transaction information of tx1 'is empty, if so, tx1' is the transaction that should be executed before tx 1;
the node a executes step S141 to determine whether tx1' is recorded in the blockchain;
since tx1' is recorded on the blockchain, node a performs no adjustment of the packing order of tx 1. At this time, the transaction to be packed into the block (100) is: tx1 to tx 11.
Since the preceding transaction information and the following transaction information of tx2 to tx7 are both empty, tx2 to tx7 are the second type of transaction that has no logical order of execution.
The node A executes the step S13, because the preorder transaction information of tx8 is hash (tx9), the postorder transaction information is null, tx8 is the first type transaction, and the corresponding preorder transaction tx9 is searched according to the preorder transaction information of tx 8;
judging whether the preamble transaction information of tx9 is empty, and if so, tx9 is the transaction that should be executed before tx 8;
the node a executes step S141 to determine whether tx9 is recorded in the blockchain;
since tx9 is not recorded in the blockchain, node a executes step S1421 to determine whether tx9 is in the memory pool;
since tx9 is in the memory pool, node A determines if tx9 is to be packed into block (100);
since tx9 is to be packed into block (100), node a performs step S14223, and since the packing order of tx8, tx9 at this time is different from { tx9, tx8}, node a adjusts the packing order of tx8, tx9 so as to be the same as { tx9, tx8 }. At this point, the transaction to be packed into the block (100) becomes: tx1 to tx7, { tx9, tx8}, tx10, tx 11.
The node A executes the step S13, because the preorder transaction information of tx10 is hash (tx30), the postorder transaction information is null, tx10 is the first type transaction, and the corresponding preorder transaction tx30 is searched according to the preorder transaction information of tx 10;
judging whether the preamble transaction information of tx30 is empty, and if so, tx30 is the transaction that should be executed before tx 10;
the node a executes step S141 to determine whether tx30 is recorded in the blockchain;
since tx30 is not recorded in the blockchain, node a executes step S1421 to determine whether tx30 is in the memory pool;
since tx30 is in the memory pool, node A determines whether tx30 is to be packed into block (100);
since tx30 is not to be packed into block (100), node A performs step S14222 to adjust the packing order of tx30 and a number of transactions of the second type (e.g., tx7) that do not execute logical order to be packed into the first block to ensure that tx10 and tx30 are packed together into block (100) in { tx30, tx10} order. At this point, the transaction to be packed into the block (100) becomes: tx1 to tx6, { tx9, tx8}, { tx30, tx10}, and tx 11.
The node a executes step S13, since the preamble transaction information of tx11 is hash (tx150), the subsequent transaction information is null, tx11 is a first type transaction, and the corresponding preamble transaction tx150 is searched according to the preamble transaction information of tx 11;
since tx150 cannot be found in the memory pool, node a executes step S1423, and never packs tx11 into block (100). At this point, the transaction to be packed into the block (100) becomes: tx 1-tx 6, { tx9, tx8}, and { tx30, tx10 }.
Finally, the transactions to be packed into the block (100) are: tx 1-tx 6, { tx9, tx8}, and { tx30, tx10 }.
In further embodiments, S13 may also be configured according to actual requirements, for example, configured to:
when the first transaction is judged to be a first type transaction with an execution logic sequence, finding the first head transaction according to the first head transaction information of the first transaction;
searching corresponding subsequent transactions according to subsequent transaction information of the first head transaction;
judging whether the found subsequent transaction information of the subsequent transaction is a first transaction:
if not, searching the corresponding subsequent transaction according to the found subsequent transaction information of the subsequent transaction, and returning to judge whether the found subsequent transaction information of the subsequent transaction is the first transaction;
if yes, then each subsequent transaction found, excluding the first transaction, and the first transaction are determined to be each second transaction that should be executed before the first transaction.
With reference to the foregoing embodiment, the header transaction information of tx1 is a hash (tx1'), the header transaction information of tx25 is a hash (tx1'), the header transaction information of tx8 is a hash (tx9), the header transaction information of tx10 is a hash (tx30), and the header transaction information of tx11 is a hash (tx150), which can achieve the same technical effect.
The embodiment enables a plurality of transactions generated by one cross-chain transfer requirement to be packaged according to the execution logic sequence.
Fig. 2 is a flowchart of step S13 in a preferred embodiment of the method shown in fig. 1. As shown in fig. 2, in a preferred embodiment, when it is determined that the first transaction is a first type of transaction having an execution logic sequence, the searching for each second transaction that should be executed before the first transaction according to the first identifier of the first transaction includes:
s131: when the first transaction is judged to be a first type transaction with an execution logic sequence, finding the first head transaction according to the first head transaction information of the first transaction;
s132: searching corresponding subsequent transactions according to subsequent transaction information of the first head transaction;
s1331: judging whether the found subsequent transaction information of the subsequent transaction is a first transaction:
otherwise, step S1332 is executed: searching corresponding subsequent transactions according to the found subsequent transaction information of the subsequent transactions, and returning to judge whether the found subsequent transaction information of the subsequent transactions is the first transaction;
if yes, go to step S1333: the found subsequent transactions excluding the first transaction and the first transaction are determined as second transactions that should be executed before the first transaction.
The transaction packaging principle of the above embodiment can refer to the method shown in fig. 1, and is not described herein again.
Fig. 3 is a flowchart of step S13 in another preferred embodiment of the method shown in fig. 1. As shown in fig. 3, in a preferred embodiment, when it is determined that the first transaction is a first type of transaction having an execution logic sequence, the searching for each second transaction that should be executed before the first transaction according to the first identifier of the first transaction includes:
s135: when the first transaction is judged to be a first type of transaction with an execution logic sequence, searching a corresponding preorder transaction according to first preorder transaction information of the first transaction;
s1361: determining whether the preamble transaction information of the found preamble transaction is null:
otherwise, step S1362 is performed: searching corresponding preorder transactions according to the preorder transaction information of the found preorder transactions, and returning to judge whether the preorder transaction information of the found preorder transactions is empty or not;
if yes, go to step S1363: each preceding transaction found is determined to be a second transaction that should be executed before the first transaction.
The transaction packaging principle of the above embodiment can refer to the method shown in fig. 1, and is not described herein again.
FIG. 4 is a flow diagram of a preferred embodiment of the method shown in FIG. 1. As shown in fig. 4, in a preferred embodiment, the method further includes:
s151: judging whether the subsequent transaction information of the first transaction is null:
otherwise, step S152 is executed: searching corresponding subsequent transactions according to subsequent transaction information of the first transaction;
s153: searching corresponding subsequent transactions according to the found subsequent transaction information of the subsequent transactions;
s1541: judging whether the found subsequent transaction information of the subsequent transaction is null:
otherwise, step S1542 is executed: searching corresponding subsequent transactions according to the found subsequent transaction information of the subsequent transactions, and returning to judge whether the found subsequent transaction information of the subsequent transactions is empty;
if yes, go to step S1543: and adjusting the packaging sequence of each found subsequent transaction and a plurality of second-type transactions to be packaged into the first block so as to ensure that each found subsequent transaction and the first transaction are packaged into the first block together, wherein the packaging sequence of each found subsequent transaction and the first transaction after adjustment is the same as the first execution logic sequence.
Take the scenario of the embodiment shown in fig. 1 as an example;
for tx 1:
the node a executes step S151 to determine whether the subsequent transaction information of tx1 is empty;
because the subsequent transaction information of tx1 is not null, step S152 is executed to find the corresponding subsequent transaction according to the subsequent transaction information of tx 1;
the node A executes the step S153, and searches the corresponding subsequent transaction tx25 according to the found subsequent transaction information hash (tx25) of the subsequent transaction;
the node a executes step S1541, and determines whether the subsequent transaction information of tx25 is empty;
since the subsequent transaction information of tx25 is null, no subsequent transaction is searched;
the node a performs step S1543 to adjust the packing order of tx25 and several transactions of the second type to be packed into the first block, so as to ensure that tx25 and tx1 will be packed into the block together (100), and in conjunction with tx1' recorded on the block chain, the packing order of the adjusted tx1', tx25 and tx1 is the same as { tx1', tx1, tx25 }.
The embodiment enables a plurality of transactions generated by one cross-chain transfer requirement to be packaged according to the execution logic sequence and packaged into the same block as much as possible.
Fig. 5 is a schematic structural diagram of an apparatus according to an embodiment of the present invention.
As shown in fig. 5, as another aspect, the present application also provides an apparatus 500 including one or more Central Processing Units (CPUs) 501 that can perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM)502 or a program loaded from a storage section 508 into a Random Access Memory (RAM) 503. In the RAM503, various programs and data necessary for the operation of the apparatus 500 are also stored. The CPU501, ROM502, and RAM503 are connected to each other via a bus 504. An input/output (I/O) interface 505 is also connected to bus 504.
The following components are connected to the I/O interface 505: an input portion 506 including a keyboard, a mouse, and the like; an output portion 507 including a display such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker; a storage portion 508 including a hard disk and the like; and a communication section 509 including a network interface card such as a LAN card, a modem, or the like. The communication section 509 performs communication processing via a network such as the internet. The driver 510 is also connected to the I/O interface 505 as necessary. A removable medium 511 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 510 as necessary, so that a computer program read out therefrom is mounted into the storage section 508 as necessary.
In particular, according to an embodiment of the present disclosure, the method described in any of the above embodiments may be implemented as a computer software program. For example, embodiments of the present disclosure include a computer program product comprising a computer program tangibly embodied on a machine-readable medium, the computer program comprising program code for performing any of the methods described above. In such an embodiment, the computer program may be downloaded and installed from a network through the communication section 509, and/or installed from the removable medium 511.
As yet another aspect, the present application also provides a computer-readable storage medium, which may be the computer-readable storage medium included in the apparatus of the above-described embodiment; or it may be a separate computer readable storage medium not incorporated into the device. The computer readable storage medium stores one or more programs for use by one or more processors in performing the methods described in the present application.
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units or modules described in the embodiments of the present application may be implemented by software or hardware. The described units or modules may also be provided in a processor, for example, each of the described units may be a software program provided in a computer or a mobile intelligent device, or may be a separately configured hardware device. Wherein the designation of a unit or module does not in some way constitute a limitation of the unit or module itself.
The above description is only a preferred embodiment of the application and is illustrative of the principles of the technology employed. It will be appreciated by those skilled in the art that the scope of the invention herein disclosed is not limited to the particular combination of features described above, but also encompasses other arrangements formed by any combination of the above features or their equivalents without departing from the spirit of the present application. For example, the above features may be replaced with (but not limited to) features having similar functions disclosed in the present application.

Claims (6)

1. A transaction packing method applicable to a blockchain node, the method comprising:
in response to obtaining packaging rights for a first block of a first block height, predetermining a number of transactions from a memory pool to be packaged into the first block, and performing the following for each of the transactions:
when the first transaction is judged to be a first type transaction with an execution logic sequence, searching each second transaction which should be executed before the first transaction according to the first identification of the first transaction;
judging whether each second transaction is recorded on the blockchain according to a pre-configured first execution logic sequence:
if not, judging whether the second transactions which are not recorded on the block chain are all in the memory pool:
if yes, determining whether each second transaction not recorded in the blockchain is to be packed into the first block:
if not, adjusting the packaging sequence of each second transaction which is not recorded on the block chain and a plurality of second transactions which are not to be packaged into the first block and have no execution logic sequence, so as to ensure that the first transaction and each second transaction are jointly packaged into the first block; the adjusted packaging sequence of the first transaction and each second transaction is the same as the pre-configured first execution logic sequence of the first transaction and each second transaction;
if yes, when the packaging sequence of the first transaction and each second transaction which is not recorded on the blockchain is different from the first execution logic sequence, adjusting the packaging sequence of the first transaction and each second transaction which is not recorded on the blockchain to ensure that the packaging sequence is the same as the first execution logic sequence;
and if not, the first transaction is not packaged into the first block for the moment.
2. The method of claim 1, wherein searching for second transactions that should be executed before the first transaction according to the first identifier of the first transaction when the first transaction is determined to be the first type of transaction having the execution logic sequence comprises:
when the first transaction is judged to be a first type transaction with an execution logic sequence, finding the first head transaction according to the first head transaction information of the first transaction;
searching corresponding subsequent transactions according to the subsequent transaction information of the first head transaction;
judging whether the found subsequent transaction information of the subsequent transaction is the first transaction:
if not, searching corresponding subsequent transactions according to the found subsequent transaction information of the subsequent transactions, and returning to the judgment whether the found subsequent transaction information of the subsequent transactions is the first transaction or not;
if yes, then the found subsequent transactions excluding the first transaction and the first head transaction are determined to be second transactions that should be executed before the first transaction.
3. The method of claim 1, wherein searching for second transactions that should be executed before the first transaction according to the first identifier of the first transaction when the first transaction is determined to be the first type of transaction having the execution logic sequence comprises:
when the first transaction is judged to be a first type of transaction with an execution logic sequence, searching a corresponding preorder transaction according to first preorder transaction information of the first transaction;
determining whether the preamble transaction information of the found preamble transaction is null:
if not, searching the corresponding preorder transaction according to the preorder transaction information of the found preorder transaction, and returning to judge whether the preorder transaction information of the found preorder transaction is empty or not;
if so, then each preceding transaction found is determined to be each second transaction that should be executed before the first transaction.
4. The method according to any one of claims 1-3, further comprising:
judging whether the subsequent transaction information of the first transaction is null:
if not, searching corresponding subsequent transactions according to subsequent transaction information of the first transaction;
searching corresponding subsequent transactions according to the found subsequent transaction information of the subsequent transactions;
judging whether the found subsequent transaction information of the subsequent transaction is null:
if not, searching the corresponding subsequent transaction according to the found subsequent transaction information of the subsequent transaction, and returning to the judgment whether the found subsequent transaction information of the subsequent transaction is empty or not;
if so, adjusting the packaging sequence of each found subsequent transaction and a plurality of second transactions to be packaged into the first block so as to ensure that each found subsequent transaction and the first transaction are packaged into the first block together, and the packaging sequence of each found subsequent transaction and the first transaction after adjustment is the same as the first execution logic sequence.
5. An apparatus, characterized in that the apparatus comprises:
one or more processors;
a memory for storing one or more programs,
the one or more programs, when executed by the one or more processors, cause the one or more processors to perform the method recited in any of claims 1-4.
6. A storage medium storing a computer program, characterized in that the program, when executed by a processor, implements the method according to any one of claims 1-4.
CN202010748641.0A 2020-07-30 2020-07-30 Transaction packaging method, device and storage medium Active CN111858773B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010748641.0A CN111858773B (en) 2020-07-30 2020-07-30 Transaction packaging method, device and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010748641.0A CN111858773B (en) 2020-07-30 2020-07-30 Transaction packaging method, device and storage medium

Publications (2)

Publication Number Publication Date
CN111858773A true CN111858773A (en) 2020-10-30
CN111858773B CN111858773B (en) 2023-11-28

Family

ID=72946199

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010748641.0A Active CN111858773B (en) 2020-07-30 2020-07-30 Transaction packaging method, device and storage medium

Country Status (1)

Country Link
CN (1) CN111858773B (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112488836A (en) * 2020-11-30 2021-03-12 成都质数斯达克科技有限公司 Transaction sending method and device, electronic equipment and readable storage medium
CN112950185A (en) * 2021-03-11 2021-06-11 杭州复杂美科技有限公司 Transaction fee payment method, device and storage medium based on parallel execution
CN113110925A (en) * 2021-04-09 2021-07-13 杭州复杂美科技有限公司 Block packing method and equipment based on parallel execution and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110298756A (en) * 2019-06-28 2019-10-01 杭州复杂美科技有限公司 Parallel chain is from knowing together method, equipment and storage medium
WO2019213867A1 (en) * 2018-05-09 2019-11-14 合肥达朴汇联科技有限公司 Method and device for reaching consensus in blockchain
CN110796545A (en) * 2019-10-25 2020-02-14 杭州趣链科技有限公司 Batch processing method, equipment and storage medium for blockchain transaction
WO2020043046A1 (en) * 2018-08-30 2020-03-05 杭州复杂美科技有限公司 Parallel chain cross-chain transaction method, device and storage medium

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2019213867A1 (en) * 2018-05-09 2019-11-14 合肥达朴汇联科技有限公司 Method and device for reaching consensus in blockchain
WO2020043046A1 (en) * 2018-08-30 2020-03-05 杭州复杂美科技有限公司 Parallel chain cross-chain transaction method, device and storage medium
CN110298756A (en) * 2019-06-28 2019-10-01 杭州复杂美科技有限公司 Parallel chain is from knowing together method, equipment and storage medium
CN110796545A (en) * 2019-10-25 2020-02-14 杭州趣链科技有限公司 Batch processing method, equipment and storage medium for blockchain transaction

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
王志鹏;伍前红;: "一种清算结算区块链设计", 密码学报, no. 05 *

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112488836A (en) * 2020-11-30 2021-03-12 成都质数斯达克科技有限公司 Transaction sending method and device, electronic equipment and readable storage medium
CN112488836B (en) * 2020-11-30 2023-06-02 成都质数斯达克科技有限公司 Transaction transmitting method, device, electronic equipment and readable storage medium
CN112950185A (en) * 2021-03-11 2021-06-11 杭州复杂美科技有限公司 Transaction fee payment method, device and storage medium based on parallel execution
CN112950185B (en) * 2021-03-11 2023-10-20 杭州复杂美科技有限公司 Transaction fee payment method, device and storage medium based on parallel execution
CN113110925A (en) * 2021-04-09 2021-07-13 杭州复杂美科技有限公司 Block packing method and equipment based on parallel execution and storage medium

Also Published As

Publication number Publication date
CN111858773B (en) 2023-11-28

Similar Documents

Publication Publication Date Title
CN111858773A (en) Transaction packaging method, device and storage medium
CN109831514B (en) Parallel chain consensus method, data exception handling method, device and storage medium
CN111861754B (en) Transaction packaging method, device and storage medium
US7433854B2 (en) Backward chaining with extended knowledge base network
US9870221B2 (en) Providing code change job sets of different sizes to validators
US11275814B2 (en) Recording ledger data on a blockchain
CN110287196B (en) Block storage method, parallel chain transaction acquisition method, equipment and storage medium
CN110442580B (en) Block chain state data storage method, equipment and storage medium
US10979532B2 (en) Resource download method, electronic device, and apparatus
CN106713396A (en) Server scheduling method and system
CN110796545A (en) Batch processing method, equipment and storage medium for blockchain transaction
JP6975153B2 (en) Data storage service processing method and equipment
US20130151487A1 (en) Automatic selection of blocking column for de-duplication
CN111245897B (en) Data processing method, device, system, storage medium and processor
CN109995585B (en) Exception handling method, device and storage medium
CN111709748B (en) Transaction execution method and device with business attribute and electronic equipment
CN110298756B (en) Parallel chain self-consensus method, device and storage medium
CN111523896A (en) Anti-attack method, device and storage medium
CN105868002B (en) Method and device for processing retransmission request in distributed computing
CN111639939A (en) Block restoring method, equipment and storage medium
US11586633B2 (en) Secondary tagging in a data heap
CN112506911A (en) Data quality monitoring method and device, electronic equipment and storage medium
CN111292028A (en) Inventory information processing method and system, computer system and readable storage medium
CN111884809B (en) Method and device for preventing branch chain transaction replay and electronic equipment
CN111526211B (en) Asset transfer method, device 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