Sequence-based transaction execution method and system

By merging the consensus sequence and the queue-jumping sequence in the executor, and using an auto-incrementing sequence number or timestamp to determine the transaction order, the problem that queue-jumping transactions in the existing technology are only executed within the current block is solved, and a more flexible transaction queue-jumping scheme is realized.

CN114358574BActive Publication Date: 2026-03-03HANGZHOU RIVTOWER TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202111659627.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-30
Publication Date
2026-03-03
Estimated Expiration
2041-12-30

AI Technical Summary

Technical Problem

In existing technologies, transaction queue-jumping schemes based on sequencers lack flexibility, as they can only be executed within the current block and cannot meet the needs for more flexible queue-jumping.

Method used

The queue-jumping transaction is sent directly to a centralized sequencer outside the blockchain to generate a queue-jumping sequence. This sequence is then merged with the consensus sequence in the executor. The transaction order is determined using an auto-incrementing sequence number or a timestamp, thus enabling cross-block queue-jumping.

Benefits of technology

It improves the flexibility of transaction queue jumping, so that the specific location of the queue jumping transaction is no longer limited to the current block, thus enhancing the flexibility and adaptability of execution.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114358574B_ABST
    Figure CN114358574B_ABST
Patent Text Reader

Abstract

The embodiment of the application discloses a sequence-based transaction execution method and system, wherein the method comprises the following steps: a consensus transaction is sent to a blockchain for consensus, and a consensus sequence obtained is sent to an executor; a queue-jumping transaction is sent to a centralized sequence generator outside the blockchain, a queue-jumping sequence generated is sent to the executor; the consensus sequence and the queue-jumping sequence are combined in the executor to obtain an actual execution sequence; and the consensus transaction and the queue-jumping transaction are executed according to the actual execution sequence, and the execution ends after block output. The embodiment of the application is used for improving the flexibility of queue-jumping execution by improving the executor, and is not limited in the current block.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of blockchain technology, specifically relating to a transaction execution method and system based on a sequencer. Background Technology

[0002] In one consortium blockchain model, transactions published on the blockchain network need to go through consensus to confirm their execution order. The sequence of transactions with the confirmed execution order is then sent to an independent executor for execution. In this scheme, the transaction execution function of the chain is separate from the blockchain itself. The blockchain itself is used more for consensus, thereby improving the credibility and security of on-chain data. However, the cost is that the consensus process requires more time and computing power.

[0003] In one existing solution, to balance execution efficiency and security, a portion of transactions can bypass consensus and be directly sorted by a centralized sequencer before being sent to the blockchain network. This blockchain network can be pre-designed to, upon receiving the sorted "queue-jumping transactions" from the sequencer, directly insert them into a predetermined position in the block-producing transaction queue according to pre-defined rules, for example, placing them at the beginning, thus achieving "intra-block" level "transaction queuing." See also Figure 1 Queue-jumping transactions 1 and 2 are queued by a centralized sequencer to form a queue sequence. This queue sequence is then sent to the blockchain network, forming an execution queue consisting of queue-jumping transaction 1, queue-jumping transaction 2, consensus transaction 3, consensus transaction 2, and consensus transaction 1. This queue is then sent to the executor for execution. From the user's perspective, this scheme combines decentralization and centralization. When a user trusts the centralized institution, they can choose to use the centralized sequencer as a fast channel; if the user does not trust the centralized system, they can choose to use the decentralized blockchain's slow channel. Ultimately, both the fast and slow channels achieve the same function.

[0004] Since the final transaction sequence given to the executor is provided by the blockchain itself, the "queue-jumping transaction" in the above technical solution can only be implemented within the current block, and its flexibility is still insufficient. Summary of the Invention

[0005] The technical problem to be solved by the present invention is to provide a transaction execution method and system based on a sequencer, which improves the flexibility of queue-jumping execution by improving the executor and is not limited to the current block.

[0006] To solve the above-mentioned technical problems, the present invention adopts the following technical solution:

[0007] In a first aspect, embodiments of the present invention provide a transaction execution method based on a sequencer, comprising the following steps:

[0008] Consensus transactions are sent to the blockchain for consensus, and the resulting consensus sequence is sent to the executor.

[0009] Queue-jumping transactions are sent to a centralized sequencer outside the blockchain, which generates a queue-jumping sequence that is then sent to the executor.

[0010] The consensus sequence and the queue-jumping sequence are merged in the executor to obtain the actual execution sequence;

[0011] The consensus transactions and queue-jumping transactions are executed sequentially according to the actual execution sequence, and the execution ends after a block is produced.

[0012] In one possible design of the first aspect, the executor uses an auto-incrementing sequence number as the basis for merging the consensus sequence and the queue-jumping sequence.

