Methods and apparatus for cross-chain resource transfer in cross-chain system, and system
By deploying resource contracts, transition contracts, and cross-chain contracts in the cross-chain system, the problems of poor liquidity and transaction consistency in resource transfers in the cross-chain system are solved, the atomicity of cross-chain transfers and the preservation of resource attributes are achieved, and the liquidity of digital resources is enhanced.
Patent Information
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- ANT BLOCKCHAIN TECHNOLOGY (SHANGHAI) CO LTD
- Filing Date
- 2025-10-30
- Publication Date
- 2026-05-07
AI Technical Summary
Existing cross-chain systems lack effective solutions for transferring resources across chains, resulting in poor liquidity of digital resources between different blockchains, and making it difficult to guarantee the atomicity and consistency of cross-chain transfers.
In the cross-chain system, resource contracts, transition contracts, and cross-chain contracts are deployed for the first and second blockchains respectively. Digital resources are managed through smart contracts, and cross-chain messages are transmitted in cross-chain messages to realize cross-chain transfers. Transition contracts are used to maintain cross-chain reference information to ensure that resources remain unique and their attributes remain unchanged during the transfer process between different blockchains.
It enables digital resource management and cross-chain transfers between different blockchains, ensuring the uniqueness and attributes of resources remain unchanged, while maintaining the atomicity and consistency of cross-chain transfers and enhancing the liquidity of digital resources.
Smart Images

