Cross-chain transaction control method and device, electronic equipment and storage medium

Through the control method of the global transaction coordinator, resources are locked and events and receipts are forwarded, and the problems of cross-chain transaction atomicity and flexibility are solved, achieving efficient and reliable cross-chain transactions.

CN119806755APending Publication Date: 2025-04-11AISINO CORPORATION
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411864052.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-17
Publication Date
2025-04-11

AI Technical Summary

Technical Problem

How to ensure the atomicity of cross-chain transactions and improve the flexibility of cross-chain transactions, especially under the limitations of notary technology and relay chain technology.

Method used

Through the control method of the global transaction coordinator, cross-chain events constructed by the source chain are obtained, the target chain is determined, and the event and receipt are forwarded after the target chain locks the resource. If the operation receipt is successful, a transaction submission instruction is sent to ensure resource unlocking and transaction status updates of the source and target chains.

Benefits of technology

The atomicity of cross-chain transactions is realized, ensuring that both the source and target chains are either successfully executed or failed, improving the flexibility of cross-chain transactions and the timeliness and effectiveness of transaction execution.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119806755A_ABST
    Figure CN119806755A_ABST
Patent Text Reader

Abstract

The invention discloses a cross-chain transaction control method and device, electronic equipment and a storage medium, and belongs to the technical field of blockchains, and the method comprises the steps: obtaining a cross-chain event constructed by a source chain, and determining a target chain of a cross-chain transaction in the cross-chain event; the cross-chain event is constructed after the source chain changes a first transaction state into a pre-submission state and locks a first resource; forwarding the cross-chain event to the target chain and receiving an operation receipt of the cross-chain event sent by the target chain; the operation receipt is constructed after the target chain changes a second transaction state into a pre-submission state and locks a second resource corresponding to the first resource; if the operation receipt indicates that the transaction succeeds, a transaction submission instruction is sent to the source chain and the target chain, so that the source chain and the target chain unlock corresponding resources based on the transaction submission instruction, and the corresponding transaction state is changed to be submitted; and when the received transaction submission results of the source chain and the target chain are both successful submission, confirming that the cross-chain transaction is completed. The atomicity of the cross-chain transaction is ensured, and the flexibility of the cross-chain transaction is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of blockchain technology, and in particular to a method, device, electronic device and storage medium for controlling cross-chain transactions. Background Art

[0002] With the development of blockchain technology, many different types of blockchain networks have emerged, each with its own ledger, consensus mechanism and smart contract platform, which limits the interoperability of data between these networks. In order to enable transactions between different blockchains, cross-chain transactions are generated, and ensuring the atomicity of cross-chain transactions is the key to ensuring the consistency and integrity of cross-chain transactions. The atomicity of cross-chain transactions means that the source chain and the target chain of the cross-chain transaction are either executed successfully or failed. If the execution fails, it needs to be restored to the unexecuted state.

[0003] At present, the commonly used cross-chain technologies mainly include notary technology and relay chain technology. Among them, notary technology is based on cross-chain interoperation by notaries, and notaries are required to ensure the atomicity of transactions and the validity of each transaction in the transaction. However, notary technology is generally suitable for cross-chain interaction between two chains with a strong trust relationship, and has poor flexibility. Relay chain technology is to perform cross-chain operations and transaction control by adding a relay chain. However, the deployment of the relay chain model is also more complicated, and the target chain usually executes transactions directly according to cross-chain events, that is, the relevant resources have been unlocked before the transaction is completed. In this way, if the subsequent verification fails or there is a problem with the source chain, the atomicity of the cross-chain transaction may not be guaranteed.

[0004] Therefore, how to ensure the atomicity of cross-chain transactions and improve the flexibility of cross-chain transactions is a technical problem that needs to be solved urgently. Summary of the invention

[0005] The embodiments of the present application provide a cross-chain transaction control method, device, electronic device, and storage medium to ensure the atomicity of cross-chain transactions and improve the flexibility of cross-chain transactions.

[0006] In a first aspect, an embodiment of the present application provides a method for controlling a cross-chain transaction, which is applied to a global transaction coordinator, and the method includes:

[0007] Obtain a cross-chain event constructed by a source chain, and determine a target chain of a cross-chain transaction in the cross-chain event; wherein the cross-chain event is constructed by the source chain after changing a first transaction state to a pre-commit state and locking a first resource; and the first resource is a transaction resource of the cross-chain transaction;

[0008] Forwarding the cross-chain event to the target chain and receiving an operation receipt for the cross-chain event sent by the target chain; wherein the operation receipt is constructed by the target chain after changing the second transaction state to a pre-commit state and locking a second resource corresponding to the first resource;

[0009] If the operation receipt indicates that the transaction is successful, a transaction submission instruction is sent to the source chain and the target chain, so that the source chain and the target chain respectively unlock corresponding resources and change the corresponding transaction status to submitted based on the transaction submission instruction;

[0010] When the transaction submission results of the source chain and the target chain are both received as successful, the transaction submission results are recorded and the cross-chain transaction is confirmed to be completed.

[0011] In some embodiments, before forwarding the cross-chain event to the target chain, the process further includes:

[0012] Based on the cross-chain event, the connectivity status of the target chain is determined to be connected, and the transaction proof of the source chain is verified to be passed.

[0013] In some embodiments, the method further comprises:

[0014] If the connection status of the target chain is disconnected or the transaction proof verification of the source chain fails, a rollback instruction is sent to the source chain.

[0015] In some embodiments, before sending the transaction submission instruction to the source chain and the target chain, the process further includes:

[0016] Based on the operation receipt, it is determined that the transaction proof of the target chain is verified and passed, and it is determined that the cross-chain transaction has not timed out.

[0017] In some embodiments, the method further comprises:

[0018] If the transaction proof verification of the target chain fails or the cross-chain transaction times out, a rollback instruction is sent to the source chain.

[0019] In some embodiments, the method further comprises:

