Cross-chain transaction processing method and device and electronic equipment

By recording transaction identification and block height in cross-chain transactions, the cross-chain transaction failure problem caused by transaction interruption is solved, and the secure storage of transaction data and subsequent restart are realized, thereby improving the success rate of cross-chain transactions.

CN119067775APending Publication Date: 2024-12-03CHINA TELECOM BESTPAY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411080054.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-07
Publication Date
2024-12-03

AI Technical Summary

Technical Problem

During cross-chain transactions, transaction interruption leads to cross-chain transaction failure, especially when performing cross-chain relay services and adapter services upgrades, the existing technology lacks effective solutions.

Method used

During cross-chain transactions, the source adapter reads transaction data from the source blockchain and writes it to the destination blockchain through the destination adapter, records the transaction identification and block height, and stores it in the database to stop reading when the transaction is suspended And continue trading from the interruption during restart to avoid missing transaction data.

Benefits of technology

It improves the execution success rate of cross-chain transactions, ensures that transaction data is not lost and can continue to be executed after interruption, and solves the failure problem caused by transaction interruption.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119067775A_ABST
    Figure CN119067775A_ABST
Patent Text Reader

Abstract

The invention discloses a cross-chain transaction processing method, a cross-chain transaction processing device and electronic equipment. Relates to the technical field of block chains, and the method comprises the steps: reading transaction data from a source block chain through a source adapter in a process of executing a cross-chain transaction, and writing the read transaction data into a target block chain through a target adapter; in response to a transaction pause operation for the cross-chain transaction, controlling the source adapter to stop reading transaction data in the source block chain, and recording a transaction identifier of the cross-chain transaction and a block height of a target block chain, the block height being used for indicating a transaction data transmission process of the cross-chain transaction; and correspondingly storing the transaction identifier and the block height in a database. According to the method and the device, the technical problem of cross-chain transaction failure caused by transaction interruption when tasks such as cross-chain relay service and adapter service upgrading are executed in a cross-chain transaction process in related technologies is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of blockchain technology, and in particular to a cross-chain transaction processing method, device and electronic device. Background Art

[0002] With the development and popularization of blockchain technology, different blockchain networks need to conduct cross-chain transactions with each other. However, due to the different structures and characteristics of different blockchain networks, transactions during cross-chain transaction system upgrades are often prone to transaction failures. In related technologies, the switch control of the adapter is mainly to open / close the link control transaction, which is prone to transaction loss, and then leads to the failure of cross-chain transaction execution.

[0003] With respect to the problem of cross-chain transaction failure due to transaction interruption when performing cross-chain relay services and adapter service upgrades in the above-mentioned related technologies during cross-chain transactions, no effective solution has been proposed so far. Summary of the invention

[0004] The embodiments of the present invention provide a cross-chain transaction processing method, device and electronic device to at least solve the technical problem in the related art that when performing tasks such as cross-chain relay services and adapter service upgrades during cross-chain transactions, cross-chain transactions fail due to transaction interruptions.

[0005] According to one aspect of an embodiment of the present invention, a cross-chain transaction processing method is provided, comprising: in the process of executing a cross-chain transaction, reading transaction data from a source blockchain through a source adapter, and writing the read transaction data to a destination blockchain through a destination adapter; in response to a transaction pause operation for the cross-chain transaction, controlling the source adapter to stop reading the transaction data in the source blockchain, and recording a transaction identifier of the cross-chain transaction, and a block height of the destination blockchain, wherein the block height is used to indicate the transaction data transmission process of the cross-chain transaction; and storing the transaction identifier and the block height in a database correspondingly.

[0006] Optionally, reading transaction data from the source blockchain through the source adapter and writing the read transaction data to the destination blockchain through the destination adapter includes: reading transaction data from the source blockchain through the source adapter, and sending the read transaction data to the destination adapter through a relay gateway; writing the read transaction data to the destination blockchain through the destination adapter.

[0007] Optionally, after storing the transaction identifier and the block height correspondingly in the database, the method further includes: generating a transaction restart instruction in response to a transaction restart operation for the cross-chain transaction; based on the transaction restart instruction, obtaining the transaction identifier and the block height of the cross-chain transaction from the database through the source adapter; starting from the block height, continuing to read transaction data from the source blockchain through the source adapter, and writing the transaction data continued to be read to the destination blockchain through the destination adapter until the cross-chain transaction is executed.

[0008] Optionally, in response to a transaction suspension operation for the cross-chain transaction, stopping reading the transaction data in the source blockchain, and recording the transaction identifier of the cross-chain transaction, and the block height of the destination blockchain, includes: generating a transaction suspension instruction in response to the transaction suspension operation; based on the transaction suspension instruction, controlling the source adapter to stop reading the transaction data in the source blockchain, and controlling the destination adapter to continue writing the transaction data already issued by the source blockchain into the destination blockchain; when the destination adapter stops writing the already issued transaction data into the destination blockchain, obtaining the block height of the destination blockchain and recording the transaction identifier of the cross-chain transaction.

[0009] Optionally, during the process of executing the cross-chain transaction, before reading transaction data from the source blockchain and sending the read transaction data to the destination blockchain, the method also includes: generating a transaction start instruction in response to a transaction start operation for the cross-chain transaction; and executing the cross-chain transaction based on the transaction start instruction.

