CN111882322A - Method and device for packaging transactions in sequence and electronic equipment - Google Patents
Method and device for packaging transactions in sequence and electronic equipment Download PDFInfo
- Publication number
- CN111882322A CN111882322A CN202010697227.1A CN202010697227A CN111882322A CN 111882322 A CN111882322 A CN 111882322A CN 202010697227 A CN202010697227 A CN 202010697227A CN 111882322 A CN111882322 A CN 111882322A
- Authority
- CN
- China
- Prior art keywords
- transaction
- transactions
- executed
- pool
- prior
- 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.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 42
- 238000004806 packaging method and process Methods 0.000 title claims description 25
- 230000001419 dependent effect Effects 0.000 claims abstract description 73
- 238000004590 computer program Methods 0.000 claims description 9
- 238000012545 processing Methods 0.000 claims description 8
- 238000010276 construction Methods 0.000 claims description 2
- 238000012856 packing Methods 0.000 abstract description 4
- 238000010586 diagram Methods 0.000 description 4
- 230000008569 process Effects 0.000 description 4
- 238000005516 engineering process Methods 0.000 description 2
- 238000000802 evaporation-induced self-assembly Methods 0.000 description 2
- PCTMTFRHKVHKIS-BMFZQQSSSA-N (1s,3r,4e,6e,8e,10e,12e,14e,16e,18s,19r,20r,21s,25r,27r,30r,31r,33s,35r,37s,38r)-3-[(2r,3s,4s,5s,6r)-4-amino-3,5-dihydroxy-6-methyloxan-2-yl]oxy-19,25,27,30,31,33,35,37-octahydroxy-18,20,21-trimethyl-23-oxo-22,39-dioxabicyclo[33.3.1]nonatriaconta-4,6,8,10 Chemical compound C1C=C2C[C@@H](OS(O)(=O)=O)CC[C@]2(C)[C@@H]2[C@@H]1[C@@H]1CC[C@H]([C@H](C)CCCC(C)C)[C@@]1(C)CC2.O[C@H]1[C@@H](N)[C@H](O)[C@@H](C)O[C@H]1O[C@H]1/C=C/C=C/C=C/C=C/C=C/C=C/C=C/[C@H](C)[C@@H](O)[C@@H](C)[C@H](C)OC(=O)C[C@H](O)C[C@H](O)CC[C@@H](O)[C@H](O)C[C@H](O)C[C@](O)(C[C@H](O)[C@H]2C(O)=O)O[C@H]2C1 PCTMTFRHKVHKIS-BMFZQQSSSA-N 0.000 description 1
- 238000003491 array Methods 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 230000005540 biological transmission Effects 0.000 description 1
- 230000001413 cellular effect Effects 0.000 description 1
- 230000008859 change Effects 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 230000006872 improvement Effects 0.000 description 1
- 238000004519 manufacturing process Methods 0.000 description 1
- 230000007246 mechanism Effects 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 238000011022 operating instruction Methods 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 230000002093 peripheral effect Effects 0.000 description 1
- 230000000750 progressive effect Effects 0.000 description 1
- 238000012163 sequencing technique Methods 0.000 description 1
- 230000003068 static effect Effects 0.000 description 1
- 238000012795 verification Methods 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06Q—INFORMATION 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
- G06Q20/00—Payment architectures, schemes or protocols
- G06Q20/38—Payment protocols; Details thereof
- G06Q20/40—Authorisation, e.g. identification of payer or payee, verification of customer or shop credentials; Review and approval of payers, e.g. check credit lines or negative lists
- G06Q20/405—Establishing or using transaction specific rules
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06Q—INFORMATION 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/00—Finance; Insurance; Tax strategies; Processing of corporate or income taxes
- G06Q40/04—Trading; Exchange, e.g. stocks, commodities, derivatives or currency exchange
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L9/00—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
- H04L9/50—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols using hash chains, e.g. blockchains or hash trees
Landscapes
- Business, Economics & Management (AREA)
- Accounting & Taxation (AREA)
- Engineering & Computer Science (AREA)
- Finance (AREA)
- Physics & Mathematics (AREA)
- Economics (AREA)
- Strategic Management (AREA)
- Development Economics (AREA)
- General Business, Economics & Management (AREA)
- General Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Marketing (AREA)
- Technology Law (AREA)
- Computer Security & Cryptography (AREA)
- Packages (AREA)
Abstract
The embodiment of the specification relates to a method, a device and electronic equipment for packing transactions in sequence, wherein a transaction sequence identifier is arranged in a transaction to ensure that all transactions before the transaction are executed in the execution sequence of the transaction without paying attention to the sequence relation during packing of block chain transactions. When the user continuously sends the transactions with the dependency relationship, the transactions with the dependency relationship can be packed into the block as soon as possible without waiting for the block to be determined and then sending the subsequent transactions. Putting the transactions which are not executed before the dependent transactions into a waiting queue, and putting the transactions meeting the conditions into a transaction pool again through certain rules and strategies; and the early transactions in the waiting queue are cleared to ensure that the number of transactions in the waiting queue is within a preset range.
Description
Technical Field
The embodiment of the specification relates to the technical field of networks, in particular to a method and a device for packaging transactions in sequence and electronic equipment.
Background
In the blockchain system, for the transaction of the UTXO model, the transaction is generated by a user side wallet, the transaction comprises an execution result, and only verification is carried out on a chain; the transactions are organized in the mode of input and output, the input refers to the transactions which depend on the input, and the transactions are naturally sequential. For the transaction of the Account model, the transaction is only a method call to be executed by the user, the real execution is performed by the virtual machine on the chain, and a transaction result is generated according to the world state of the block chain.
Therefore, Account type transaction is for a user, and the user needs to send multiple sequential transactions continuously for the same service to complete. For example, A, B, C, D transactions are required to be executed in sequential order. At this time, the user can send the subsequent transaction B only after the processing of the transaction a on the chain is completed, and after the transaction B is sent, the transaction C can be sent only after waiting for the transaction B. At least four blocks are required to be fully packed. If the user sends all transactions at one time, the transactions firstly enter the node transaction pool, and in the node transaction pool, due to the reasons that the forwarding mechanism and the transaction sequencing modes of all nodes are different, the transaction packaging sequence of the nodes does not necessarily accord with the initial sending sequence of the user, so that the transactions cannot be executed smoothly.
Disclosure of Invention
The embodiment of the specification provides a method and a device for packaging transactions in sequence and electronic equipment, and is used for solving the problem that the transactions can not be packaged and executed in a preset sequence in the prior art.
In order to solve the above technical problem, the embodiments of the present specification adopt the following technical solutions:
in a first aspect, a method for packing transactions in order is provided, which is applied to a blockchain system, and the method includes:
constructing more than one transaction and determining the execution sequence of the transactions;
setting a transaction sequence identifier in a transaction, wherein the transaction sequence identifier represents a prior dependent transaction of the transaction; the prior dependent transaction is a transaction whose execution order precedes the transaction;
before the current transaction enters a transaction pool, judging whether the prior dependent transaction represented in the transaction sequence identifier is executed or not;
if the prior dependent transaction is executed completely, the current transaction is put into a transaction pool;
if the prior dependent transaction is not executed in the transaction pool, putting the current transaction into the transaction pool, and packaging the prior dependent transaction prior to the current transaction;
if the prior dependent transaction has not been executed and has not entered the transaction pool, the current transaction is placed in a wait queue.
In a second aspect, there is provided an apparatus for packing transactions in sequence, which is applied to a blockchain system, the apparatus comprising:
a transaction construction unit: for constructing more than one transaction and determining the execution order of the transactions;
a transaction sequence identification unit: the transaction sequence identifier is used for setting a transaction sequence identifier in a transaction, and the transaction sequence identifier represents a prior dependent transaction of the transaction; the prior dependent transaction is a transaction whose execution order precedes the transaction;
a judging unit: before the current transaction enters the transaction pool, judging whether the prior dependent transaction represented in the transaction sequence identifier is executed;
a transaction processing unit: if the prior dependent transaction is executed completely, the current transaction is put into a transaction pool; if the prior dependent transaction is not executed in the transaction pool, putting the current transaction into the transaction pool, and packaging the prior dependent transaction prior to the current transaction; if the prior dependent transaction has not been executed and has not entered the transaction pool, the current transaction is placed in a wait queue.
In a third aspect, an electronic device is provided, including: one or more processors and memory, wherein the memory contains one or more computer programs executable by the one or more processors to cause the one or more processors to perform a method of packaging transactions in order provided according to embodiments of the present invention.
In a fourth aspect, the present invention also provides a storage medium storing a computer program for causing a computer to execute the method of packaging transactions in order provided according to embodiments of the present invention.
The embodiment of the specification adopts at least one technical scheme which can achieve the following beneficial effects: by setting the transaction sequence identifier in the transaction, the execution sequence of the transaction is ensured to be completed before all transactions are executed, and the sequence relation of block chain transaction packaging is not needed to be concerned. When the user continuously sends the transactions with the dependency relationship, the transactions with the dependency relationship can be packed into the block as soon as possible without waiting for the block to be determined and then sending the subsequent transactions. Putting the transactions which are not executed before the dependent transactions into a waiting queue, and putting the transactions meeting the conditions into a transaction pool again through certain rules and strategies; and the early transactions in the waiting queue are cleared to ensure that the number of transactions in the waiting queue is within a preset range.
Drawings
In order to more clearly illustrate the embodiments of the present specification or the technical solutions in the prior art, the drawings needed to be used in the description of the embodiments or the prior art will be briefly introduced below, it is obvious that the drawings in the following description are only some embodiments described in the embodiments of the present specification, and for those skilled in the art, other drawings can be obtained according to the drawings without any creative efforts.
FIG. 1 is a schematic diagram of the steps of a packed-in-order transaction method provided by an embodiment of the present disclosure;
FIG. 2 is a schematic diagram of a structure of a package-in-order transaction apparatus provided in an embodiment of the present disclosure;
fig. 3 is a schematic structural diagram of an electronic device provided in an embodiment of this specification.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present disclosure more clear, the technical solutions of the embodiments of the present disclosure will be clearly and completely described below with reference to the specific embodiments of the present disclosure and the accompanying drawings. It is to be understood that the embodiments described are only a few embodiments of the present disclosure, and not all embodiments. All other embodiments obtained by a person of ordinary skill in the art based on the embodiments in the present specification without any creative effort belong to the protection scope of the embodiments in the present specification.
The technical solutions provided by the embodiments of the present description are described in detail below with reference to the accompanying drawings.
Example one
Referring to fig. 1, a method for packaging transactions in order provided for an embodiment of the present specification is applied to a blockchain system, and the method includes:
step 101: constructing more than one transaction and determining the execution sequence of the transactions;
step 102: setting a transaction sequence identifier in a transaction, wherein the transaction sequence identifier represents a prior dependent transaction of the transaction; the prior dependent transaction is a transaction whose execution order precedes the transaction;
step 103: before the current transaction enters a transaction pool, judging whether the prior dependent transaction represented in the transaction sequence identifier is executed or not;
step 104-1: if the prior dependent transaction is executed completely, the current transaction is put into a transaction pool;
step 104-2: if the prior dependent transaction is not executed in the transaction pool, putting the current transaction into the transaction pool, and packaging the prior dependent transaction prior to the current transaction;
step 104-3: if the prior dependent transaction has not been executed and has not entered the transaction pool, the current transaction is placed in a wait queue.
Optionally, wherein the transaction sequence identification comprises a transaction hash of the prior dependent transaction; the prior dependent transaction may be one or more.
For example, when A, B, C, D four transactions are constructed, determining that their transaction order is A, B, C, D requires strict sequential execution; the transaction order for each transaction is identified as the refs field of an array type array tx hash, where the field in refs is the transaction hash of the previous dependent transaction for that transaction.
Thus, for A transaction, its refs _ A is null; for a B transaction, its refs _ B is [ A.hash ]; for a C transaction, its refs _ C is [ B.hash ]; the refs _ D of the D transaction is [ c.hash ], thereby indicating that ABCD needs to be processed in sequence.
If the execution sequence is that A transaction must be executed first, B and C are processed after A, but the two are not in strict sequence relation, and D must be executed after B and C are executed, then refs _ A is null, refs _ B is [ A.hash ], refs of C is [ A.hash ], and refs of D is [ B.hash, C.hash ].
Optionally, after setting a certain number of blocks, or checking whether the transaction in the waiting queue can enter the transaction pool at a fixed time interval. And putting the executed prior dependent transaction into the transaction pool for the transaction of which the execution is completed or the prior dependent transaction is not executed in the transaction pool.
Optionally, when the number of transactions in the waiting queue exceeds a preset threshold, the earliest preset number of transactions in the queue is deleted.
Optionally, the method further comprises: and setting a consensus protocol rule and a node synchronization rule, so that after the node receives the transaction, whether the prior dependent transaction is executed or not is judged, and if the prior dependent transaction is not executed, the block is judged to be an illegal block.
Through the technical scheme of the specification, the transaction sequence identifier is set in the transaction, so that the execution sequence of the transaction is ensured to be that all transactions before the transaction are executed, and the sequence relation of block chain transaction packaging is not needed to be considered. When the user continuously sends the transactions with the dependency relationship, the transactions with the dependency relationship can be packed into the block as soon as possible without waiting for the block to be determined and then sending the subsequent transactions. Putting the transactions which are not executed before the dependent transactions into a waiting queue, and putting the transactions meeting the conditions into a transaction pool again through certain rules and strategies; and the early transactions in the waiting queue are cleared to ensure that the number of transactions in the waiting queue is within a preset range.
Example two
Referring to fig. 2, a schematic structural diagram of an apparatus for packaging transactions in sequence according to an embodiment of the present disclosure is applied to a blockchain system, and the apparatus includes:
the transaction configuration unit 201: for constructing more than one transaction and determining the execution order of the transactions;
transaction order identification unit 202: the transaction sequence identifier is used for setting a transaction sequence identifier in a transaction, and the transaction sequence identifier represents a prior dependent transaction of the transaction; the prior dependent transaction is a transaction whose execution order precedes the transaction;
the judgment unit 203: before the current transaction enters the transaction pool, judging whether the prior dependent transaction represented in the transaction sequence identifier is executed;
the transaction processing unit 204: if the prior dependent transaction is executed completely, the current transaction is put into a transaction pool; if the prior dependent transaction is not executed in the transaction pool, putting the current transaction into the transaction pool, and packaging the prior dependent transaction prior to the current transaction; if the prior dependent transaction has not been executed and has not entered the transaction pool, the current transaction is placed in a wait queue.
Optionally, the apparatus further includes a waiting queue checking unit, configured to check whether the transaction in the waiting queue can enter the transaction pool according to a preset number of blocks and/or a preset time interval, and place the transaction in the transaction pool when the execution of the previous dependent transaction is completed or the previous dependent transaction is not executed in the transaction pool.
Optionally, the apparatus further includes a wait queue clearing unit: and deleting the earliest preset number of transactions entering the queue in the queue when the number of the transactions in the waiting queue exceeds a preset threshold value.
Optionally, the apparatus further includes a rule setting unit: the method is used for setting consensus protocol rules and node synchronization rules, so that after the node receives a transaction, whether a prior dependent transaction is executed or not is judged, and if the prior dependent transaction is not executed, the block is judged to be an illegal block.
It should be noted that: the transaction sequence identification comprises a transaction hash of the prior dependent transaction; the prior dependent transaction may be one or more.
Through the technical scheme of the specification, the transaction sequence identifier is set in the transaction, so that the execution sequence of the transaction is ensured to be that all transactions before the transaction are executed, and the sequence relation of block chain transaction packaging is not needed to be considered. When the user continuously sends the transactions with the dependency relationship, the transactions with the dependency relationship can be packed into the block as soon as possible without waiting for the block to be determined and then sending the subsequent transactions. Putting the transactions which are not executed before the dependent transactions into a waiting queue, and putting the transactions meeting the conditions into a transaction pool again through certain rules and strategies; and the early transactions in the waiting queue are cleared to ensure that the number of transactions in the waiting queue is within a preset range.
It should be understood that, in the second embodiment, the apparatus may execute all technical solutions related to the method for performing the sequential package transaction in the form of the functional module, and implement corresponding technical effects, which are not described herein again.
EXAMPLE III
The electronic apparatus of the embodiment of the present specification is described in detail below with reference to fig. 3. Referring to fig. 3, at a hardware level, the electronic device includes one or more processors and a memory. Optionally, an internal bus and a network interface are also included. The Memory may include a Memory, such as a Random-Access Memory (RAM), and may further include a Non-Volatile Memory (Non-Volatile Memory), such as at least 1 disk Memory. Of course, the electronic device may also include hardware required for other services.
The processor, the network interface, and the memory may be interconnected by an internal bus, which may be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, an extended EISA (EISA) bus, or the like. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one double-headed arrow is shown in FIG. 3, but this does not indicate only one bus or one type of bus.
A memory for storing a computer program. In particular, the computer program may comprise program code comprising computer operating instructions. The memory may include both memory and non-volatile storage and provides instructions and data to the processor.
The processor reads the corresponding computer program from the nonvolatile memory into the memory and then runs the computer program to form a device for packaging transactions in sequence on a logic level. And a processor executing the program stored in the memory and specifically configured to perform the method operations performed when the apparatus for packaging transactions in sequence as described above is used as the execution subject.
The method performed by the apparatus according to the embodiment shown in fig. 1 of the present specification may be implemented in or by a processor. The processor may be an integrated circuit chip having signal processing capabilities. In implementation, the steps of the above method may be performed by integrated logic circuits of hardware in a processor or instructions in the form of software. The Processor may be a general-purpose Processor, including a Central Processing Unit (CPU), a Network Processor (NP), and the like; but also Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), Field Programmable Gate Arrays (FPGAs) or other Programmable logic devices, discrete Gate or transistor logic devices, discrete hardware components. The methods, steps, and logic blocks disclosed in one or more embodiments of the present specification may be implemented or performed. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. The steps of a method disclosed in connection with one or more embodiments of the present disclosure may be embodied directly in hardware, in a software module executed by a hardware decoding processor, or in a combination of the hardware and software modules executed by a hardware decoding processor. The software module may be located in ram, flash memory, rom, prom, or eprom, registers, etc. storage media as is well known in the art. The storage medium is located in a memory, and a processor reads information in the memory and completes the steps of the method in combination with hardware of the processor.
Of course, besides the software implementation, the electronic device of the embodiment of the present disclosure does not exclude other implementations, such as a logic device or a combination of software and hardware, and the like, that is, the execution subject of the following processing flow is not limited to each logic unit, and may also be hardware or a logic device.
Through the technical scheme of the specification, the transaction sequence identifier is set in the transaction, so that the execution sequence of the transaction is ensured to be that all transactions before the transaction are executed, and the sequence relation of block chain transaction packaging is not needed to be considered. When the user continuously sends the transactions with the dependency relationship, the transactions with the dependency relationship can be packed into the block as soon as possible without waiting for the block to be determined and then sending the subsequent transactions. Putting the transactions which are not executed before the dependent transactions into a waiting queue, and putting the transactions meeting the conditions into a transaction pool again through certain rules and strategies; and the early transactions in the waiting queue are cleared to ensure that the number of transactions in the waiting queue is within a preset range.
Example four
Embodiments of the present description also provide a storage medium storing a computer program, the computer readable storage medium storing one or more programs for use by a processor to perform the method of packaging transactions in order described herein.
By setting the transaction sequence identifier in the transaction, the execution sequence of the transaction is ensured to be completed before all transactions are executed, and the sequence relation of block chain transaction packaging is not needed to be concerned. When the user continuously sends the transactions with the dependency relationship, the transactions with the dependency relationship can be packed into the block as soon as possible without waiting for the block to be determined and then sending the subsequent transactions. Putting the transactions which are not executed before the dependent transactions into a waiting queue, and putting the transactions meeting the conditions into a transaction pool again through certain rules and strategies; and the early transactions in the waiting queue are cleared to ensure that the number of transactions in the waiting queue is within a preset range.
In short, the above description is only a preferred embodiment of the present disclosure, and is not intended to limit the scope of the present disclosure. Any modification, equivalent replacement, improvement and the like made within the spirit and principle of the present specification shall be included in the protection scope of the present specification.
The system, apparatus, module or unit illustrated in one or more of the above embodiments may be implemented by a computer chip or an entity, or by an article of manufacture with a certain functionality. One typical implementation device is a computer. In particular, the computer may be, for example, a personal computer, a laptop computer, a cellular telephone, a camera phone, a smartphone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.
Computer-readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), Read Only Memory (ROM), Electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), Digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device. As defined herein, a computer readable medium does not include a transitory computer readable medium such as a modulated data signal and a carrier wave.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
The embodiments in the present specification are described in a progressive manner, and the same and similar parts among the embodiments are referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the system embodiment, since it is substantially similar to the method embodiment, the description is simple, and for the relevant points, reference may be made to the partial description of the method embodiment.
The foregoing description has been directed to specific embodiments of this disclosure. Other embodiments are within the scope of the following claims. In some cases, the actions or steps recited in the claims may be performed in a different order than in the embodiments and still achieve desirable results. In addition, the processes depicted in the accompanying figures do not necessarily require the particular order shown, or sequential order, to achieve desirable results. In some embodiments, multitasking and parallel processing may also be possible or may be advantageous.
Claims (12)
1. A method of packaging transactions in order for use in a blockchain system, the method comprising:
constructing more than one transaction and determining the execution sequence of the transactions;
setting a transaction sequence identifier in a transaction, wherein the transaction sequence identifier represents a prior dependent transaction of the transaction; the prior dependent transaction is a transaction whose execution order precedes the transaction;
before the current transaction enters a transaction pool, judging whether the prior dependent transaction represented in the transaction sequence identifier is executed or not;
if the prior dependent transaction is executed completely, the current transaction is put into a transaction pool;
if the prior dependent transaction is not executed in the transaction pool, putting the current transaction into the transaction pool, and packaging the prior dependent transaction prior to the current transaction;
if the prior dependent transaction has not been executed and has not entered the transaction pool, the current transaction is placed in a wait queue.
2. The method of claim 1, further comprising: and checking whether the transaction in the waiting queue can enter the transaction pool according to the preset block number and/or the preset time interval, and putting the transaction into the transaction pool when the execution of the prior dependent transaction is completed or the prior dependent transaction is not executed in the transaction pool.
3. The method of claim 2, further comprising: and when the number of the transactions in the waiting queue exceeds a preset threshold value, deleting the earliest preset number of transactions entering the queue in the queue.
4. The method of claim 1, further comprising: and setting a consensus protocol rule and a node synchronization rule, so that after the node receives the transaction, whether the prior dependent transaction is executed or not is judged, and if the prior dependent transaction is not executed, the block is judged to be an illegal block.
5. The method of claims 1-4, wherein the transaction sequence identification comprises a transaction hash of the prior dependent transaction; the prior dependent transaction may be one or more.
6. An apparatus for packaging transactions in sequence for use in a blockchain system, the apparatus comprising:
a transaction construction unit: for constructing more than one transaction and determining the execution order of the transactions;
a transaction sequence identification unit: the transaction sequence identifier is used for setting a transaction sequence identifier in a transaction, and the transaction sequence identifier represents a prior dependent transaction of the transaction; the prior dependent transaction is a transaction whose execution order precedes the transaction;
a judging unit: before the current transaction enters the transaction pool, judging whether the prior dependent transaction represented in the transaction sequence identifier is executed;
a transaction processing unit: if the prior dependent transaction is executed completely, the current transaction is put into a transaction pool; if the prior dependent transaction is not executed in the transaction pool, putting the current transaction into the transaction pool, and packaging the prior dependent transaction prior to the current transaction; if the prior dependent transaction has not been executed and has not entered the transaction pool, the current transaction is placed in a wait queue.
7. The apparatus of claim 6, further comprising a waiting queue checking unit for checking whether the transaction in the waiting queue can enter the transaction pool according to a preset number of blocks and/or a preset time interval, and putting the transaction into the transaction pool for a transaction in which a previous dependent transaction is executed or a previous dependent transaction is not executed in the transaction pool.
8. The apparatus of claim 7, further comprising a wait queue clear unit to: and deleting the earliest preset number of transactions entering the queue in the queue when the number of the transactions in the waiting queue exceeds a preset threshold value.
9. The apparatus of claim 6, further comprising a rule setting unit: the method is used for setting consensus protocol rules and node synchronization rules, so that after the node receives a transaction, whether a prior dependent transaction is executed or not is judged, and if the prior dependent transaction is not executed, the block is judged to be an illegal block.
10. The apparatus of claims 6-9, wherein the transaction sequence identification comprises a transaction hash of the prior dependent transaction; the prior dependent transaction may be one or more.
11. An electronic device, comprising:
one or more processors;
a memory for storing one or more computer 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-5.
12. 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-5.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010697227.1A CN111882322A (en) | 2020-07-20 | 2020-07-20 | Method and device for packaging transactions in sequence and electronic equipment |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010697227.1A CN111882322A (en) | 2020-07-20 | 2020-07-20 | Method and device for packaging transactions in sequence and electronic equipment |
Publications (1)
Publication Number | Publication Date |
---|---|
CN111882322A true CN111882322A (en) | 2020-11-03 |
Family
ID=73154911
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202010697227.1A Pending CN111882322A (en) | 2020-07-20 | 2020-07-20 | Method and device for packaging transactions in sequence and electronic equipment |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN111882322A (en) |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113626531A (en) * | 2021-09-03 | 2021-11-09 | 杭州复杂美科技有限公司 | Transaction packaging method, computer device and storage medium |
WO2022171190A1 (en) * | 2021-02-10 | 2022-08-18 | 中国人民银行数字货币研究所 | Fixed execution sequence transaction method, and apparatus |
WO2023142605A1 (en) * | 2022-01-25 | 2023-08-03 | 腾讯科技(深圳)有限公司 | Blockchain-based data processing method and related apparatus |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108512775A (en) * | 2018-04-16 | 2018-09-07 | 杭州秘猿科技有限公司 | A kind of method and device of sequence transaction queue |
CN110135985A (en) * | 2019-04-04 | 2019-08-16 | 杭州抖音科技有限公司 | A kind of parallel execution method and system traded on block chain |
CN110618859A (en) * | 2019-09-10 | 2019-12-27 | 杭州秘猿科技有限公司 | Transaction pool design method supporting sequential packaging and electronic equipment |
CN110648125A (en) * | 2019-09-10 | 2020-01-03 | 杭州秘猿科技有限公司 | Packaging transaction method and device and electronic equipment |
-
2020
- 2020-07-20 CN CN202010697227.1A patent/CN111882322A/en active Pending
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108512775A (en) * | 2018-04-16 | 2018-09-07 | 杭州秘猿科技有限公司 | A kind of method and device of sequence transaction queue |
CN110135985A (en) * | 2019-04-04 | 2019-08-16 | 杭州抖音科技有限公司 | A kind of parallel execution method and system traded on block chain |
CN110618859A (en) * | 2019-09-10 | 2019-12-27 | 杭州秘猿科技有限公司 | Transaction pool design method supporting sequential packaging and electronic equipment |
CN110648125A (en) * | 2019-09-10 | 2020-01-03 | 杭州秘猿科技有限公司 | Packaging transaction method and device and electronic equipment |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2022171190A1 (en) * | 2021-02-10 | 2022-08-18 | 中国人民银行数字货币研究所 | Fixed execution sequence transaction method, and apparatus |
CN113626531A (en) * | 2021-09-03 | 2021-11-09 | 杭州复杂美科技有限公司 | Transaction packaging method, computer device and storage medium |
WO2023142605A1 (en) * | 2022-01-25 | 2023-08-03 | 腾讯科技(深圳)有限公司 | Blockchain-based data processing method and related apparatus |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109447810B (en) | Parallel block chain consensus method, system, electronic device and computer-readable storage medium | |
CN110659988B (en) | Parallel processing method and device for block chain consensus and execution and electronic equipment | |
CN111882322A (en) | Method and device for packaging transactions in sequence and electronic equipment | |
CN108846749B (en) | Partitioned transaction execution system and method based on block chain technology | |
CN110648136B (en) | Consensus and transaction synchronous parallel processing method and device and electronic equipment | |
CN110020859B (en) | Parallel execution block chain consensus method and device and electronic equipment | |
CN108765159B (en) | Block chain-based uplink and state processing method and device and interconnection system | |
CN111369358B (en) | Block chain consensus method and device and electronic equipment | |
CN110648125B (en) | Packaging transaction method and device, electronic equipment and storage medium | |
CN111383031B (en) | Intelligent contract execution method and system in block chain and electronic equipment | |
CN110061930B (en) | Method and device for determining data flow limitation and flow limiting values | |
CN109582398B (en) | State processing method and device and electronic equipment | |
CN111709748B (en) | Transaction execution method and device with business attribute and electronic equipment | |
CN111949297B (en) | Block chain intelligent contract upgrading method and device and electronic equipment | |
CN111523887B (en) | Authority control method and device for intelligent contract read-only method and electronic equipment | |
CN111143853B (en) | Application security assessment method and device | |
CN110618859B (en) | Transaction pool design method supporting sequential packaging and electronic equipment | |
CN108650150B (en) | Data verification method and device | |
CN110599139B (en) | Block output method and device in block chain consensus algorithm | |
CN113706146A (en) | Processing method, device and system for executing batch transaction based on block chain | |
CN110750271B (en) | Service aggregation, method and device for executing aggregated service and electronic equipment | |
CN110704134A (en) | Method and device for performing function expansion on block chain | |
CN109615465B (en) | Service order processing method and device and electronic equipment | |
CN112907198A (en) | Service state circulation maintenance method and device and electronic equipment | |
CN111884809B (en) | Method and device for preventing branch chain transaction replay and electronic equipment |
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 | ||
CB02 | Change of applicant information |
Address after: Room 2339, 2nd Floor, No. 92, Huancheng North Road, Gongshu District, Hangzhou City, Zhejiang Province 310005 Applicant after: Hangzhou Xita Technology Co.,Ltd. Address before: 310000 No. 1001, floor 10, tower a, Huaxing Times Square, No. 478, Wensan Road, Xihu District, Hangzhou, Zhejiang Province Applicant before: Hangzhou Xita Technology Co.,Ltd. |
|
CB02 | Change of applicant information |