[0020] According to a preset detection cycle, detecting the connectivity of the source chain and detecting the connectivity of the target chain;

[0021] Recording and analyzing the detection results of the source chain and the detection results of the target chain;

[0022] If the detection result of the source chain and the detection result of the target chain are both connected, when a cross-chain event constructed by the source chain is obtained, the cross-chain event is processed;

[0023] If the detection result of the target chain is disconnected, when a cross-chain event constructed by the source chain is obtained, the cross-chain event is not processed.

[0024] In a second aspect, an embodiment of the present application provides a method for controlling a cross-chain transaction, which is applied to a target chain, and the method includes:

[0025] Get cross-chain events sent by the global transaction coordinator;

[0026] Based on the cross-chain event, execute a cross-chain transaction;

[0027] Change the transaction status to pre-commit status and lock the target resource;

[0028] Sending an operation receipt for the cross-chain event to the global transaction coordinator;

[0029] When receiving the transaction commit instruction sent by the global transaction coordinator, unlocking the target resource and changing the transaction status to committed;

[0030] Sending the transaction submission result of the target chain to the global transaction coordinator.

[0031] In a third aspect, an embodiment of the present application provides a control device for a cross-chain transaction, which is applied to a global transaction coordinator, and the device includes:

[0032] A first determination module is used to obtain a cross-chain event constructed by a source chain and determine a target chain of a cross-chain transaction in the cross-chain event; wherein the cross-chain event is constructed by the source chain after changing the first transaction state to a pre-commit state and locking a first resource; and the first resource is a transaction resource of the cross-chain transaction;

[0033] A forwarding module, used to forward the cross-chain event to the target chain and receive an operation receipt for the cross-chain event sent by the target chain; wherein the operation receipt is constructed by the target chain after changing the second transaction state to a pre-commit state and locking a second resource corresponding to the first resource;

[0034] A sending module, configured to send a transaction submission instruction to the source chain and the target chain if the operation receipt indicates that the transaction is successful, so that the source chain and the target chain respectively unlock corresponding resources and change the corresponding transaction status to submitted based on the transaction submission instruction;

[0035] The second determination module is used to record the transaction submission result and confirm the completion of the cross-chain transaction when the transaction submission results of the source chain and the target chain are both successfully submitted.

[0036] In some embodiments, it also includes:

[0037] A verification module is used to determine that the connectivity status of the target chain is connected based on the cross-chain event before the forwarding module forwards the cross-chain event to the target chain, and to verify the transaction proof of the source chain.

[0038] In some embodiments, the verification module is further used to:

[0039] If the connection status of the target chain is disconnected or the transaction proof verification of the source chain fails, a rollback instruction is sent to the source chain.

[0040] In some embodiments, before the sending module sends a transaction submission instruction to the source chain and the target chain, the verification module is further configured to:

[0041] Based on the operation receipt, it is determined that the transaction proof of the target chain is verified and passed, and it is determined that the cross-chain transaction has not timed out.

[0042] In some embodiments, the verification module is further used to:

[0043] If the transaction proof verification of the target chain fails or the cross-chain transaction times out, a rollback instruction is sent to the source chain.

[0044] In some embodiments, it also includes:

[0045] A detection module, used to detect the connectivity of the source chain and the connectivity of the target chain according to a preset detection cycle;

[0046] Recording and analyzing the detection results of the source chain and the detection results of the target chain;

[0047] If the detection result of the source chain and the detection result of the target chain are both connected, when a cross-chain event constructed by the source chain is obtained, the cross-chain event is processed;

[0048] If the detection result of the target chain is disconnected, when a cross-chain event constructed by the source chain is obtained, the cross-chain event is not processed.

[0049] In a fourth aspect, an embodiment of the present application provides a control device for a cross-chain transaction, which is applied to a target chain, and the device includes:

[0050] The acquisition module is used to obtain cross-chain events sent by the global transaction coordinator;

[0051] An execution module, used to execute a cross-chain transaction based on the cross-chain event;

[0052] A first change module, used to change the transaction state to a pre-commit state and lock the target resource;

[0053] A first sending module, configured to send an operation receipt for the cross-chain event to the global transaction coordinator;

[0054] A second changing module is used to unlock the target resource and change the transaction status to committed when receiving a transaction commit instruction sent by the global transaction coordinator;

[0055] The second sending module is used to send the transaction submission result of the target chain to the global transaction coordinator.

[0056] In a fifth aspect, an embodiment of the present application provides an electronic device, comprising: at least one processor, and a memory communicatively connected to the at least one processor, wherein:

[0057] The memory stores a computer program that can be executed by at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the cross-chain transaction control method provided by the first aspect or the second aspect above.

[0058] In a sixth aspect, an embodiment of the present application provides a storage medium. When a computer program in the storage medium is executed by a processor of an electronic device, the electronic device can execute the cross-chain transaction control method provided in the first or second aspect above.

[0059] In the seventh aspect, an embodiment of the present application provides a computer program product. When the computer program product is called and executed by an electronic device, the electronic device executes the cross-chain transaction control method provided by the first aspect or the second aspect above.

[0060] In an embodiment of the present application, a cross-chain event constructed by a source chain is obtained, and a target chain of a cross-chain transaction in the cross-chain event is determined; the cross-chain event is constructed by the source chain after changing a first transaction state to a pre-committed state and locking a first resource; the first resource is a transaction resource of a cross-chain transaction; the cross-chain event is forwarded to a target chain and an operation receipt for the cross-chain event sent by the target chain is received; the operation receipt is constructed by the target chain after changing a second transaction state to a pre-committed state and locking a second resource corresponding to the first resource; if the operation receipt indicates that the transaction is successful, a transaction submission instruction is sent to the source chain and the target chain, so that the source chain and the target chain respectively unlock the corresponding resources and change the corresponding transaction state to submitted based on the transaction submission instruction; when the transaction submission results received from the source chain and the target chain are both submitted successfully, the transaction submission result is recorded and the completion of the cross-chain transaction is confirmed. In this way, by configuring the pre-commit status of each application chain, the transaction status of each application chain participating in the cross-chain after executing the transaction is in the pre-commit status. When the global transaction coordinator determines that the target chain transaction is successful, it sends a transaction submission instruction to each application chain, ensuring the atomicity of cross-chain transactions, improving the flexibility of cross-chain transactions, and the timeliness and effectiveness of transaction execution.