[0010] Optionally, the method also includes: in the process of executing the cross-chain transaction, in response to a transaction closing operation for the cross-chain transaction, generating a transaction closing instruction; based on the transaction closing instruction, controlling the source adapter to stop reading the transaction data in the source blockchain, and at the same time controlling the destination adapter to stop writing the read transaction data to the destination blockchain.

[0011] Optionally, the method further includes: generating an operation instruction in response to a transaction operation for the cross-chain transaction, wherein the transaction operation is any one of the following: a transaction start operation, a transaction pause operation, a transaction restart operation, and a transaction stop operation, and the operation instruction is any one of the following: a transaction start instruction, a transaction restart instruction, a transaction pause instruction, and a transaction stop instruction; encrypting the operation instruction to obtain an encrypted instruction; and sending the encrypted instruction to the source adapter and the destination adapter through the relay gateway.

[0012] Optionally, after sending the encrypted instruction to the source adapter and the destination adapter through the relay gateway, the method further includes: receiving instruction confirmation information from the source adapter and the destination adapter respectively for the received encrypted instruction, the instruction confirmation information being used to confirm whether the received instruction of the corresponding adapter is consistent with the operation instruction, wherein the received instruction is obtained by decrypting the received encrypted instruction by the corresponding adapter; generating feedback information based on the instruction confirmation information; and sending the feedback information to the source adapter and the destination adapter respectively.

[0013] According to another aspect of an embodiment of the present invention, a cross-chain transaction processing device is also provided, including: a cross-chain transaction module, which is used to read transaction data from a source blockchain through a source adapter during the execution of a cross-chain transaction, and write the read transaction data to a destination blockchain through a destination adapter; a transaction control module, which is used to control the source adapter to stop reading transaction data in the source blockchain in response to a transaction pause operation for the cross-chain transaction, and record the transaction identifier of the cross-chain transaction and the block height of the destination blockchain, wherein the block height is used to indicate the transaction data transmission process of the cross-chain transaction; a data storage module, which is used to store the transaction identifier and the block height in a database in correspondence with each other.

[0014] According to another aspect of an embodiment of the present invention, there is also provided an electronic device, comprising one or more processors and a memory, wherein the memory is used to store one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement any one of the cross-chain transaction processing methods.

[0015] In an embodiment of the present invention, during the execution of a cross-chain transaction, transaction data is read from a source blockchain through a source adapter, and the read transaction data is written to a destination blockchain through a destination adapter; in response to a transaction suspension operation for the cross-chain transaction, the source adapter is controlled to stop reading transaction data in the source blockchain, and a transaction identifier of the cross-chain transaction and a block height of the destination blockchain are recorded, wherein the block height is used to indicate the transaction data transmission process of the cross-chain transaction; the transaction identifier and the block height are stored in a database correspondingly, so that when the cross-chain transaction needs to be suspended, the source adapter is controlled to stop reading transaction data in the source blockchain, and the transaction identifier and block height are recorded, so that when the cross-chain transaction is subsequently restarted, the transaction execution can be continued from the interruption point, thereby achieving the technical effect of avoiding the failure of the cross-chain transaction due to the lack of transaction data and improving the success rate of the cross-chain transaction execution, thereby solving the technical problem of the failure of the cross-chain transaction due to transaction interruption when performing tasks such as cross-chain relay services and adapter service upgrades during the cross-chain transaction process in the related technology. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of this application. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:

[0017] Figure 1 is a flow chart of a cross-chain transaction processing method according to an embodiment of the present invention;

[0018] Figure 2 is a schematic diagram of an optional cross-chain transaction processing system according to an embodiment of the present invention;

[0019] Figure 3 is a flowchart of an optional cross-chain transaction processing method according to an embodiment of the present invention;

[0020] Figure 4 It is a schematic diagram of a cross-chain transaction processing device according to an embodiment of the present invention. DETAILED DESCRIPTION

[0021] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.

[0022] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0023] First, to facilitate understanding of the embodiments of the present invention, some terms or nouns involved in the present invention are explained below:

[0024] An adapter is a device that adapts to different chain architectures, operates the corresponding blockchain through an integrated software development kit (SDK) and integrates some other functions.

[0025] Relay gateway, used to forward adapter requests and record transaction information.

[0026] According to an embodiment of the present invention, a method embodiment of cross-chain transaction processing is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although the logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0027] Figure 1 is a flow chart of a cross-chain transaction processing method according to an embodiment of the present invention. Figure 1 As shown, the method comprises the following steps:

[0028] Step S102, in the process of executing the cross-chain transaction, the transaction data is read from the source blockchain through the source adapter, and the read transaction data is written to the destination blockchain through the destination adapter;

[0029] Optionally, cross-chain transactions are used to indicate the transaction process of exchanging assets or data between different blockchains. A cross-chain transaction between a source blockchain and a destination blockchain can be the process of transferring transaction data in a corresponding block in the source blockchain (i.e., source block) to a corresponding block in the destination blockchain (i.e., destination block).