[0013] In one possible design of the first aspect, the sequencer generates the queue-jumping sequence along with a timestamp of the queue-jumping transaction;

[0014] The auto-incrementing sequence number is a timestamp. The executor determines the order of transactions after merging the consensus sequence and the queue-jumping sequence based on the timestamps of the queue-jumping transactions and the consensus transactions.

[0015] In one possible design of the first aspect, if the queue-jumping sequence is not sent to the executor in time within the executor's preset buffer waiting period, and the executor has already completed the execution of the consensus transaction with a timestamp earlier than the queue-jumping transaction, then the received queue-jumping transaction will be reprocessed.

[0016] Secondly, embodiments of the present invention provide a transaction execution system based on a sequencer, comprising a blockchain, a sequencer, and an executor.

[0017] The blockchain is used to receive consensus transactions and perform consensus, and the resulting consensus sequence is sent to the executor.

[0018] The sequencer is used to receive queue-jumping transactions and generate a queue-jumping sequence to send to the executor;

[0019] The executor is used to merge the consensus sequence and the queue-jumping sequence to obtain the actual execution sequence;

[0020] The executor is also used to execute the consensus transactions and queue-jumping transactions in the actual execution sequence, and the execution ends after a block is produced.

[0021] In one possible design of the second aspect, the executor uses an auto-incrementing sequence number as the basis for merging the consensus sequence and the queue-jumping sequence.

[0022] In one possible design of the second aspect, the sequencer generates a queue-jumping sequence along with a timestamp of the queue-jumping transaction.

[0023] The auto-incrementing sequence number is a timestamp. The executor determines the order of transactions after the consensus sequence and the queue-jumping sequence are merged based on the timestamps of the queue-jumping transactions and the consensus transactions.

[0024] In one possible design of the second aspect, if the queue-jumping sequence is not sent to the executor in time within the executor's preset buffer waiting period, and the executor has already completed the execution of the consensus transaction with a timestamp earlier than the queue-jumping transaction, then the received queue-jumping transaction will be reprocessed.

[0025] Thirdly, embodiments of the present invention provide a computer device, including at least a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the transaction execution method based on the sequencer as described above.

[0026] Fourthly, embodiments of the present invention provide a computer-readable storage medium storing a computer program that is executed by a processor to implement the transaction execution method based on a sequencer as described above.

[0027] The present invention has the following advantages: it changes the original sending of the queue-jumping sequence to the blockchain to sending it directly to the executor, so that there is no logical binding relationship between the queue-jumping transaction and the current block, and thus the specific position of the queue-jumping is not limited to the current block, which significantly improves flexibility. Attached Figure Description

[0028] Figure 1 This is a schematic diagram illustrating one method of executing a queue-jumping transaction in the prior art.

[0029] Figure 2 This is a flowchart of a transaction execution method based on a sequencer according to an embodiment of the present invention;

[0030] Figure 3 This is a schematic diagram illustrating an example of a transaction execution method based on a sequencer according to the present invention;

[0031] Figure 4 This is a schematic diagram illustrating an implementation of a transaction execution method based on a sequencer, as shown in an example of the present invention.

[0032] Figure 5 This is a schematic diagram of the structure of a computer device according to an embodiment of the present invention. Detailed Implementation

[0033] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0034] See Figure 2 The figure shows a transaction execution method based on a sequencer according to an embodiment of the present invention, which includes the following steps:

[0035] S10, consensus transactions are sent to the blockchain for consensus, and the resulting consensus sequence is sent to the executor;

[0036] S20, the queue-jumping transaction is sent to a centralized sequencer outside the blockchain, generating a queue-jumping sequence that is then sent to the executor;

[0037] S30, in the executor, the consensus sequence and the queue-jumping sequence are merged to obtain the actual execution sequence;

[0038] S40, execute the consensus transactions and queue-jumping transactions according to the actual execution sequence, and the execution ends after the block is produced.

[0039] The biggest difference between this technical solution and existing solutions is that the queue-jumping transaction sequence generated by the sequencer is no longer sent to the blockchain, but directly to the executor. With this setting, the actual execution order of the queue-jumping transactions is not limited to the current block; it may appear at the beginning, middle or end of the current block, or even cross-block queue-jumping, making the implementation more flexible.

[0040] An embodiment of the present invention provides a transaction execution method based on a sequencer, wherein when merging a consensus sequence and a queue-jumping sequence in the executor, an auto-incrementing sequence number is used as the basis for merging the sequence.

[0041] One typical solution is to use the auto-incrementing sequence number as a timestamp and use the timestamp as the basis for merging sequences. That is, when the sequencer generates the queue-jumping sequence, it can attach the timestamps of each queue-jumping transaction, and the consensus sequence itself has a timestamp. Therefore, the executor can determine the order of each transaction after the two sequences are merged based on the timestamps of the queue-jumping transactions and the consensus transactions.