[0061] Other features and advantages of the present application will be described in the following description, and partly become apparent from the description, or be understood by practicing the present application. The purpose and other advantages of the present application can be realized and obtained by the structures specifically pointed out in the written description, claims, and drawings. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0063] Figure 1 A cross-chain system architecture diagram based on notary technology in the prior art provided in an embodiment of the present application;

[0064] Figure 2 A cross-chain system architecture diagram based on relay chain technology in the prior art provided in an embodiment of the present application;

[0065] Figure 3 A flowchart of a cross-chain transaction control method provided in an embodiment of the present application;

[0066] Figure 4 A flowchart of another cross-chain transaction control method provided in an embodiment of the present application;

[0067] Figure 5 An interactive flow chart of a cross-chain transaction control method provided in an embodiment of the present application;

[0068] Figure 6 A schematic diagram of the structure of a cross-chain transaction control device provided in an embodiment of the present application;

[0069] Figure 7 A schematic diagram of the structure of another cross-chain transaction control device provided in an embodiment of the present application;

[0070] Figure 8 A schematic diagram of the hardware structure of an electronic device for implementing a control method for cross-chain transactions provided in an embodiment of the present application. DETAILED DESCRIPTION

[0071] In order to make the purpose, technical scheme and advantages of the present application clearer, the technical scheme in the embodiment of the present application will be clearly and completely described below in conjunction with the drawings in the embodiment of the present application. Obviously, the described embodiment is only a part of the embodiment of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of the present application. In the absence of conflict, the embodiments in the present application and the features in the embodiments can be arbitrarily combined with each other. In addition, although the logical order is shown in the flow chart, in some cases, the steps shown or described can be performed in an order different from that here.

[0072] The terms "first" and "second" in the specification and claims of the present application and the above-mentioned drawings are used to distinguish different objects, rather than to describe a specific order. In addition, the term "comprising" and any of their variations are intended to cover non-exclusive protection. For example, a process, method, system, product or device comprising a series of steps or units is not limited to the listed steps or units, but optionally also includes steps or units that are not listed, or optionally also includes other steps or units inherent to these processes, methods, products or devices. "Multiple" in the present application can mean at least two, for example, two, three or more, and the embodiments of the present application are not limited.

[0073] The following is a description of exemplary embodiments of the present application in conjunction with the accompanying drawings, including various details of the embodiments of the present application to facilitate understanding, which should be considered as merely exemplary. Therefore, those of ordinary skill in the art should recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope of the present application. Similarly, for the sake of clarity and conciseness, the description of well-known functions and structures is omitted in the following description. It should be noted that in the embodiments of the present application, certain software, components, models and other existing solutions in the industry may be mentioned, which should be considered as exemplary, and their purpose is only to illustrate the feasibility of the implementation of the technical solution of the present application, but it does not mean that the applicant has or will necessarily use the solution.

[0074] In the technical solution of this application, the acquisition, transmission, storage, and use of data are in compliance with the requirements of relevant national laws and regulations.

[0075] Before introducing a method provided by an embodiment of the present application, in order to facilitate understanding, the background technology and terms involved in the embodiment of the present application are first introduced below.

[0076] Application chain: A blockchain dedicated to a specific application can be called an application chain. In the embodiment of the present application, both the source chain and the target chain belong to the application chain.

[0077] With the development of blockchain technology, many different types of blockchain networks have emerged, each with its own ledger, consensus mechanism and smart contract platform, which limits the interoperability of data between these networks. In order to enable transactions between different blockchains, cross-chain transactions are generated, and ensuring the atomicity of cross-chain transactions is the key to ensuring the consistency and integrity of cross-chain transactions. The atomicity of cross-chain transactions means that the source chain and the target chain of the cross-chain transaction are either executed successfully or failed. If the execution fails, it needs to be restored to the unexecuted state.

[0078] At present, the commonly used cross-chain technologies mainly include notary technology, relay chain technology, etc. Figure 1 , Figure 1 A cross-chain system architecture diagram based on notary technology in the prior art provided for an embodiment of the present application includes a source chain 10, a gateway 11, a notary 12, a target chain 13 and a gateway 14.

[0079] The source chain 10, as the initiator of the cross-chain event, is used to construct and broadcast the cross-chain event.

[0080] Gateway 11, as an intermediate node, is responsible for forwarding cross-chain events and interacting with notary 12.

[0081] Notary 12, as a trusted third party, is responsible for verifying and confirming the authenticity of cross-chain events and coordinating the interactions between the source chain 10 and the target chain 13.

[0082] Gateway 14, as an intermediate node, is responsible for receiving cross-chain events and interacting with notary 12.

[0083] Target chain 13, as the target party of the cross-chain transaction, is responsible for processing the received cross-chain events and performing corresponding operations. That is, the notary technology is based on the notary for cross-chain interoperation, and the notary is required to ensure the atomicity of the transaction and the validity of each transaction in the transaction. However, the notary technology is generally suitable for cross-chain interaction between two chains with a strong trust relationship, and has poor flexibility.

[0084] See also Figure 2 , Figure 2 A cross-chain system architecture diagram based on relay chain technology in the prior art provided for an embodiment of the present application includes a source chain 20, a gateway 21, a relay chain 22, a target chain 23 and a gateway 24.

[0085] The source chain 20, as the initiator of the cross-chain event, is used to construct and broadcast the cross-chain event.

[0086] Gateway 21, as an intermediate node, is responsible for forwarding cross-chain events and interacting with the relay chain 22.