[0030] Optionally, the source blockchain and the destination blockchain are respectively configured with corresponding adapters, namely, a source adapter and a destination adapter, wherein the source adapter can be used to read transaction data from a source block in the source blockchain during the execution of a cross-chain transaction, and send the read transaction data to a destination block in the destination blockchain, and the destination adapter is used to write the received transaction data to the destination block in the destination blockchain.

[0031] Optionally, the execution subject of step S102 to step S106 may be a main server, which may be a cross-chain server platform (hereinafter referred to as the cross-chain platform). Through the cross-chain platform, the switch status of the source adapter and the destination adapter may be set to adjust the transaction process of the cross-chain transaction. For example, through the cross-chain platform, the start, pause, restart, and stop of the cross-chain transaction may be set, and the corresponding operation instructions may be generated and sent to the source adapter and / or the destination adapter, and the process of the cross-chain transaction may be controlled through the operation instructions.

[0032] In an optional embodiment, transaction data is read from a source blockchain through a source adapter, and the read transaction data is written to a destination blockchain through a destination adapter, including: reading transaction data from a source blockchain through a source adapter, and sending the read transaction data to a destination adapter through a relay gateway; and writing the read transaction data to a destination blockchain through a destination adapter.

[0033] Optionally, a relay gateway can be set between the source adapter and the destination adapter. The relay gateway acts as a "bridge". Through the relay gateway, the transaction data read by the source adapter can be forwarded to the destination adapter to realize cross-chain transmission of transaction data.

[0034] Optionally, the relay gateway can receive operation instructions from the cross-chain platform, adjust its own switch state according to the received operation instructions, cooperate with the source adapter and the destination adapter, and control the execution process of the cross-chain transaction.

[0035] In an optional embodiment, during the execution of a cross-chain transaction, transaction data is read from a source blockchain, and before the read transaction data is sent to a destination blockchain, the method further includes: generating a transaction start instruction in response to a transaction start operation for the cross-chain transaction; and executing the cross-chain transaction based on the transaction start instruction.

[0036] Optionally, before executing step S102, it is necessary to start a cross-chain transaction, and the transaction start operation for the cross-chain transaction is triggered through the cross-chain platform. After responding to the transaction start operation, the cross-chain platform generates a transaction start instruction, and sends the transaction start instruction to the source adapter, the destination adapter and the relay gateway at the same time to control the source adapter, the destination adapter and the relay gateway to start. After the source adapter, the destination adapter and the relay gateway respectively receive the transaction start instruction, the source adapter starts to read the corresponding transaction data from the source blockchain, the relay gateway transmits the transaction data, and the destination adapter writes the corresponding transaction data to the destination blockchain, and continues to execute the cross-chain transaction.

[0037] Optionally, after the cross-chain platform sends a transaction start instruction to the source adapter, destination adapter and relay gateway, it will synchronously store the transaction start instruction and the switch status information of the source adapter, destination adapter and relay gateway to their respective corresponding local databases to achieve real-time recording and follow-up of the cross-chain transaction process.

[0038] Step S104, in response to the transaction suspension operation for the cross-chain transaction, the source adapter is controlled to stop reading the transaction data in the source blockchain, and record the transaction identifier of the cross-chain transaction and the block height of the destination blockchain, wherein the block height is used to indicate the transaction data transmission process of the cross-chain transaction;

[0039] Optionally, when encountering scenarios such as relay gateway, server upgrade, source adapter or destination adapter upgrade, it is necessary to suspend the execution of cross-chain transactions. The transaction suspension operation for cross-chain transactions can be triggered through the cross-chain platform. After responding to the transaction suspension operation, the cross-chain platform controls the original adapter to stop reading transaction data from the corresponding block (i.e., source block) in the source blockchain to suspend the execution of cross-chain transactions. At the same time, the transaction identifier of the cross-chain transaction and the block height of the destination block in the destination blockchain are recorded accordingly. Through the corresponding record of the transaction identifier and the block height, the transaction process of the current cross-chain transaction can be marked, so that when the cross-chain transaction is restarted later, the cross-chain transaction can continue to be executed from the corresponding position of the block height to avoid the occurrence of cross-chain transaction execution failure.

[0040] Optionally, when a cross-chain transaction is suspended, in addition to recording the block height of the destination block and recording the transaction execution progress of the current cross-chain transaction through the block height of the destination block, the block height of the source block can also be recorded after the adapter stops reading the transaction data in the source blockchain, and the transaction execution progress of the current cross-chain transaction can be recorded through the block height of the source block.

[0041] In an optional embodiment, in response to a transaction pause operation for a cross-chain transaction, reading of transaction data in a source blockchain is stopped, and a transaction identifier of the cross-chain transaction and a block height of a destination blockchain are recorded, including: in response to the transaction pause operation, a transaction pause instruction is generated; based on the transaction pause instruction, a source adapter is controlled to stop reading transaction data in a source blockchain, and a destination adapter is controlled to continue writing transaction data already issued by the source blockchain to the destination blockchain; when the destination adapter stops writing transaction data already issued to the destination blockchain, the block height of the destination blockchain is obtained, and the transaction identifier of the cross-chain transaction is recorded.

