Cross-chain transaction processing method and device, electronic device, and computer program
By introducing a variety of nodes and gateway devices into the blockchain system, processing cross-chain transaction requests and verifying transaction data, the problem of excessive workload of terminal equipment in the existing technology is solved, and more efficient and transparent cross-chain transaction processing is achieved.
Patent Information
- Application Number
- JP2023548555
- Authority / Receiving Office
- JP · JP
- Patent Type
- Patents
- Current Assignee / Owner
- Priority Date
- 2021-07-27
- Filing Date
- 2022-06-17
- Publication Date
- 2025-05-07
- Estimated Expiration
- 2042-06-17
AI Technical Summary
When handling cross-chain transactions, the prior art requires terminal equipment to handle complex cross-chain event integrity and verification, which increases the workload of terminal equipment.
By introducing the first and second node devices, gateway devices and verification node devices into the blockchain system, they are respectively responsible for receiving cross-chain transaction requests, executing services and cross-chain contracts, transmitting data and verifying the authenticity of transaction data, thereby realizing the processing and verification of cross-chain transactions.
It reduces the workload of terminal devices in cross-chain transaction processing, improves the transparency and traceability of transactions, and improves the scalability and flexibility of the system through a distributed framework.
Smart Images

Figure 0007672499000001 
Figure 0007672499000002 
Figure 0007672499000003
Abstract
Description
[Technical field]
[0001] This application claims priority to a Chinese patent application bearing application number 202110853182.7 and entitled "Cross-chain transaction processing method, apparatus, electronic device, and storage medium" filed with the China Patent Office on July 27, 2021, the entire contents of which are incorporated herein by reference.
[0002] The present application relates to the technical field of blockchain, and in particular to a cross-chain transaction processing method and device, an electronic device, and a computer program. [Background technology]
[0003] With the development of blockchain technology, it has been widely applied in various industries. Each industry can build a blockchain system according to its own needs and use the built blockchain system to store its own assets. Summary of the Invention [Problem to be solved by the invention]
[0004] An object of the embodiments of the present application is to provide a cross-chain transaction processing method and device, an electronic device, and a computer program. [Means for solving the problem]
[0005] According to one aspect, a cross-chain transaction processing method is provided, the cross-chain transaction processing method being executed by a first node device in a blockchain system, the blockchain system having a first blockchain and a second blockchain configured (arranged / configured), the method comprising: Receive a cross-chain transaction request from a terminal, the cross-chain transaction request instructing to conduct a cross-chain transaction between the first blockchain and the second blockchain (note that "instruct" refers to "indicate"; hereinafter, similar cases and meanings shall be the same); Execute a first service contract on the first blockchain according to the cross-chain transaction request, where the first service contract indicates a first execution manner of the cross-chain transaction on the first blockchain; The first business contract determines to execute a first transaction event of the cross-chain transaction on the first blockchain, execute a first cross-chain contract on the first blockchain, and execute a second transaction event of the cross-chain transaction on the second blockchain, where the first cross-chain contract indicates a second execution manner of the cross-chain transaction on the first blockchain; The first business contract stores first cross-chain transaction data in the first blockchain, and the first cross-chain transaction data indicates that the first transaction event has been executed in the first blockchain and that the second transaction event has been executed in the second blockchain. is executed Instruct that; obtaining second cross-chain transaction data from the second blockchain, the second cross-chain transaction data being obtained based on the first cross-chain transaction data, the second cross-chain transaction data indicating that the second transaction event has already been executed on the second blockchain; and Sending a transaction completion response to the terminal according to the first business contract and the first cross-chain contract, the transaction completion response including indicating that the cross-chain transaction has been completed.
[0006] According to another aspect, a cross-chain transaction processing method is provided, the cross-chain transaction processing method being executed by a second node device in a blockchain system, the blockchain system being configured with a first blockchain and a second blockchain, the method comprising: Obtain first cross-chain transaction data from the first blockchain, the first cross-chain transaction data indicating that a first transaction event of the cross-chain transaction has been performed on the first blockchain and a second transaction event of the cross-chain transaction has been performed on the second blockchain. is executed Instruct that; Execute a second cross-chain contract on the second blockchain according to the first cross-chain transaction data, where the second cross-chain contract indicates a fourth execution manner of the cross-chain transaction on the second blockchain; Storing the first cross-chain transaction data on the second blockchain by the second cross-chain contract and executing a second business contract on the second blockchain, the second business contract indicating a third execution manner of the cross-chain transaction on the second blockchain; and The second transaction event is executed on the second blockchain by the second business contract, and then the second cross-chain contract is executed, and second cross-chain transaction data is stored on the second blockchain, and the second cross-chain transaction data indicates that the second transaction event has been executed on the second blockchain.
[0007] According to another aspect, there is provided a blockchain system for cross-chain transaction processing, the blockchain system including a first node device, a second node device, a first gateway device, and a second gateway device, the blockchain system including a first blockchain and a second blockchain; The first node device receiving a cross-chain transaction request from a terminal, the cross-chain transaction request indicating conducting a cross-chain transaction between the first blockchain and the second blockchain; Execute a first business contract on the first blockchain according to the cross-chain transaction request, where the first business contract indicates a first execution manner of the cross-chain transaction on the first blockchain; The first business contract determines to execute a first transaction event of the cross-chain transaction on the first blockchain, execute a first cross-chain contract on the first blockchain, and execute a second transaction event of the cross-chain transaction on the second blockchain, where the first cross-chain contract indicates a second execution manner of the cross-chain transaction on the first blockchain; and The first business contract stores first cross-chain transaction data in the first blockchain, and the first cross-chain transaction data indicates that the first transaction event has been executed in the first blockchain and that the second transaction event has been executed in the second blockchain. is executed It is used to indicate that the first gateway device is used to transmit the first cross-chain transaction data on the first blockchain to the second gateway device; the second gateway device is used to transmit the first cross-chain transaction data to the second node device; The second node device: Execute a second cross-chain contract on the second blockchain according to the first cross-chain transaction data, where the second cross-chain contract indicates a fourth execution manner of the cross-chain transaction on the second blockchain; Storing the first cross-chain transaction data on the second blockchain by the second cross-chain contract and executing a second business contract on the second blockchain, the second business contract indicating a third execution manner of the cross-chain transaction on the second blockchain; and The second business contract is used to execute the second transaction event on the second blockchain, and subsequently execute the second cross-chain contract to store second cross-chain transaction data on the second blockchain, and the second cross-chain transaction data is used to indicate that the second transaction event has been executed on the second blockchain; The second gateway device is further adapted to transmit the second cross-chain transaction data on the second blockchain to the first gateway device; The first gateway device is further adapted to transmit the second cross-chain transaction data to the first node device; The first node device is further used to receive the second cross-chain transaction data from the first gateway device and send a transaction completion response to the terminal, the transaction completion response indicating that the cross-chain transaction has been completed.
[0008] According to another aspect, a cross-chain transaction processing apparatus is provided, the apparatus being configured in a blockchain system, the blockchain system further configured with a first blockchain and a second blockchain, the apparatus including a receiving module and a processing module, The receiving module is used to receive a cross-chain transaction request from a terminal, the cross-chain transaction request instructing to perform a cross-chain transaction between the first blockchain and the second blockchain; The processing module includes: Execute a first business contract on the first blockchain according to the cross-chain transaction request, where the first business contract indicates a first execution manner of the cross-chain transaction on the first blockchain; The first business contract determines to execute a first transaction event of the cross-chain transaction on the first blockchain, execute a first cross-chain contract on the first blockchain, and execute a second transaction event of the cross-chain transaction on the second blockchain, where the first cross-chain contract indicates a second execution manner of the cross-chain transaction on the first blockchain; and The first business contract stores first cross-chain transaction data in the first blockchain, and the first cross-chain transaction data indicates that the first transaction event has been executed in the first blockchain and that the second transaction event has been executed in the second blockchain. is executed It is used to indicate that The receiving module is further used to obtain second cross-chain transaction data from the second blockchain, the second cross-chain transaction data being obtained based on the first cross-chain transaction data, and the second cross-chain transaction data indicating that the second transaction event has already been executed on the second blockchain; The processing module is further used by the first business contract and the first cross-chain contract to send a transaction completion response to the terminal, where the transaction completion response indicates that the cross-chain transaction has been completed.
[0009] According to another aspect, a cross-chain transaction processing apparatus is provided, the apparatus being configured in a blockchain system, the blockchain system further configured with a first blockchain and a second blockchain, the apparatus including: an acquiring module and a processing module; The acquiring module is used for acquiring first cross-chain transaction data from the first blockchain, and the first cross-chain transaction data indicates that a first transaction event of a cross-chain transaction has been executed on the first blockchain and a second transaction event of the cross-chain transaction has been executed on the second blockchain. is executed Instructed that, The processing module includes: Execute a second cross-chain contract on the second blockchain according to the first cross-chain transaction data, where the second cross-chain contract indicates a fourth execution manner of the cross-chain transaction on the second blockchain; Storing the first cross-chain transaction data on the second blockchain by the second cross-chain contract and executing a second business contract on the second blockchain, the second business contract indicating a third execution manner of the cross-chain transaction on the second blockchain; and The second business contract is used to execute the second transaction event on the second blockchain, and subsequently execute the second cross-chain contract and store second cross-chain transaction data on the second blockchain, where the second cross-chain transaction data is used to indicate that the second transaction event has been executed on the second blockchain.
[0010] According to another aspect, there is provided an electronic device, the electronic device including a processor and a memory, the memory being provided with at least one computer program, the at least one computer program being loaded and executed by the processor to realize the cross-chain transaction processing method according to any one of the aspects described above.
[0011] According to another aspect, there is provided a computer-readable storage medium having at least one computer program stored thereon, the at least one computer program being loaded and executed by a processor to implement the cross-chain transaction processing method according to any one of the preceding aspects.
[0012] According to another aspect, there is provided a computer program comprising program code, the program code being stored in a computer readable storage medium, the program code being read by a processor of an electronic device from the computer readable storage medium, and the processor executing the program code to cause the electronic device to perform a method as provided in any one of the aspects above. [Brief description of the drawings]
[0013] In order to more clearly describe the technical solutions in the embodiments of the present application, the following briefly introduces the drawings that need to be used to describe the embodiments. [Figure 1] FIG. 1 illustrates a blockchain system provided in an embodiment of the present application. [Diagram 2] 1 is a flowchart of a cross-chain transaction processing method provided in an embodiment of the present application. [Diagram 3] 1 is a flowchart illustrating a first node set provided in an embodiment of the present application for processing a cross-chain transaction. [Figure 4] 11 is a flowchart illustrating a second node set provided in an embodiment of the present application for processing a cross-chain transaction. [Diagram 5] FIG. 2 illustrates a cross-chain transaction processing method provided in an embodiment of the present application. [Figure 6] FIG. 2 is a configuration diagram of a cross-chain transaction processing device provided in an embodiment of the present application. [Figure 7] FIG. 2 is a configuration diagram of a cross-chain transaction processing device provided in an embodiment of the present application. [Figure 8] FIG. 1 is a block diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS
[0014] Different industries can provide different services to users. In order to realize asset transfer between different businesses, cross-chain interoperability technology has emerged accordingly, which can promote the inter-chain cooperation of different blockchain systems, which is a strong driving force for the development of blockchain towards the scale of network effect, and is gradually becoming a new hotspot for applications.
[0015] Current cross-chain interoperability technologies mainly include hash locks, notarization mechanisms, side chains / relays, etc. For these current cross-chain interoperability technologies, terminals all need to process a series of complex cross-chain transactions, such as cross-chain event integrity and cross-chain event verification, which increases the operational burden of the terminal.
[0016] First, abbreviations and main terms used in the examples of the present application will be explained below.
[0017] Smart Contract: A computerized protocol that can execute the terms of a contract, implemented by code deployed on a shared ledger and executed when certain conditions are met. According to actual business needs, the code can be used to complete an automated transaction, such as querying the logistics status of the goods purchased by the buyer, and transferring the buyer's digital currency to the seller's address after the buyer signs and receives the goods. Of course, smart contracts are not limited to executing contracts for transactions, but can also execute contracts for processing received information.
[0018] Blockchain: A set of blocks connected together in the order of their creation. When a new block is added to the blockchain, it cannot be deleted. Blocks contain data submitted by nodes in the blockchain system.
[0019] Interoperability: The ability to exchange and use information between two or more different systems and applications.
[0020] Cross-chain: Achieving interoperability between multiple blockchains. Cross-chain is a type of interoperability.
[0021] 1 is a diagram illustrating a blockchain system provided in an embodiment of the present application. As shown in FIG. 1, the blockchain system 100 includes a plurality of node groups 101, each node group 101 corresponding to one business, and the business corresponding to different node groups 101 may be the same or different. For example, one node group is used to provide services for the payment business of a first application program (e.g., Alipay), and another node group is used to provide services for the payment business of a second application program (e.g., WeChat).
[0022] Each node group 101 is used to process transaction events related to the corresponding business. At least one blockchain is set in each node group 101, and each blockchain stores transaction data of transaction events of the corresponding business. The transaction data of the same business includes same-chain transaction data and cross-chain transaction data. Among them, the same-chain transaction data indicates a transaction event executed on the blockchain of the own node group for the business (or same-chain transaction) of the own node group, and the cross-chain transaction data indicates a cross-chain transaction event executed on the blockchain of the own node group for a cross-chain business (or cross-chain transaction) between different node groups.
[0023] In order to make the processing of cross-chain business transparent and traceable, in one possible implementation, each blockchain stores a business contract and a cross-chain contract, for example, the business contract and the cross-chain contract are stored in the genesis block of the blockchain (i.e., the first block of the blockchain). Among them, the business contract is a smart contract of the business layer, and the business contract has the function of reading and writing state data of its own chain (i.e., the blockchain where the business contract is located), and when processing a cross-chain transaction, it can further call the cross-chain contract on the same blockchain to process the cross-chain business. The cross-chain contract is a smart contract for processing cross-chain transactions, and can process cross-chain transactions as a proxy contract of the business contract on the same chain. The cross-chain contract can receive a call of a business contract on its own chain (i.e., an intra-chain contract call), determine a transaction event to be executed on the other chain (i.e., a blockchain in another node group related to the cross-chain transaction) based on the cross-chain transaction related to its own chain, verify whether the cross-chain transaction data stored in the other chain is valid, call back the business contract on its own chain, and roll back the cross-chain transaction data, thereby achieving such functions. The cross-chain contract is the decision maker of the entire cross-chain process, and is publicly executed on the chain in the manner of a smart contract, thereby realizing a multi-party (decentralized) cross-chain business.
[0024] In one possible implementation, each node group 101 includes multiple node devices 1011, and the blockchain set in each node group 101 is maintained by the node device 1011 in each node group 101. Each node device 1011 in the blockchain system 100 may be a user-side terminal or a server. Among them, the terminal is also called a smart terminal or a mobile smart terminal, which has a rich human-computer interaction method, has the function of accessing the Internet, and is usually equipped with various operating systems and has powerful processing power. In some embodiments, the types of mobile smart terminals include, but are not limited to, smartphones, tablet computers, car-mounted terminals, portable game consoles, etc. The server may be a server group consisting of one or more computer devices.
[0025] In one possible implementation, each node group 101 further includes a gateway device 1012, which is an interface to the outside of the node group where it is located, and is responsible for handling the transmission of cross-chain transaction data between different node groups. In some embodiments, the gateway device of the present application is also called a cross-chain gateway.
[0026] In one possible implementation, each node group 101 further includes a validation node device 1013, and one validation node device 1013 can perform validity proof for cross-chain transaction data on the blockchain in the node group to which it belongs. Optionally, the gateway device 1012 acts as an intermediary in the cross-chain process, and performs validity proof for the cross-chain transaction data on the blockchain in the node group to which it belongs by calling the validation node device 1013. Note that the validation node device 1013 is an optional device, and in some embodiments, the gateway device 1012 does not perform validity proof for the cross-chain transaction data, in which case it does not include the validation node 1013.
[0027] In order to facilitate the management of different node groups 101 in the blockchain system 100, in one possible implementation, the blockchain system 100 further includes a registration device 102. The blockchain marker set in each node group 101 and the corresponding business marker in each node group can be registered in the registration device. Alternatively, each user in each node group can register a unified blockchain account (i.e., an account on the blockchain) in the registration device 102. The blockchain accounts registered by users in different node groups 101 belong to different blockchains, so that the user's assets, the user's asset transfer, and the status of asset changes can be recorded in the corresponding blockchain. In one possible implementation, the gateway device 1012 can further query the user's blockchain account and the marker of the blockchain to which the blockchain account belongs in the registration device 102. Note that the registration device 102 is an optional device, and the blockchain system 100 does not need to include the registration device 102, for example, when the blockchains set in different groups in the blockchain system 100 do not need to be managed in a unified manner or the blockchain accounts do not need to be registered in a unified manner.
[0028] To further explain the process of a node device in a blockchain system processing a cross-chain transaction, reference is made to the flowchart of the cross-chain transaction processing method provided in the embodiment of the present application shown in Figure 2. The method is executed by a first node device in a blockchain system, in which a first blockchain and a second blockchain are established.
[0029] 201: A first node device receives a cross-chain transaction request from a terminal, the cross-chain transaction request instructing to conduct a cross-chain transaction between the first blockchain and the second blockchain.
[0030] Wherein, the first node device is any one of the node devices in the first node group in the block chain system, and the first node group is any one of the node groups in the block chain system. A first block chain is deployed in the first node group. The terminal may be the first node device, or may be an electronic device other than the first node device.
[0031] The cross-chain transaction request includes transaction information of the cross-chain transaction, an identifier of the first business contract, and an identifier of the second business contract on the second blockchain. The cross-chain transaction may be a transaction that performs a cross-chain operation on the first blockchain and the second blockchain. For example, the cross-chain transaction may transfer a target amount of virtual resources in a first account on the first blockchain to a second account on the second blockchain, or the cross-chain transaction may perform synchronous changes to data on the first blockchain and the second blockchain. Note that the cross-chain transaction is not limited in the embodiments of the present application.
[0032] The transaction information of the cross-chain transaction indicates the cross-chain transaction. For example, if the cross-chain transaction is to transfer a target amount of virtual resources from a first account on a first blockchain to a second account on a second blockchain, the transaction information includes a resource transfer source account, a resource transfer destination account, and a resource transfer amount. Wherein, the resource transfer source account is the first account, the resource transfer destination account is the second account, and the resource transfer amount is a target amount. Also, for example, if the cross-chain transaction is to synchronously change data on the first blockchain and the second blockchain, the transaction information includes the location of the data to be changed on the first blockchain and the second blockchain, and the changed data of the data to be changed on the first blockchain and the second blockchain.
[0033] In one possible implementation, the cross-chain transaction includes two transaction events, one for a first blockchain and another for a second blockchain, and the cross-chain transaction is completed after the two transaction events are successfully executed in the corresponding blockchain. For convenience of description, the transaction event of the cross-chain transaction for the first blockchain is referred to as a first transaction event, and the transaction event of the cross-chain transaction for the second blockchain is referred to as a second transaction event. For example, if the cross-chain transaction is to transfer a target amount of virtual resources in a first account on a first blockchain to a second account on a second blockchain, the first transaction event subtracts (deducts) the target amount of virtual resources from the first account, and the second transaction event adds (increases) the target amount of virtual resources to the second account.
[0034] A business contract on a blockchain indicates a processing logic for processing a cross-chain transaction in its own chain (i.e., the blockchain in which the business contract is located). The processing logic includes, for a cross-chain transaction starting from its own chain, executing a transaction event for the cross-chain transaction in its own chain, acquiring a transaction event for a partner chain (i.e., a blockchain other than its own chain related to the cross-chain transaction, or it may be called a target chain) of the cross-chain transaction by calling a cross-chain contract on its own chain, and storing cross-chain transaction data of the cross-chain transaction in its own chain. The processing logic further includes, for a cross-chain transaction starting from the partner chain, executing a transaction event for the cross-chain transaction in its own chain by receiving a call to the cross-chain contract on its own chain. Each processing logic indicated by the business contract is realized by a program code (or computer program) in the business contract, and different processing logics may correspond to different program codes.
[0035] The tag of a business contract indicates the business contract, and the tag of the business contract may be the name of the business contract. For example, a first business contract is a business contract on a first blockchain, and the tag of the first business contract indicates the first business contract, and a second business contract is a business contract on a second blockchain, and the tag of the second business contract indicates the second business contract.
[0036] 202: A first node device executes a first business contract on the first blockchain based on the cross-chain transaction request, and the first business contract indicates a first execution manner of the cross-chain transaction on the first blockchain.
[0037] Among them, the second blockchain is a blockchain set in a second node group in the blockchain system, and the second node group is any node group other than the first node group in the blockchain system.
[0038] The first business contract is a business contract on the first blockchain. Since the cross-chain transaction request is received by the first node device, the cross-chain transaction is regarded as a cross-chain transaction initiated from the first blockchain. The first execution method is realized by a processing logic related to the cross-chain transaction initiated from its own chain in the first business contract. The first execution method includes: executing a transaction event of the cross-chain transaction to the first blockchain in the first blockchain, obtaining a transaction event of the cross-chain transaction to the second blockchain by invoking a cross-chain contract on the first blockchain, and storing cross-chain transaction data of the cross-chain transaction in the first blockchain. In one possible implementation manner, the first execution method further returns a processing result of the cross-chain transaction to the terminal.
[0039] 203: According to the first business contract, the first node device determines to execute a first transaction event of the cross-chain transaction on the first blockchain, execute a first cross-chain contract on the first blockchain, and execute a second transaction event of the cross-chain transaction on the second blockchain, where the first cross-chain contract indicates a second execution manner of the cross-chain transaction on the first blockchain.
[0040] A cross-chain contract on a blockchain dictates processing logic related to a counterpart chain in a cross-chain transaction, and the processing logic includes determining transaction events for the counterpart chain of a cross-chain transaction for a cross-chain transaction originating from the own chain.
[0041] In one possible implementation, the processing logic further includes: for a cross-chain transaction starting from the own chain, verifying the authenticity of the cross-chain transaction data of the cross-chain transaction on the other chain, and calling a business contract on the own chain to return the processing result of the cross-chain transaction to the terminal. Wherein, the step of verifying the authenticity of the cross-chain transaction data of the cross-chain transaction on the other chain is an optional step. The processing logic further includes: for a cross-chain transaction starting from the other chain, verifying the authenticity of the cross-chain transaction data of the cross-chain transaction on the other chain, storing the cross-chain transaction data of the cross-chain transaction on the other chain in the own chain, calling a business contract on the own chain to execute a transaction event of the cross-chain transaction to the own chain, and storing the cross-chain transaction data of the transaction event of the cross-chain transaction to the own chain in the own chain. Wherein, the step of verifying the authenticity of the cross-chain transaction data of the cross-chain transaction on the other chain is an optional step. The processing logic indicated by the cross-chain contract is realized by the program code (or computer program) in the cross-chain contract, and different processing logic may correspond to different program codes.
[0042] The first cross-chain contract is a cross-chain contract on the first blockchain. The second execution manner is realized by a processing logic for a cross-chain transaction starting from its own chain in the first cross-chain contract. The second execution manner includes: determining to execute a second transaction event of the cross-chain transaction on the blockchain, verifying the authenticity of cross-chain transaction data of the cross-chain transaction on the second blockchain, and calling a first business contract to return a processing result for the cross-chain transaction to a terminal.
[0043] 204: According to a first business contract, a first node device stores first cross-chain transaction data in the first blockchain, and the first cross-chain transaction data is stored in the first blockchain after the first transaction event has been executed in the first blockchain and the second transaction event has been executed in the second blockchain. is executed This instructs:
[0044] Wherein, the first cross-chain transaction data is cross-chain transaction data of the cross-chain transaction. Optionally, the first cross-chain transaction data includes a processing result of the first transaction event, an indicator of the second business contract, and event information of the second transaction event. Wherein, the processing result of a transaction event is a first processing result or a second processing result, and the first processing result indicates that the transaction event has been executed in the blockchain and the execution of the transaction event is successful. For example, when the transaction event is to subtract a target amount of virtual resources from the first account, if the target amount of virtual resources has been subtracted from the first account, the execution of the transaction event is successful. Optionally, the first processing result includes event information and a success indicator of the transaction event. Wherein, the event information is used to indicate the transaction event and includes event parameters of the transaction event. For example, take the case where the transaction event is to subtract a target amount of virtual resources from the first account, and the event parameters include resource transfer source information and a resource amount waiting to be transferred. The success indicator indicates that the transaction event has been successfully executed.
[0045] The second processing result indicates that the transaction event has already been executed in the blockchain and the execution of the transaction event has failed. For example, if the transaction event is to subtract a target amount of virtual resources from a first account, if the number of virtual resources in the first account is less than the target amount, the first account cannot subtract the target amount of virtual resources, and the execution of the transaction event has failed. Optionally, the second processing result includes event information of the transaction event and a failure indicator, and the failure indicator indicates that the execution of the transaction event has failed.
[0046] In one possible implementation, the first cross-chain transaction data further includes an indicator of a second blockchain and an indicator of a second business contract on the second blockchain. In one possible implementation, the first cross-chain transaction data further includes an indicator of a target program code in the second business contract. The target program code is used to realize the second transaction event, and the event information of the second transaction event is an input parameter of the target program code.
[0047] 205: A first node device obtains second cross-chain transaction data from the second blockchain, the second cross-chain transaction data being obtained based on the first cross-chain transaction data, and the second cross-chain transaction data indicating that the second transaction event has already been executed on the second blockchain.
[0048] Wherein, the second cross-chain transaction data includes a processing result of the second transaction event.
[0049] 206: According to the first business contract and the first cross-chain contract, the first node device sends a transaction completion response to the terminal, where the transaction completion response indicates that the cross-chain transaction has been completed.
[0050] Wherein, the transaction completion response includes transaction information of the cross-chain transaction.
[0051] In the method provided in the embodiment of the present application, when a cross-chain transaction request is received from a terminal, a node device in a blockchain system executes a business contract and a cross-chain contract on the blockchain to perform a cross-chain transaction, and returns a transaction completion response to the terminal after the cross-chain transaction is completed. In the process of processing the cross-chain transaction, the terminal requests the execution of the cross-chain transaction, and receives the processing result of the cross-chain transaction, and is not concerned with the specific processing process of the cross-chain transaction, thereby reducing the work burden of the terminal.
[0052] To further explain the interaction process of node devices in different node groups between the first node group and the second node group in the process of processing cross-chain transactions, reference is made to the flowchart of the cross-chain transaction processing method provided in the embodiment of the present application shown in FIG. 3.
[0053] 301: A first node device receives a cross-chain transaction request from a terminal, the cross-chain transaction request instructing to conduct a cross-chain transaction between the first blockchain and the second blockchain.
[0054] In one possible implementation, a business application is installed on the terminal, and a user adopts a first account to register the business application on the terminal, and then issues a command (instruction) to the business application to perform the cross-chain transaction. After receiving the command, the business application generates the cross-chain transaction request, and sends the cross-chain transaction request to the terminal.
[0055] Wherein, the terminal can be a first node device or can be a device other than the first node device. When the terminal is a device other than the first node device, the terminal sends the cross-chain transaction request to the first node device, and the first node device receives the cross-chain transaction request from the terminal accordingly. When the terminal is a first node device, the first node device receives the cross-chain transaction request sent by the business application.
[0056] 302: The first node device executes a first business contract on a first blockchain based on the cross-chain transaction request, and the first business contract indicates a first execution manner of the cross-chain transaction on the first blockchain.
[0057] After receiving the cross-chain transaction request, the first node device obtains the first business contract from a local first blockchain, inputs the cross-chain transaction request into the first business contract as an input parameter of the first business contract, and triggers the first business contract to be executed.
[0058] 303: According to the first business contract, the first node device determines to execute a first transaction event of the cross-chain transaction on a first blockchain, execute a first cross-chain contract on the first blockchain, and execute a second transaction event of the cross-chain transaction on the second blockchain, where the first cross-chain contract indicates a second execution manner of the cross-chain transaction on the first blockchain.
[0059] In the execution process of the first business contract, the first node device determines a first transaction event of the cross-chain transaction according to transaction information of the cross-chain transaction in the cross-chain transaction request, executes the first transaction event on the first blockchain, and obtains a processing result of the first transaction event. Optionally, if the execution of the first transaction event is successful, the processing result of the first transaction event is a first processing result, and if the execution of the first transaction event is unsuccessful, the processing result of the first transaction event is a second processing result.
[0060] In the execution process of the first business contract, when the cross-chain transaction request is input to the first business contract, the first business contract triggers the first business contract to invoke a first cross-chain contract on a first blockchain. By invoking the first cross-chain contract on the first blockchain, the first node device obtains the first cross-chain contract from the first blockchain, inputs transaction information of the cross-chain transaction as an input parameter into the first cross-chain contract, and executes the first cross-chain contract.
[0061] In the process of executing the first cross-chain contract, the first node device determines to execute a second transaction event of the cross-chain transaction in the second blockchain according to the transaction information, and after determining the second transaction event, the first node device returns event information of the second transaction event to the first business contract.
[0062] In one possible implementation, each blockchain in the blockchain system stores the blockchain information of each blockchain in the blockchain system. For example, the genesis block of each blockchain stores the blockchain information of each blockchain in the blockchain system. Also, for example, the cross-chain contract or business contract on each blockchain stores the blockchain information of each blockchain in the blockchain system. Among them, the blockchain information of a blockchain includes an indicator of a node set to which the blockchain belongs and an indicator of the blockchain. Optionally, the blockchain information of each blockchain further includes an indicator of a business contract on each blockchain and an indicator of a program code (or computer program) for executing a transaction event of a cross-chain transaction in the business contract.
[0063] In one possible implementation manner, in the execution process of the first cross-chain contract, the first node device further determines a target program code for realizing the second transaction event in the second business contract by querying blockchain information of the second blockchain stored in the first blockchain based on the identifier of the second business contract and the second transaction event, and returns the identifier of the target program code to the first business contract.
[0064] 304: According to a first business contract, a first node device stores first cross-chain transaction data in the first blockchain, and the first cross-chain transaction data is stored in the first blockchain after the first transaction event has been executed in the first blockchain and the second transaction event has been executed in the second blockchain. is executed This instructs:
[0065] In the process of executing the first business contract, the first node device obtains a processing result of the first transaction event, and obtains event information of a second transaction event returned by the first cross-chain contract, and the first node device generates the first cross-chain transaction data according to the processing result of the first transaction event and the event information of the second transaction event, and stores the first cross-chain transaction data in the first block chain.
[0066] In one possible implementation manner, the first node device generating first cross-chain transaction data based on the processing result of the first transaction event and the event information of the second transaction event includes the first node device generating the first cross-chain transaction data based on the processing result of the first transaction event, the event information of the second transaction event, an indicator of the second business contract, and an indicator of the target program code in the second business contract.
[0067] For convenience of description, a node device for generating a block in a node group is referred to as a block generating node device, and a node device for reaching consensus on a block in a node group is referred to as a consensus node device. In one possible implementation manner, the first node device storing the first cross-chain transaction data in the first blockchain includes the first node device broadcasting the first cross-chain transaction data in the first node group, and the block generating node device in the first node group packing the first cross-chain transaction data into a target block after receiving the first cross-chain transaction data. After the target block is generated, the block generating node device broadcasts the target block among the consensus node devices of the first node group. After a number of consensus node devices in the first node group reach consensus on the target block, each first node device in the first node group stores the target block in the local first blockchain, thereby realizing the storage of the first cross-chain transaction data in the first blockchain.
[0068] 305: The first gateway device obtains first cross-chain transaction data on the first blockchain.
[0069] Among them, the first gateway device is a gateway device corresponding to the first blockchain.
[0070] In one possible implementation, every time at least one block is added to the first blockchain, the first gateway device queries whether the at least one block contains cross-chain transaction data. If the at least one block contains cross-chain transaction data, the first gateway device obtains the queried cross-chain transaction data. Thus, after the first gateway device finds a target block containing the first cross-chain transaction data from the first blockchain, the first gateway device obtains the first cross-chain transaction data from the target block.
[0071] In another possible implementation, a first gateway device monitors whether a call event occurs in a first cross-chain contract on the first blockchain, and when the call event occurs, the first gateway device obtains cross-chain transaction data (e.g., first cross-chain transaction data) related to the call event from the first blockchain.
[0072] In addition, since the first cross-chain transaction data is one cross-chain transaction data related to the embodiment of the present application, the process shown in step 305 is also a process in which a gateway device in a blockchain system obtains cross-chain transaction data from the blockchain corresponding to the gateway device.
[0073] 306: The first gateway device sends a first signature acquisition request for the first cross-chain transaction data to the first verification node device, where the first signature acquisition request instructs the first verification node device to acquire a digital signature for the first cross-chain transaction data.
[0074] Wherein, the first verification node device is a verification node device in the first node set, i.e., a verification node device corresponding to the first blockchain. A digital signature of the first cross-chain transaction data is used to indicate that the first cross-chain transaction data is stored in the first blockchain, or a verification node device certifies that the first cross-chain transaction data is stored in the first blockchain. Optionally, the first signature acquisition request includes a hash value of the first cross-chain transaction data and an indicator of a target block to which the first cross-chain transaction data belongs. Wherein, the block indicator of the target block is the block height of the target block on the first blockchain, thereby indicating which block on the first blockchain the target block is.
[0075] In addition, since the first signature acquisition request is a signature acquisition request according to an embodiment of the present application, the process shown in step 306 is also a process in which a gateway device in a blockchain system sends a signature acquisition request to a verification node device.
[0076] 307: The first verification node device receives a first signature acquisition request from the first gateway device.
[0077] 308: Based on the first signature acquisition request, the first verification node device signs the first cross-chain transaction data, obtains a digital signature of the first cross-chain transaction data, and the first digital signature certifies that the first cross-chain transaction data is stored in the first blockchain.
[0078] In one possible implementation, the first node set includes at least one first verification node device, and the at least one first verification node device is a verification node pair in the first node set. Any one of the first verification node devices that receives the first signature acquisition request broadcasts the first signature acquisition request in the verification node pair. Each of the first verification node devices that receives the first signature acquisition request executes step 308.
[0079] In one possible implementation manner, the manner in which one first verification node device signs the first cross-chain transaction data based on the first signature acquisition request includes any one of the following methods AD.
[0080] Method A: The first verification node device endorses the first cross-chain transaction data based on the first signature acquisition request, and obtains a digital signature for the first cross-chain transaction data.
[0081] The first verification node device determines a target block on the first blockchain according to the identification of the target block in the first signature acquisition request, and queries whether the first cross-chain transaction data is stored in the target block according to the hash value of the first cross-chain transaction data in the first signature acquisition request. If the first cross-chain transaction data is stored in the target block, the first verification node device uses the private key of the first verification node device to sign (or encrypt) the hash value of the first cross-chain transaction data to complete the endorsement, and obtains a digital signature for the first cross-chain transaction data of the first verification node device, where the digital signature is the hash value after encryption of the first cross-chain transaction data, which is the authenticity proof of the first cross-chain transaction data of the first verification node device. If the first cross-chain transaction data is not stored in the target block, the first verification node device does not use the private key of the first verification node device to sign the hash value of the first cross-chain transaction data.
[0082] In one possible implementation, the first verification node device querying whether the first cross-chain transaction data is stored in the target block based on the hash value of the first cross-chain transaction data in the first signature acquisition request includes: the first verification node device obtains a Merkle root of the target block from a block header of the target block, the Merkle root of the target block is obtained based on the hash value of each transaction data in the target block, and the first verification node device calculates a hash value of each transaction data in the target block based on the Merkle root; if the calculated hash value of a certain transaction data is the same as the hash value of the first cross-chain transaction data, the transaction data is the first cross-chain transaction data, that is, the first cross-chain transaction data is stored in the target block, in which case, the first verification node device determines that the first cross-chain transaction data is stored in the first blockchain; and if the calculated hash values of each transaction data are different from the hash value of the first cross-chain transaction data, that is, the target block does not include the first cross-chain transaction data, in which case, the first verification node device determines that the first cross-chain transaction data is not stored in the first blockchain.
[0083] In one possible implementation manner, the first signature acquisition request does not include a hash value of the first cross-chain transaction data, but includes the first cross-chain transaction data. In this case, the first verification node device queries the first cross-chain transaction data from the target block based on the first cross-chain transaction data in the first signature acquisition request, and when the first cross-chain transaction data can be queried from the target block, the first verification node device determines that the first cross-chain transaction data is stored in the first blockchain; otherwise, the first verification node device determines that the first cross-chain transaction data is not stored in the first blockchain.
[0084] Method B: the first verification node device is a light node, and the light node is synchronized with the block information of each block on the first blockchain, in this case, the first verification node device acquires the block information of the target block from the synchronized block information of each block on the first blockchain based on the identifier of the target block in the first signature acquisition request, and acquires the Merkle root of the target block from the block information of the target block. The first verification node device determines whether the first cross-chain transaction data is stored in the target block based on the acquired Merkle root of the target block and the hash value of the first cross-chain transaction data in the first signature acquisition request, and when the first cross-chain transaction data is stored, the first verification node device signs the hash value of the first cross-chain transaction data to obtain a digital signature of the first cross-chain transaction data.
[0085] Regarding the first verification node device determining whether the first cross-chain transaction data is stored in the target block based on the acquired Merkle root of the target block and the hash value of the first cross-chain transaction data in the first signature acquisition request, the above-mentioned related descriptions may be referred to, and detailed descriptions thereof will be omitted here.
[0086] Method C: A relay chain of the first blockchain is set in the first verification node device, and block information of each block on the first blockchain is stored in the relay chain. The first verification node device can obtain a digital signature of the first cross-chain transaction data based on the block information of the target block on the relay chain by referring to the method of method B.
[0087] Scheme D: The first verification node device sends a first signature acquisition request to the TEE (Trusted Execution Environment) of the first verification node device, and a digital signature program code is stored in the TEE. The first verification node device executes the digital signature program code in the TEE to make the first verification node device obtain a digital signature of the first cross-chain transaction data according to the first signature acquisition request. Wherein, the digital signature program code is used to realize any one of signature mechanisms for signing the cross-chain transaction data. The any one of signature mechanisms may be similar or the same as any one of the above-mentioned schemes AC, or may be different from the above-mentioned schemes AC.
[0088] In addition, the digital signature in this application is proof of the authenticity of cross-chain transaction data.
[0089] In the embodiment of the present application, the manner in which the first verification node device obtains the digital signature of the first cross-chain transaction data according to the first signature acquisition request is not limited, and may be set according to the actual application scenario. The process shown in step 308 is the process in which the verification node device obtains the digital signature of the cross-chain transaction data according to the signature acquisition request.
[0090] 309: The first verification node device sends a digital signature of the first cross-chain transaction data to the first gateway device.
[0091] In one possible implementation manner, each first verification node device in the first node group all executes step 309. Each first verification node device generates a first signature response of the first cross-chain transaction data, and sends the first signature response to the first gateway device.
[0092] Among them, when one first verification node device signs the first cross-chain transaction data, the first signature response generated by the first verification node device includes one digital signature for the first cross-chain transaction data of the first verification node device. When the first verification node device signs the first cross-chain transaction data, the first signature response includes a hash value of the first cross-chain transaction data, but does not include a digital signature of the first cross-chain transaction data.
[0093] 310: The first gateway device receives a digital signature of the first cross-chain transaction data.
[0094] Optionally, the first gateway device receives a first signature response from each first verification node device, and derives a digital signature of the first cross-chain transaction data from the received first signature response.
[0095] It should be noted that the processes illustrated in steps 306-310 are optional processes, and in some embodiments, if there is no need to verify the authenticity of the cross-chain transaction data, the processes illustrated in steps 306-310 may not be performed.
[0096] 311: The first gateway device sends the first cross-chain transaction data and a digital signature of the first cross-chain transaction data to the second gateway device.
[0097] Among them, the second gateway device is a gateway device in a second node set, that is, a gateway device corresponding to the second block chain.
[0098] In one possible implementation, in order to achieve cross-chain interoperability compatibility between different node groups, a set of target cross-chain protocols is defined in this application, which is a general-purpose cross-chain protocol used to communicate between each gateway device in the blockchain system, and the communication between the gateway device and the node group to which it belongs adopts the internal protocol of the node group to which it belongs. That is, data transmission is performed between gateway devices in different node groups in the blockchain system according to the target cross-chain protocol. Data transmission may also be performed between devices in the same node group according to a specific transmission protocol. The transmission protocols used for different node groups may be different. For convenience of description, the transmission protocol used for the first node group is referred to as the first transmission protocol, and the transmission protocol used for the second node group is referred to as the second transmission protocol.
[0099] In one possible implementation manner, the first gateway device generates a first cross-chain message conforming to a target cross-chain protocol according to the first cross-chain transaction data and the digital signature of the first cross-chain transaction data, and sends the first cross-chain message to the second gateway device, where the first cross-chain message includes the first cross-chain transaction data and the digital signature of the first cross-chain transaction data, and the data format of the first cross-chain message conforms to the cross-chain message data format defined in the target cross-chain protocol.
[0100] In one possible implementation, if the process shown in the above steps 306-310 is not performed, the first gateway device sends the first cross-chain transaction data to the second gateway device, but does not send the digital signature of the first cross-chain transaction data to the second gateway device, and accordingly, the first cross-chain message does not include the first digital signature.
[0101] 312: The second gateway device receives the first cross-chain transaction data and a digital signature of the first cross-chain transaction data.
[0102] In one possible implementation manner, the second gateway device receives the first cross-chain message, and obtains the first cross-chain transaction data and a digital signature of the first cross-chain transaction data from the first cross-chain message.
[0103] 313: The second gateway device sends the first cross-chain transaction data and a digital signature of the first cross-chain transaction data to the second node device.
[0104] Among them, the second node device is any one of the node devices in the second node set.
[0105] In one possible implementation manner, in order to enable the second node device to recognize the first cross-chain transaction data and the digital signature of the first cross-chain transaction data, the second gateway device generates a second cross-chain message conforming to a second transmission protocol according to the first cross-chain transaction data and the digital signature of the first cross-chain transaction data, where the second cross-chain message includes the first cross-chain transaction data and the digital signature of the first cross-chain transaction data, and the data format of the second cross-chain message conforms to the data format of the cross-chain message in the second transmission protocol.
[0106] After the second cross-chain message is generated, the format conversion for the first cross-chain message is completed, and the second gateway device transmits the second cross-chain message to the second node device.
[0107] 314: The second node device receives the first cross-chain transaction data and the digital signature of the first cross-chain transaction data.
[0108] In one possible implementation manner, the second node device receives the second cross-chain message, and obtains the first cross-chain transaction data and a digital signature of the first cross-chain transaction data from the second cross-chain message.
[0109] The process shown in steps 312-314 above is a process in which the second node device obtains the first cross-chain transaction data from the first blockchain.
[0110] 315: The second node device executes a second cross-chain contract on the second blockchain based on the first cross-chain transaction data, and the second cross-chain contract is used to indicate a fourth execution manner of the cross-chain business on the second blockchain.
[0111] Wherein, the second cross-chain contract is a cross-chain contract on the second blockchain. For the second node device, the first blockchain is the counterpart chain and the second blockchain is the own chain, and for the first node device, the first blockchain is the own chain and the second blockchain is the counterpart chain. The fourth execution manner is realized by a processing logic for a cross-chain transaction initiated from the counterpart chain in the second cross-chain contract. The fourth execution manner includes verifying the authenticity of the first cross-chain transaction data on the first blockchain, storing the first cross-chain transaction data in the second blockchain, invoking a second business contract to execute a second transaction event in the second blockchain, and storing the second cross-chain transaction data in the second blockchain. Wherein, verifying the authenticity of the first cross-chain transaction data on the first blockchain is optional.
[0112] After receiving the first cross-chain transaction data (or the first cross-chain transaction data and the first cross-chain transaction data digital signature), trigger the second node device to invoke the first cross-chain contract by obtaining the second cross-chain contract from the local second blockchain. The second node device inputs the first cross-chain transaction data (or the first cross-chain transaction data and the digital signature of the first cross-chain transaction data) into the second cross-chain contract as an input parameter of the second cross-chain contract, and executes the second cross-chain contract.
[0113] 316: According to the second cross-chain contract, the second node device stores the first cross-chain transaction data on the second blockchain and executes the second business contract, where the second business contract indicates a third execution manner on the second blockchain of the cross-chain business.
[0114] Wherein, the second business contract is a business contract on the second blockchain. The third execution manner is realized by a processing logic for a cross-chain transaction initiated from a counterpart chain in the second cross-chain contract. The third execution manner includes receiving a call of the second cross-chain contract and executing a second transaction event on the second blockchain. In the execution process of the second cross-chain contract, the second node device stores the first cross-chain transaction data on the second blockchain and triggers the call of the second business contract on the second blockchain. When triggering the call of the second business contract on the second blockchain, the second node device obtains the second business contract from a local second blockchain, inputs event information of the second transaction event in the first cross-chain transaction data (or the event information and an indication of the target program code) into the second business contract as an input parameter of the second business contract, and the second node device executes the second business contract.
[0115] In one possible implementation manner, the second node device storing the first cross-chain transaction data in the second blockchain includes: the second node device performs verification on the first cross-chain transaction data based on the digital signature of the first cross-chain transaction data; if the first cross-chain transaction data passes the verification, the second node device stores the first cross-chain transaction data in the second blockchain; and if the first cross-chain transaction data does not pass the verification, the second node device does not perform a subsequent step.
[0116] Wherein, the second node device verifies the first cross-chain transaction data based on the digital signature of the first cross-chain transaction data; If the number of digital signatures of the first cross-chain transaction data is greater than a second threshold, the first cross-chain transaction data is verified; otherwise, the second node device does not verify the first cross-chain transaction data, where the second threshold is half of the total number of verification node devices in the first node group; or The second node device performs verification on the data format of the first cross-chain transaction data, and if the data format of the first cross-chain transaction data passes the verification and the number of digital signatures of the second cross-chain transaction data is greater than a second threshold, passes the verification on the second cross-chain transaction data, and if not, does not pass the verification on the second cross-chain transaction data.
[0117] Wherein, the second node device verifying the data format of the first cross-chain transaction data includes: the second node device detecting whether the data format of the first cross-chain transaction data conforms to a predetermined first data format; if the data format of the first cross-chain transaction data conforms to the predetermined first data format, passing the data format verification for the first cross-chain transaction data; if not, not passing the data format verification for the second cross-chain transaction data.
[0118] 317: According to the second business contract, the second node device executes a second transaction event on the second blockchain, and then executes a second cross-chain contract to store second cross-chain transaction data in the second blockchain, where the second cross-chain transaction data indicates that the second transaction event has been executed on the second blockchain.
[0119] In the execution process of the second business contract, the second node device inputs the event information of the second transaction event into the target program code of the business contract as an input parameter of the target program code based on the identification of the target program code in the first cross-chain transaction data, and executes the target program code.
[0120] In the process of executing the target program code, the second node device executes a second transaction event on the second blockchain, and returns a processing result of the second transaction event to the second cross-chain contract. If the execution of the second transaction event is successful, the processing result of the second transaction event is the first processing result, and if the execution of the second transaction event is unsuccessful, the processing result of the second transaction event is the second processing result.
[0121] The processing result of the second transaction event returned by the second business contract triggers the first node device to continue executing the second cross-chain contract. When continuing to execute the second cross-chain contract, the second node device generates second cross-chain transaction data according to the processing result of the second transaction event, and stores the second cross-chain transaction data in the second blockchain.
[0122] Among them, the process in which the second node device stores the second cross-chain transaction data in the second blockchain is similar to the process in which the first node device stores the first cross-chain transaction data in the first blockchain in step 303 described above. Therefore, in this embodiment of the present application, the description of the process in which the second node device stores the second cross-chain transaction data in the second blockchain is omitted.
[0123] 318: The second gateway device obtains second cross-chain transaction data on the second blockchain.
[0124] Step 318 is similar to step 305 described above, so here, the description of step 318 is omitted in the embodiment of the present application.
[0125] 319: The second gateway device sends a second signature acquisition request for the second cross-chain transaction data to the second verification node device, where the second signature acquisition request instructs the second verification node device to acquire a digital signature for the second cross-chain transaction data.
[0126] Step 319 is similar to step 306 described above, so here, the description of step 319 is omitted in the embodiment of the present application.
[0127] Wherein, the second verification node device is a verification node device in the second node set, that is, a verification node device corresponding to the second block chain. A digital signature of the second cross-chain transaction data indicates that the second cross-chain transaction data is stored in the second block chain.
[0128] 320: The second verification node device receives a second signature acquisition request from the second gateway device.
[0129] Step 320 is similar to step 307 described above, so here, the description of step 320 is omitted in the embodiment of the present application.
[0130] 321: The second verification node device obtains a digital signature of the second cross-chain transaction data based on the second signature acquisition request.
[0131] Step 321 is similar to step 308 described above, so here, the description of step 321 is omitted in the embodiment of the present application.
[0132] 322: The second verification node device sends a digital signature of the second cross-chain transaction data to the second gateway device.
[0133] Step 322 is similar to step 309 described above, so here, the description of step 322 is omitted in the embodiment of the present application.
[0134] 323: The second gateway device receives the digital signature of the second cross-chain transaction data.
[0135] Step 323 is similar to step 310 described above, so here, the description of step 323 is omitted in the embodiment of the present application.
[0136] It should be noted that the processes shown in steps 319-323 are optional processes, and in some embodiments, if there is no need to verify the authenticity of the cross-chain transaction data, the processes shown in steps 319-323 may not be performed.
[0137] 324: The second gateway device sends the second cross-chain transaction data and a digital signature of the second cross-chain transaction data to the first gateway device.
[0138] In one possible implementation manner, the second gateway device generates a third cross-chain message conforming to a target cross-chain protocol according to the second cross-chain transaction data and the digital signature of the second cross-chain transaction data, and sends the third cross-chain message to the first gateway device, where the third cross-chain message includes the second cross-chain transaction data and the digital signature of the second cross-chain transaction data, and the data format of the third cross-chain message conforms to the cross-chain message data format defined in the target cross-chain protocol.
[0139] In one possible implementation manner, when the process shown in the above steps 319-323 is not performed, the second gateway device sends the second cross-chain transaction data to the first gateway device, but does not send the digital signature of the second cross-chain transaction data to the first gateway device, and accordingly, the third cross-chain message does not include the digital signature of the second cross-chain transaction data.
[0140] 325: The first gateway device receives the second cross-chain transaction data and a digital signature of the second cross-chain transaction data.
[0141] Step 325 is similar to step 312 described above, so here, the description of step 325 is omitted in the embodiment of the present application.
[0142] 326: The first gateway device sends the second cross-chain transaction data and a digital signature of the second cross-chain transaction data to the first node device.
[0143] In one possible implementation manner, in order to enable the first node device to recognize the second cross-chain transaction data and the digital signature of the second cross-chain transaction data, the first gateway device generates a fourth cross-chain message conforming to the first transmission protocol according to the second cross-chain transaction data and the digital signature of the second cross-chain transaction data, where the fourth cross-chain message includes the second cross-chain transaction data and the digital signature of the second cross-chain transaction data, and the data format of the fourth cross-chain message conforms to the data format of the cross-chain message in the first transmission protocol.
[0144] After the fourth cross-chain message is generated, the format conversion for the third cross-chain message is completed, and the first gateway device sends the fourth cross-chain message to the first node device.
[0145] 327: The first node device receives the second cross-chain transaction data and a digital signature of the second cross-chain transaction data.
[0146] Step 327 is similar to step 314 described above, so here, the description of step 327 is omitted in the embodiment of the present application.
[0147] The process shown in steps 324-327 above is a process in which the first node device receives second cross-chain transaction data on the second blockchain provided by the second gateway device from the first gateway device.
[0148] 328: According to the first business contract and the first cross-chain contract, the first node device sends a transaction completion response to the terminal, where the transaction completion response indicates that the cross-chain transaction has been completed.
[0149] After the first node device obtains the second cross-chain transaction data, if the processing result of the second cross-chain transaction data is the first processing result, it means that the second transaction event is successfully executed in the second blockchain. If the processing result of the first cross-chain transaction data is the first processing result, it means that the first transaction event is successfully executed in the first blockchain. If the execution of the first transaction event and the second transaction event are all successful, the second node device returns a transaction completion response to the terminal. If the processing result of the second transaction event in the second cross-chain transaction data is the second result, or the processing result of the first transaction event in the first cross-chain transaction data is the second processing result, the first node device returns a transaction failure response to the terminal, and the transaction failure response is used to indicate a failure of the cross-chain transaction processing.
[0150] In one possible implementation, the first node device can execute a first cross-chain contract on the first blockchain to invoke a first business contract, and send a transaction completion response or a transaction failure response to the terminal, such as in steps 3281-3282 below.
[0151] Step 3281: The first node device executes the first cross-chain contract again based on the second cross-chain transaction data.
[0152] After receiving the second cross-chain transaction data (or the second cross-chain transaction data and the digital signature of the second cross-chain transaction data), the first node device inputs the second cross-chain transaction data (or the second cross-chain transaction data and the digital signature of the second cross-chain transaction data) into the first cross-chain contract as an input parameter of the first cross-chain contract, and triggers the first cross-chain contract to be executed again.
[0153] Step 3282: Through the re-execution of the first cross-chain contract, the first node device sends the second cross-chain transaction data to the first business contract, executes the first business contract again, and sends a transaction completion response to the terminal.
[0154] In the process of the first cross-chain contract being executed again, the first node device stores the second cross-chain transaction data in the first blockchain, thereby triggering the invocation of the first business contract on the first blockchain. By triggering the invocation of the first business contract on the first blockchain, the first node device inputs the second cross-chain transaction data (or the second cross-chain transaction data and the digital signature of the second cross-chain transaction data) into the first business contract as an input parameter of the first business contract, and executes the first business contract again. In the process of the second business contract being executed again, the first node device determines whether the cross-chain transaction has been completed according to the first cross-chain transaction data and the second cross-chain transaction data, and if it has been completed, sends a transaction completion response to the terminal, and if not, sends a transaction failure response to the terminal.
[0155] In one possible implementation manner, the first node device stores the second cross-chain transaction data in the first blockchain, where the first node device performs verification on the second cross-chain transaction data based on the digital signature of the second cross-chain transaction data, and if the second cross-chain transaction data passes the verification, the first node device stores the second cross-chain transaction data in the first blockchain; and if the second cross-chain transaction data passes the verification, the first node device does not store the second cross-chain transaction data in the first blockchain.
[0156] Wherein, the first node device verifies the second cross-chain transaction data based on the digital signature of the second cross-chain transaction data; If the number of digital signatures of the second cross-chain transaction data is greater than a first threshold, the first node device passes the verification of the second cross-chain transaction data; otherwise, the first threshold is half of the total number of verification node devices in the second node group; or The first node device performs verification on the data format of the second cross-chain transaction data, and if the data format of the second cross-chain transaction data passes the verification and the number of digital signatures of the second cross-chain transaction data is greater than a first threshold, the first node device passes the verification on the second cross-chain transaction data, and if not, the first node device does not pass the verification on the second cross-chain transaction data.
[0157] Wherein, the first node device verifying the data format of the second cross-chain transaction data includes: the first node device detecting whether the data format of the second cross-chain transaction data matches a predetermined second data format; if the data format of the second cross-chain transaction data matches the predetermined second data format, passing the data format verification of the second cross-chain transaction data of the first node device; if not, not passing the data format verification of the second cross-chain transaction data of the first node device.
[0158] In the method provided in the embodiment of the present application, when a cross-chain transaction request is received from a terminal, a node device in a blockchain system executes a business contract and a cross-chain contract on the blockchain, performs a cross-chain transaction, and returns a transaction completion response to the terminal after the cross-chain transaction is completed. In the process of the cross-chain transaction processing, the terminal requests the execution of the cross-chain transaction, receives the processing result of the cross-chain transaction, and is not interested in the specific processing process of the cross-chain transaction, so that the work burden of the terminal can be reduced. In addition, by storing the cross-chain contract in the blockchain, each node device in the blockchain system can complete the cross-chain transaction in the blockchain, and the cross-chain transaction data can be prevented from being tampered with. In addition, by making the verification node device a single device for authenticating the authenticity of the cross-chain transaction data, the user can set the rules for authenticating the cross-chain transaction data in the verification node device, and the gateway device does not need to authenticate the cross-chain transaction data by itself, so that the work burden of the gateway device can be reduced. By distributing the execution process of cross-chain transactions among multiple devices (node devices, gateway devices and verification node devices), cross-chain transactions can be completed through a distributed cross-chain framework. Such a cross-chain framework is abstracted as a general-purpose service, has multiple implementation methods internally, and can provide a unified digital signature for verification to the outside. The cross-chain framework has good customization and scalability, and can meet the cross-chain needs of different scenarios.
[0159] In addition, the following three points need to be explained further regarding Figures 3 and 4.
[0160] (1) By a business contract, the execution logic of the steps executed by the node device is realized by the program code (or computer program) in the business contract. By a cross-chain contract, the execution logic of the steps executed by the node device is realized by the program code (or computer program) in the cross-chain contract.
[0161] (2) Because there are relatively many steps, in order to make the logic clearer, steps 301 to 328 are divided into Figures 3 and 4, in which Figure 3 is a flowchart of a first node set provided in an embodiment of the present application processing a cross-chain transaction, and Figure 3 includes steps performed by each device in the first node set when processing a cross-chain transaction. Figure 4 is a flowchart of a second node set provided in an embodiment of the present application processing a cross-chain transaction, and Figure 4 includes steps performed by each device in the second node set when processing a cross-chain transaction.
[0162] (3) In the process shown in Figures 3 and 4, each node set has a verification node device, and the verification node device in each node set provides a digital signature for the cross-chain transaction data stored in the blockchain of each node set. In another possible implementation, the blockchain system provides the same verification node device that can be shared by the node sets, and the same verification node device can provide a digital signature for the cross-chain transaction data in each node set in the blockchain system.
[0163] To further explain the process shown in Figures 3 and 4, the processing process of cross-chain transactions will be described as follows by taking the blockchain system shown in Figure 5 as an example.
[0164] FIG. 5 is a diagram illustrating a cross-chain transaction processing method provided in an embodiment of the present application. The blockchain system in FIG. 5 includes a first node group, a second node group, and a registration device. The node device in the first node group is a first node device, and a plurality of first node devices maintain a blockchain 1, and the node device in the second node group is a second node device, and a plurality of second node devices maintain a blockchain 2. The gateway device in the first node group is a first gateway device, and the gateway device in the second node group is a second gateway device. The verification node device in the first node group is a first verification node device, and the verification node device in the second node group is a second verification node device. The first node device can receive one cross-chain transaction request of a terminal, and the cross-chain transaction request may be sent from one business App (Application) in the terminal (as shown in FIG. 5), and the business APP may be a cross-chain application or a decentralization application Dapp.
[0165] After receiving the cross-chain transaction request, the first node device can execute the business contract 1 on the blockchain 1, and the business contract 1 executes the first transaction event of the cross-chain transaction on its own chain (i.e., blockchain 1) and determines the second transaction event of the cross-chain transaction to be executed on the other chain (i.e., blockchain 2) by calling the cross-chain contract 1 on the blockchain 1. When the transaction event of the cross-chain transaction is executed on its own chain and the second transaction event to be executed on the other chain is determined, the business contract 1 stores the cross-chain transaction data 1 on its own chain of the cross-chain transaction on its own chain. The first gateway device can obtain the authenticity proof (i.e., digital signature) of the cross-chain transaction data 1 from the first verification node device, and send the authenticity proof and the cross-chain transaction data 1 to the second gateway device. The second gateway device sends the received cross-chain transaction data 1 and authenticity proof to the second node device. The second node device executes the cross-chain contract 2 on its own chain (i.e., the blockchain 2) based on the cross-chain transaction data 1, and if the authenticity proof passes the verification of the cross-chain contract 2, the cross-chain contract 2 stores the cross-chain transaction data 1 in its own chain, and then invokes the business contract 2 on its own chain, which executes a second transaction event of the cross-chain transaction on the blockchain 2, and returns the processing result of the second transaction event to the cross-chain contract 2. The cross-chain contract 2 stores the cross-chain transaction data 2 in the blockchain 2 based on the processing result of the second transaction event.The second gateway device obtains the cross-chain transaction data 2 from the blockchain 2, obtains the authenticity proof (i.e., digital signature) of the cross-chain transaction data 2 from the second verification node device, and returns the cross-chain transaction data 2 and the authenticity proof to the first gateway device. The first gateway device further returns the cross-chain transaction data 2 and the authenticity proof to the first node device, and the first node device executes the cross-chain contract 1 again, and when the received authenticity proof passes the verification of the cross-chain contract 1, the cross-chain contract 1 calls the business contract 1 and sends a transaction completion response to the terminal or the business application in the terminal.
[0166] 6 is a configuration diagram of a cross-chain transaction processing device provided in an embodiment of the present application. As shown in FIG. 6, the device 500 is configured in a block chain system, in which a first block chain and a second block chain are further configured, and the device 500 includes:
[0167] Receiving module 501: used for receiving a cross-chain transaction request of a terminal, where the cross-chain transaction request instructs to conduct a cross-chain transaction between a first blockchain and a second blockchain.
[0168] Processing module 502: according to the cross-chain transaction request, execute a first business contract on a first blockchain, where the first business contract indicates a first execution manner of the cross-chain transaction on the first blockchain; execute a first transaction event of the cross-chain transaction on the first blockchain through the first business contract, execute a first cross-chain contract on the first blockchain, and determine to execute a second transaction event of the cross-chain transaction on the second blockchain, where the first cross-chain contract indicates a second execution manner of the cross-chain transaction on the first blockchain; and store first cross-chain transaction data on the first blockchain through the first business contract, where the first cross-chain transaction data indicates that the first transaction event has been executed on the first blockchain and the second transaction event has been executed on the second blockchain. is executed It is used to indicate that something should be done.
[0169] The receiving module 501 is further used to obtain second cross-chain transaction data from a second blockchain, where the second cross-chain transaction data is obtained based on the first cross-chain transaction data, and the second cross-chain transaction data indicates that a second transaction event has already been executed in the second blockchain.
[0170] The processing module 502 is further used by the first business contract and the first cross-chain contract to send a transaction completion response to the terminal, where the transaction completion response indicates that the cross-chain transaction has been completed.
[0171] In some embodiments, the processing module 502 further comprises: re-executing the first cross-chain contract based on the second cross-chain transaction data; and The re-executed first cross-chain contract is used to send the second cross-chain transaction data to the first business contract, re-execute the first business contract, and send a transaction completion response to the terminal.
[0172] In some embodiments, the receiving module 501 further receives a digital signature of the second cross-chain transaction data, the digital signature being used to indicate that the second cross-chain transaction data has already been stored in the second blockchain. Sending the second cross-chain transaction data to the first business contract includes sending the second cross-chain transaction data to the first business contract when the number of the digital signatures of the second cross-chain transaction data is greater than a first threshold.
[0173] In some embodiments, the receiving module 501 is further used for receiving second cross-chain transaction data on the second blockchain from the first gateway device, when the first blockchain corresponds to the first gateway device and the second blockchain corresponds to the second gateway device, and the second cross-chain transaction data is provided by the second gateway device.
[0174] In some embodiments, the cross-chain transaction request includes transaction information of the cross-chain transaction, an indicator of a first business contract, and an indicator of a second business contract on the second blockchain, where the second business contract indicates a third execution manner of the cross-chain transaction on the second blockchain.
[0175] In addition, when the cross-chain transaction processing device 500 processes a cross-chain transaction, the above-mentioned division of each functional module is described as an example, but in actual applications, the above-mentioned functions may be assigned to different functional modules according to needs, that is, the internal configuration of the device may be divided into different functional modules to complete all or part of the above-mentioned functions. In addition, since the cross-chain transaction processing device provided in the above embodiment belongs to the same concept as the embodiment of the cross-chain transaction processing method, the specific implementation process can be referred to the embodiment of the method, and a detailed description thereof will be omitted here.
[0176] 7 is a configuration diagram of a cross-chain transaction processing device provided in an embodiment of the present application. The device 600 is configured in a block chain system, in which a first block chain and a second block chain are further configured, and the device 600 includes:
[0177] An acquisition module 601 is used to acquire first cross-chain transaction data from a first blockchain, the first cross-chain transaction data being a first transaction event of a cross-chain transaction that has been executed on the first blockchain and a second transaction event of a cross-chain transaction that has been executed on the second blockchain. is executed This instructs:
[0178] Processing module 602: is used to: execute a second cross-chain contract on the second blockchain according to the first cross-chain transaction data, where the second cross-chain contract indicates a fourth execution manner of the cross-chain transaction on the second blockchain; store the first cross-chain transaction data on the second blockchain through the second cross-chain contract, execute a second business contract on the second blockchain, where the second business contract indicates a third execution manner of the cross-chain transaction on the second blockchain; and execute a second transaction event on the second blockchain through the second business contract, continue to execute the second cross-chain contract, and store the second cross-chain transaction data on the second blockchain, where the second cross-chain transaction data indicates that the second transaction event has been executed on the second blockchain.
[0179] In some embodiments, the acquiring module 601 is also used to receive a digital signature of the first cross-chain transaction data, where the digital signature indicates that the first cross-chain transaction data has already been stored in the first blockchain. Storing the first cross-chain transaction data in the second blockchain includes storing the first cross-chain transaction data in the second blockchain when a number of the digital signatures of the first cross-chain transaction data is greater than a second threshold.
[0180] In some embodiments, the acquiring module 601 is further used for receiving first cross-chain transaction data on the first blockchain from the second gateway device, when the first blockchain corresponds to the first gateway device and the second blockchain corresponds to the second gateway device, and the first cross-chain transaction data is provided by the first gateway device.
[0181] In addition, when the cross-chain transaction processing device 600 processes a cross-chain transaction, the above-mentioned division of each functional module is described as an example, but in actual applications, the above-mentioned functions may be assigned to different functional modules according to needs, that is, the internal configuration of the device may be divided into different functional modules to complete all or part of the above-mentioned functions. In addition, since the cross-chain transaction processing device provided in the above embodiment belongs to the same concept as the embodiment of the cross-chain transaction processing method, the specific implementation process can be referred to the embodiment of the method, and a detailed description thereof will be omitted here.
[0182] 8 is a block diagram of an electronic device provided in an embodiment of the present application. As shown in FIG. 8, the electronic device 700 may be configured as any one of the devices in the above-mentioned blockchain system, such as any one of the node devices, any one of the gateway devices, any one of the verification node devices or the registration device, and the electronic device 700 may be widely different depending on the settings and performance, and may include one or more CPUs (central processing units). The electronic device 700 may include a processing unit 701 and one or more memory units 702, in which at least one computer program is stored, and the at least one computer program can be loaded and executed by the processor 701 to realize the methods provided in the above-mentioned method embodiments. Of course, the electronic device 700 may further include components such as a wired or wireless network interface, a keyboard, an input / output interface, etc. for input / output, and the electronic device 700 may further include other components for realizing the functions of the device, but detailed description thereof will be omitted here.
[0183] In an exemplary embodiment, a computer-readable storage medium, such as a storage device containing a program code, is further provided, and the program code can be executed by a processor in a terminal to realize the cross-chain transaction processing method in the above embodiment. For example, the computer-readable storage medium can be a Read-Only Memory (ROM), a Random Access Memory (RAM), a Compact Disc Read-Only Memory (CD-ROM), a magnetic tape, an optical data storage device, etc.
[0184] All of the above-mentioned optional technical solutions can be adopted in any combination to form optional embodiments of the present invention, and a comprehensive listing is omitted here.
[0185] As can be understood by those skilled in the art, the realization of all or part of the steps of the above-mentioned embodiments may be completed by hardware, or may be completed by a program instructing related hardware, and the program may be stored in a computer-readable storage medium, such as a ROM, a magnetic disk, an optical disk, etc.
[0186] Although the preferred embodiment of the present application has been described above, the present application is not limited to this embodiment, and any modification to the present application falls within the technical scope of the present application as long as it does not depart from the spirit of the present application.
Claims
1. A method for processing a cross-chain transaction, executed by a first node device in a blockchain system, comprising: The blockchain system includes a first blockchain and a second blockchain, The first blockchain corresponds to a first gateway device, and the second blockchain corresponds to a second gateway device; The method comprises: receiving a cross-chain transaction request from a terminal, the cross-chain transaction request indicating performing a cross-chain transaction between the first blockchain and the second blockchain; Executing a first business contract on the first blockchain according to the cross-chain transaction request, the first business contract indicating a first execution manner of the cross-chain transaction on the first blockchain; determining, through the first business contract, to execute a first transaction event of the cross-chain transaction on the first blockchain, execute a first cross-chain contract on the first blockchain, and execute a second transaction event of the cross-chain transaction on the second blockchain, where the first cross-chain contract indicates a second execution manner of the cross-chain transaction on the first blockchain; storing first cross-chain transaction data in the first blockchain according to the first business contract, the first cross-chain transaction data indicating that the first transaction event has been executed in the first blockchain and the second transaction event will be executed in the second blockchain; the first gateway device is used to receive a digital signature of the first cross-chain transaction data from a first verification node device, and generate a first cross-chain message conforming to a target cross-chain protocol based on the first cross-chain transaction data and the digital signature of the first cross-chain transaction data, and send the first cross-chain message to the second gateway device, the first verification node device is used to perform authenticity proof on the first cross-chain transaction data, and the target cross-chain protocol is a general-purpose cross-chain protocol used for communication between each gateway device in the blockchain system; receiving, from the first gateway device, second cross-chain transaction data on the second blockchain provided by the second gateway device, the second cross-chain transaction data being obtained based on the first cross-chain transaction data, the second cross-chain transaction data indicating that the second transaction event has already been executed on the second blockchain, the second gateway device being used to receive a digital signature of the second cross-chain transaction data from a second verification node device, and generating a third cross-chain message conforming to the target cross-chain protocol based on the second cross-chain transaction data and the digital signature of the second cross-chain transaction data, and sending the third cross-chain message to the first gateway device, the second verification node device being used to perform authenticity attestation on the second cross-chain transaction data; and sending a transaction completion response to the terminal by the first business contract and the first cross-chain contract, the transaction completion response indicating that the cross-chain transaction has been completed.
2. 2. The method of claim 1, The step of sending a transaction completion response to the terminal by the first business contract and the first cross-chain contract includes: Sending the second cross-chain transaction data to the first business contract by executing the first cross-chain contract again according to the second cross-chain transaction data; and sending the transaction completion response to the terminal by executing the first business contract again.
3. 3. The method of claim 2, before executing the first cross-chain contract again based on the second cross-chain transaction data; The method comprises: receiving a digital signature of the second cross-chain transaction data, the digital signature indicating that the second cross-chain transaction data has already been stored in the second blockchain; The step of sending the second cross-chain transaction data to the first business contract includes: When a number of digital signatures of the second cross-chain transaction data is greater than a first threshold, sending the second cross-chain transaction data to the first business contract.
4. 2. The method of claim 1, The cross-chain transaction request includes transaction information of the cross-chain transaction, an indicator of the first business contract, and an indicator of a second business contract on the second blockchain, the second business contract indicating a third execution manner of the cross-chain transaction on the second blockchain.
5. A method for processing a cross-chain transaction, executed by a second node device in a blockchain system, comprising: The blockchain system includes a first blockchain and a second blockchain, The first blockchain corresponds to a first gateway device, and the second blockchain corresponds to a second gateway device; The method comprises: receiving, from the second gateway device, first cross-chain transaction data on the first blockchain provided by the first gateway device, the first cross-chain transaction data indicating that a first transaction event of a cross-chain transaction has already been executed on the first blockchain and a second transaction event of the cross-chain transaction will be executed on the second blockchain; the first gateway device is used to receive a digital signature of the first cross-chain transaction data from a first verification node device, and generate a first cross-chain message conforming to a target cross-chain protocol based on the first cross-chain transaction data and the digital signature of the first cross-chain transaction data, and send the first cross-chain message to the second gateway device, the first verification node device is used to perform authenticity proof on the first cross-chain transaction data, and the target cross-chain protocol is a general-purpose cross-chain protocol used for communication between each gateway device in the blockchain system; executing a second cross-chain contract on the second blockchain according to the first cross-chain transaction data, where the second cross-chain contract indicates a fourth execution manner of the cross-chain transaction on the second blockchain; storing the first cross-chain transaction data in the second blockchain and executing a second business contract on the second blockchain by the second cross-chain contract, the second business contract indicating a third execution manner of the cross-chain transaction on the second blockchain; and executing the second transaction event on the second blockchain according to the second business contract, continuing to execute the second cross-chain contract, and storing second cross-chain transaction data on the second blockchain, wherein the second cross-chain transaction data indicates that the second transaction event has already been executed on the second blockchain; the second gateway device is used to receive a digital signature of the second cross-chain transaction data from a second verification node device, and based on the second cross-chain transaction data and the digital signature of the second cross-chain transaction data, generate a third cross-chain message conforming to the target cross-chain protocol and send the third cross-chain message to the first gateway device; and the second verification node device is used to perform authenticity attestation on the second cross-chain transaction data.
6. 6. The method of claim 5, before executing a second cross-chain contract on the second blockchain based on the first cross-chain transaction data; The method comprises: receiving a digital signature of the first cross-chain transaction data, the digital signature indicating that the first cross-chain transaction data has already been stored in the first blockchain; Storing the first cross-chain transaction data on the second blockchain includes: storing the first cross-chain transaction data in the second blockchain if a number of digital signatures of the first cross-chain transaction data is greater than a second threshold.
7. A blockchain system for processing cross-chain transactions, comprising: The block chain system includes a first node device, a second node device, a first gateway device, a second gateway device, and a verification node device, The blockchain system includes a first blockchain and a second blockchain, The first blockchain corresponds to a first gateway device, and the second blockchain corresponds to a second gateway device; The first node device receiving a cross-chain transaction request from a terminal, the cross-chain transaction request indicating performing a cross-chain transaction between the first blockchain and the second blockchain; Execute a first business contract on the first blockchain according to the cross-chain transaction request, where the first business contract indicates a first execution manner of the cross-chain transaction on the first blockchain; The first business contract determines to execute a first transaction event of the cross-chain transaction on the first blockchain, execute a first cross-chain contract on the first blockchain, and execute a second transaction event of the cross-chain transaction on the second blockchain, where the first cross-chain contract indicates a second execution manner of the cross-chain transaction on the first blockchain; and The first business contract stores first cross-chain transaction data on the first blockchain, and the first cross-chain transaction data indicates that the first transaction event has been executed on the first blockchain and that the second transaction event will be executed on the second blockchain. It is used to do that. The first gateway device is used to send the first cross-chain transaction data on the first blockchain to the second gateway device, and the first gateway device is used to receive a digital signature of the first cross-chain transaction data from the verification node device, generate a first cross-chain message conforming to a target cross-chain protocol based on the first cross-chain transaction data and the digital signature of the first cross-chain transaction data, and send the first cross-chain message to the second gateway device, the target cross-chain protocol being a general-purpose cross-chain protocol used for communication between each gateway device in the blockchain system; the second gateway device is used to transmit the first cross-chain transaction data to the second node device; The second node device: execute a second cross-chain contract on the second blockchain according to the first cross-chain transaction data, the second cross-chain contract indicating a fourth execution manner of the cross-chain transaction on the second blockchain; The second cross-chain contract stores the first cross-chain transaction data in the second blockchain and executes a second business contract on the second blockchain, the second business contract indicating a third execution manner of the cross-chain transaction on the second blockchain; and Execute the second transaction event on the second blockchain according to the second business contract, and continue to execute the second cross-chain contract, and store second cross-chain transaction data on the second blockchain, where the second cross-chain transaction data indicates that the second transaction event has been executed on the second blockchain. It is used to do that. The second gateway device is further used to send the second cross-chain transaction data on the second blockchain to the first gateway device, and the second gateway device is used to receive a digital signature of the second cross-chain transaction data from the verification node device, generate a third cross-chain message conforming to the target cross-chain protocol based on the second cross-chain transaction data and the digital signature of the second cross-chain transaction data, and send the third cross-chain message to the first gateway device; The first gateway device is further adapted to transmit the second cross-chain transaction data to the first node device; The first node device is further adapted to receive the second cross-chain transaction data from the first gateway device and send a transaction completion response to the terminal, the transaction completion response indicating that the cross-chain transaction has been completed; The verification node device is used to attest to the authenticity of cross-chain transaction data, The verification node device: receiving a request to obtain a signature for cross-chain transaction data from a gateway device, the gateway device being the first gateway device or the second gateway device, and the cross-chain transaction data being the first cross-chain transaction data or the second cross-chain transaction data; Obtaining a digital signature of the cross-chain transaction data based on the signature acquisition request, the digital signature indicating that the cross-chain transaction data is stored in a cross-chain corresponding to the gateway device; and Sending a digital signature of the cross-chain transaction data to the gateway device It is used to do that. The gateway device is further used for sending a digital signature of the cross-chain transaction data and the cross-chain transaction data to a corresponding node device.
8. An apparatus for processing cross-chain transactions, comprising: The device is configured in a blockchain system, and a first blockchain and a second blockchain are further configured in the blockchain system; The first blockchain corresponds to a first gateway device, and the second blockchain corresponds to a second gateway device; The apparatus includes a receiving module and a processing module; The receiving module is used to receive a cross-chain transaction request from a terminal, the cross-chain transaction request indicating performing a cross-chain transaction between the first blockchain and the second blockchain; The processing module includes: Execute a first business contract on the first blockchain according to the cross-chain transaction request, where the first business contract indicates a first execution manner of the cross-chain transaction on the first blockchain; The first business contract determines to execute a first transaction event of the cross-chain transaction on the first blockchain, execute a first cross-chain contract on the first blockchain, and execute a second transaction event of the cross-chain transaction on the second blockchain, where the first cross-chain contract indicates a second execution manner of the cross-chain transaction on the first blockchain; and The first business contract stores first cross-chain transaction data in the first blockchain, and the first cross-chain transaction data indicates that the first transaction event has been executed in the first blockchain and that the second transaction event will be executed in the second blockchain. The first gateway device is used to receive a digital signature of the first cross-chain transaction data from a first verification node device, generate a first cross-chain message conforming to a target cross-chain protocol based on the first cross-chain transaction data and the digital signature of the first cross-chain transaction data, and send the first cross-chain message to the second gateway device. The first verification node device is used to perform authenticity proof on the first cross-chain transaction data. The target cross-chain protocol is a general-purpose cross-chain protocol used to communicate between each gateway device in the blockchain system. It is used to do that. The receiving module is further used to receive, from the first gateway device, second cross-chain transaction data on the second blockchain provided by the second gateway device, the second cross-chain transaction data being obtained based on the first cross-chain transaction data, the second cross-chain transaction data indicating that the second transaction event has already been executed on the second blockchain; the second gateway device is used to receive a digital signature of the second cross-chain transaction data from a second verification node device, and generate a third cross-chain message conforming to the target cross-chain protocol based on the second cross-chain transaction data and the digital signature of the second cross-chain transaction data, and send the third cross-chain message to the first gateway device; and the second verification node device is used to perform authenticity attestation on the second cross-chain transaction data; The processing module is further used by the first business contract and the first cross-chain contract to send a transaction completion response to the terminal, the transaction completion response indicating that the cross-chain transaction has been completed.
9. 9. An apparatus according to claim 8, comprising: The processing module further comprises: Re-executing the first cross-chain contract according to the second cross-chain transaction data, and sending the second cross-chain transaction data to the first business contract through the re-executed first cross-chain contract; and Execute the first business contract again and send the transaction completion response to the terminal. A device used to perform a task.
10. An apparatus for processing cross-chain transactions, comprising: The device is configured in a blockchain system, and a first blockchain and a second blockchain are further configured in the blockchain system; The first blockchain corresponds to a first gateway device, and the second blockchain corresponds to a second gateway device; The apparatus includes an acquisition module and a processing module; the acquiring module is used to receive first cross-chain transaction data on the first blockchain provided by the first gateway device from the second gateway device, the first cross-chain transaction data indicating that a first transaction event of a cross-chain transaction has already been executed on the first blockchain and a second transaction event of the cross-chain transaction will be executed on the second blockchain; the first gateway device is used to receive a digital signature of the first cross-chain transaction data from a first verification node device, generate a first cross-chain message conforming to a target cross-chain protocol based on the first cross-chain transaction data and the digital signature of the first cross-chain transaction data, and send the first cross-chain message to the second gateway device; the first verification node device is used to perform authenticity proof on the first cross-chain transaction data; and the target cross-chain protocol is a general-purpose cross-chain protocol used for communication between each gateway device in the blockchain system; The processing module includes: execute a second cross-chain contract on the second blockchain according to the first cross-chain transaction data, the second cross-chain contract indicating a fourth execution manner of the cross-chain transaction on the second blockchain; The second cross-chain contract stores the first cross-chain transaction data in the second blockchain and executes a second business contract, the second business contract indicating a third execution manner of the cross-chain transaction on the second blockchain; and Execute the second transaction event in the second blockchain according to the second business contract, continue to execute the second cross-chain contract, and store second cross-chain transaction data in the second blockchain, the second cross-chain transaction data indicating that the second transaction event has been executed in the second blockchain; the second gateway device is used to receive a digital signature of the second cross-chain transaction data from a second verification node device, generate a third cross-chain message conforming to the target cross-chain protocol based on the second cross-chain transaction data and the digital signature of the second cross-chain transaction data, and send the third cross-chain message to the first gateway device; and the second verification node device is used to perform authenticity certification on the second cross-chain transaction data. A device used to perform a task.
11. An electronic device including a processor and a memory connected to the processor, The storage device stores a computer program, 7. An electronic device, the processor being configured to execute the computer program to implement the method according to any one of claims 1 to 6.
12. A program for causing a computer to execute the method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Verifying integrity of data stored in consortium blockchain using public sidechain
JP2020145681A
Resource transfer method and apparatus, storage medium, and computer device
US20190347657A1
Blockchain implementing cross-chain transactions
WO2019211225A1
Public chain-based blockchain network addressing method
WO2021012812A1
Method and apparatus for processing data request
WO2021042713A1