[0087] The relay chain 22, as a centralized blockchain network, is responsible for verifying and confirming transactions from different application chains, ensuring the consistency and security of cross-chain transactions, and coordinating the interaction between the source chain 20 and the target chain 23.

[0088] Gateway 21, as an intermediate node, is responsible for receiving cross-chain events and interacting with the relay chain 22.

[0089] The target chain 23, as the target party of the cross-chain transaction, is responsible for processing the received cross-chain events and performing corresponding operations. That is, the relay chain technology is to perform cross-chain operations and transaction control by adding a relay chain. However, the deployment of the relay chain model is also relatively complex, and the target chain usually executes transactions directly according to the cross-chain events, that is, the relevant resources have been unlocked before the transaction is completed. In this way, if the subsequent verification fails or there is a problem with the source chain, the atomicity of the cross-chain transaction may not be guaranteed.

[0090] In view of this, the embodiments of the present application provide a control method, device, electronic device and storage medium for cross-chain transactions, which are applicable to cross-chain systems of notary technology and relay chain technology, to ensure the atomicity of cross-chain transactions and improve the flexibility of cross-chain transactions. The following describes some preferred embodiments of the present application in conjunction with the drawings of the specification.

[0091] See also Figure 3 , Figure 3 A flowchart of a cross-chain transaction control method provided in an embodiment of the present application, the method is executed by a global transaction coordinator, wherein a cross-chain system based on notary technology can set the global transaction coordinator in the gateway of the source chain, and a cross-chain system based on relay chain technology can set the global transaction coordinator in the relay chain, and the method includes the following steps.

[0092] In step 301, a cross-chain event constructed by a source chain is obtained, and a target chain of a cross-chain transaction in the cross-chain event is determined; wherein the cross-chain event is constructed by the source chain after changing the first transaction state to a pre-committed state and locking a first resource; and the first resource is a transaction resource of the cross-chain transaction.

[0093] In specific implementation, the cross-chain event in the embodiment of the present application is actually generated by a cross-chain contract. Specifically, in the process of executing the cross-chain, the cross-chain contract and the gateway are required to help each application chain complete the cross-chain; first, the source chain user calls the cross-chain contract to initiate a cross-chain transaction request; then, the request content is parsed through the cross-chain contract to perform legality verification, such as fund verification, authority verification, etc. After confirming that the verification is passed, according to the cross-chain transaction request content, the cross-chain contract locks the transaction resources, such as freezing or locking a specified number of assets from the user's account to ensure that these assets will not be reused or transferred, and modifies the first transaction state to the pre-commit state (ProCommit) to indicate that the source chain is ready for final submission, and generates a unique transaction ID to identify this operation. At this time, the cross-chain contract triggers a cross-chain event, including locked resource information, target chain address, etc., and then the global transaction coordinator can determine the target chain of the cross-chain transaction in the cross-chain event based on the cross-chain event.

[0094] In specific implementation, after the source chain constructs a cross-chain event, the source chain gateway can obtain the cross-chain event through the event monitoring mechanism based on the gateway plug-in. Among them, the gateway plug-in can be integrated into the source chain gateway, or it can be independently set between the source chain and the source chain gateway. The global transaction coordinator can obtain the cross-chain event through the source chain gateway.

[0095] During specific implementation, in order to further ensure the operability of cross-chain transactions, the connectivity of the application chain can be checked in advance, and the handling strategy for cross-chain events can be determined based on the connectivity test results.

[0096] In specific implementation, the connectivity of the source chain and the connectivity of the target chain can be detected according to the preset detection cycle; the detection results of the source chain and the target chain are recorded and analyzed; if the detection results of the source chain and the target chain are both connected, then when a cross-chain event constructed by the source chain is obtained, the cross-chain event is processed; if the detection result of the target chain is not connected, then when a cross-chain event constructed by the source chain is obtained, the cross-chain event is not processed.

[0097] For example, through the heartbeat packet mechanism, heartbeat packets are sent to the source chain and the target chain according to the preset detection cycle to determine the connection status, and after receiving the response, the response time is recorded to ensure that the source chain and the target chain respond quickly, and the results of each connectivity detection are recorded in a database or file to form a connectivity status table, which can contain chain identification: the unique identifier of the source chain and the target chain, detection time: the specific time of each detection, connectivity status: connected or disconnected, delay time: the time difference from sending a request to receiving a response, error information: if the detection fails, the specific error information or abnormal situation is recorded. An alarm mechanism can also be set. When multiple consecutive detections are disconnected or the delay exceeds the preset value, an alarm is triggered to notify relevant personnel to handle it.

[0098] In this way, when the detection result of the target chain is disconnected, when a cross-chain event constructed by the source chain is obtained, the cross-chain event can be processed without being processed, and a rollback instruction can be sent directly to the source chain to avoid waste of resources and ensure the operability of cross-chain transactions.

[0099] In step 302, the cross-chain event is forwarded to the target chain and an operation receipt for the cross-chain event sent by the target chain is received; wherein the operation receipt is constructed by the target chain after changing the second transaction state to the pre-commit state and locking the second resource corresponding to the first resource.

[0100] In specific implementation, before forwarding the cross-chain event to the target chain, it is also possible to determine that the connectivity status of the target chain is connected based on the cross-chain event, and verify the transaction proof of the source chain.

[0101] For example, the connectivity status of the target chain can be determined by accessing a pre-established connectivity status table, and querying the most recent connectivity status of the target chain through the target chain identifier; when constructing a cross-chain event, the smart contract on the source chain will generate a transaction proof containing transaction details. The transaction proof includes the ID of the cross-chain transaction, the block number of the transaction execution, the sequence number of the transaction, and the status of the transaction. Therefore, when verifying the transaction proof of the source chain, the execution result on the source chain can be compared with the transaction proof. If they are consistent, it means that the verification is successful, that is, the cross-chain transaction is valid. If the connectivity status of the target chain is determined to be connected, and the transaction proof of the source chain is verified, the cross-chain event will be forwarded to the target chain.