[0042] Optionally, a transaction suspension operation for a cross-chain transaction is triggered through the cross-chain platform. After responding to the transaction suspension operation, the cross-chain platform can generate a corresponding transaction suspension instruction and send the transaction suspension instruction to the source adapter, the destination adapter and the relay gateway at the same time to control the source adapter to shut down and stop reading the transaction data in the source blockchain, but does not control the shutdown of the relay gateway and the destination adapter. At this time, the transaction data that has been sent by the source blockchain will continue to be written to the destination blockchain through the destination adapter until all the transaction data that has been sent is written to the destination blockchain, or the destination adapter stops writing transaction data due to the failure of the relay gateway and the destination adapter. When the destination adapter stops writing the transaction data that has been sent to the destination blockchain, the transaction identifier of the cross-chain transaction and the block height of the destination block in the destination blockchain are recorded accordingly, so that when the cross-chain transaction is restarted later, the cross-chain transaction can continue to be executed from the position corresponding to the block height.

[0043] It should be noted that the block height of the destination blockchain is the block height of the destination block in the destination blockchain, and the destination block is the block in the destination blockchain used to receive transaction data from the source blockchain. By recording the block height of the destination block, the data reception process of the destination block can be reflected. When the cross-chain transaction process is restarted, the data reception progress of the destination block can be determined according to the block height of the destination block, and then it can be determined which transaction data needs to be transmitted to the destination block, thereby accurately reflecting the transaction data transmission process of the cross-chain transaction, and avoiding the failure of the relay gateway or the destination adapter to cause some of the transaction data that has been sent to be unable to be written normally to the destination blockchain, thereby causing the transaction data of the cross-chain transaction to be missing.

[0044] Step S106, storing the transaction identifier and block height in the database in correspondence.

[0045] Optionally, after the cross-chain transaction is suspended and the transaction identifier of the cross-chain transaction and the block height of the destination block are obtained, the transaction identifier and the block height of the destination block can be stored in a database corresponding to each other. The database can be a local database corresponding to the cross-chain platform, or a local database corresponding to the cross-chain platform, the source adapter, and the destination adapter. That is, the transaction identifier and the block height of the destination block can be stored in a local database corresponding to the cross-chain platform, the source adapter, and the destination adapter at the same time. When the cross-chain transaction process needs to be restarted later, the corresponding block height can be directly retrieved from the database through the transaction identifier query, so that when the cross-chain transaction is restarted later, the cross-chain transaction can continue to be executed from the position corresponding to the block height to avoid the occurrence of cross-chain transaction execution failure.

[0046] In an optional embodiment, after storing the transaction identifier and block height correspondingly in the database, the method further includes: generating a transaction restart instruction in response to a transaction restart operation for a cross-chain transaction; based on the transaction restart instruction, obtaining the transaction identifier and block height of the cross-chain transaction from the database through the source adapter; starting from the block height, continuing to read transaction data from the source blockchain through the source adapter, and writing the transaction data that continues to be read to the destination blockchain through the destination adapter until the cross-chain transaction is executed.

[0047] Optionally, when the relay gateway, server upgrade, source adapter or destination adapter upgrade is completed, the cross-chain transactions that have not been completed need to be restarted. The transaction restart operation for the cross-chain transaction can be triggered through the cross-chain platform. After responding to the transaction restart operation, the cross-chain platform generates a transaction restart instruction and sends the transaction restart instruction to the source adapter, relay gateway and destination adapter at the same time to control the source adapter, relay gateway and destination adapter to restart. The source adapter can start from the recorded block height and continue to read the corresponding transaction data in the source block. The relay gateway will continue to send the read transaction data to the destination adapter, and the destination adapter will write the transaction data to the destination block. In the above method, the source adapter can continue to read the transaction data from the pre-recorded block height, thereby ensuring the uninterrupted execution of the cross-chain transaction, avoiding the occurrence of missing or repeated reading of transaction data, and ensuring the smooth execution of the cross-chain transaction.

[0048] In an optional embodiment, the method further includes: in the process of executing a cross-chain transaction, in response to a transaction closing operation for the cross-chain transaction, generating a transaction closing instruction; based on the transaction closing instruction, controlling the source adapter to stop reading the transaction data in the source blockchain, and controlling the destination adapter to stop writing the read transaction data to the destination blockchain.

[0049] Optionally, when a cross-chain transaction needs to be closed during its execution, a transaction closing operation for the cross-chain transaction can be triggered through the cross-chain platform. After responding to the transaction closing operation, the cross-chain platform will generate a corresponding transaction closing instruction and send the transaction closing instruction to the source adapter, relay gateway, and destination adapter at the same time. The transaction closing instruction can simultaneously control the shutdown of the source adapter and the destination adapter. At this time, all read and write operations of the transaction data are stopped, thereby ensuring that the cross-chain transaction can be completely closed.

[0050] In an optional embodiment, the method further includes: generating an operation instruction in response to a transaction operation for a cross-chain transaction, wherein the transaction operation is any one of the following: a transaction start operation, a transaction pause operation, a transaction restart operation, and a transaction stop operation, and the operation instruction is any one of the following: a transaction start instruction, a transaction restart instruction, a transaction pause instruction, and a transaction stop instruction; encrypting the operation instruction to obtain an encrypted instruction; and sending the encrypted instruction to the source adapter and the destination adapter via a relay gateway.

