Cross-chain transaction sequential transaction execution method and system based on block chain
By assigning serial numbers to cross-chain transactions and building storage queues, the problem of transaction dependencies in cross-chain transaction execution is solved, and the orderly execution and consistency of results of cross-chain transactions are achieved.
Patent Information
- Application Number
- CN202510677214.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-26
- Publication Date
- 2025-09-19
AI Technical Summary
Existing cross-chain transaction execution methods cannot effectively handle the dependencies between transactions and cannot determine the execution order of multiple cross-chain transactions, resulting in some transactions succeeding while others fail.
By assigning a unique serial number to each cross-chain transaction, building a cross-chain transaction storage queue, and determining the execution order of pending transactions by recording the maximum serial number of completed transactions, we ensure that only one transaction is processed in the same time period. We use the self-increment of the serial number to detect and block missing transactions, thus achieving strict sequential execution of transactions.
Cross-chain transactions are strictly executed in a predetermined order, ensuring that all cross-chain transactions are completed under the continuity conditions, thus avoiding the problem of partial transaction failure.
Smart Images

Figure CN120670144A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of blockchain technology, and in particular to a method and system for executing cross-chain transaction sequence based on blockchain. Background Art
[0002] The statements in this section merely provide background information related to the present disclosure and do not necessarily constitute prior art.
[0003] With the development of technology, blockchain application scenarios have become increasingly complex. To address the data silos between different blockchains and promote data interoperability between different blockchain systems, cross-chain technology has emerged. Cross-chain refers to the process of two or more blockchain systems participating together, connecting them through specific technologies, enabling data to flow between homogeneous or heterogeneous blockchains and achieving cross-chain interoperability.
[0004] Transaction consistency is a primary concern for cross-chain technology. During cross-chain transactions, a single operation is split into multiple transactions and executed on different blockchains. These transactions are executed independently on different chains, so some transactions may succeed while others fail. To ensure a clear outcome for this operation, the results of the operation on different chains must be consistent—either all succeed or all fail. To achieve this, cross-chain systems typically use transactions to manage the results of the same cross-chain operation on different chains. Transactions are committed when all succeed. If any transaction fails, the changes made by all other successful transactions are rolled back.
[0005] During cross-chain operations, there are often certain requirements for the relationships between the multiple transactions corresponding to multiple cross-chain operations. In certain scenarios, such as when a subsequent cross-chain operation depends on the results of a previous cross-chain operation, when system resources can only support the execution of one cross-chain operation within a given timeframe, or when transactions corresponding to cross-chain operations interfere with each other during parallel execution, multiple transactions must be ordered according to specific rules. Each transaction has a unique predecessor transaction, and the current transaction can only begin executing after the predecessor transaction completes.
[0006] For the aforementioned transaction scenarios, existing cross-chain transaction execution methods rely on direct parallel execution. This means that the cross-chain system assumes that all cross-chain transactions do not have dependencies or interference with each other. Once a cross-chain transaction is created and sent to the cross-chain system, it will begin execution immediately. The system will not block the current transaction due to an unfinished previous transaction, nor will it block subsequent transactions due to an unfinished current transaction. Therefore, existing cross-chain transaction execution methods generally fail to effectively handle dependencies between transactions, cannot determine the execution order of multiple cross-chain transactions, and cannot ensure that cross-chain transactions are executed strictly in the predetermined order. Summary of the Invention
[0007] To solve the above problems, the present disclosure proposes a blockchain-based cross-chain transaction sequential transaction execution method and system. The method determines the execution order of cross-chain transactions by assigning a unique sequence number to each cross-chain transaction; records the progress of transaction execution by recording the largest sequence number among the currently completed cross-chain transactions; and determines whether the current pending cross-chain transaction should start execution by comparing the largest sequence number of the completed transactions in the record with the sequence number of the pending transaction.
[0008] According to some embodiments, the present disclosure adopts the following technical solutions: A cross-chain transaction sequence execution method based on blockchain, including: Build a cross-chain transaction storage queue and set a cross-chain tag; Obtain pending cross-chain transactions, assign a sequence number to each cross-chain transaction based on the order in which the cross-chain transactions were created, and store them in a queue; Transaction cross-chain scheduling is performed based on the assigned sequence number. Each time, the cross-chain transaction with the smallest sequence number that meets the continuity condition is executed cross-chain, and other transactions are blocked to ensure that only one transaction is running across the chain in the same time period. After the current transaction cross-chain is completed, the transaction with a sequence number that increases by 1 is selected for the same cross-chain execution. By self-incrementing the sequence number, the missing transactions in the sequential sequence are detected and blocked. All cross-chain transactions with assigned sequence numbers are executed in sequence, and the self-increment is repeated until all cross-chain transactions complete the cross-chain operation.
[0009] According to some embodiments, the present disclosure adopts the following technical solutions: A cross-chain transaction sequence execution system based on blockchain, including: The sequence number allocation module is used to build a cross-chain transaction storage queue and set cross-chain tags; obtain pending cross-chain transactions, assign a sequence number to each cross-chain transaction according to the creation time sequence of the cross-chain transactions, and store them in the queue; The transaction sequencing module is used to schedule and sort cross-chain transactions for each cross-chain transaction with a sequence number assigned to it; The transaction execution module is used to schedule transactions across chains based on the assigned sequence numbers. Each time, the cross-chain transaction with the smallest sequence number that meets the continuity conditions is executed across chains, and other transactions are blocked to ensure that only one transaction is running across chains in the same time period. After the current transaction crosses the chain, the transaction with a sequence number that increases by 1 is selected for the same cross-chain execution. By self-incrementing the sequence number, the missing transactions in the sequential sequence are detected and blocked. All cross-chain transactions with assigned sequence numbers are executed in sequence, and the self-increment is repeated until all cross-chain transactions complete the cross-chain operation.
[0010] According to some embodiments, the present disclosure adopts the following technical solutions: A computer program product includes a computer program, which, when executed by a processor, implements the blockchain-based cross-chain transaction sequence execution method.
[0011] According to some embodiments, the present disclosure adopts the following technical solutions: A non-transitory computer-readable storage medium is used to store computer instructions. When the computer instructions are executed by a processor, the blockchain-based cross-chain transaction sequence execution method is implemented.
[0012] According to some embodiments, the present disclosure adopts the following technical solutions: An electronic device comprises: a processor, a memory, and a computer program; wherein the processor is connected to the memory, and the computer program is stored in the memory. When the electronic device is running, the processor executes the computer program stored in the memory to enable the electronic device to implement the cross-chain transaction sequence execution method based on blockchain.
[0013] Compared with the prior art, the present invention has the following beneficial effects: The blockchain-based cross-chain transaction sequential transaction execution method disclosed in this disclosure constructs a sequentially arranged queue of pending transactions and determines the execution order of cross-chain transactions by assigning a unique serial number to each cross-chain transaction, which can meet the need for sorting cross-chain transactions.
[0014] The disclosed blockchain-based cross-chain transaction sequential transaction execution method records the progress of transaction execution by recording the largest serial number in the currently completed cross-chain transaction; and determines whether the current pending cross-chain transaction should start execution by comparing the largest serial number of the completed transaction in the record with the serial number of the pending transaction. When processing cross-chain transactions, the cross-chain transaction with the smallest serial number that meets the continuity condition is processed each time, and other transactions are blocked, which can ensure that only one transaction is being processed in the same time period. After the processing is completed, the transaction with the serial number increased by one is continuously selected for the same processing. By self-incrementing the serial number, a transaction missing from the sequential sequence can be discovered in time and blocked in time, thereby ensuring that the cross-chain transaction is strictly executed according to the continuous serial number, meeting the requirements of the sequential execution of cross-chain transactions. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] The accompanying drawings, which constitute a part of the present disclosure, are used to provide a further understanding of the present disclosure. The exemplary embodiments of the present disclosure and their descriptions are used to explain the present disclosure and do not constitute an improper limitation to the present disclosure.
[0016] Figure 1 This is a flow chart of a method for executing cross-chain transaction sequence based on blockchain according to an embodiment of the present disclosure; Figure 2This is a flow chart of the cross-chain transaction sequence cross-chain method according to an embodiment of the present disclosure.
[0017] Figure 3 This is an architecture diagram of the cross-chain transaction sequence execution system based on blockchain in an embodiment of the present disclosure. DETAILED DESCRIPTION
[0018] The present disclosure will be further described below with reference to the accompanying drawings and embodiments.
[0019] It should be noted that the following detailed descriptions are illustrative and intended to provide further explanation of the present disclosure. Unless otherwise specified, all technical and scientific terms used herein have the same meaning as commonly understood by those skilled in the art to which the present disclosure belongs.
[0020] It should be noted that the terms used herein are only for describing specific embodiments and are not intended to limit the exemplary embodiments according to the present disclosure. As used herein, unless the context clearly indicates otherwise, the singular form is intended to include the plural form. In addition, it should be understood that when the terms "comprise" and / or "include" are used in this specification, they indicate the presence of features, steps, operations, devices, components and / or combinations thereof.
[0021] Example 1 The disclosed blockchain-based cross-chain transaction sequential transaction execution method determines the execution order of cross-chain transactions by assigning a unique sequence number to each cross-chain transaction, and determines whether the current pending cross-chain transaction should begin execution by comparing the maximum sequence number of completed transactions in the record with the sequence number of pending transactions. The method steps include: Step 1: Build a cross-chain transaction storage queue and set a cross-chain tag; Step 2: Obtain pending cross-chain transactions, assign a sequence number to each cross-chain transaction based on the order in which the cross-chain transactions were created, and store them in a queue; Step 3: Schedule transactions across chains based on the assigned sequence numbers. Each time, the cross-chain transaction with the smallest sequence number that meets the continuity condition is executed across chains, and other transactions are blocked to ensure that only one transaction is running across chains in the same time period. After the current transaction is completed across chains, the transaction with a sequence number that increases by 1 is selected for the same cross-chain execution. By increasing the sequence number, the missing transactions in the sequential sequence are detected and blocked. All cross-chain transactions with assigned sequence numbers are executed in sequence, and the self-increment is repeated until all cross-chain transactions complete the cross-chain operation.
[0022] As an embodiment, the specific implementation process of the blockchain-based cross-chain transaction sequence execution method disclosed in this disclosure is as follows: Step 1: Build a cross-chain transaction storage queue and set a cross-chain tag; Specifically, a cross-chain transaction queue La is constructed to store all pending cross-chain transactions. A cross-chain marker s1 is constructed to record the maximum sequence number of the currently completed cross-chain transaction. The default value of s1 is 0.
[0023] Step 2: Obtain pending cross-chain transactions, assign a sequence number to each cross-chain transaction based on the order in which the cross-chain transactions were created, and store them in a queue; Specifically, a sequence number is assigned to each pending cross-chain transaction based on its creation time, with the oldest transaction assigned first. Sequence numbers start at 1 and increment by 1 with each assignment. The incremented value serves as the sequence number for the next cross-chain transaction, which increments again, and so on. Once assigned, all pending cross-chain transactions are placed in the cross-chain transaction storage queue La.
[0024] As an example, when assigning sequence numbers, all known pending cross-chain transactions are assigned sequence numbers in chronological order of creation. Sequence numbers are numeric, with an initial value of 1 or the largest value from the last sequence number assignment plus 1. The initial value is assigned to the oldest cross-chain transaction, then incremented by 1 before being assigned to the next cross-chain transaction. This increment and assignment process is repeated until all cross-chain transactions have a sequence number.
[0025] Furthermore, after the sequence numbers are assigned, each cross-chain transaction assigned a sequence number is sorted according to the sequence number, with the cross-chain transaction with the smallest sequence number at the front and the cross-chain transaction with the largest sequence number at the back, and is added to the pending storage queue La in sequence, waiting for sequential processing; Step 3: Schedule transactions across chains based on the assigned sequence numbers. Each time, the cross-chain transaction with the smallest sequence number that meets the continuity condition is executed across chains, and other transactions are blocked to ensure that only one transaction is running across chains in the same time period. After the current transaction is completed across chains, the transaction with a sequence number that increases by 1 is selected for the same cross-chain execution. By increasing the sequence number, the missing transactions in the sequential sequence are detected and blocked. All cross-chain transactions with assigned sequence numbers are executed in sequence, and the self-increment is repeated until all cross-chain transactions complete the cross-chain operation.
[0026] Specifically, it is executed in sequence. Starting from the transaction with the smallest sequence number, all cross-chain transactions with assigned sequence numbers are executed in sequence. The cross-chain mark s1 is compared with the smallest sequence number s2 of all transactions in the storage queue La. If s2 is equal to s1+1, the execution of the cross-chain transaction corresponding to s2 is started and the transaction is removed from the storage queue La; otherwise, nothing is done (waiting), such as Figure 2 The specific process steps are as follows: Step 1031: Select the cross-chain transaction with the smallest sequence number from the pending storage queue La; Step 1032: Determine whether the selected cross-chain transaction meets the execution conditions. A sequence number of 1 indicates that this cross-chain transaction is the first transaction in the entire cross-chain process; a sequence number equal to the completed sequence number plus one indicates that all preceding cross-chain transactions have been completed. If the conditions are met, jump to step 1033. If the conditions are not met, the preceding cross-chain transaction has not yet completed, and the operation ends immediately.
[0027] Step 1033: Execute the selected cross-chain transaction. If successful, delete the cross-chain transaction from the pending storage queue and set the completed sequence number as the sequence number of the current cross-chain transaction.
[0028] Step 1034: Determine whether the pending storage queue is empty. If it is not empty, it means that there are still pending cross-chain transactions, and jump to step 1031; if it is empty, it means that all current cross-chain transactions have been processed, and the execution step ends.
[0029] Example 2 In one embodiment of the present disclosure, a cross-chain transaction sequence execution system based on blockchain is provided. Figure 3 As shown, it includes: a sequence number allocation module 201, a transaction sequencing module 202 and a transaction execution module 203.
[0030] Furthermore, the sequence number allocation module 201 includes a sequence number generation module 2011 and a transaction generation module 2022, which are used to generate, record and allocate sequence numbers.
[0031] The serial number generating module 2011 is used to generate an initial value of the serial number, perform an auto-increment operation on the initial value to continuously generate new serial numbers, and record the maximum value of the currently generated serial number.
[0032] The transaction generation module 2012 is used to construct a cross-chain transaction and write the sequence number generated in the sequence number generation module into the cross-chain transaction object.
[0033] Furthermore, the transaction sequencing module 202 is used to sort all pending cross-chain transactions, record the maximum sequence number of the currently completed transaction, record the ordered list of all pending cross-chain transactions, schedule cross-chain transactions, and send cross-chain transactions to the transaction execution module for processing. It includes a transaction storage module 2021 and a transaction scheduling module 2022.
[0034] The transaction storage module 2021 is used to sort and store all pending cross-chain transactions and record the maximum sequence number of the currently completed cross-chain transaction.
[0035] The transaction scheduling module 2022 is used to determine whether there is a pending cross-chain transaction that can be started, and send the cross-chain transaction to the transaction execution module for processing, obtain the execution result from the transaction processing module, and update the content in the transaction storage module.
[0036] Furthermore, the transaction execution module 203 is used to process cross-chain transactions, send transactions to different blockchains, and ensure the atomicity of the results of transactions on different chains to obtain a certain execution result.
[0037] As an embodiment, the specific functions of each module are as follows: The sequence number allocation module is used to build a cross-chain transaction storage queue and set cross-chain tags; obtain pending cross-chain transactions, assign a sequence number to each cross-chain transaction according to the creation time sequence of the cross-chain transactions, and store them in the queue; The transaction sequencing module is used to schedule and sort cross-chain transactions for each cross-chain transaction with a sequence number assigned to it; The transaction execution module is used to schedule transactions across chains based on the assigned sequence numbers. Each time, the cross-chain transaction with the smallest sequence number that meets the continuity conditions is executed across chains, and other transactions are blocked to ensure that only one transaction is running across chains in the same time period. After the current transaction crosses the chain, the transaction with a sequence number that increases by 1 is selected for the same cross-chain execution. By self-incrementing the sequence number, the missing transactions in the sequential sequence are detected and blocked. All cross-chain transactions with assigned sequence numbers are executed in sequence, and the self-increment is repeated until all cross-chain transactions complete the cross-chain operation.
[0038] Example 3 In one embodiment of the present disclosure, a computer program product is provided, including a computer program, which, when executed by a processor, implements the blockchain-based cross-chain transaction sequence execution method.
[0039] Example 4 In one embodiment of the present disclosure, a non-transitory computer-readable storage medium is provided, wherein the non-transitory computer-readable storage medium is used to store computer instructions. When the computer instructions are executed by a processor, the blockchain-based cross-chain transaction sequence execution method is implemented.
[0040] Example 5 In one embodiment of the present disclosure, an electronic device is provided, comprising: a processor, a memory, and a computer program; wherein the processor is connected to the memory, and the computer program is stored in the memory. When the electronic device is running, the processor executes the computer program stored in the memory, so that the electronic device executes the cross-chain transaction sequence execution method based on blockchain.
[0041] The present disclosure is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present disclosure. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 a process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0042] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing the instructions executed on the computer or other programmable device for implementing the process. Figure 1 a process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.
[0043] Although the above describes the specific implementation methods of the present disclosure in conjunction with the accompanying drawings, it is not intended to limit the scope of protection of the present disclosure. Those skilled in the art should understand that on the basis of the technical solution of the present disclosure, various modifications or variations that can be made by those skilled in the art without creative work are still within the scope of protection of the present disclosure.
Claims
1. A cross-chain transaction sequence execution method based on blockchain, characterized in that: include: Build a cross-chain transaction storage queue and set a cross-chain tag; Obtain pending cross-chain transactions, assign a sequence number to each cross-chain transaction based on the order in which the cross-chain transactions were created, and store them in a queue; Transaction cross-chain scheduling is performed based on the assigned sequence number. Each time, the cross-chain transaction with the smallest sequence number that meets the continuity condition is executed cross-chain, and other transactions are blocked to ensure that only one transaction is running across the chain in the same time period. After the current transaction cross-chain is completed, the transaction with a sequence number that increases by 1 is selected for the same cross-chain execution. By self-incrementing the sequence number, the missing transactions in the sequential sequence are detected and blocked. All cross-chain transactions with assigned sequence numbers are executed in sequence, and the self-increment is repeated until all cross-chain transactions complete the cross-chain operation.
2. The cross-chain transaction sequence execution method based on blockchain according to claim 1, characterized in that: Build a cross-chain transaction storage queue list La to store all pending cross-chain transactions, and build a cross-chain tag s1. The cross-chain tag is used to record the maximum sequence number in the currently completed cross-chain transaction. The default value of s1 is 0.
3. The cross-chain transaction sequence execution method based on blockchain according to claim 1, characterized in that: According to the creation time of the pending cross-chain transaction, a serial number is assigned to each transaction in turn. The transaction with the earliest creation time is assigned first. The serial number starts from 1 and is incremented by 1 each time it is assigned. The incremented value is used as the serial number of the next transaction and is incremented again. This process is repeated in this way. After the serial number assignment is completed, all pending cross-chain transactions are placed in the queue list La.
4. The cross-chain transaction sequence execution method based on blockchain according to claim 1, characterized in that: After the cross-chain operation starts, compare the cross-chain mark s1 with the minimum sequence number s2 of all cross-chain transactions in the queue list La. If s2 is equal to s1+1, start the execution of the cross-chain transaction corresponding to s2 and remove the transaction from the queue list La; otherwise, wait.
5. The cross-chain transaction sequence execution method based on blockchain according to claim 1, characterized in that: After any cross-chain transaction is executed, the cross-chain tag s1 is incremented by 1, and the cross-chain tag is compared with the minimum sequence number of all transactions in the queue list La again to prepare for cross-chain execution.
6. The cross-chain transaction sequence execution method based on blockchain according to claim 1, characterized in that: Execute the selected cross-chain transaction. After the cross-chain is successful, delete the cross-chain transaction from the pending queue list La and set the completed sequence number to the sequence number of the current transaction; determine whether the pending queue list La is empty. If it is not empty, it means that there are still pending cross-chain transactions, and continue to execute the cross-chain sequentially; If it is empty, it means that all current cross-chain transactions have been processed and the process ends.
7. A cross-chain transaction sequence execution system based on blockchain, characterized by: include: The sequence number allocation module is used to build a cross-chain transaction storage queue and set cross-chain tags; obtain pending cross-chain transactions, assign a sequence number to each cross-chain transaction according to the creation time sequence of the cross-chain transactions, and store them in the queue; The transaction sequencing module is used to schedule and sort cross-chain transactions for each assigned sequence number; The transaction execution module is used to schedule transactions across chains based on the assigned sequence numbers. Each time, the cross-chain transaction with the smallest sequence number that meets the continuity conditions is executed across chains, and other transactions are blocked to ensure that only one transaction is running across chains in the same time period. After the current transaction crosses the chain, the transaction with a sequence number that increases by 1 is selected for the same cross-chain execution. By self-incrementing the sequence number, the missing transactions in the sequential sequence are detected and blocked. All cross-chain transactions with assigned sequence numbers are executed in sequence, and the self-increment is repeated until all cross-chain transactions complete the cross-chain operation.
8. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the method for executing cross-chain transaction sequence based on blockchain according to any one of claims 1 to 6 is implemented.
9. A non-transitory computer-readable storage medium, characterized in that The non-transitory computer-readable storage medium is used to store computer instructions. When the computer instructions are executed by the processor, the blockchain-based cross-chain transaction sequence execution method as described in any one of claims 1 to 6 is implemented.
10. An electronic device, characterized in that: include: A processor, a memory, and a computer program; wherein the processor is connected to the memory, and the computer program is stored in the memory. When the electronic device is running, the processor executes the computer program stored in the memory to enable the electronic device to execute the cross-chain transaction sequence execution method based on blockchain as described in any one of claims 1 to 6.