[0102] In specific implementation, if the target chain’s connectivity status is disconnected or the transaction proof verification of the source chain fails, a rollback instruction is sent to the source chain.

[0103] In specific implementation, when the target link receives a cross-chain event, it can execute the cross-chain business contract according to the cross-chain event, change the second transaction state to the pre-commit state (ProCommit), and lock the second resource corresponding to the first resource to ensure that these resources will not be used for other operations before the cross-chain transaction is completed. Once the resource is locked successfully and the transaction state is set to ProCommit, the smart contract on the target chain will generate an operation receipt, which includes the transaction ID, the status of the current transaction, the status of the locked resource, and the transaction proof, and send the generated receipt to the global transaction coordinator.

[0104] In step 303, if the operation receipt indicates that the transaction is successful, a transaction commit instruction is sent to the source chain and the target chain, so that the source chain and the target chain respectively unlock the corresponding resources and change the corresponding transaction status to submitted based on the transaction commit instruction.

[0105] In specific implementation, before sending transaction submission instructions to the source chain and the target chain, in order to ensure the security and reliability of cross-chain transactions, it is also possible to verify the transaction proof of the target chain based on the operation receipt and determine that the cross-chain transaction has not timed out.

[0106] For example, when verifying the transaction proof of the target chain, the execution result on the target chain can be compared with the transaction proof. If they are consistent, the verification is successful, which proves that the cross-chain transaction is valid. When performing timeout detection on cross-chain transactions, the actual time of the cross-chain transaction can be determined based on the generation time of the cross-chain event and the time when the operation receipt is received. If the actual time of the cross-chain transaction is greater than the preset time threshold, it is determined that the cross-chain transaction has timed out. If the actual time of the cross-chain transaction is not greater than the preset time threshold, it is determined that the cross-chain transaction has not timed out.

[0107] In specific implementation, if the transaction proof verification of the target chain fails or the cross-chain transaction times out, a rollback instruction is sent to the source chain.

[0108] In this way, not only the accuracy and security of cross-chain transaction processing are improved, but also the reliability of the system and user experience are enhanced.

[0109] In specific implementation, when the source chain and the target chain receive the transaction submission instruction, they respectively unlock the corresponding resources and change the corresponding transaction status to submitted.

[0110] In step 304, when the transaction submission results received from both the source chain and the target chain are successful, the transaction submission results are recorded and the cross-chain transaction is confirmed to be completed.

[0111] In an embodiment of the present application, a cross-chain event constructed by a source chain is obtained, and a target chain of a cross-chain transaction in the cross-chain event is determined; the cross-chain event is constructed by the source chain after changing a first transaction state to a pre-committed state and locking a first resource; the first resource is a transaction resource of a cross-chain transaction; the cross-chain event is forwarded to a target chain and an operation receipt for the cross-chain event sent by the target chain is received; the operation receipt is constructed by the target chain after changing a second transaction state to a pre-committed state and locking a second resource corresponding to the first resource; if the operation receipt indicates that the transaction is successful, a transaction submission instruction is sent to the source chain and the target chain, so that the source chain and the target chain respectively unlock the corresponding resources and change the corresponding transaction state to submitted based on the transaction submission instruction; when the transaction submission results received from the source chain and the target chain are both submitted successfully, the transaction submission result is recorded and the completion of the cross-chain transaction is confirmed. In this way, by configuring the pre-commit status of each application chain, the transaction status of each application chain participating in the cross-chain after executing the transaction is in the pre-commit status. When the global transaction coordinator determines that the target chain transaction is successful, it sends a transaction submission instruction to each application chain, ensuring the atomicity of cross-chain transactions, improving the flexibility of cross-chain transactions, and the timeliness and effectiveness of transaction execution.

[0112] See also Figure 4 , Figure 4 A flowchart of another cross-chain transaction control method provided in an embodiment of the present application, the method is executed by the target chain, and the method includes the following steps.

[0113] In step 401, a cross-chain event sent by a global transaction coordinator is obtained.

[0114] In step 402, based on the cross-chain event, a cross-chain transaction is performed.

[0115] In step 403, the transaction state is changed to a pre-commit state and the target resource is locked.

[0116] In specific implementation, the target chain changes the transaction state to the pre-commit state (ProCommit), and the locked target resource is the transaction resource corresponding to the first resource. Locking the resource before the final submission can effectively prevent the same resource from being used or transferred multiple times at the same time.

[0117] In step 404, an operation receipt for the cross-chain event is sent to the global transaction coordinator.

[0118] In specific implementation, once the target resource is locked successfully and the transaction status is set to ProCommit, the smart contract on the target chain will generate an operation receipt, which includes the transaction ID, the status of the current transaction, the status of the locked resource, and the transaction proof, and send the generated receipt to the global transaction coordinator.

[0119] In step 405, when a transaction commit instruction sent by the global transaction coordinator is received, the target resource is unlocked and the transaction status is changed to committed.

[0120] In specific implementation, when the target chain receives the transaction commit instruction, it unlocks the target resources and changes the transaction status to Committed. In this way, by changing the transaction status to Committed, it can ensure that the entire cross-chain transaction is either completed successfully or not executed at all, thereby maintaining the atomicity of the cross-chain operation. The final commit will only be made when all verification steps are passed and the status of the source chain and the target chain are consistent. This ensures that the status on the two chains remains synchronized and avoids partial success or partial failure. Once the global transaction controller issues a transaction commit instruction, the target chain immediately responds and unlocks the resources, reducing waiting time and improving processing speed.

[0121] In step 406, the transaction commit result of the target chain is sent to the global transaction coordinator.

[0122] In an embodiment of the present application, when the target chain receives a cross-chain event, it first changes the transaction state to a pre-commit state and locks the target resources. In this way, if a problem is found in the pre-commit stage, the system can more easily roll back to the initial state because the resources are still in a locked state and have not been finally released. When the transaction commit instruction sent by the global transaction coordinator is received, the target resources are unlocked and the transaction state is changed to committed, thereby maintaining the atomicity of the cross-chain operation.