[0042] For example, if the timestamp of consensus transaction A is 00:01:00 and the timestamp of queue-jumping transaction X is 00:00:01, then queue-jumping transaction X is earlier than consensus transaction A. Therefore, after the merge sequence, queue-jumping transaction X is before consensus transaction A. During execution, queue-jumping transaction X is executed first, followed by consensus transaction A.

[0043] If the queue-jumping sequence is not sent in time within the preset cache waiting period, taking the timestamp of queue-jumping transaction X as earlier than that of consensus sequence A as an example, assuming that consensus sequence A has been completed before queue-jumping transaction X is sent to the executor, the queue-jumping sequence can be directly invalidated, the execution order can be reconfirmed, or error information can be recorded, etc., and corresponding processing can be carried out according to the needs of the actual application scenario.

[0044] See Figure 3 The diagram illustrates an example of a transaction execution method based on a sequencer according to the present invention. Consensus transactions 3, 1, and 2 are sent to the blockchain for consensus, resulting in a consensus sequence that is then sent to the executor. The order of the consensus sequence is consensus transaction 3, consensus transaction 1, and consensus transaction 2. Queue-jumping transactions 1 and 2 are sent to a centralized sequencer outside the blockchain, generating a queue-jumping sequence of queue-jumping transactions 1 and 2, which is then sent to the executor. The executor merges the consensus sequence and the queue-jumping sequence to obtain the actual execution sequence. The sequences are then sorted according to the timestamps of each transaction, forming an execution queue in the order of consensus transaction 3, queue-jumping transaction 1, consensus transaction 1, queue-jumping transaction 2, and consensus transaction 2.

[0045] Consensus transactions and queue-jumping transactions are executed in the actual execution sequence, and execution ends after a block is produced.

[0046] For the corresponding embodiments of the method of the present invention, see [link to relevant documentation]. Figure 4 This invention also provides a transaction execution system based on a sequencer, comprising a blockchain, a sequencer, and an executor. The blockchain is used to receive consensus transactions and reach a consensus, obtaining a consensus sequence which is then sent to the executor. The sequencer is used to receive queue-jumping transactions, generate a queue-jumping sequence, and send it to the executor. The executor is used to merge the consensus sequence and the queue-jumping sequence to obtain an actual execution sequence. The executor is also used to execute the consensus transactions and queue-jumping transactions in the order of the actual execution sequence, and execution ends after a block is produced.

[0047] An embodiment of the present invention provides a transaction execution system based on a sequencer, wherein when merging a consensus sequence and a queue-jumping sequence in the executor, an auto-incrementing sequence number is used as the basis for merging the sequence.

[0048] One typical solution is to use the auto-incrementing sequence number as a timestamp and use the timestamp as the basis for merging sequences. That is, when the sequencer generates the queue-jumping sequence, it can attach the timestamps of each queue-jumping transaction, and the consensus sequence itself has a timestamp. Therefore, the executor can determine the order of each transaction after the two sequences are merged based on the timestamps of the queue-jumping transactions and the consensus transactions.

[0049] For example, if the timestamp of consensus transaction A is 00:01:00 and the timestamp of queue-jumping transaction X is 00:00:01, then queue-jumping transaction X is earlier than consensus transaction A. Therefore, after the merge sequence, queue-jumping transaction X is before consensus transaction A. During execution, queue-jumping transaction X is executed first, followed by consensus transaction A.

[0050] If the queue-jumping sequence is not sent in time within the preset cache waiting period, taking the timestamp of queue-jumping transaction X as earlier than that of consensus sequence A as an example, assuming that consensus sequence A has been completed before queue-jumping transaction X is sent to the executor, the queue-jumping sequence can be directly invalidated, the execution order can be reconfirmed, or error information can be recorded, etc., and corresponding processing can be carried out according to the needs of the actual application scenario.

[0051] Figure 5 This diagram illustrates a more specific hardware structure of a computing device provided in an embodiment of this specification. The computer device may include: a processor 101, a memory 102, an input / output interface 103, a communication interface 104, and a bus 105. The processor 101, memory 102, input / output interface 103, and communication interface 104 are interconnected internally via the bus 105.

[0052] The processor 101 can be implemented using a general-purpose CPU (Central Processing Unit), microprocessor, application-specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of this specification.

[0053] The memory 102 can be implemented in the form of ROM (Read Only Memory), RAM (Random Access Memory), static storage device, dynamic storage device, etc. The memory 102 can store the operating system and other applications. When the technical solutions provided in the embodiments of this specification are implemented by software or firmware, the relevant program code is stored in the memory 102 and is called and executed by the processor 101.