[0051] Optionally, after triggering a transaction operation for a cross-chain transaction (such as a transaction start operation, a transaction pause operation, a transaction restart operation, a transaction stop operation, etc.) through the cross-chain platform, a corresponding operation instruction (such as a transaction start instruction, a transaction restart instruction, a transaction pause instruction, a transaction stop instruction, etc.) can be generated for the transaction operation through the cross-chain platform, and the operation instruction can be further sent to the source adapter and the destination adapter in an encrypted form (and can also be sent to the relay gateway at the same time), thereby achieving the secure execution of cross-chain transactions.

[0052] In an optional embodiment, after sending the encrypted instruction to the source adapter and the destination adapter through the relay gateway, the method also includes: receiving instruction confirmation information from the source adapter and the destination adapter respectively for the received encrypted instruction, the instruction confirmation information being used to confirm whether the received instruction of the corresponding adapter is consistent with the operation instruction, wherein the received instruction is obtained by decrypting the received encrypted instruction by the corresponding adapter; generating feedback information based on the instruction confirmation information; and sending the feedback information to the source adapter and the destination adapter respectively.

[0053] Optionally, after receiving the encrypted instruction, the adapter (i.e., the source adapter and the destination adapter) will decrypt the received encrypted instruction, generate corresponding instruction confirmation information based on the decryption result, and feed back the instruction confirmation information in encrypted form to the cross-chain platform. The cross-chain platform can confirm whether the adapter has successfully received the operation instruction based on the received instruction confirmation information, and send feedback information to the adapter in encrypted form to inform the adapter whether it has successfully received the correct operation instruction. Through the above repeated confirmations, it can be ensured that the source adapter and the destination adapter can accurately receive the corresponding operation instructions, thereby ensuring the smooth execution of cross-chain transactions.

[0054] Through the above steps S102 to S106, when it is necessary to suspend the cross-chain transaction, the source adapter can be controlled to stop reading the transaction data in the source blockchain and record the transaction identifier and block height, so that when the cross-chain transaction is subsequently restarted, the transaction can be continued from the interruption point, thereby achieving the technical effect of avoiding the failure of the cross-chain transaction due to the lack of transaction data and improving the success rate of the cross-chain transaction execution, and then solving the technical problem of the failure of the cross-chain transaction due to the interruption of the transaction when performing the cross-chain relay service and the adapter service upgrade in the cross-chain transaction process in the related technology.

[0055] Based on the above embodiments and optional embodiments, the present invention proposes an optional implementation mode: Figure 2 is a schematic diagram of an optional cross-chain transaction processing system according to an embodiment of the present invention, such as Figure 2 As shown, the system includes an adapter module, a cross-chain platform module and a relay gateway module, wherein:

[0056] The adapter module (including source adapter and destination adapter) is used to complete the mutual recognition and confirmation of identity with the cross-blockchain and cross-chain relay chain (i.e., relay gateway) in the local area and receive requests from the cross-chain server platform (hereinafter referred to as the cross-chain platform), establish cross-chain communication data information and switch control information to store in the corresponding local database (database, db), and monitor the source blockchain transaction information or destination blockchain transaction information in the cross-chain communication according to the data information related to the cross-chain communication (source blockchain / destination blockchain / adapter deployment address / port / affiliated organization) and the switch control information of the adapter (contract / method / event), and match the cross-chain contract / method / event. The local / cross-region adapter switch status is updated through multiple communication confirmation mechanisms with the cross-chain platform. The adapter end starts the switch timing scanning task, records the current block height record and the current block position, monitors the switch status in real time, and controls whether the adapter reads the block, opens, pauses, and closes the transaction channel between the adapter and the relay gateway.

[0057] The cross-chain platform module is used to establish a platform interface for users to connect with the backend, create a cross-chain communication connection through the cross-chain platform (connect transaction / start transaction / pause transaction / close transaction), and store the cross-chain information between the source blockchain and the destination blockchain, including contract name, contract method, switch status, adapter information (deployed address), etc. in the local database. Through the interface operation, multi-chain switch control operation is realized, and one-click control is achieved to establish a cross-chain communication state between the source blockchain and the destination blockchain, and the uncompleted cross-chain transaction is rolled back through the current state, and the transaction status and transaction progress of the current cross-chain transaction are checked through the interface.

[0058] The relay gateway module is used to synchronize the switch status information from the cross-chain platform, and control whether to continue processing or roll back the cross-chain transaction according to the source adapter information and the destination adapter information, and whether to continue forwarding the cross-chain transaction related data to the corresponding adapter.

[0059] Based on the above embodiments and optional embodiments, the present invention proposes an optional implementation mode: Figure 3 is a flowchart of an optional cross-chain transaction processing method according to an embodiment of the present invention, such as Figure 3 As shown, the method specifically includes:

[0060] Through the cross-chain platform, find the cross-chain transaction that needs to be operated, as well as the cross-chain communication corresponding to the cross-chain transaction, send operation instructions (such as transaction start instructions, transaction stop instructions, transaction pause instructions, etc.), and the cross-chain platform program records the operation instruction status to the corresponding local database. After successful saving, the cross-chain platform uses the currently recorded source adapter information, destination adapter information (deployment address, port number, currently used contract), etc. to encrypt the instructions to the source adapter and destination adapter through the Advanced Encryption Standard (AES) through the relay gateway http communication. The source adapter and the destination adapter receive the information decryption instruction (here the adapter will confirm the switch status with the cross-chain platform again to ensure that the instruction is received, and the cross-chain server will initiate confirmation after receiving the request). After confirming that the reception status is successful, the database switch status associated with the adapter is updated.