[0123] The following is a detailed introduction to the control method of the cross-chain transaction in the embodiment of the present application in three stages: transaction preparation stage, pre-commit stage, and commit stage.

[0124] See also Figure 5 , Figure 5 An interactive flow chart of a control method for a cross-chain transaction provided in an embodiment of the present application includes a source chain, a global transaction coordinator, and a target chain, wherein the cross-chain system based on notary technology uses the gateway of the source chain as the global transaction coordinator, and the cross-chain system based on relay chain technology uses the relay chain as the global transaction coordinator, and the method includes the following steps.

[0125] Phase 1: Transaction preparation phase.

[0126] In step 501, the global transaction coordinator detects the connectivity of the source chain according to a preset detection cycle.

[0127] In step 502, the global transaction coordinator detects the connectivity of the target chain according to a preset detection cycle.

[0128] In step 503, the global transaction coordinator records the detection result of the source chain and the detection result of the target chain.

[0129] In specific implementation, if the detection result of the source chain and the detection result of the target chain are both connected, the cross-chain event is processed when the cross-chain event constructed by the source chain is obtained; if the detection result of the target chain is not connected, the cross-chain event is not processed when the cross-chain event constructed by the source chain is obtained.

[0130] Phase 2: Pre-submission phase.

[0131] In step 504, the source chain user calls the smart contract to initiate a cross-chain transaction.

[0132] In step 505, the source chain executes the cross-chain business contract.

[0133] In step 506, the source chain modifies the first transaction status to pre-commit.

[0134] In step 507, the source chain locks the first resource of the cross-chain transaction.

[0135] In step 508, the source chain sends a cross-chain event to the global transaction coordinator.

[0136] In step 509, the global transaction coordinator queries the detection result of the target chain to determine whether the target chain is connected. If it is connected, it proceeds to step 510. If it is not connected, it sends a rollback instruction to the source chain.

[0137] In step 510, the global transaction coordinator verifies the transaction proof of the source chain. If it passes, it proceeds to step 511. If it fails, it sends a rollback instruction to the source chain.

[0138] In step 511, the global transaction coordinator records the source chain transaction.

[0139] In step 512, the global transaction coordinator forwards the cross-chain event to the target chain.

[0140] In step 513, the target chain executes the cross-chain business contract based on the cross-chain event.

[0141] In step 514, the target chain modifies the second transaction state to pre-commit.

[0142] In step 515, the target chain locks a second resource corresponding to the first resource.

[0143] In step 516, the target chain sends an operation receipt for the cross-chain event to the global transaction coordinator.

[0144] Phase 3: Submission phase.

[0145] In step 517, the global transaction coordinator records the target chain transaction.

[0146] In step 518, when the global transaction coordinator determines that the operation receipt is a successful transaction, the transaction proof of the target chain is verified. If it passes, it proceeds to step 519. If it fails, it sends a rollback instruction to the source chain.

[0147] In step 519, the global transaction coordinator checks whether the transaction of the target chain has timed out. If not, the process proceeds to step 520. If so, a rollback instruction is sent to the source chain.

[0148] In step 520, the global transaction coordinator generates a transaction commit instruction.

[0149] In step 521, the global transaction coordinator sends a transaction commit instruction to the source chain and the target chain.

[0150] In step 522, the source chain unlocks the first resource and changes the first transaction status to committed based on the transaction commit instruction.

[0151] In step 523, the target chain unlocks the second resource based on the transaction commit instruction and changes the second transaction status to committed.

[0152] In step 524, the source chain sends the transaction submission result of the source chain to the global transaction coordinator.

[0153] In step 525, the target chain sends the transaction submission result of the target chain to the global transaction coordinator.

[0154] In step 526, when the global transaction coordinator receives successful transaction submission results from both the source chain and the target chain, it records the transaction submission results and confirms that the cross-chain transaction is completed.

[0155] Compared with the existing control method for cross-chain transactions, the embodiment of the present application adds a transaction preparation stage, during which the connectivity check of the application chain is regularly performed to effectively ensure the operability of the cross-chain transaction; a pre-commit state is set, and the transaction state of the application chain participating in the cross-chain is the pre-commit state after the transaction is executed. The global transaction coordinator checks the execution results of each application chain, and sends a commit instruction to each application chain if the transaction passes the validity check and the execution does not time out, otherwise a rollback instruction is sent, which enhances the inspection of transaction execution and ensures the timeliness and effectiveness of transaction execution.

[0156] Based on the same technical concept, an embodiment of the present application also provides a control device for a cross-chain transaction. The principle of solving the problem by the control device for a cross-chain transaction is similar to that of the control method for a cross-chain transaction. Therefore, the implementation of the control device for a cross-chain transaction can refer to the implementation of the control method for a cross-chain transaction, and the repeated parts will not be repeated.

[0157] Figure 6 A schematic diagram of the structure of a cross-chain transaction control device provided in an embodiment of the present application includes:

[0158] The first determination module 601 is used to obtain a cross-chain event constructed by a source chain and determine a target chain of a cross-chain transaction in the cross-chain event; wherein the cross-chain event is constructed by the source chain after changing the first transaction state to a pre-commit state and locking a first resource; and the first resource is a transaction resource of the cross-chain transaction;

[0159] A forwarding module 602 is used to forward the cross-chain event to the target chain and receive an operation receipt for the cross-chain event sent by the target chain; wherein the operation receipt is constructed by the target chain after changing the second transaction state to a pre-commit state and locking a second resource corresponding to the first resource;

[0160] A sending module 603 is used to send a transaction submission instruction to the source chain and the target chain if the operation receipt indicates that the transaction is successful, so that the source chain and the target chain respectively unlock corresponding resources and change the corresponding transaction status to submitted based on the transaction submission instruction;