[0054] Those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be performed by instructions, or by instructions controlling related hardware. These instructions can be stored in a computer-readable storage medium and loaded and executed by a processor.

[0055] Therefore, embodiments of this application provide a computer-readable storage medium storing a plurality of computer programs that can be loaded by a processor to execute steps in any of the sequencer-based transaction execution methods provided in embodiments of this application. For example, the computer program can execute the following steps:

[0056] Consensus transactions are sent to the blockchain for consensus, and the resulting consensus sequence is sent to the executor.

[0057] Queue-jumping transactions are sent to a centralized sequencer outside the blockchain, which generates a queue-jumping sequence that is then sent to the executor.

[0058] The consensus sequence and the queue-jumping sequence are merged in the executor to obtain the actual execution sequence;

[0059] The consensus transactions and queue-jumping transactions are executed in the actual execution sequence, and the execution ends after a block is produced.

[0060] For details on the implementation of each of the above steps, please refer to the above method implementation examples, which will not be repeated here.

[0061] Computer-readable media, including both permanent and non-permanent, removable and non-removable media, can store information using any method or technology. Information can be computer-readable instructions, data structures, program modules, 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 technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic magnetic disk storage or other magnetic storage devices, or any other non-transfer medium that can be used to store information accessible by a computing device.

[0062] Since the computer program stored in the storage medium can execute the steps in any of the sequencer-based transaction execution methods provided in the embodiments of this application, the beneficial effects that any of the sequencer-based transaction execution methods provided in the embodiments of this application can achieve can be realized, as detailed in the above embodiments, which will not be repeated here.

[0063] It should be understood that the exemplary embodiments described herein are illustrative and not restrictive. Although one or more embodiments of the invention have been described in conjunction with the accompanying drawings, those skilled in the art will understand that various changes in form and detail may be made without departing from the spirit and scope of the invention as defined by the appended claims.

Claims

1. A transaction execution method based on a sequencer, characterized in that, Includes the following steps: Consensus transactions are sent to the blockchain for consensus, and the resulting consensus sequence is sent to the executor. Queue-jumping transactions are sent to a centralized sequencer outside the blockchain, which generates a queue-jumping sequence that is then sent to the executor. The consensus sequence and the queue-jumping sequence are merged in the executor to obtain the actual execution sequence; The consensus transactions and queue-jumping transactions are executed sequentially according to the actual execution sequence, and the execution ends after a block is produced. When merging the consensus sequence and the queue-jumping sequence in the executor, the auto-incrementing sequence number is used as the basis for merging the sequence; when the sequencer generates the queue-jumping sequence, it includes the timestamp of the queue-jumping transaction; the auto-incrementing sequence number is a timestamp, and the executor determines the order of each transaction after merging the consensus sequence and the queue-jumping sequence based on the timestamps of the queue-jumping transaction and the consensus transaction.

2. The transaction execution method based on a sequencer as described in claim 1, characterized in that, If the queue-jumping sequence is not sent to the executor in time within the executor's preset buffer waiting time, and the executor has already completed the execution of consensus transactions with timestamps earlier than the queue-jumping transaction, then the received queue-jumping transaction will be reprocessed.

3. A transaction execution system based on a sequencer, characterized in that, Including blockchain, sequencers, and executors. The blockchain is used to receive consensus transactions and perform consensus, and the resulting consensus sequence is sent to the executor. The sequencer is used to receive queue-jumping transactions and generate a queue-jumping sequence to send to the executor; The executor is used to merge the consensus sequence and the queue-jumping sequence to obtain the actual execution sequence; The executor is also used to execute the consensus transactions and queue-jumping transactions in the actual execution sequence, and the execution ends after a block is produced. When merging the consensus sequence and the queue-jumping sequence in the executor, the auto-incrementing sequence number is used as the basis for merging the sequence; when the sequencer generates the queue-jumping sequence, it includes the timestamp of the queue-jumping transaction; the auto-incrementing sequence number is a timestamp, and the executor determines the order of each transaction after merging the consensus sequence and the queue-jumping sequence based on the timestamps of the queue-jumping transaction and the consensus transaction.

4. The transaction execution system based on a sequencer as described in claim 3, characterized in that, If the queue-jumping sequence is not sent to the executor in time within the executor's preset buffer waiting period, and the executor has already completed the execution of consensus transactions with timestamps earlier than the queue-jumping transaction, then the received queue-jumping transaction will be reprocessed.

5. A computer device, characterized in that, It includes at least a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the sequencer-based transaction execution method as described in any one of claims 1 to 2.

6. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that is executed by a processor to implement the sequencer-based transaction execution method according to any one of claims 1 to 2.

Citation Information

Patent Citations

  • Heterogeneous distributed task processing system and processing method in cloud computing platform

    CN105022670A