[0061] The adapter itself monitors the switch status of the adapter (source adapter and destination adapter) recorded in the database, and reads / stops reading and writes / stops writing the block of the blockchain connected to the adapter (i.e., the source block connected to the source adapter and the destination block connected to the destination adapter) according to the current status. When the cross-chain transaction is suspended, the source adapter is stopped from continuing to read the transaction data in the source block. In this way, the source adapter will suspend the cross-chain transaction if it cannot read the transaction data of the source block, but will not stop the sent transaction from being written to the destination blockchain (i.e., the cross-chain). At this time, the block height and transaction identifier id of the source block are recorded. When started, the remaining transaction data is read from the source block from the breakpoint block height, so as to achieve the purpose of breakpoint continuation without losing transaction data. In the closed state, the destination adapter will be prevented from writing transaction data to the destination blockchain, and the source adapter will be prevented from reading transaction data. The transaction data of failed cross-chain transactions will be rolled back and recorded in the local database corresponding to the source adapter, and will be continued to be processed according to the next switch status.

[0062] The above embodiments can be used in scenarios where cross-chain transactions need to be suspended, such as relay gateways, server upgrades, source adapters or destination adapters that need to be upgraded. When cross-chain relay services and adapter services need to be upgraded, in order to avoid transaction failures caused by upgrades, transactions are suspended through the cross-chain platform. At this time, the transaction does not fail, but stops scanning the transaction data on the source block and stops sending. After the upgrade is successful, the cross-chain transaction is resumed and the transaction data is continued from the breakpoint. The purpose of pausing the cross-chain transaction and upgrading the local program safely is achieved by controlling the switch of the cross-chain service, and the transaction is continued at the paused position after the cross-chain transaction is restarted, thereby ensuring that no transaction data is lost in the middle.

[0063] This embodiment can achieve at least one of the following effects: 1) The cross-chain platform is uniformly controlled and synchronizes control information to the adapter (i.e., the source adapter and the destination adapter). The adapter controls the start, pause, and breakpoint (block height of the paused transaction) of the cross-chain transaction through status scanning. Compared with related technologies, it adds the recording of the breakpoint position and continues the processing after starting. 2) Combined with the relay chain cross-chain technology, the cross-chain platform centrally dispatches instructions to the adapter end to control the switch execution action of the adapter. Compared with related technologies, it is convenient to centrally manage the cross-chain communication status through the cross-chain platform.

[0064] In this embodiment, a cross-chain transaction processing device is also provided, which is used to implement the above embodiments and preferred implementations, and will not be repeated here. As used below, the terms "module" and "device" can implement a combination of software and / or hardware for a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.

[0065] According to an embodiment of the present invention, a device embodiment for implementing the above cross-chain transaction processing method is also provided. Figure 4 is a schematic diagram of the structure of a cross-chain transaction processing device according to an embodiment of the present invention. Figure 4 As shown, the cross-chain transaction processing device includes: a cross-chain transaction module 400, a transaction control module 402, and a data storage module 404, wherein:

[0066] The cross-chain transaction module 400 is used to read transaction data from a source blockchain through a source adapter and write the read transaction data to a destination blockchain through a destination adapter during the execution of a cross-chain transaction;

[0067] The transaction control module 402 is connected to the cross-chain transaction module 400 and is used to control the source adapter to stop reading the transaction data in the source blockchain in response to the transaction suspension operation for the cross-chain transaction, and record the transaction identifier of the cross-chain transaction and the block height of the destination blockchain, wherein the block height is used to indicate the transaction data transmission process of the cross-chain transaction;

[0068] The data storage module 404 is connected to the transaction control module 402 and is used to store the transaction identifier and the block height in the database in correspondence.

[0069] In the embodiment of the present invention, a cross-chain transaction module 400 is provided to read transaction data from a source blockchain through a source adapter during a cross-chain transaction, and write the read transaction data to a destination blockchain through a destination adapter; a transaction control module 402 is connected to the cross-chain transaction module 400, and is used to control the source adapter to stop reading transaction data in the source blockchain in response to a transaction suspension operation for a cross-chain transaction, and record a transaction identifier of the cross-chain transaction, and a block height of the destination blockchain, wherein the block height is used to indicate the transaction data transmission process of the cross-chain transaction; a data storage module 404 is connected to the transaction The control module 402 is used to store the transaction identifier and the block height in the database in correspondence, so that when the cross-chain transaction needs to be suspended, the source adapter is controlled to stop reading the transaction data in the source blockchain and record the transaction identifier and block height, so that when the cross-chain transaction is restarted later, the transaction can be continued from the interruption point, thereby achieving the technical effect of avoiding the failure of cross-chain transactions caused by missing transaction data and improving the success rate of cross-chain transaction execution, and further solving the technical problem of cross-chain transaction failure due to transaction interruption when executing cross-chain relay services and adapter service upgrades in the cross-chain transaction process in the related technology.