[0161] The second determination module 604 is used to record the transaction submission result and confirm the completion of the cross-chain transaction when the transaction submission results of the source chain and the target chain are both submitted successfully.

[0162] In some embodiments, it also includes:

[0163] The verification module 605 is used to determine that the connectivity status of the target chain is connected based on the cross-chain event before the forwarding module 602 forwards the cross-chain event to the target chain, and to verify the transaction proof of the source chain.

[0164] In some embodiments, the verification module 605 is further used to:

[0165] If the connection status of the target chain is disconnected or the transaction proof verification of the source chain fails, a rollback instruction is sent to the source chain.

[0166] In some embodiments, before the sending module 603 sends a transaction submission instruction to the source chain and the target chain, the verification module 605 is further used to:

[0167] Based on the operation receipt, it is determined that the transaction proof of the target chain is verified and passed, and it is determined that the cross-chain transaction has not timed out.

[0168] In some embodiments, the verification module 605 is further used to:

[0169] If the transaction proof verification of the target chain fails or the cross-chain transaction times out, a rollback instruction is sent to the source chain.

[0170] In some embodiments, it also includes:

[0171] A detection module 606, configured to detect the connectivity of the source chain and the connectivity of the target chain according to a preset detection cycle;

[0172] Recording and analyzing the detection results of the source chain and the detection results of the target chain;

[0173] If the detection result of the source chain and the detection result of the target chain are both connected, when a cross-chain event constructed by the source chain is obtained, the cross-chain event is processed;

[0174] If the detection result of the target chain is disconnected, when a cross-chain event constructed by the source chain is obtained, the cross-chain event is not processed.

[0175] Figure 7 A schematic diagram of the structure of another cross-chain transaction control device provided in an embodiment of the present application includes:

[0176] Acquisition module 701, used to acquire cross-chain events sent by the global transaction coordinator;

[0177] An execution module 702, configured to execute a cross-chain transaction based on the cross-chain event;

[0178] The first changing module 703 is used to change the transaction state to a pre-commit state and lock the target resource;

[0179] A first sending module 704 is used to send an operation receipt for the cross-chain event to the global transaction coordinator;

[0180] A second changing module 705 is configured to unlock the target resource and change the transaction status to committed when receiving a transaction commit instruction sent by the global transaction coordinator;

[0181] The second sending module 706 is used to send the transaction submission result of the target chain to the global transaction coordinator.

[0182] The division of modules in the embodiments of the present application is schematic and is only a logical function division. There may be other division methods in actual implementation. In addition, the functional modules in the embodiments of the present application may be integrated in a processor, or may exist physically separately, or two or more modules may be integrated in one module. The coupling between the modules may be achieved through some interfaces, which are usually electrical communication interfaces, but it is not excluded that they may be mechanical interfaces or other forms of interfaces. Therefore, the modules described as separate components may or may not be physically separated, and may be located in one place or distributed to different locations of the same or different devices. The above-mentioned integrated modules may be implemented in the form of hardware or in the form of software functional modules.

[0183] After introducing the control method and device of the cross-chain transaction according to the exemplary embodiment of the present application, next, an electronic device according to another exemplary embodiment of the present application is introduced.

[0184] Refer to the following Figure 8 The electronic device 130 implemented according to this embodiment of the present application is described. Figure 8 The electronic device 130 shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.

[0185] like Figure 8 As shown, the electronic device 130 is in the form of a general electronic device. The components of the electronic device 130 may include but are not limited to: the at least one processor 131, the at least one memory 132, and a bus 133 connecting different system components (including the memory 132 and the processor 131).

[0186] Bus 133 represents one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, a processor, or a local bus using any of a variety of bus architectures.

[0187] The memory 132 may include a readable medium in the form of a volatile memory, such as a random access memory (RAM) 1321 and / or a cache memory 1322 , and may further include a read-only memory (ROM) 1323 .

[0188] The memory 132 may also include a program / utility 1325 having a set (at least one) of program modules 1324, such program modules 1324 including but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment.

[0189] The electronic device 130 may also communicate with one or more external devices 134 (e.g., keyboards, pointing devices, etc.), may also communicate with one or more devices that enable a user to interact with the electronic device 130, and / or communicate with any device that enables the electronic device 130 to communicate with one or more other electronic devices (e.g., routers, modems, etc.). Such communication may be performed via an input / output (I / O) interface 135. Furthermore, the electronic device 130 may also communicate with one or more networks (e.g., a local area network (LAN), a wide area network (WAN), and / or a public network, such as the Internet) via a network adapter 136. As shown, the network adapter 136 communicates with other modules for the electronic device 130 via a bus 133. It should be understood that, although not shown in the figure, other hardware and / or software modules may be used in conjunction with the electronic device 130, including but not limited to: microcode, device drivers, redundant processors, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.

[0190] In an exemplary embodiment, a storage medium is also provided, and when the computer program in the storage medium is executed by the processor of the electronic device, the electronic device can execute the above-mentioned cross-chain transaction control method. Optionally, the storage medium can be a non-temporary computer-readable storage medium, for example, the non-temporary computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, and an optical data storage device, etc.

[0191] In an exemplary embodiment, the electronic device of the present application may include at least one processor and a memory communicatively connected to the at least one processor, wherein the memory stores a computer program executable by the at least one processor, and when the computer program is executed by the at least one processor, the at least one processor may execute the steps of any cross-chain transaction control method provided in the embodiments of the present application.

[0192] In an exemplary embodiment, a computer program product is also provided. When the computer program product is executed by an electronic device, the electronic device can implement any exemplary method provided in the present application.

[0193] Furthermore, the computer program product may use any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples (non-exhaustive list) of readable storage media include: an electrical connection with one or more wires, a portable disk, a hard disk, a RAM, a ROM, an erasable programmable read-only memory (EPROM), a flash memory, an optical fiber, a compact disk read only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.