Figure CN2025131160_07052026_PF_FP_ABST
Abstract
Description
Methods, systems and apparatus for cross-chain resource transfer in cross-chain systems
[0001] This application claims priority to Chinese patent application filed on October 31, 2024, with application number 2024115493255, entitled "Method, System and Apparatus for Cross-Chain Transfer of Resources in a Cross-Chain System", the entire contents of which are incorporated herein by reference. Technical Field
[0002] This specification relates to the field of blockchain technology in one or more embodiments, and particularly to a method, system and apparatus for cross-chain resource transfer in a cross-chain system. Background Technology
[0003] Blockchain is a novel application model of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanisms, and cryptographic algorithms. In a blockchain, data blocks are sequentially linked together to form a chain-like data structure, and cryptographic methods are used to ensure the immutability and forgery resistance of these data blocks. Due to its decentralized, immutable, and autonomous characteristics, blockchain has received increasing attention and application. Currently, there is a need for a cross-chain resource transfer solution within a cross-chain system. Summary of the Invention
[0004] This specification provides one or more embodiments of a method, system, and apparatus for cross-chain resource transfer in a cross-chain system.
[0005] According to a first aspect, a method for cross-chain resource transfer in a cross-chain system is provided, the cross-chain system comprising a first blockchain and a second blockchain; the first blockchain deploys a first resource contract, a first transition contract, and a first cross-chain contract; the second blockchain deploys a second resource contract, a second transition contract, and a second cross-chain contract; the method is executed by nodes of the first blockchain; the method includes:
[0006] Receive a first transaction that invokes the first resource contract; the first transaction indicates the transfer of the first resource from a first account on the first blockchain to a second account on the second blockchain;
[0007] Based on the first transaction, the first resource is transferred from the first account to the first transition contract, and the first transition contract calls the sending interface of the first cross-chain contract to transmit a cross-chain message to the second blockchain; the cross-chain message is used to instruct the transfer of the first resource to the second account through the second resource contract and the second transition contract.
[0008] According to a second aspect, a method for cross-chain resource transfer in a cross-chain system is provided, the cross-chain system comprising a first blockchain and a second blockchain; a second resource contract, a second transition contract, and a second cross-chain contract are deployed in the second blockchain; the method is executed by nodes of the second blockchain; the method includes:
[0009] Receive a cross-chain transfer transaction that invokes the second cross-chain contract; the cross-chain transfer transaction includes a cross-chain message from the first blockchain; the cross-chain message is used to instruct the transfer of the first resource to the second account through the second resource contract and the second transition contract;
[0010] The second cross-chain contract is executed, triggering the second transition contract to call the second resource contract to update the resources in the second account based on the cross-chain message, so as to perform a cross-chain transfer operation.
[0011] According to a third aspect, a cross-chain system is provided, the cross-chain system comprising a first blockchain and a second blockchain; the first blockchain is deployed with a first resource contract, a first transition contract and a first cross-chain contract; the second blockchain is deployed with a second resource contract, a second transition contract and a second cross-chain contract;
[0012] A node in the first blockchain is used to receive a first transaction that invokes the first resource contract; the first transaction indicates the transfer of the first resource from a first account in the first blockchain to a second account in the second blockchain; based on the first transaction, the first resource is transferred from the first account to the first transition contract, and the first transition contract calls the sending interface of the first cross-chain contract to transmit a cross-chain message to the second blockchain; the cross-chain message is used to indicate the transfer of the first resource to the second account through the second resource contract and the second transition contract;
[0013] The nodes of the second blockchain are used to perform cross-chain transfer operations based on the cross-chain messages.
[0014] According to a fourth aspect, an apparatus for cross-chain resource transfer in a cross-chain system is provided, the cross-chain system comprising a first blockchain and a second blockchain; the first blockchain deploys a first resource contract, a first transition contract, and a first cross-chain contract; the second blockchain deploys a second resource contract, a second transition contract, and a second cross-chain contract; the apparatus is deployed on a node of the first blockchain; the apparatus comprises:
[0015] The receiving module is configured to receive a first transaction that invokes the first resource contract; the first transaction indicates the transfer of the first resource from a first account in the first blockchain to a second account in the second blockchain;
[0016] An execution module is configured to transfer the first resource from the first account to the first transition contract based on the first transaction, and to transmit a cross-chain message to the second blockchain by calling the sending interface of the first cross-chain contract through the first transition contract; the cross-chain message is used to instruct the transfer of the first resource to the second account through the second resource contract and the second transition contract.
[0017] According to a fifth aspect, an apparatus for cross-chain resource transfer in a cross-chain system is provided, the cross-chain system comprising a first blockchain and a second blockchain; a second resource contract, a second transition contract, and a second cross-chain contract are deployed in the second blockchain; the apparatus is deployed on a node of the second blockchain for execution; the method includes:
[0018] A receiving module is configured to receive a cross-chain transfer transaction that invokes the second cross-chain contract; the cross-chain transfer transaction includes a cross-chain message from the first blockchain; the cross-chain message is used to instruct the transfer of the first resource to the second account through the second resource contract and the second transition contract;
[0019] The transfer module is used to run the second cross-chain contract, triggering the second transition contract to call the second resource contract to update the resources in the second account based on the cross-chain message, so as to perform a cross-chain transfer operation.
[0020] According to a sixth aspect, a computer-readable storage medium is provided, the storage medium storing a computer program that, when executed by a processor, implements the method described in any one of the first or second aspects above.
[0021] According to a seventh aspect, a computing device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the method described in any one of the first or second aspects above.
[0022] The technical solutions provided in the embodiments of this specification may include the following beneficial effects:
[0023] The embodiments of this specification provide a method and apparatus for cross-chain resource transfer in a cross-chain system. This involves deploying a first resource contract, a first transition contract, and a first cross-chain contract in a first blockchain of the cross-chain system, and a second resource contract, a second transition contract, and a second cross-chain contract in a second blockchain. After receiving a first transaction instructing the transfer of first resources from a first account in the first blockchain to a second account in the second blockchain, a node in the first blockchain, based on the first transaction, transfers the first resources from the first account to the first transition contract. The first transition contract then calls the sending interface of the first cross-chain contract to transmit a cross-chain message to the second blockchain. This cross-chain message instructs the transfer of the first resources to the second account through the second resource contract and the second transition contract. Nodes in the second blockchain then perform cross-chain transfer operations based on the cross-chain message. This enables the management and cross-chain transfer of digital resources through multiple smart contracts deployed in the blockchain system.
[0024] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and do not limit this application. Attached Figure Description
[0025] To more clearly illustrate the technical solutions of the embodiments in this specification, the drawings used in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in this specification. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0026] Figure 1 is an architecture diagram of a blockchain system illustrated in this specification according to an exemplary embodiment;
[0027] Figure 2 is an interactive flowchart illustrating a cross-chain resource transfer method in a cross-chain system according to an exemplary embodiment of this specification;
[0028] Figure 3a is a schematic diagram of the message body of a cross-chain message according to an exemplary embodiment of this specification;
[0029] Figure 3b is a schematic diagram illustrating a scenario of cross-chain resource transfer in a cross-chain system according to an exemplary embodiment of this specification;
[0030] Figure 3c is a schematic diagram of a cross-chain resource transfer scenario in another cross-chain system according to an exemplary embodiment of this specification;
[0031] Figure 4 is a block diagram of a cross-chain resource transfer device in a cross-chain system according to an exemplary embodiment of this specification.
[0032] Figure 5 is a block diagram of a cross-chain resource transfer device in another cross-chain system according to an exemplary embodiment of this specification. Detailed Implementation
[0033] To enable those skilled in the art to better understand the technical solutions in this specification, the technical solutions in the embodiments of this specification will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this specification, and not all embodiments. Based on the embodiments in this specification, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of this specification.
[0034] Figure 1 illustrates the architecture of a blockchain system in one embodiment. As shown in Figure 1, the blockchain system includes N nodes, with nodes 1 through 8 schematically shown in Figure 1. The lines connecting the nodes schematically represent connections between nodes used for data transfer. These nodes can store the entire ledger, i.e., the state of all blocks and all accounts. Each node in the blockchain system can generate the same state in the blockchain system by executing the same transaction, and each node can store the same state database.
[0035] In the blockchain field, a transaction refers to a task unit executed and recorded within the blockchain system. A transaction typically includes a send field (From), a receive field (To), and a data field (Data). Specifically, in the case of a transfer transaction, the From field represents the account address initiating the transaction (i.e., initiating a transfer task to another account), the To field represents the account address receiving the transaction (i.e., receiving the transfer), and the Data field includes the transfer amount.
[0036] Blockchain systems offer smart contract functionality. A smart contract on a blockchain is a contract that can be triggered and executed by transactions. Smart contracts can be defined in the form of code. Invoking a smart contract within a blockchain system involves initiating a transaction pointing to the smart contract's address, causing each node in the blockchain system to run the smart contract code in a distributed manner.
[0037] In a contract deployment scenario, for example, Bob sends a transaction containing information about creating a smart contract (i.e., deploying the contract) to the blockchain system shown in Figure 1. The transaction's `data` field includes the code of the contract to be created (such as bytecode or machine code), and the `to` field is empty to indicate that the transaction is used to deploy the contract. After the nodes reach a consensus through the consensus mechanism, they determine the contract address "0x6f8ae93…". Each node adds a contract account corresponding to the smart contract's contract address to its state database, allocates state storage corresponding to that contract account, stores the contract code, and saves the hash value of the contract code in the contract's state storage, thus successfully creating the contract.
[0038] In a contract invocation scenario, for example, Bob sends a transaction to the blockchain system shown in Figure 1 to invoke a smart contract. The `from` field of this transaction is the address of the account of the transaction initiator (i.e., Bob), the `to` field is the aforementioned "0x6f8ae93…", which is the address of the smart contract to be invoked, and the `data` field includes the method and parameters for invoking the smart contract. After consensus is reached on this transaction within the blockchain system, each node in the blockchain system can execute the transaction, thereby executing the contract and updating the state database based on the execution of the contract.
[0039] Currently, with the continuous development of the blockchain industry, more and more organizations and institutions are using blockchain systems to support their business capabilities. Many of these businesses involve digital resources, and the expansion of these businesses has created a demand for cross-chain interaction, thus promoting the emergence and improvement of cross-chain systems. Cross-chain systems involving digital resources can include multiple blockchain systems, enabling the transfer of digital resources between different blockchain systems, thereby enhancing the liquidity of digital resources.
[0040] Therefore, this specification provides a cross-chain transfer scheme in a cross-chain system, which enables the management and cross-chain transfer of digital resources through multiple smart contracts deployed in the blockchain system. This ensures that when transferring digital resources from one blockchain to another, the uniqueness and attributes of the digital resources remain unchanged, and the cross-chain transfer of digital resources maintains atomicity and consistency.
[0041] The solutions provided in this specification will be described in detail below with reference to specific embodiments.
[0042] Figure 2 is an interactive flowchart illustrating a cross-chain resource transfer method in a cross-chain system according to an exemplary embodiment. The cross-chain system includes a first blockchain and a second blockchain, each comprising multiple nodes. Resource contracts, transition contracts, and cross-chain contracts are deployed in both the first and second blockchains. For example, resource contract C11, transition contract C12, and cross-chain contract C13 are deployed in the first blockchain, and resource contract C21, transition contract C22, and cross-chain contract C23 are deployed in the second blockchain. The method includes the following steps:
[0043] In step 201, the user equipment sends transaction TX1, which calls resource contract C11, to the node of the first blockchain. In step 203, the node of the first blockchain, based on transaction TX1, transfers resource Z from account A to transition contract C12, and through transition contract C12 calls the sending interface of cross-chain contract C13 to transmit cross-chain message X to the node of the second blockchain.
[0044] Resource contracts can be used to manage digital resources, storing the balances of digital resources across multiple different accounts and handling transfer transactions. Cross-chain contracts provide interfaces for sending and receiving cross-chain messages, enabling the sending of or receiving of such messages to other blockchains. Transition contracts maintain cross-chain reference information, which may include, for example, the association between the contract addresses of resource contracts deployed on the local blockchain and the contract addresses of similar resource contracts deployed on other blockchains, a cross-chain routing table, the contract addresses of transition contracts deployed on other blockchains, and records data for each cross-chain transaction. They can also call the sending interface of cross-chain contracts to send or receive cross-chain messages for resource contracts.
[0045] In this embodiment, taking the transfer of resource Z from account A to account B as an example, the user can send transaction TX1 to a node of the first blockchain through the user device. Transaction TX1 invokes resource contract C11, and TX1 instructs the transfer of resource Z from account A in the first blockchain to account B in the second blockchain. The node of the first blockchain can receive transaction TX1 and, based on transaction TX1, transmit cross-chain message X to the node of the second blockchain. Here, resource Z can be a digital resource, such as a non-fungible digital resource.
[0046] Specifically, transaction TX1 can include cross-chain transfer data, which may include the account identifier of account A (transferring resources), the account identifier of account B (transferring resources), the blockchain address of the second blockchain where account B resides, the contract address of transition contract C22 deployed in the second blockchain, and the resource data of resource Z to be transferred. Nodes on the first blockchain can first use transaction TX1 to call the transfer interface in resource contract C11 to transfer resource Z from account A to the account in transition contract C12 (i.e., in the contract state of resource contract C11, resource Z is removed from account A, and in the contract state of transition contract C12, resource Z is added), triggering the execution of the cross-chain process in transition contract C12. It should be noted that after transferring resource Z to the account in transition contract C12, resource Z needs to be locked to ensure that resource Z remains locked in the account of transition contract C12.
[0047] Next, the cross-chain process in transition contract C12 is executed. First, the cross-chain transfer data mentioned above is obtained from transaction TX1, and cross-chain reference information is obtained from the contract state of transition contract C12. For example, the cross-chain reference information may include the binding relationship between contract address A11 of resource contract C11 and contract address A21 of resource contract C21, the cross-chain routing table, and contract address A22 of transition contract C22. Then, based on the cross-chain transfer data and cross-chain reference information, message content M is generated. Specifically, based on the cross-chain transfer data, the contract address A21 of resource contract C21, the contract address A22 of transition contract C22, and the routing information required to transfer resource Z can be found in the cross-chain reference information. Then, based on the found information, message content M is generated. Finally, by calling the sending interface of cross-chain contract C13, a cross-chain message X containing message content M is generated, and the operation of transmitting cross-chain message X to the second blockchain is executed. In addition, the cross-chain event can be recorded in the cross-chain event history data, which is stored in the contract state of cross-chain contract C13.
[0048] Figure 3a illustrates the message body of a cross-chain message. As shown in Figure 3a, taking the example of transferring resource Z from account A to account B, the message body of cross-chain message X may include the following fields: version, sender_contract, target_domain, receiver_contract, sequence, and payload. The version field records the version number of the message body of cross-chain message X; the sender_contract field records the contract address A12 of transition contract C12 in the first blockchain; the target_domain field records the ID of the second blockchain in the cross-chain system (the cross-chain system configures a unique domain name as the ID of each blockchain); the receiver_contract field records the contract address A22 of transition contract C22 in the second blockchain; the sequence field records the sequence number of cross-chain message X (messages with smaller sequence numbers are uploaded to the chain before messages with larger sequence numbers); and the payload field records the message content M.
[0049] The message content M can further include the following fields: sender_asset, receiver_asset, asset_type, raw_asset_info, status, error_msg, and extension. The sender_asset field records the contract address A11 of resource contract C11 in the first blockchain; the receiver_asset field records the contract address A12 of resource contract C12 in the second blockchain; the asset_type field records the type of resource Z; the status field records the cross-chain status of the asset, corresponding to the cross-chain result. For example, status can indicate a sending status, a success status, or a failure status. If status indicates a sending status, it means the cross-chain message X has been sent; if status indicates a success status, it means the cross-chain transfer was successful; if status indicates a failure status, it means the cross-chain transfer failed; the error_msg field records the message content after the cross-chain transfer operation fails; the extension field records extended information, which can store additional resource attributes; and the raw_asset_info field records resource transfer information. Resource transfer information may include, for example, the following fields: sender_account, token_ids, amounts, and receiver_account. The sender_account field records the account address of account A; the token_ids field records the identifier of resource Z; the amounts field records the amount of resource Z to be transferred; and the receiver_account field records the account address of account B.
[0050] In this embodiment, when a node in the first blockchain performs the operation of transmitting a cross-chain message X to the second blockchain, the node can directly send a transaction TX2 to the second blockchain, with the transaction TX2 including the cross-chain message X. Alternatively, the node in the first blockchain can send the cross-chain message X to other system devices, and these other system devices can then send a transaction TX2 containing the cross-chain message X to the second blockchain. For example, the cross-chain system may include a relay system and an endorsement system. The relay system can be used to transmit cross-chain messages between different blockchains, and the endorsement system can be used to verify the legality of the cross-chain message and provide an endorsement certificate. Specifically, the endorsement system can obtain the block data of the first blockchain, and based on the block data, find the cross-chain transfer event corresponding to the cross-chain message X in block n with block height n. It then obtains the consensus node signature and Merkle proof p corresponding to block n. It verifies the proof p carried by the cross-chain message X. If the proof p is the same as the value in the block header, the endorsement system generates an endorsement certificate. Since the endorsement system is used for verification, there is no need for a large number of redundant signatures, reducing the number of signatures for cross-chain verification and improving system performance.
[0051] As shown in Figure 3b, in some implementations, nodes in the first blockchain can first send the cross-chain message X to the endorsement system via a relay system. The endorsement system verifies the legitimacy of the cross-chain message X and generates signature data for proof. Then, the endorsement system can send the verification result and signature data to the relay system, which then sends transaction TX2 to the second blockchain. Transaction TX2 carries the cross-chain message X, the verification result, and the signature data.
[0052] As shown in Figure 3c, in some implementations, the cross-chain system may also include a third blockchain for auditing and evidence storage. This third blockchain deploys a resource contract C31, a transition contract C32, and a cross-chain contract C33. Nodes on the first blockchain can first send the cross-chain message X to the endorsement system via a relay system. The endorsement system verifies the legality of the cross-chain message X and generates signature data for proof. Then, the endorsement system can send the verification result and signature data to the relay system, which then sends transaction TX3 to the third blockchain. Transaction TX3 carries the cross-chain message X, the verification result, and the signature data. After receiving transaction TX3, nodes on the third blockchain can invoke resource contract C31, transition contract C32, and cross-chain contract C33 to parse transaction TX3, obtain the cross-chain message X, the verification result, and the signature data, and perform auditing and evidence storage based on these data. Then, the nodes of the third blockchain send the cross-chain message X, the verification result, and the signature data to the relay system, instructing the relay system to send transaction TX2 to the second blockchain. Transaction TX2 carries the cross-chain message X, the verification result, and the signature data.
[0053] In step 205, transaction TX2, including cross-chain message X, is obtained, and in step 207, cross-chain contract C23 is run to trigger transition contract C22 to call resource contract C21 based on cross-chain message X to update the resources in account B.
[0054] In this embodiment, nodes in the second blockchain can receive transaction TX2, carrying cross-chain message X, verification result, and signature data, through the receiving interface of cross-chain contract C23. The verification result and signature data are then verified through cross-chain contract C23. After successful verification, cross-chain message X is obtained, and the contract address A22 of transition contract C22 in the second blockchain is determined based on cross-chain message X. Transition contract C22 is then invoked based on contract address A22. By invoking transition contract C22, transfer information such as the contract address A11 of resource contract C11 in the first blockchain, the contract address A21 of resource contract C21 in the second blockchain, the account address of account B, the type of resource Z, and the amount of resource Z can be extracted from cross-chain message X. Based on this transfer information, the resources of account B are updated using resource Z by invoking the interface of resource contract C21.
[0055] Specifically, the contract state of transition contract C22 can store some locked digital resources. These locked digital resources can be pre-existing in the contract state of transition contract C22, or they can be transferred from resource contract C21 through some transactions. This embodiment does not limit this aspect. In the process of updating the resources of account B, it can first be determined whether resource Z is stored in the contract state of transition contract C22 based on the above transfer information. If resource Z does not exist, transition contract C22 can instruct resource contract C21 to mint resource Z, and add the minted resource Z to account B in the contract state of resource contract C21, thereby completing the update of account B. If resource Z exists in a locked state, transition contract C22 unlocks the locked resource Z, and adds the unlocked resource Z to account B in the contract state of resource contract C21, thereby completing the update of account B.
[0056] In step 209, the node of the second blockchain returns the operation result of the cross-chain transfer operation to the first blockchain, and in step 210, the transition contract C22 is invoked to process the operation result.
[0057] In this embodiment, after updating account B, transition contract C22 can generate a return message. This message may include, but is not limited to, the contract address A12 of transition contract C12 of the first blockchain, the contract address A22 of transition contract C22 of the second blockchain, the contract address A11 of resource contract C11 of the first blockchain, the contract address A21 of resource contract C21 of the second blockchain, the account address of account A, the account address of account B, the type of resource Z, the amount of resource Z to be transferred, and the operation result of the cross-chain transfer operation (i.e., whether the cross-chain transfer operation was successful). The node of the second blockchain can return the above return message to the node of the first blockchain by calling the sending interface of cross-chain contract C23.
[0058] The nodes of the first blockchain receive the returned message through the receiving interface of the cross-chain contract C13. They then invoke the transition contract C12 to process the operation result in the returned message. Specifically, if the operation result indicates that the cross-chain transfer operation was successful, the transition contract C12 can record the operation result in the cross-chain event history data for evidence storage. If the operation result indicates that the cross-chain transfer operation failed, the resource Z, which is in a locked state in the contract state of the transition contract C12, can be unlocked, and the unlocked resource Z can be added to account A in the contract state of the resource contract C11, while resource Z is removed from the contract state of the transition contract.
[0059] The cross-chain resource transfer method in a cross-chain system provided by the above embodiments of this specification involves deploying a first resource contract, a first transition contract, and a first cross-chain contract in a first blockchain of the cross-chain system, and deploying a second resource contract, a second transition contract, and a second cross-chain contract in a second blockchain. After receiving a first transaction instructing the transfer of first resources from a first account in the first blockchain to a second account in the second blockchain, a node in the first blockchain, based on the first transaction, transfers the first resources from the first account to the first transition contract. The first transition contract then calls the sending interface of the first cross-chain contract to transmit a cross-chain message to the second blockchain. This cross-chain message instructs the transfer of the first resources to the second account through the second resource contract and the second transition contract. Nodes in the second blockchain then perform cross-chain transfer operations based on the cross-chain message. This enables the management and cross-chain transfer of digital resources through multiple smart contracts deployed in the blockchain system.
[0060] It should be noted that although the operations of the methods of the embodiments of this specification are described in a specific order in the above embodiments, this does not require or imply that these operations must be performed in that specific order, or that all the operations shown must be performed to achieve the desired result. On the contrary, the steps depicted in the flowcharts may be executed in a different order. Additionally or alternatively, certain steps may be omitted, multiple steps may be combined into one step, and / or one step may be broken down into multiple steps.
[0061] Corresponding to the aforementioned method embodiments for cross-chain resource transfer in cross-chain systems, this specification also provides embodiments of apparatuses for cross-chain resource transfer in cross-chain systems.
[0062] As shown in Figure 4, which is a block diagram of a cross-chain resource transfer device in a cross-chain system according to an exemplary embodiment of this specification, the cross-chain system includes a first blockchain and a second blockchain. The first blockchain deploys a first resource contract, a first transition contract, and a first cross-chain contract. The second blockchain deploys a second resource contract, a second transition contract, and a second cross-chain contract. The device is deployed on a node of the first blockchain and may include a receiving module 401 and an execution module 402.
[0063] The receiving module 401 is used to receive a first transaction that invokes the first resource contract; the first transaction indicates the transfer of the first resource from a first account in the first blockchain to a second account in the second blockchain.
[0064] The execution module 402 is used to transfer the first resource from the first account to the first transition contract based on the first transaction, and to call the sending interface of the first cross-chain contract through the first transition contract to transmit a cross-chain message to the second blockchain; the cross-chain message is used to instruct the transfer of the first resource to the second account through the second resource contract and the second transition contract.
[0065] In some implementations, the execution module 402 transfers the first resource from the first account to the first transition contract by: removing the first resource from the first account in the contract state of the first resource contract; and adding the first resource in the contract state of the first transition contract, thereby locking the first resource.
[0066] In other implementations, the first transaction includes cross-chain transfer data; the cross-chain transfer data includes information about the first resource, account information about the second account, and information about the second blockchain; wherein, the contract state of the first transition contract stores cross-chain reference information; the cross-chain reference information includes the binding relationship between the accounts in the first resource contract and the second resource contract, routing information for transferring the first resource to the second blockchain, and the contract address of the second transition contract deployed in the second blockchain.
[0067] In other implementations, the execution module 402 calls the sending interface of the first cross-chain contract through the first transition contract in the following manner: obtaining the cross-chain reference information from the contract state of the first transition contract; based on the cross-chain transfer data and the cross-chain reference information, executing the sending interface of the first cross-chain contract to generate a cross-chain message for transmitting the cross-chain message to the second blockchain; and recording the cross-chain event in the cross-chain event history data.
[0068] In other embodiments, the cross-chain system further includes a relay system and an endorsement system; wherein, the execution module 402 transmits cross-chain messages to the second blockchain in the following manner: instructing the relay node in the relay system to request the endorsement system to perform cross-chain transfer verification, enabling the endorsement system to perform the cross-chain transfer verification, and after the cross-chain transfer verification is passed, sending the verification result and signature data to the relay node, which then requests the second blockchain to perform a cross-chain transfer based on the cross-chain message, the verification result, and the signature data.
[0069] In other implementations, the relay node requests the second blockchain to perform a cross-chain transfer based on the cross-chain message, the verification result, and the signature data by sending a cross-chain transfer transaction to the second blockchain; the cross-chain transfer transaction includes the cross-chain message, the verification result, and the signature data.
[0070] In other embodiments, the cross-chain system further includes a third blockchain; the third blockchain deploys a third resource contract, a third cross-chain contract, and a third system contract; wherein, the relay node requests the second blockchain to perform a cross-chain transfer based on the cross-chain message, the verification result, and the signature data in the following manner: sending a second transaction to the third blockchain; the second transaction includes the cross-chain message, the verification result, and the signature data; enabling the node of the third blockchain to perform audit and evidence storage based on the second transaction, through the third resource contract, the third cross-chain contract, and the third system contract, based on the cross-chain message, the verification result, and the signature data; and sending a cross-chain transfer transaction to the node of the second blockchain under the instruction of the node of the third blockchain; the cross-chain transfer transaction includes at least the cross-chain message.
[0071] In other embodiments, the apparatus may further include an acquisition module and a processing module (not shown in the figure).
[0072] The acquisition module is used to acquire the operation result of the cross-chain transfer operation returned by the second blockchain.
[0073] The processing module is used to receive the operation result through the receiving interface of the first cross-chain contract and call the first transition contract to process the operation result; if the operation result indicates that the cross-chain transfer operation failed, the first resource in the locked state is unlocked from the contract state of the first transition contract, the first resource is added to the second account in the contract state of the first resource contract, and the first resource is removed from the contract state of the first transition contract.
[0074] As shown in Figure 5, which is a block diagram of a cross-chain resource transfer device in another cross-chain system according to an exemplary embodiment of this specification, the cross-chain system includes a first blockchain and a second blockchain. A second resource contract, a second transition contract, and a second cross-chain contract are deployed in the second blockchain. The device is deployed on a node of the second blockchain and may include a receiving module 501 and a transfer module 502.
[0075] The receiving module 501 is used to receive a cross-chain transfer transaction that invokes the second cross-chain contract; the cross-chain transfer transaction includes a cross-chain message from the first blockchain; the cross-chain message is used to instruct the transfer of the first resource to the second account through the second resource contract and the second transition contract.
[0076] The transfer module 502 is used to run the second cross-chain contract, triggering the second transition contract to call the second resource contract to update the resources in the second account based on the cross-chain message, so as to perform a cross-chain transfer operation.
[0077] In other implementations, the transfer module 502 updates the resources in the second account by invoking the second resource contract based on the cross-chain message in the following manner: based on the cross-chain message, it determines whether the first resource exists in the contract state of the second transition contract; if the first resource does not exist, it instructs the second resource contract to mint the first resource and adds the first resource to the second account in the contract state of the second resource contract; if the first resource exists in a locked state, it unlocks the locked first resource and adds the unlocked first resource to the second account in the contract state of the second resource contract.
[0078] In other embodiments, the device may also include a return module (not shown in the figure).
[0079] The return module is used to return the operation result of the cross-chain transfer operation to the node of the first blockchain, so that the node of the first blockchain can receive the operation result through the receiving interface of the first cross-chain contract and call the first transition contract to process the operation result.
[0080] It should be understood that the aforementioned device can be pre-installed in the blockchain node or loaded into the blockchain node through download or other means. The corresponding modules in the aforementioned device can cooperate with the modules in the blockchain node to realize a cross-chain resource transfer solution within the cross-chain system.
[0081] For the device embodiments, since they basically correspond to the method embodiments, the relevant parts can be referred to in the description of the method embodiments. The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of one or more embodiments of this specification, depending on actual needs. Those skilled in the art can understand and implement this without creative effort.
[0082] One or more embodiments of this specification also provide a computer-readable storage medium storing a computer program that can be used to perform a method for transferring resources across chains in a cross-chain system provided in any of the embodiments of FIG2 above.
[0083] One or more embodiments of this specification also provide a computing device, including a memory and a processor, wherein the memory stores executable code, and when the processor executes the executable code, it implements a method for cross-chain resource transfer in a cross-chain system provided in any of the embodiments of FIG2 above.
[0084] In the 1990s, improvements to a technology could be clearly distinguished as either hardware improvements (e.g., improvements to the circuit structure of diodes, transistors, switches, etc.) or software improvements (improvements to the methodology). However, with technological advancements, many methodological improvements today can be considered direct improvements to the hardware circuit structure. Designers almost always obtain the corresponding hardware circuit structure by programming the improved methodology into the hardware circuit. Therefore, it cannot be said that a methodological improvement cannot be implemented using hardware physical modules. For example, a Programmable Logic Device (PLD) (such as a Field Programmable Gate Array (FPGA)) is such an integrated circuit whose logic function is determined by the user programming the device. Designers can program and "integrate" a digital system onto a PLD themselves, without needing chip manufacturers to design and manufacture dedicated integrated circuit chips. Furthermore, nowadays, instead of manually manufacturing integrated circuit chips, this programming is mostly implemented using "logic compiler" software. Similar to the software compiler used in program development, the original code before compilation must also be written in a specific programming language, called a Hardware Description Language (HDL). There are many HDLs, such as ABEL (Advanced Boolean Expression Language), AHDL (Altera Hardware Description Language), Confluence, CUPL (Cornell University Programming Language), HDCal, JHDL (Java Hardware Description Language), Lava, Lola, MyHDL, PALASM, and RHDL (Ruby Hardware Description Language). Currently, the most commonly used are VHDL (Very-High-Speed Integrated Circuit Hardware Description Language) and Verilog. Those skilled in the art should also understand that by simply performing some logic programming on the method flow using one of these hardware description languages and programming it into an integrated circuit, the hardware circuit implementing the logical method flow can be easily obtained.
[0085] The controller can be implemented in any suitable manner. For example, it can take the form of a microprocessor or processor and a computer-readable medium storing computer-readable program code (e.g., software or firmware) executable by the (micro)processor, logic gates, switches, application-specific integrated circuits (ASICs), programmable logic controllers, and embedded microcontrollers. Examples of controllers include, but are not limited to, the following microcontrollers: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20, and Silicon Labs C8051F320. A memory controller can also be implemented as part of the control logic of the memory. Those skilled in the art will also recognize that, in addition to implementing the controller in purely computer-readable program code form, the same functionality can be achieved by logically programming the method steps to make the controller take the form of logic gates, switches, application-specific integrated circuits, programmable logic controllers, and embedded microcontrollers. Therefore, such a controller can be considered a hardware component, and the means included therein for implementing various functions can also be considered as structures within the hardware component. Alternatively, the means for implementing various functions can be considered as both software modules implementing the method and structures within the hardware component.
[0086] The systems, devices, modules, or units described in the above embodiments can be implemented by computer chips or physical entities, or by products with certain functions. A typical implementation device is a server system. Of course, this application does not exclude the possibility that, with the future development of computer technology, the computer implementing the functions of the above embodiments can be, for example, a personal computer, a laptop computer, an in-vehicle human-machine interaction device, a cellular phone, a camera phone, a smartphone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or any combination of these devices.
[0087] While one or more embodiments of this specification provide the operational steps of the methods described in the embodiments or flowcharts, more or fewer operational steps may be included based on conventional or non-inventive means. The order of steps listed in the embodiments is merely one possible order of execution among many steps and does not represent the only possible order. In actual device or end product execution, the methods shown in the embodiments or drawings may be executed sequentially or in parallel (e.g., in a parallel processor or multi-threaded processing environment, or even a distributed data processing environment). The terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, product, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, product, or apparatus. Without further limitations, the presence of other identical or equivalent elements in the process, method, product, or apparatus that includes the elements is not excluded. For example, the use of terms such as "first," "second," etc., is to denote names and does not indicate any particular order.
[0088] For ease of description, the above devices are described in terms of function, divided into various modules. Of course, when implementing one or more of these specifications, the functions of each module can be implemented in one or more software and / or hardware components, or a module that performs the same function can be implemented by a combination of multiple sub-modules or sub-units. The device embodiments described above are merely illustrative. For example, the division of units is only a logical functional division; in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces, indirect coupling or communication connection between devices or units, and may be electrical, mechanical, or other forms.
[0089] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in one or more blocks of the flowchart illustrations and / or one or more blocks of the block diagrams.
[0090] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means that implement the functions specified in one or more flowcharts and / or one or more block diagrams.
[0091] These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer-implemented process, such that the instructions, which execute on the computer or other programmable apparatus, provide steps for implementing the functions specified in one or more flowcharts and / or one or more block diagrams.
[0092] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0093] Memory may include non-persistent storage in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of computer-readable media.
[0094] Computer-readable media include both permanent and non-permanent, removable and non-removable media that can store information by any method or technology. Information can be computer-readable instructions, data structures, program modules, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic magnetic disk storage, graphene storage or other magnetic storage devices, or any other non-transferable medium that can be used to store information accessible by a computing device. As defined herein, computer-readable media does not include transient computer-readable media, such as modulated data signals and carrier waves.
[0095] Those skilled in the art will understand that one or more embodiments of this specification can be provided as a method, system, or computer program product. Therefore, one or more embodiments of this specification may take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, one or more embodiments of this specification may take the form of a computer program product implemented on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0096] One or more embodiments of this specification can be described in the general context of computer-executable instructions, such as program modules, that are executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, etc., that perform a particular task or implement a particular abstract data type. One or more embodiments of this specification can also be practiced in distributed computing environments where tasks are performed by remote processing devices connected via a communication network. In a distributed computing environment, program modules can reside in local and remote computer storage media, including storage devices.
[0097] The various embodiments in this specification are described in a progressive manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, system embodiments are basically similar to method embodiments, so the description is relatively simple; relevant parts can be referred to the descriptions in the method embodiments. In the description of this specification, the terms "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., refer to specific features, structures, materials, or characteristics described in connection with that embodiment or example, which are included in at least one embodiment or example of this specification. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described can be combined in any suitable manner in one or more embodiments or examples. Moreover, without contradiction, those skilled in the art can combine and integrate the different embodiments or examples described in this specification and the features of different embodiments or examples.
[0098] The above description is merely an embodiment of one or more embodiments of this specification and is not intended to limit the scope of this specification. Various modifications and variations can be made to the one or more embodiments of this specification by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this specification should be included within the scope of the claims.
Claims
1. A method for cross-chain resource transfer in a cross-chain system, the cross-chain system comprising a first blockchain and a second blockchain; the first blockchain deploying a first resource contract, a first transition contract, and a first cross-chain contract; and the second blockchain deploying a second resource contract, a second transition contract, and a second cross-chain contract. The method is executed by nodes of the first blockchain; the method includes: Receive a first transaction that invokes the first resource contract; the first transaction indicates the transfer of the first resource from a first account on the first blockchain to a second account on the second blockchain; Based on the first transaction, the first resource is transferred from the first account to the first transition contract, and the first transition contract calls the sending interface of the first cross-chain contract to transmit a cross-chain message to the second blockchain; the cross-chain message is used to instruct the transfer of the first resource to the second account through the second resource contract and the second transition contract.
2. The method according to claim 1, wherein, The step of transferring the first resource from the first account to the first transition contract includes: In the contract status of the first resource contract, the first resource is removed from the first account; In the contract state of the first transition contract, the first resource is added, and the first resource is put into a locked state.
3. The method according to claim 1, wherein, The first transaction includes cross-chain transfer data; the cross-chain transfer data includes information about the first resource, account information about the second account, and information about the second blockchain; The first transition contract stores cross-chain reference information in its contract state; the cross-chain reference information includes the binding relationship between accounts in the first resource contract and the second resource contract, routing information for transferring the first resource to the second blockchain, and the contract address of the second transition contract deployed in the second blockchain.
4. The method according to claim 3, wherein, The step of calling the sending interface of the first cross-chain contract through the first transition contract includes: Obtain the cross-chain reference information from the contract state of the first transition contract; Based on the cross-chain transfer data and the cross-chain reference information, the sending interface of the first cross-chain contract is executed to generate a cross-chain message, thereby transmitting the cross-chain message to the second blockchain; and Cross-chain events are recorded in the cross-chain event history data.
5. The method according to claim 1, wherein, The cross-chain system also includes a relay system and an endorsement system; wherein, the transmission of cross-chain messages to the second blockchain includes: The relay node in the relay system is instructed to request the endorsement system to perform cross-chain transfer verification. The endorsement system then performs the cross-chain transfer verification and, after the cross-chain transfer verification is successful, sends the verification result and signature data to the relay node. The relay node then requests the second blockchain to perform a cross-chain transfer based on the cross-chain message, the verification result, and the signature data.
6. The method according to claim 5, wherein, The relay node requests the second blockchain to perform a cross-chain transfer based on the cross-chain message, the verification result, and the signature data in the following manner: Send a cross-chain transfer transaction to the second blockchain; the cross-chain transfer transaction includes the cross-chain message, the verification result, and the signature data.
7. The method according to claim 5, wherein, The cross-chain system also includes a third blockchain; the third blockchain deploys a third resource contract, a third cross-chain contract, and a third system contract; wherein, the relay node requests the second blockchain to perform a cross-chain transfer based on the cross-chain message, the verification result, and the signature data in the following manner: Send a second transaction to the third blockchain; the second transaction includes the cross-chain message, the verification result, and the signature data; enable the nodes of the third blockchain to perform audit and evidence storage based on the second transaction, through the third resource contract, the third cross-chain contract, and the third system contract, based on the cross-chain message, the verification result, and the signature data; Under the instruction of a node in the third blockchain, a cross-chain transfer transaction is sent to a node in the second blockchain; the cross-chain transfer transaction includes at least the cross-chain message.
8. The method according to claim 1, wherein, The method further includes: Obtain the operation result of the cross-chain transfer returned by the second blockchain; The operation result is received through the receiving interface of the first cross-chain contract, and the operation result is processed by calling the first transition contract; If the operation result indicates that the cross-chain transfer operation has failed, the first resource, which is in a locked state, is unlocked from the contract state of the first transition contract, the first resource is added to the second account in the contract state of the first resource contract, and the first resource is removed from the contract state of the first transition contract.
9. A method for cross-chain resource transfer in a cross-chain system, the cross-chain system comprising a first blockchain and a second blockchain; a second resource contract, a second transition contract, and a second cross-chain contract deployed in the second blockchain; the method being executed by nodes of the second blockchain; the method comprising: Receive cross-chain transfer transactions that invoke the second cross-chain contract; The cross-chain transfer transaction includes cross-chain messages from the first blockchain; The cross-chain message is used to instruct the transfer of the first resource to the second account through the second resource contract and the second transition contract; The second cross-chain contract is executed, triggering the second transition contract to call the second resource contract to update the resources in the second account based on the cross-chain message, so as to perform a cross-chain transfer operation.
10. The method according to claim 9, wherein, The step of invoking the second resource contract to update the resources in the second account based on the cross-chain message includes: Based on the cross-chain message, determine whether the first resource exists in the contract state of the second transition contract; If the first resource does not exist, instruct the second resource contract to forge the first resource, and add the first resource to the second account in the contract status of the second resource contract; If a first resource is locked, unlock the locked first resource and add the unlocked first resource to the second account in the contract status of the second resource contract.
11. The method according to claim 8, wherein, The method further includes: The operation result of the cross-chain transfer is returned to the node of the first blockchain, so that the node of the first blockchain receives the operation result through the receiving interface of the first cross-chain contract and calls the first transition contract to process the operation result.
12. A cross-chain system, the cross-chain system comprising a first blockchain and a second blockchain; the first blockchain deploying a first resource contract, a first transition contract and a first cross-chain contract; the second blockchain deploying a second resource contract, a second transition contract and a second cross-chain contract; A node in the first blockchain is used to receive a first transaction that invokes the first resource contract; the first transaction indicates the transfer of the first resource from a first account in the first blockchain to a second account in the second blockchain; based on the first transaction, the first resource is transferred from the first account to the first transition contract, and the first transition contract calls the sending interface of the first cross-chain contract to transmit a cross-chain message to the second blockchain; the cross-chain message is used to indicate the transfer of the first resource to the second account through the second resource contract and the second transition contract; The nodes of the second blockchain are used to perform cross-chain transfer operations based on the cross-chain messages.
13. An apparatus for cross-chain resource transfer in a cross-chain system, the cross-chain system comprising a first blockchain and a second blockchain; the first blockchain deploying a first resource contract, a first transition contract and a first cross-chain contract; and the second blockchain deploying a second resource contract, a second transition contract and a second cross-chain contract; The device is deployed on a node of the first blockchain; the device includes: The receiving module is configured to receive a first transaction that invokes the first resource contract; the first transaction indicates the transfer of the first resource from a first account in the first blockchain to a second account in the second blockchain; An execution module is configured to transfer the first resource from the first account to the first transition contract based on the first transaction, and to transmit a cross-chain message to the second blockchain by calling the sending interface of the first cross-chain contract through the first transition contract; the cross-chain message is used to instruct the transfer of the first resource to the second account through the second resource contract and the second transition contract.
14. An apparatus for cross-chain resource transfer in a cross-chain system, the cross-chain system comprising a first blockchain and a second blockchain; wherein a second resource contract, a second transition contract and a second cross-chain contract are deployed in the second blockchain; The device is deployed on a node of the second blockchain for execution; the method includes: A receiving module is configured to receive a cross-chain transfer transaction that invokes the second cross-chain contract; the cross-chain transfer transaction includes a cross-chain message from the first blockchain; the cross-chain message is used to instruct the transfer of the first resource to the second account through the second resource contract and the second transition contract; The transfer module is used to run the second cross-chain contract, triggering the second transition contract to call the second resource contract to update the resources in the second account based on the cross-chain message, so as to perform a cross-chain transfer operation.
15. A computer-readable storage medium having a computer program stored thereon, which, when executed in a computer, causes the computer to perform the method of any one of claims 1-11.
16. A computing device comprising a memory and a processor, wherein the memory stores executable code, and the processor, when executing the executable code, implements the method of any one of claims 1-11.
Citation Information
Patent Citations
Block chain digital asset cross-chain transfer method and device
CN116823258A
Method and device for cross-chain fund conversion, storage medium and electronic equipment
CN118586909A
Cross-chain resource transfer method, system and device in cross-chain system
CN119295067A
Method and apparatus for cross-chain transmission of resources
WO2020258848A1