[0070] It should be noted that the above modules can be implemented by software or hardware. For example, for the latter, it can be implemented in the following ways: the above modules can be located in the same processor; or the above modules can be located in different processors in any combination.

[0071] It should be noted that the cross-chain transaction module 400, the transaction control module 402, and the data storage module 404 correspond to steps S102 to S106 in the embodiment, and the examples and application scenarios implemented by the modules and the corresponding steps are the same, but are not limited to the contents disclosed in the above embodiments. It should be noted that the modules as part of the device can be run in a computer terminal.

[0072] It should be noted that the optional or preferred implementation of this embodiment can refer to the relevant description in the embodiment, which will not be repeated here.

[0073] The above-mentioned cross-chain transaction processing device may also include a processor and a memory. The above-mentioned cross-chain transaction module 400, transaction control module 402, data storage module 404, etc. are all stored in the memory as program modules, and the processor executes the above-mentioned program modules stored in the memory to realize corresponding functions.

[0074] The processor includes a kernel, which retrieves the corresponding program module from the memory. The kernel may be one or more. The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. The memory includes at least one memory chip.

[0075] According to an embodiment of the present application, an embodiment of a non-volatile storage medium is also provided. Optionally, in this embodiment, the non-volatile storage medium includes a stored program, wherein when the program is running, the device where the non-volatile storage medium is located is controlled to execute any of the above cross-chain transaction processing methods.

[0076] Optionally, in this embodiment, the non-volatile storage medium may be located in any computer terminal in a computer terminal group in a computer network, or in any mobile terminal in a mobile terminal group, and the non-volatile storage medium includes a stored program.

[0077] Optionally, when the program is running, the device where the non-volatile storage medium is located is controlled to perform the following functions: in the process of executing a cross-chain transaction, transaction data is read from the source blockchain through the source adapter, and the read transaction data is written to the destination blockchain through the destination adapter; in response to a transaction pause operation for the cross-chain transaction, the source adapter is controlled to stop reading the transaction data in the source blockchain, and the transaction identifier of the cross-chain transaction and the block height of the destination blockchain are recorded, wherein the block height is used to indicate the transaction data transmission process of the cross-chain transaction; the transaction identifier and the block height are stored in the database accordingly.

[0078] According to an embodiment of the present application, an embodiment of a processor is also provided. Optionally, in this embodiment, the processor is used to run a program, wherein when the program is running, it is suitable for executing a program that is initialized with the following method steps: in the process of executing a cross-chain transaction, the transaction data is read from the source blockchain through the source adapter, and the read transaction data is written to the destination blockchain through the destination adapter; in response to a transaction suspension operation for a cross-chain transaction, the source adapter is controlled to stop reading the transaction data in the source blockchain, and the transaction identifier of the cross-chain transaction and the block height of the destination blockchain are recorded, wherein the block height is used to indicate the transaction data transmission process of the cross-chain transaction; the transaction identifier and the block height are stored in the database accordingly.

[0079] According to an embodiment of the present application, an embodiment of a computer program product is also provided, which, when executed on a data processing device, is suitable for executing a program that initializes any of the above-mentioned cross-chain transaction processing method steps.

[0080] Optionally, the above-mentioned computer program product, when executed on a data processing device, is suitable for executing a program initialized with the following method steps: in the process of executing a cross-chain transaction, reading transaction data from the source blockchain through the source adapter, and writing the read transaction data to the destination blockchain through the destination adapter; in response to a transaction pause operation for the cross-chain transaction, controlling the source adapter to stop reading the transaction data in the source blockchain, and recording the transaction identifier of the cross-chain transaction, and the block height of the destination blockchain, wherein the block height is used to indicate the transaction data transmission process of the cross-chain transaction; and storing the transaction identifier and the block height in the database accordingly.

[0081] An embodiment of the present invention provides an electronic device, which includes a processor, a memory, and a program stored in the memory and executable on the processor. When the processor executes the program, the following steps are implemented: in the process of executing a cross-chain transaction, transaction data is read from a source blockchain through a source adapter, and the read transaction data is written to a destination blockchain through a destination adapter; in response to a transaction pause operation for a cross-chain transaction, the source adapter is controlled to stop reading transaction data in the source blockchain, and a transaction identifier of the cross-chain transaction and a block height of the destination blockchain are recorded, wherein the block height is used to indicate the transaction data transmission process of the cross-chain transaction; and the transaction identifier and the block height are stored in a database correspondingly.

[0082] The above sequence of the embodiments of the present invention is for description only and does not represent the superiority or inferiority of the embodiments.

[0083] In the above embodiments of the present invention, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0084] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of the above modules can be a logical function division. There may be other division methods in actual implementation, such as multiple modules or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, modules or indirect coupling or communication connection of modules, which can be electrical or other forms.

[0085] The modules described above as separate components may or may not be physically separated, and the components shown as modules may or may not be physical modules, that is, they may be located in one place or distributed on multiple modules. Some or all of the modules may be selected according to actual needs to achieve the purpose of the present embodiment.

[0086] In addition, each functional module in each embodiment of the present invention may be integrated into one processing module, or each module may exist physically separately, or two or more modules may be integrated into one module. The above-mentioned integrated module may be implemented in the form of hardware or in the form of software functional modules.