[0194] The program product for controlling cross-chain transactions in the embodiments of the present application may adopt a CD-ROM and include program code, and may be run on a computing device. However, the program product of the present application is not limited thereto, and in this document, a readable storage medium may be any tangible medium containing or storing a program, which may be used by or in combination with an instruction execution system, apparatus, or device.

[0195] The readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, wherein the readable program code is carried. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. The readable signal medium may also be any readable medium other than a readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device.

[0196] The program code contained on the readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wired, optical cable, radio frequency (RF), etc., or any suitable combination of the foregoing.

[0197] The technical solution provided by the present application is introduced in detail above. The principles and implementation methods of the present application are explained by using specific examples in the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea. At the same time, for those skilled in the art, according to the idea of ​​the present application, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.

[0198] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.

[0199] The present application is described with reference to the flowcharts and / or block diagrams of the methods, apparatus (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of the 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 generate 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.

[0200] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0201] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0202] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.

Claims

1. A method for controlling cross-chain transactions, characterized in that: Applied to a global transaction coordinator, the method comprises: Obtain a cross-chain event constructed by a source chain, and determine a target chain of a cross-chain transaction in the cross-chain event; wherein the cross-chain event is constructed by the source chain after changing a first transaction state to a pre-commit state and locking a first resource; and the first resource is a transaction resource of the cross-chain transaction; Forwarding the cross-chain event to the target chain and receiving an operation receipt for the cross-chain event sent by the target chain; wherein the operation receipt is constructed by the target chain after changing the second transaction state to a pre-commit state and locking a second resource corresponding to the first resource; If the operation receipt indicates that the transaction is successful, a transaction submission instruction is sent to the source chain and the target chain, so that the source chain and the target chain respectively unlock corresponding resources and change the corresponding transaction status to submitted based on the transaction submission instruction; When the transaction submission results of the source chain and the target chain are both received as successful, the transaction submission results are recorded and the cross-chain transaction is confirmed to be completed.

2. The method according to claim 1, characterized in that Before forwarding the cross-chain event to the target chain, the method further includes: Based on the cross-chain event, the connectivity status of the target chain is determined to be connected, and the transaction proof of the source chain is verified to be passed.

3. The method according to claim 2, characterized in that The method further comprises: If the connection status of the target chain is disconnected or the transaction proof verification of the source chain fails, a rollback instruction is sent to the source chain.

4. The method according to claim 1, characterized in that Before sending the transaction submission instruction to the source chain and the target chain, the method further includes: Based on the operation receipt, it is determined that the transaction proof of the target chain is verified and passed, and it is determined that the cross-chain transaction has not timed out.

5. The method according to claim 4, characterized in that The method further comprises: If the transaction proof verification of the target chain fails or the cross-chain transaction times out, a rollback instruction is sent to the source chain.

6. The method according to any one of claims 1 to 5, characterized in that: The method further comprises: According to a preset detection cycle, detecting the connectivity of the source chain and detecting the connectivity of the target chain; Recording and analyzing the detection results of the source chain and the detection results of the target chain; If the detection result of the source chain and the detection result of the target chain are both connected, when a cross-chain event constructed by the source chain is obtained, the cross-chain event is processed; If the detection result of the target chain is disconnected, when a cross-chain event constructed by the source chain is obtained, the cross-chain event is not processed.

7. A method for controlling cross-chain transactions, characterized in that: Applied to the target chain, the method comprises: Get cross-chain events sent by the global transaction coordinator; Based on the cross-chain event, execute a cross-chain transaction; Change the transaction status to pre-commit status and lock the target resource; Sending an operation receipt for the cross-chain event to the global transaction coordinator; When receiving the transaction commit instruction sent by the global transaction coordinator, unlocking the target resource and changing the transaction status to committed; Sending the transaction submission result of the target chain to the global transaction coordinator.

8. A cross-chain transaction control device, characterized in that: Applied to a global transaction coordinator, the device comprises: A first determination module is used to obtain a cross-chain event constructed by a source chain and determine a target chain of a cross-chain transaction in the cross-chain event; wherein the cross-chain event is constructed by the source chain after changing the first transaction state to a pre-commit state and locking a first resource; and the first resource is a transaction resource of the cross-chain transaction; A forwarding module, used to forward the cross-chain event to the target chain and receive an operation receipt for the cross-chain event sent by the target chain; wherein the operation receipt is constructed by the target chain after changing the second transaction state to a pre-commit state and locking a second resource corresponding to the first resource; A sending module, configured to send a transaction submission instruction to the source chain and the target chain if the operation receipt indicates that the transaction is successful, so that the source chain and the target chain respectively unlock corresponding resources and change the corresponding transaction status to submitted based on the transaction submission instruction; The second determination module is used to record the transaction submission result and confirm the completion of the cross-chain transaction when the transaction submission results of the source chain and the target chain are both successfully submitted.

9. A cross-chain transaction control device, characterized in that: Applied to the target chain, the device comprises: The acquisition module is used to obtain cross-chain events sent by the global transaction coordinator; An execution module, used to execute a cross-chain transaction based on the cross-chain event; A first change module, used to change the transaction state to a pre-commit state and lock the target resource; A first sending module, configured to send an operation receipt for the cross-chain event to the global transaction coordinator; A second changing module is used to unlock the target resource and change the transaction status to committed when receiving a transaction commit instruction sent by the global transaction coordinator; The second sending module is used to send the transaction submission result of the target chain to the global transaction coordinator.

10. An electronic device, characterized in that: include: at least one processor, and a memory communicatively connected to the at least one processor, wherein: The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the method according to any one of claims 1 to 6, or execute the method according to claim 7.

11. A storage medium, characterized in that: When the computer program in the storage medium is executed by a processor of an electronic device, the electronic device can execute the method according to any one of claims 1 to 6, or execute the method according to claim 7.

12. A computer program product, characterized in that The computer program product comprises: a computer program code, and when the computer program code is run on a computer, the computer executes the method according to any one of claims 1 to 6, or executes the method according to claim 7.