Method and device for cross-chain fund conversion, storage medium and electronic equipment
Locking and unlocking funds on the blockchain through smart contracts and cross-chain message transmission protocols, combined with a decentralized verifier network and a multi-signature mechanism, solves the problems of inconsistency and centralization risks in cross-chain bridges, achieving security, Efficient cross-chain fund conversion.
Patent Information
- Application Number
- CN202411068056.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-05
- Publication Date
- 2024-09-03
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
Existing cross-chain bridges have problems with inconsistent contract interfaces, complexity caused by on-chain and off-chain gaps, and large attack surfaces during the fund conversion process between blockchains, leading to security and centralization risks.
Lock and unlock funds on the blockchain through smart contracts, use cross-chain message transmission protocols for verification and communication, and combine with a decentralized verifier network and multi-signature mechanism to ensure the balance and security of fund conversion and reduce single points of failure and centralization risks.
It achieves the security, decentralization and fairness of cross-chain fund conversion, reduces the security, complexity and centralization risks in traditional cross-chain bridge solutions, and provides safe, efficient and reliable cross-chain fund conversion services.
Smart Images

Figure CN118586909A
Abstract
Description
Technical Field
[0001] The present invention relates to computer technology, and in particular to a method, device, storage medium and electronic device for cross-chain fund conversion. Background Art
[0002] In existing technologies, blockchains cannot communicate directly with each other, and it is usually impossible to monitor or track activities in other networks. Each blockchain has its own set of rules, including protocol design, currency, programming language, governance structure, and culture. Therefore, it is extremely difficult to achieve interoperability between blockchains, which limits the economic activities of the Web3 ecosystem. The economic activities of each blockchain network are completely isolated and cannot form synergies. However, if we can connect different blockchains, expansion solutions, and application chains, we can leverage the unique advantages of each blockchain ecosystem and promote greater synergies.
[0003] A cross-chain bridge is a decentralized application that enables the transfer of assets from one blockchain to another, achieving cross-chain liquidity and thus increasing token utilization. A cross-chain bridge typically achieves this process by locking or destroying tokens in a smart contract on the originating chain and then unlocking or minting tokens in another smart contract on the target chain. Bridges typically use a cross-chain messaging protocol, the purpose of which is to transfer tokens between blockchains.
[0004] Although the idea of locking and unlocking is fairly simple, cross-chain bridges face three practical challenges that have caused serious attacks in reality. First, managing various assets with inconsistent contract interfaces on heterogeneous blockchains introduces error-prone on-chain logic. Second, the large on-chain-off-chain gap leads to complex off-chain code and potential inconsistencies between on-chain routing contracts and off-chain relays. Third, the complex and multi-step workflow of cross-chain bridges introduces a large attack surface, including both traditional attacks and blockchain-specific attacks. Summary of the invention
[0005] The purpose of the embodiments of this specification is to provide a method, device, storage medium and electronic device for cross-chain fund conversion.
[0006] The embodiments of this specification provide a method for cross-chain fund conversion, which can ensure that the fund conversion process through the cross-chain bridge is balanced, avoid fund loss or inconsistency, reduce single point failure and centralization risk through smart contracts, provide fast and reliable cross-chain communication through cross-chain message transmission protocol, support cross-chain transactions of multiple blockchains and asset types, adapt to the technical characteristics and ecosystem requirements of different blockchains, provide extensive blockchain interoperability, achieve efficient blockchain interoperability through standardized cross-chain message transmission protocol, realize fund conversion and verification through the use of decentralized smart contracts, smart contracts run on the blockchain, there is no single control point, reduce centralization risk, reduce security risks and attack possibilities, and ensure the security of the fund conversion process. Smart contracts run in an open and transparent manner to ensure the decentralization and fairness of the transaction process, avoid single point failure and potential improper operations, and can effectively overcome the security, complexity and centralization risks existing in traditional cross-chain bridge solutions. The problem, while providing users with safe, efficient and reliable cross-chain fund conversion services, the method includes: Locking the first funds to be transferred corresponding to the first user account on the source blockchain through a first smart contract on the source blockchain, and obtaining a cross-chain transaction certificate generated by the first smart contract; The cross-chain transaction certificate is transmitted to the target blockchain through the cross-chain message transmission protocol, and the cross-chain transaction certificate is verified on the target blockchain. If the verification is successful, the second fund corresponding to the first fund is unlocked or minted on the target blockchain through the second smart contract on the target blockchain, and the second fund is transferred to the second user account on the target blockchain; A balance check is performed on the source blockchain and the target blockchain regarding this cross-chain fund conversion. If the check passes, the cross-chain fund conversion is determined to be completed.
[0007] Furthermore, the method further comprises: The cross-chain transaction proof is stored on the source blockchain.
[0008] Furthermore, the verifying the cross-chain transaction proof on the target blockchain includes: The cross-chain transaction proof is verified by the second smart contract.
[0009] Furthermore, the verifying the cross-chain transaction proof on the target blockchain includes: The cross-chain transaction proof is verified by a decentralized validator network that has access to the target blockchain.
[0010] Furthermore, unlocking or minting second funds corresponding to the first funds on the target blockchain through a second smart contract on the target blockchain includes: The second smart contract on the target blockchain determines whether the second fund corresponding to the first fund already exists on the target blockchain. If so, the second fund is unlocked; otherwise, the second fund is minted on the target blockchain.
[0011] Furthermore, the method further comprises: Generate confirmation information corresponding to this cross-chain fund conversion on the target blockchain, and send the confirmation information to the source blockchain through the cross-chain message transmission protocol; The balance check on the source blockchain and the target blockchain regarding the cross-chain fund conversion is performed, and if the check passes, the cross-chain fund conversion is completed, including: In response to the first smart contract on the source blockchain receiving the confirmation information, a balance check is performed on the source blockchain and the target blockchain regarding this cross-chain funds conversion. If the check passes, it is determined that this cross-chain funds conversion is completed.
[0012] Furthermore, the transferring of the second funds to the second user account on the target blockchain further includes: Locking the second funds in the second user account; The determination of the completion of this cross-chain fund conversion includes: The second funds in the second user account are unlocked to confirm that the cross-chain funds conversion is completed.
[0013] Furthermore, the balance check on the source blockchain and the target blockchain regarding this cross-chain funds conversion includes: Obtaining first fund change information of the source blockchain regarding the cross-chain fund conversion through the first smart contract on the source blockchain; Obtain the second fund change information of the target blockchain regarding this cross-chain fund conversion; A balance check is performed based on the corresponding relationship between the first funds change information and the second funds change information.
[0014] Furthermore, the obtaining of the second fund change information of the target blockchain regarding the cross-chain fund conversion includes any of the following: Obtaining second fund change information of the target blockchain regarding this cross-chain fund conversion through the second smart contract on the target blockchain; The event information on the target blockchain is captured by a decentralized validator network that has been connected to the target blockchain, and the second fund change information of the target blockchain regarding this cross-chain fund conversion is determined in the decentralized validator network according to the event information.
[0015] Furthermore, the first smart contract and the second smart contract need to have a predetermined number of preset private key signatures among multiple preset private key signatures corresponding to the multi-signature mechanism before they can be executed.
[0016] The embodiment of this specification also provides a device for cross-chain fund conversion, including: A locking module, configured to lock the first funds to be transferred corresponding to the first user account on the source blockchain through a first smart contract on the source blockchain, and obtain a cross-chain transaction certificate generated by the first smart contract; A verification module, configured to transmit the cross-chain transaction certificate to a target blockchain through a cross-chain message transmission protocol, verify the cross-chain transaction certificate on the target blockchain, and if the verification is successful, unlock or mint the second fund corresponding to the first fund on the target blockchain through a second smart contract on the target blockchain, and transfer the second fund to a second user account on the target blockchain; The balance check module is used to perform a balance check on the source blockchain and the target blockchain regarding this cross-chain fund conversion. If the check passes, it is determined that this cross-chain fund conversion is completed.
[0017] The embodiments of the present specification also provide a computer program product, wherein the computer program product stores at least one instruction, and the at least one instruction is suitable for being loaded by a processor and executing the above method steps.
[0018] The embodiments of the present specification also provide a storage medium, wherein the storage medium stores a computer program, and the computer program is suitable for being loaded by a processor and executing the steps of the above method.
[0019] An embodiment of the present specification also provides an electronic device, comprising: a processor and a memory; wherein the memory stores a computer program, and the computer program is suitable for being loaded by the processor and executing the steps of the above method.
[0020] In the embodiments of this specification, through innovative technical design and strict security measures, it is possible to ensure that the funds conversion process through the cross-chain bridge is balanced, avoid fund loss or inconsistency, reduce single point failure and centralization risks through smart contracts, provide fast and reliable cross-chain communication through cross-chain message transmission protocols, support cross-chain transactions of multiple blockchains and asset types, adapt to the technical characteristics and ecosystem requirements of different blockchains, provide extensive blockchain interoperability, achieve efficient blockchain interoperability through standardized cross-chain message transmission protocols, and realize fund conversion and verification through the use of decentralized smart contracts. Smart contracts run on the blockchain without a single control point, reducing centralization risks, reducing security risks and the possibility of attacks, and ensuring the security of the funds conversion process. Smart contracts run in an open and transparent manner to ensure the decentralization and fairness of the transaction process, avoid single point failures and potential improper operations, and can effectively overcome the security, complexity and centralization risks existing in traditional cross-chain bridge solutions. The risks, while providing users with safe, efficient and reliable cross-chain funds conversion services. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] Figure 1 A flowchart of a method for cross-chain fund conversion provided in an embodiment of this specification; Figure 2 A flowchart of a method for cross-chain fund conversion provided in an embodiment of this specification; Figure 3 A flowchart of a method for cross-chain fund conversion provided as an example in an embodiment of this specification; Figure 4 A schematic diagram of the structure of a device for cross-chain fund conversion provided in an embodiment of this specification; Figure 5 A schematic diagram of the structure of an electronic device provided in an embodiment of this specification. DETAILED DESCRIPTION
[0022] In order to make the purpose, technical solutions and advantages of this specification more clear, the technical solutions of this specification will be clearly and completely described below in combination with the specific embodiments of this specification and the corresponding drawings. Obviously, the described embodiments are only part of the embodiments of this specification, not all of them. Based on the embodiments in this specification, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this specification.
[0023] See also Figure 1, is a flow chart of a method for cross-chain fund conversion provided in an embodiment of this specification. In the embodiment of this specification, the method for cross-chain fund conversion is applied to a device for cross-chain fund conversion (hereinafter referred to as "cross-chain fund conversion device") or an electronic device equipped with a cross-chain fund conversion device. Figure 1 The process shown is described in detail, and the method for cross-chain fund conversion may specifically include the following steps: S102, locking the first funds to be transferred corresponding to the first user account on the source blockchain through the first smart contract on the source blockchain, and obtaining the cross-chain transaction certificate generated by the first smart contract.
[0024] In some embodiments, a smart contract is a program running on a blockchain, which consists of a series of codes (functions) and data (states) located at a specific address on the blockchain. Smart contracts are not controlled by people like ordinary accounts, but run automatically on the network as programs. Individual users can interact with smart contracts by submitting transactions to execute a function in a smart contract. Smart contracts can set rules like traditional contracts and automatically execute these rules through code. By default, once a smart contract is deployed, it cannot be deleted, and operations interacting with it are irreversible. Among them, smart contracts can reduce single point failures and centralization risks.
[0025] In some embodiments, the first user executes the function of locking funds in the first smart contract by interacting with the first smart contract in the source blockchain, locks the specified amount of funds of the specified type in the account of the first user in the source blockchain (the amount of funds and the type of funds are specified by the first user), generates a locking transaction, and uses the locked funds as the first funds to be transferred to the target blockchain. It should be noted that those skilled in the art should understand that any type of funds can be included in the protection scope of this specification, and this specification does not limit this. In some embodiments, after locking the first funds, the first smart contract will generate a corresponding cross-chain transaction certificate, which is used to verify the validity and existence of the first funds being locked in the source blockchain. The cross-chain transaction certificate is a certificate of the legitimacy of the cross-chain transaction of the first funds from the source blockchain to the target blockchain. This exemplary embodiment does not specifically limit the specific content of the cross-chain transaction certificate. It should be noted that those skilled in the art should understand that any content of the cross-chain transaction certificate can be included in the protection scope of this specification, and this specification does not limit this. The cross-chain transaction certificate can be a certificate in the form of a document, or it can also be the unique identification information corresponding to the certificate (for example, a hash value or a Merkle tree root).
[0026] S104, transmitting the cross-chain transaction certificate to the target blockchain through a cross-chain message transmission protocol, verifying the cross-chain transaction certificate on the target blockchain, and if the verification passes, unlocking or minting second funds corresponding to the first funds on the target blockchain through a second smart contract on the target blockchain, and transferring the second funds to a second user account on the target blockchain.
[0027] In some embodiments, a cross-chain bridge is a decentralized application that can transfer assets from one blockchain to another, achieving cross-chain liquidity and thus improving token utilization. The cross-chain bridge typically achieves this process by locking or destroying tokens in a smart contract on the originating chain and then unlocking or minting tokens in another smart contract on the target chain. The cross-chain bridge typically uses a cross-chain message transfer protocol, the purpose of which is to transfer tokens between blockchains.
[0028] In some embodiments, a cross-chain transaction certificate is transmitted from a source blockchain to a target blockchain via a cross-chain message transmission protocol, and the cross-chain transaction certificate is verified on the target blockchain to verify the validity and consistency of the cross-chain transaction certificate. If the verification is successful, the target fund type and target fund amount corresponding to the specified amount of the specified type of first funds on the source blockchain on the target blockchain are determined according to a preset exchange rate or exchange relationship (for example, the NUM1 amount of TYPE1 type first funds on the source blockchain are converted into the NUM2 amount of TYPE2 type second funds on the target blockchain, where TYPE1 type is different from TYPE2 type), and then the function of unlocking or minting funds in the second smart contract is executed by interacting with the second smart contract on the target blockchain, and the second funds of the target fund type and the target fund amount are unlocked or minted on the target blockchain (the fund type of the second funds is different from the fund type of the first funds), and the second funds are transferred to the second user (i.e., the recipient) in the account of the target blockchain, wherein the cross-chain message transmission protocol can provide efficient and secure cross-chain communication, realize data transmission and verification between different blockchains, and support the interoperability of various blockchain ecosystems. The embodiments of this specification use smart contracts to lock, unlock or mint funds on the source blockchain and the target blockchain to ensure the security and reliability of cross-chain transactions. Smart contracts automatically perform fund conversions through programmed rules without manual intervention, ensuring the irreversibility and reliability of operations. It should be noted that those skilled in the art should understand that any type of cross-chain message transmission protocol can be included in the scope of protection of this specification, and this specification does not limit this.
[0029] S106, performing a balance check on the source blockchain and the target blockchain regarding this cross-chain fund conversion, and if the check passes, determining that this cross-chain fund conversion is completed.
[0030] In some embodiments, in order to ensure asset security and prevent on-chain assets from being attacked by hackers, it is necessary to perform a balance check on the source blockchain and the target blockchain regarding this cross-chain fund conversion, obtain the fund change information of the source blockchain in this cross-chain fund conversion (the fund change information is used to characterize what type of funds have undergone what changes in the source blockchain in this cross-chain fund conversion event), and the fund change information of the target blockchain in this cross-chain fund conversion (the fund change information is used to characterize what type of funds have undergone what changes in the target blockchain in this cross-chain fund conversion event), for example, based on the cross-chain transaction proof, determine the fund change information of the source blockchain in this cross-chain fund conversion from the historical event information of the source blockchain, and based on the cross-chain transaction proof, determine the fund change information of the target blockchain in this cross-chain fund conversion from the historical event information of the target blockchain Change information, for example, based on the relevant proof content of the cross-chain transaction proof, filter out the fund change information of the source blockchain or the target blockchain in this cross-chain fund conversion from the historical event information of the source blockchain or the target blockchain, or first obtain the corresponding proof document based on the cross-chain transaction proof, and then filter out the fund change information of the source blockchain or the target blockchain in this cross-chain fund conversion from the historical event information of the source blockchain or the target blockchain according to the file content of the proof document; for another example, by interacting with the first smart contract to call the relevant function in the first smart contract based on the cross-chain transaction proof to obtain the fund change information of the source blockchain in this cross-chain fund conversion, and by interacting with the second smart contract to call the relevant function in the second smart contract based on the cross-chain transaction proof to obtain the fund change information of the target blockchain in this cross-chain fund conversion. In some embodiments, a balance check is performed on the correspondence between the fund change information of the source blockchain and the fund change information of the target blockchain to detect whether the correspondence between the two is balanced, that is, to check whether the correspondence between the two satisfies a preset exchange rate or exchange relationship. If so, it is determined that the correspondence between the two is balanced, that is, it is determined that the source blockchain and the target blockchain pass the balance check on this cross-chain fund conversion, thereby determining that the cross-chain fund conversion is completed, thereby ensuring the consistency of this cross-chain fund conversion through a balance check, and any inconsistency (i.e., failure to pass the balance check) will trigger an alarm and / or corrective measures.
[0031] In the embodiments of this specification, through innovative technical design and strict security measures, it is possible to ensure that the funds conversion process through the cross-chain bridge is balanced, avoid fund loss or inconsistency, reduce single point failure and centralization risks through smart contracts, provide fast and reliable cross-chain communication through cross-chain message transmission protocols, support cross-chain transactions of multiple blockchains and asset types, adapt to the technical characteristics and ecosystem requirements of different blockchains, provide extensive blockchain interoperability, achieve efficient blockchain interoperability through standardized cross-chain message transmission protocols, and realize fund conversion and verification through the use of decentralized smart contracts. Smart contracts run on the blockchain without a single control point, reducing centralization risks, reducing security risks and the possibility of attacks, and ensuring the security of the funds conversion process. Smart contracts run in an open and transparent manner to ensure the decentralization and fairness of the transaction process, avoid single point failures and potential improper operations, and can effectively overcome the security, complexity and centralization risks existing in traditional cross-chain bridge solutions. The risks, while providing users with safe, efficient and reliable cross-chain funds conversion services.
[0032] In some embodiments, the method further includes: storing the cross-chain transaction proof on the source blockchain. In some embodiments, if the cross-chain transaction proof is a proof document in the form of a file, the cross-chain transaction proof will be stored on the source blockchain, and if the cross-chain transaction proof is the unique identification information corresponding to the proof document (for example, a hash value or a Merkle tree root), in addition to storing the cross-chain transaction proof on the source blockchain, the corresponding proof document will also be stored on the source blockchain.
[0033] In some embodiments, the verifying the cross-chain transaction proof on the target blockchain includes: verifying the cross-chain transaction proof through the second smart contract. In some embodiments, the chain transaction proof can be sent to the second smart contract on the target blockchain, and the function of checking the validity and consistency of the proof in the second smart contract can be executed by interacting with the second smart contract to verify the cross-chain transaction proof.
[0034] In some embodiments, the verification of the cross-chain transaction proof on the target blockchain includes: verifying the cross-chain transaction proof through a decentralized validator network that has been connected to the target blockchain. In some embodiments, the decentralized validator network is connected to the target blockchain, and at least one validator in the decentralized validator network verifies the cross-chain transaction proof based on a consensus mechanism to verify the validity and consistency of the cross-chain transaction proof. Each validator in the decentralized validator network serves as a node in the target blockchain. For example, the decentralized validator network is a network built based on decentralized verification technology (DVT, Distributed Validator Technology), and the network includes multiple validators other than the first user and the second user. The multiple validators verify the cross-chain transaction proof based on a consensus mechanism. The decentralized validator network can reduce single point failures and centralization risks. The embodiments of this specification realize fund conversion and verification by adopting decentralized smart contracts and verifier networks. The verifier network verifies cross-chain transactions through a consensus mechanism to ensure the validity and consistency of transactions, thereby enhancing the security and reliability of the system. Smart contracts and verifier networks operate in an open and transparent manner to ensure the decentralization and fairness of the transaction process and avoid single points of failure and potential improper operations.
[0035] In some embodiments, unlocking or casting the second fund corresponding to the first fund on the target blockchain through the second smart contract on the target blockchain includes: judging whether the second fund corresponding to the first fund already exists on the target blockchain through the second smart contract on the target blockchain, and if so, unlocking the second fund, otherwise casting the second fund on the target blockchain. In some embodiments, the target fund type and target fund amount corresponding to the specified amount of the specified type of the first fund on the source blockchain on the target blockchain are determined according to a preset exchange rate or exchange relationship, and then the second smart contract on the target blockchain is interacted with to execute the second smart contract to judge whether the second fund of the target fund type and the target fund amount already exists on the target blockchain, and if so, execute the function of unlocking funds in the second smart contract to unlock the second fund on the target blockchain, otherwise, execute the function of casting funds in the second smart contract to cast the second fund on the target blockchain.
[0036] In some embodiments, the transferring of the second funds to the second user account on the target blockchain further includes: locking the second funds in the second user account; wherein, the determining that the cross-chain funds conversion is completed includes: unlocking the second funds in the second user account, and determining that the cross-chain funds conversion is completed. In some embodiments, after the second funds are transferred to the second user's (i.e., the recipient's) account in the target blockchain on the target blockchain, the second funds in the second user account will also be locked on the target blockchain, and only after the subsequent balance check of the source blockchain and the target blockchain on this cross-chain funds conversion is passed, the second funds in the second user account will be unlocked in the target second blockchain to determine that the cross-chain funds conversion is completed.
[0037] In some embodiments, the balance check of the source blockchain and the target blockchain regarding this cross-chain fund conversion includes: obtaining the first fund change information of the source blockchain regarding this cross-chain fund conversion through the first smart contract on the source blockchain; obtaining the second fund change information of the target blockchain regarding this cross-chain fund conversion; and performing a balance check based on the correspondence between the first fund change information and the second fund change information. In some embodiments, the function of obtaining fund change information in the first smart contract may be executed by interacting with the first smart contract on the source blockchain to obtain the first fund change information of the source blockchain in this cross-chain fund conversion, and the input parameter of the function may include the cross-chain transaction certificate, or may also include conversion parameter information corresponding to this cross-chain fund conversion (the conversion parameter information includes but is not limited to the relevant account information of the first user account, the relevant account information of the second user account, the fund identification information of the first fund, the fund quantity information, the fund type information, the fund identification information of the second fund, the fund quantity information, the fund type information, the lock time of the first fund, the unlock time or casting time of the second fund, the relevant operation information of the lock operation corresponding to the first fund, the relevant operation information of the unlocking or casting operation corresponding to the second fund, etc.). In some embodiments, the second fund change information of the target blockchain in this cross-chain fund conversion will also be obtained, specifically, it can be obtained through the second smart contract on the target blockchain, or it can also be obtained through the decentralized validator network that has been connected to the target blockchain. In some embodiments, the fund change information includes but is not limited to the fund type (what type of funds have changed), the fund change event type (the event type includes but is not limited to the lock type, unlock type, casting type, etc.), the fund amount (how much amount of funds has changed, for example, how much type of A funds are locked, how much type of B funds are unlocked, how much type of C funds are cast), etc. It should be noted that the content of the above fund change information is only an example, and those skilled in the art should understand that any content of fund change information can be included in the protection scope of this specification, and this specification does not limit this. In some embodiments, based on a preset exchange rate or exchange relationship, a balance check is performed on the corresponding relationship between the first fund change information and the second fund change information, that is, a balance check is performed based on whether the corresponding relationship between the fund change event type, fund type, and fund amount in the first fund change information and the fund change event type, fund type, and fund amount in the second fund change information meets the preset exchange rate or exchange relationship.In some embodiments, if the types of fund change events in the two fund change information match (for example, if fund locking occurs in the source blockchain and fund unlocking or minting occurs in the target blockchain, it can be determined that the two match) and the fund types and fund amounts in the two fund change information meet the preset exchange rate or exchange relationship (for example, if a first amount of type A funds is locked in the source blockchain and a second amount of type B funds is unlocked or minted in the target blockchain, it can be determined that the two meet the preset exchange rate or exchange relationship), it can be determined that the corresponding relationship between the first fund change information and the second fund change information is determined through a balance check, and the cross-chain fund conversion is completed. For example, the source blockchain locks NUM1 amount of TYPE1 type funds in this cross-chain fund conversion, and the target blockchain unlocks or mints NUM2 amount of TYPE2 type funds in this cross-chain fund conversion. If the corresponding relationship between NUM1 amount of TYPE1 type funds and NUM2 amount of TYPE2 type funds meets the preset exchange rate or exchange relationship, it can be determined that the source blockchain and the target blockchain pass the balance check on this cross-chain fund conversion and determine that the cross-chain fund conversion is completed.
[0038] In some embodiments, the obtaining of the second fund change information of the target blockchain regarding the cross-chain fund conversion includes any of the following: obtaining the second fund change information of the target blockchain regarding the cross-chain fund conversion through the second smart contract on the target blockchain; capturing the event information on the target blockchain through the decentralized validator network that has been connected to the target blockchain, and determining the second fund change information of the target blockchain regarding the cross-chain fund conversion in the decentralized validator network according to the event information. In some embodiments, the function of obtaining fund change information in the second smart contract can be executed by interacting with the second smart contract on the target blockchain to obtain the second fund change information of the target blockchain in the cross-chain fund conversion. The input parameter of the function can include the cross-chain transaction certificate, or can also include the conversion parameter information corresponding to the cross-chain fund conversion. In some embodiments, the historical event information on the target blockchain can also be captured through the decentralized validator network that has been connected to the target blockchain, and at least one validator in the decentralized validator network determines the second fund change information of the target blockchain in the cross-chain fund conversion based on the historical event information based on the consensus mechanism.
[0039] In some embodiments, the first smart contract and the second smart contract need to have a predetermined number of preset private key signatures in the multiple preset private key signatures corresponding to the multi-signature mechanism before they can be executed. In some embodiments, the first smart contract on the source blockchain and the second smart contract on the target blockchain enhance security through mechanisms such as multi-signatures. Only when the first smart contract has a predetermined number of preset private key signatures in the multiple preset private key signatures corresponding to the multi-signature mechanism can it interact with the first smart contract on the source blockchain to execute the corresponding function in the first smart contract, that is, a predetermined number of preset signers are required to initiate an interaction request for the first smart contract. Similarly, only when the second smart contract has a predetermined number of preset private key signatures in the multiple preset private key signatures corresponding to the multi-signature mechanism can it interact with the second smart contract on the target blockchain to execute the corresponding function in the second smart contract, that is, a predetermined number of preset signers are required to initiate an interaction request for the second smart contract. The embodiments of this specification enhance the security and anti-attack capabilities of smart contracts by introducing a multi-signature security mechanism. Multi-signatures ensure that key operations can be performed with the consent of multiple participants, prevent single point failures and improper behavior, and ensure the security of the fund conversion process.
[0040] Figure 2 A flow chart of a method for cross-chain fund conversion provided in an embodiment of this specification specifically includes the following steps: S202, locking the first funds to be transferred corresponding to the first user account on the source blockchain through the first smart contract on the source blockchain, and obtaining the cross-chain transaction certificate generated by the first smart contract. Step S202 is the same or similar to the above step S102, and will not be repeated here.
[0041] S204, transmitting the cross-chain transaction certificate to the target blockchain through the cross-chain message transmission protocol, verifying the cross-chain transaction certificate on the target blockchain, and if the verification is successful, unlocking or minting the second fund corresponding to the first fund on the target blockchain through the second smart contract on the target blockchain, and transferring the second fund to the second user account on the target blockchain. Step S204 is the same or similar to the aforementioned step S104, and will not be repeated here.
[0042] S206, generating confirmation information corresponding to this cross-chain funds conversion on the target blockchain, and sending the confirmation information to the source blockchain through the cross-chain message transmission protocol.
[0043] In some embodiments, the confirmation information corresponding to the cross-chain funds conversion is generated on the target blockchain. The function of confirming the funds transfer in the second smart contract is executed by interacting with the second smart contract on the target blockchain to confirm the cross-chain funds conversion (including but not limited to confirming whether the second funds are transferred to the account of the second user (i.e., the recipient) in the target blockchain (i.e., the second user account), confirming the type and amount of the second funds transferred to the second user account, etc.), and generating the corresponding confirmation information after the confirmation is completed. Alternatively, at least one validator in the decentralized validator network that has been connected to the target blockchain confirms the cross-chain funds conversion based on a consensus mechanism, and generating the corresponding confirmation information after the confirmation is completed. In this example embodiment, the specific content of the confirmation information is not particularly limited. It should be noted that those skilled in the art should understand that confirmation information of any content can be included in the protection scope of this specification, and this specification does not limit this.
[0044] S208, in response to the first smart contract on the source blockchain receiving the confirmation information, performing a balance check on the source blockchain and the target blockchain regarding this cross-chain funds conversion, and if the check passes, determining that this cross-chain funds conversion is completed.
[0045] In some embodiments, the target blockchain transmits the generated confirmation information to the source blockchain through the cross-chain message transmission protocol. In response to the first smart contract on the source blockchain receiving the confirmation information, the function of confirming the fund transfer in the first smart contract can be executed by interacting with the first smart contract on the source blockchain to confirm this cross-chain fund conversion (including but not limited to confirming the fund type and fund amount of the first fund locked in the first user account, etc.). Once the confirmation is completed, the closed-loop verification of the transaction is completed, that is, the closed-loop verification of the transaction is completed through the two-way confirmation of the source blockchain and the target blockchain. In some embodiments, after the two-way confirmation is completed, a balance check is performed on the source blockchain and the target blockchain regarding this cross-chain fund conversion. If the check passes, it is determined that this cross-chain fund conversion is completed. In some embodiments, if the first smart contract on the source blockchain does not receive the confirmation information, for example, the first smart contract on the source blockchain times out and fails to receive the confirmation information corresponding to the cross-chain transaction proof within a predetermined time range from the time the cross-chain transaction proof is transmitted to the target blockchain, or if the operation result of the confirmation operation performed by the target blockchain on this cross-chain funds conversion is failed, then the target blockchain does not need to send the corresponding confirmation information to the source blockchain, and directly triggers an alarm and / or corrective measures, or, if the operation result of the confirmation operation performed by the source blockchain on this cross-chain funds conversion is failed, then there is no need to continue with subsequent balance checks, and alarms and / or corrective measures are directly triggered.
[0046] Figure 3 A flowchart of a method for cross-chain fund conversion is provided as an example of an embodiment of this specification.
[0047] like Figure 3 As shown, the user locks the first funds in the user account by interacting with the smart contract for locking funds on the source chain. The smart contract generates a corresponding cross-chain transaction certificate, and then transmits the cross-chain transaction certificate from the source chain to the target chain through the cross-chain message transmission protocol. The cross-chain transaction certificate is verified by the decentralized verifier network that has been connected to the target chain. At least one verifier in the verifier network verifies the cross-chain transaction certificate based on the consensus mechanism. After the verification is passed, the second fund corresponding to the first fund is unlocked or minted by interacting with the smart contract for unlocking or minting funds on the target chain, and the second fund is transferred to the fund recipient's account in the target chain. The target chain sends the generated confirmation information to the source chain for two-way confirmation. After the confirmation is passed, the source chain and the target chain are balanced and checked for this cross-chain fund transaction. If the check is passed, the cross-chain fund transaction is completed.
[0048] Figure 4 The schematic diagram of the structure of a device for cross-chain fund conversion provided in the embodiments of this specification, the device for cross-chain fund conversion (hereinafter referred to as "cross-chain fund conversion device 1") can be implemented as all or part of an electronic device through software, hardware or a combination of both. According to some embodiments, the cross-chain fund conversion device 1 includes a locking module 11, a verification module 12 and a balance check module 13.
[0049] The locking module 11 is used to lock the first funds to be transferred corresponding to the first user account on the source blockchain through the first smart contract on the source blockchain, and obtain the cross-chain transaction certificate generated by the first smart contract.
[0050] The verification module 12 is used to transmit the cross-chain transaction certificate to the target blockchain through the cross-chain message transmission protocol, and verify the cross-chain transaction certificate on the target blockchain. If the verification passes, the second fund corresponding to the first fund is unlocked or minted on the target blockchain through the second smart contract on the target blockchain, and the second fund is transferred to the second user account on the target blockchain.
[0051] The balance check module 13 is used to perform a balance check on the source blockchain and the target blockchain regarding this cross-chain fund conversion. If the check passes, it is determined that this cross-chain fund conversion is completed.
[0052] In some embodiments, the cross-chain funds conversion device 1 is also used to: store the cross-chain transaction certificate on the source blockchain.
[0053] In some embodiments, verifying the cross-chain transaction proof on the target blockchain includes: verifying the cross-chain transaction proof through the second smart contract.
[0054] In some embodiments, verifying the cross-chain transaction proof on the target blockchain includes: verifying the cross-chain transaction proof through a decentralized validator network that has been connected to the target blockchain.
[0055] In some embodiments, unlocking or minting second funds corresponding to the first funds on the target blockchain through a second smart contract on the target blockchain includes: determining through the second smart contract on the target blockchain whether second funds corresponding to the first funds already exist on the target blockchain; if so, unlocking the second funds; otherwise, minting the second funds on the target blockchain.
[0056] In some embodiments, the cross-chain funds conversion device 1 is also used to: generate confirmation information corresponding to this cross-chain funds conversion on the target blockchain, and send the confirmation information to the source blockchain through the cross-chain message transmission protocol; wherein, the balance check on the source blockchain and the target blockchain regarding this cross-chain funds conversion, if the check passes, determines that the cross-chain funds conversion is completed, including: in response to the first smart contract on the source blockchain receiving the confirmation information, the source blockchain and the target blockchain are balanced. Check, if the check passes, determines that the cross-chain funds conversion is completed.
[0057] In some embodiments, transferring the second funds to the second user account on the target blockchain further includes: locking the second funds in the second user account; wherein, determining the completion of the cross-chain funds conversion includes: unlocking the second funds in the second user account, and determining the completion of the cross-chain funds conversion.
[0058] In some embodiments, the balance check on the source blockchain and the target blockchain regarding this cross-chain funds conversion includes: obtaining first funds change information about the cross-chain funds conversion on the source blockchain through the first smart contract on the source blockchain; obtaining second funds change information about the cross-chain funds conversion on the target blockchain; and performing a balance check based on the correspondence between the first funds change information and the second funds change information.
[0059] In some embodiments, obtaining the second funds change information of the target blockchain regarding this cross-chain funds conversion includes any one of the following: obtaining the second funds change information of the target blockchain regarding this cross-chain funds conversion through the second smart contract on the target blockchain; capturing event information on the target blockchain through a decentralized validator network that has been connected to the target blockchain, and determining the second funds change information of the target blockchain regarding this cross-chain funds conversion in the decentralized validator network based on the event information.
[0060] In some embodiments, the first smart contract and the second smart contract need to have a predetermined number of preset private key signatures among multiple preset private key signatures corresponding to the multi-signature mechanism before they can be executed.
[0061] The above device embodiments correspond to the method embodiments. For specific descriptions, please refer to the description of the method embodiments, which will not be repeated here. The device embodiments are obtained based on the corresponding method embodiments and have the same technical effects as the corresponding method embodiments. For specific descriptions, please refer to the corresponding method embodiments.
[0062] The embodiment of the present specification also provides a computer storage medium, which can store multiple instructions, and the instructions are suitable for being loaded by a processor to execute the method of the embodiment of the present specification.
[0063] The embodiments of the present specification also provide a computer program product, which stores at least one instruction, and the at least one instruction is loaded by the processor to execute the method of the embodiments of the present specification.
[0064] The embodiments of this specification also provide Figure 5 The structural diagram of the electronic device shown in FIG. Figure 5 At the hardware level, the electronic device includes a processor, an internal bus, a network interface, a memory, and a non-volatile memory, and may also include hardware required for other services. The processor reads the corresponding computer program from the non-volatile memory into the memory and then runs it to implement the above-mentioned voice activity detection method.
[0065] Of course, in addition to software implementation, this specification does not exclude other implementation methods, such as logic devices or a combination of software and hardware, etc., that is to say, the executor of the following processing flow is not limited to each logic unit, but can also be hardware or logic devices.
[0066] In the 1990s, it was very clear whether the improvement of a technology was hardware improvement (for example, improvement of the circuit structure of diodes, transistors, switches, etc.) or software improvement (improvement of the method flow). However, with the development of technology, many improvements of the method flow today can be regarded as direct improvements of the hardware circuit structure. Designers almost always obtain the corresponding hardware circuit structure by programming the improved method flow into the hardware circuit. Therefore, it cannot be said that the improvement of a method flow cannot be implemented with hardware entity modules. For example, a programmable logic device (PLD) (such as a field programmable gate array (FPGA)) is such an integrated circuit whose logical function is determined by the user's programming of the device. Designers can "integrate" a digital system on a PLD by programming it themselves, without having to ask chip manufacturers to design and make dedicated integrated circuit chips. Moreover, nowadays, instead of manually making integrated circuit chips, this kind of programming is mostly implemented by "logic compiler" software, which is similar to the software compiler used when developing and writing programs, and the original code before compilation must also be written in a specific programming language, which is called hardware description language (HDL). There is not only one kind of HDL, but many kinds, 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, RHDL (Ruby Hardware Description Language), etc. The most commonly used ones are VHDL (Very-High-Speed Integrated Circuit Hardware Description Language) and Verilog. Those skilled in the art should also know that it is only necessary to program the method flow slightly in the above-mentioned hardware description languages and program it into the integrated circuit, and then it is easy to obtain the hardware circuit that implements the logic method flow.
[0067] The controller may be implemented in any suitable manner, for example, the controller may take the form of a microprocessor or processor and a computer-readable medium storing a computer-readable program code (e.g., software or firmware) executable by the (micro)processor, a logic gate, a switch, an application-specific integrated circuit (ASIC), a programmable logic controller, and an embedded microcontroller, examples of which include but are not limited to the following microcontrollers: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20, and Silicone Labs C8051F320, and the memory controller may also be implemented as part of the control logic of the memory. It is also known to those skilled in the art that, in addition to implementing the controller in a purely computer-readable program code manner, the controller may be implemented in the form of a logic gate, a switch, an application-specific integrated circuit, a programmable logic controller, and an embedded microcontroller by logically programming the method steps. Therefore, such a controller may be considered as a hardware component, and the devices for implementing various functions included therein may also be considered as structures within the hardware component. Or even, the devices for implementing various functions may be considered as both software modules for implementing the method and structures within the hardware component.
[0068] The systems, devices, modules or units described in the above embodiments may be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer. Specifically, the computer may be, for example, a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.
[0069] For the convenience of description, the above device is described in various units according to their functions. Of course, when implementing this specification, the functions of each unit can be implemented in the same or multiple software and / or hardware.
[0070] Those skilled in the art will appreciate that the embodiments of this specification may be provided as methods, systems, or computer program products. Therefore, this specification may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, 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.
[0071] This specification is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of this specification. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0072] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0073] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0074] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0075] The memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.
[0076] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. 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 technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0077] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0078] It should be understood by those skilled in the art that the embodiments of this specification may be provided as methods, systems or computer program products. Therefore, this specification may take the form of a complete hardware embodiment, a complete software embodiment or an embodiment combining software and hardware. Moreover, 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.
[0079] This specification may be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. This specification may also be practiced in distributed computing environments where tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules may be located in local and remote computer storage media, including storage devices.
[0080] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0081] The above description is only an embodiment of the present specification and is not intended to limit the present specification. For those skilled in the art, the present specification may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present specification shall be included in the scope of the claims of the present specification.
Claims
1. A method for cross-chain fund conversion, include: Locking the first funds to be transferred corresponding to the first user account on the source blockchain through a first smart contract on the source blockchain, and obtaining a cross-chain transaction certificate generated by the first smart contract; The cross-chain transaction certificate is transmitted to the target blockchain through the cross-chain message transmission protocol, and the cross-chain transaction certificate is verified on the target blockchain. If the verification is successful, the second fund corresponding to the first fund is unlocked or minted on the target blockchain through the second smart contract on the target blockchain, and the second fund is transferred to the second user account on the target blockchain; A balance check is performed on the source blockchain and the target blockchain regarding this cross-chain fund conversion. If the check passes, the cross-chain fund conversion is determined to be completed.
2. The method according to claim 1, further comprising: include: The cross-chain transaction proof is stored on the source blockchain.
3. The method according to claim 1, wherein the cross-chain transaction proof is verified on the target blockchain, include: The cross-chain transaction proof is verified by the second smart contract.
4. The method according to claim 1, wherein the cross-chain transaction proof is verified on the target blockchain, include: The cross-chain transaction proof is verified by a decentralized validator network that has access to the target blockchain.
5. The method according to claim 1, wherein the second fund corresponding to the first fund is unlocked or minted on the target blockchain through a second smart contract on the target blockchain, include: The second smart contract on the target blockchain determines whether the second fund corresponding to the first fund already exists on the target blockchain. If so, the second fund is unlocked; otherwise, the second fund is minted on the target blockchain.
6. The method according to claim 1, further comprising: include: Generate confirmation information corresponding to this cross-chain fund conversion on the target blockchain, and send the confirmation information to the source blockchain through the cross-chain message transmission protocol; The balance check on the source blockchain and the target blockchain regarding the cross-chain fund conversion is performed, and if the check passes, the cross-chain fund conversion is completed, including: In response to the first smart contract on the source blockchain receiving the confirmation information, a balance check is performed on the source blockchain and the target blockchain regarding this cross-chain funds conversion. If the check passes, it is determined that this cross-chain funds conversion is completed.
7. The method according to claim 1 or 6, wherein the transferring of the second funds to the second user account on the target blockchain further comprises: include: Locking the second funds in the second user account; The determination of the completion of this cross-chain fund conversion includes: The second funds in the second user account are unlocked to confirm that the cross-chain funds conversion is completed.
8. The method according to claim 1 or 6, wherein a balance check is performed on the source blockchain and the target blockchain regarding the cross-chain funds conversion. include: Obtaining first fund change information of the source blockchain regarding the cross-chain fund conversion through the first smart contract on the source blockchain; Obtain the second fund change information of the target blockchain regarding this cross-chain fund conversion; A balance check is performed based on the corresponding relationship between the first funds change information and the second funds change information.
9. According to the method of claim 8, the step of obtaining the second fund change information of the target blockchain regarding the cross-chain fund conversion comprises any one of the following: Obtaining second fund change information of the target blockchain regarding this cross-chain fund conversion through the second smart contract on the target blockchain; The event information on the target blockchain is captured by a decentralized validator network that has been connected to the target blockchain, and the second fund change information of the target blockchain regarding this cross-chain fund conversion is determined in the decentralized validator network according to the event information.
10. According to the method described in any one of claims 1 to 6, the first smart contract and the second smart contract need to have a predetermined number of preset private key signatures among multiple preset private key signatures corresponding to the multi-signature mechanism before they can be executed.
11. A device for cross-chain fund conversion, include: A locking module, configured to lock the first funds to be transferred corresponding to the first user account on the source blockchain through a first smart contract on the source blockchain, and obtain a cross-chain transaction certificate generated by the first smart contract; A verification module, configured to transmit the cross-chain transaction certificate to a target blockchain through a cross-chain message transmission protocol, verify the cross-chain transaction certificate on the target blockchain, and if the verification is successful, unlock or mint the second fund corresponding to the first fund on the target blockchain through a second smart contract on the target blockchain, and transfer the second fund to a second user account on the target blockchain; The balance check module is used to perform a balance check on the source blockchain and the target blockchain regarding this cross-chain fund conversion. If the check passes, it is determined that this cross-chain fund conversion is completed.
12. A storage medium having a computer program stored thereon, It is characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 10 are implemented.
13. An electronic device, It is characterized in that include: A processor and a memory; wherein the memory stores a computer program, and the computer program is suitable for being loaded by the processor and executing the steps of the method as claimed in any one of claims 1 to 10.
14. A computer program product having stored thereon at least one instruction, It is characterized in that When the at least one instruction is executed by the processor, the steps of the method described in any one of claims 1 to 10 are implemented.
Citation Information
Patent Citations
Decentralized side chain issuing anchoring main chain token method and system
CN111160881A
Block chain cross-chain transaction method and system
CN112926097A
Block chain-based cross-border remittance method and apparatus, and electronic device
CN114118988A
Block chain digital asset cross-chain transfer method and device
CN116823258A
Asset transfer method and device based on multi-block chain, equipment, medium and product
CN117917681A
Cited By
Methods and apparatus for cross-chain resource transfer in cross-chain system, and system
WO2026092570A1