[0087] If the above-mentioned integrated module is implemented in the form of a software function module and sold or used as an independent product, it can be stored in a computer-readable non-volatile storage medium. Based on this understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a non-volatile storage medium, including a number of instructions to enable a computer device (which can be a personal computer, server or network device, etc.) to perform all or part of the steps of the various embodiments of the present invention. The aforementioned non-volatile storage medium includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, magnetic disk or optical disk and other media that can store program codes.

[0088] The above are only preferred embodiments of the present invention. It should be pointed out that, for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.

Claims

1. A cross-chain transaction processing method, characterized in that: include: In the process of executing cross-chain transactions, the transaction data is read from the source blockchain through the source adapter, and the read transaction data is written to the destination blockchain through the destination adapter; In response to a transaction suspension operation for the cross-chain transaction, controlling the source adapter to stop reading transaction data in the source blockchain, and recording a transaction identifier of the cross-chain transaction and a block height of the destination blockchain, wherein the block height is used to indicate a transaction data transmission process of the cross-chain transaction; The transaction identifier and the block height are stored in a database in correspondence.

2. The method according to claim 1, characterized in that The reading of transaction data from the source blockchain through the source adapter and writing the read transaction data to the destination blockchain through the destination adapter includes: Reading transaction data from the source blockchain through the source adapter, and sending the read transaction data to the destination adapter through a relay gateway; The read transaction data is written to the destination blockchain through the destination adapter.

3. The method according to claim 1, characterized in that After storing the transaction identifier and the block height in a database in correspondence, the method further includes: In response to a transaction restart operation for the cross-chain transaction, generating a transaction restart instruction; Based on the transaction restart instruction, obtaining the transaction identifier and the block height of the cross-chain transaction from the database through the source adapter; Starting from the block height, the transaction data is continued to be read from the source blockchain through the source adapter, and the transaction data continued to be read is written to the destination blockchain through the destination adapter until the cross-chain transaction is completed.

4. The method according to claim 1, characterized in that: In response to the transaction suspension operation for the cross-chain transaction, stopping reading the transaction data in the source blockchain, and recording the transaction identifier of the cross-chain transaction and the block height of the destination blockchain, includes: In response to the trading suspension operation, generating a trading suspension instruction; Based on the transaction suspension instruction, control the source adapter to stop reading the transaction data in the source blockchain, and control the destination adapter to continue writing the transaction data already issued by the source blockchain into the destination blockchain; When the destination adapter stops writing the sent transaction data into the destination blockchain, the block height of the destination blockchain is obtained, and the transaction identifier of the cross-chain transaction is recorded.

5. The method according to claim 1, characterized in that: In the process of performing the cross-chain transaction, before reading the transaction data from the source blockchain and sending the read transaction data to the destination blockchain, the method further includes: In response to a transaction start operation for the cross-chain transaction, generating a transaction start instruction; Based on the transaction start instruction, the cross-chain transaction is executed.

6. The method according to claim 1, characterized in that The method further comprises: In the process of executing the cross-chain transaction, in response to a transaction closing operation for the cross-chain transaction, generating a transaction closing instruction; Based on the transaction closing instruction, the source adapter is controlled to stop reading the transaction data in the source blockchain, and the destination adapter is controlled to stop writing the read transaction data to the destination blockchain.

7. The method according to claim 2, characterized in that The method further comprises: In response to a transaction operation for the cross-chain transaction, an operation instruction is generated, wherein the transaction operation is any one of the following: a transaction start operation, a transaction pause operation, a transaction restart operation, and a transaction stop operation, and the operation instruction is any one of the following: a transaction start instruction, a transaction restart instruction, a transaction pause instruction, and a transaction stop instruction; Encrypting the operation instruction to obtain an encrypted instruction; The encryption instruction is sent to the source adapter and the destination adapter through the relay gateway.

8. The method according to claim 7, characterized in that After sending the encryption instruction to the source adapter and the destination adapter through the relay gateway, the method further includes: Receiving instruction confirmation information from the source adapter and the destination adapter respectively for the received encrypted instruction, the instruction confirmation information being used to confirm whether the received instruction of the corresponding adapter is consistent with the operation instruction, wherein the received instruction is obtained by the corresponding adapter decrypting the received encrypted instruction; generating feedback information based on the instruction confirmation information; The feedback information is sent to the source adapter and the destination adapter respectively.

9. A cross-chain transaction processing device, characterized in that: include: The cross-chain transaction module is used to read transaction data from the source blockchain through the source adapter and write the read transaction data to the destination blockchain through the destination adapter during the execution of the cross-chain transaction; A transaction control module, configured to, in response to a transaction suspension operation for the cross-chain transaction, control the source adapter to stop reading the transaction data in the source blockchain, and record the transaction identifier of the cross-chain transaction and the block height of the destination blockchain, wherein the block height is used to indicate the transaction data transmission process of the cross-chain transaction; The data storage module is used to store the transaction identifier and the block height in a database in correspondence.

10. An electronic device, characterized in that: It includes one or more processors and a memory, wherein the memory is used to store one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the cross-chain transaction processing method described in any one of claims 1 to 8.