An atomic cross-chain transaction interaction method and system
By selecting the witness chain in cross-chain transactions and recording the transaction status and dividing it into exchangeable and refundable stages, the limitations of existing cross-chain technologies in terms of security and performance are solved, and the atomicity and low-cost interaction of cross-chain transactions are achieved.
Patent Information
- Application Number
- CN202210008638.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-01-05
- Publication Date
- 2025-06-20
- Estimated Expiration
- 2042-01-05
AI Technical Summary
The existing cross-chain technology has limitations in terms of security and performance, and it is difficult to effectively ensure the atomicity of cross-chain transactions, and the cross-chain transaction costs are relatively high.
Record cross-chain transaction status by selecting witness chains, making cross-chain transactions more transparent, avoiding trust issues with third parties, and dividing cross-chain transactions into exchangeable stages and refundable stages. In each stage, different blockchains interact by submitting evidence information to ensure the security of the cross-chain interaction process.
The atomicity of cross-chain transactions is realized, the cost of cross-chain transactions is reduced, the security and efficiency of interactions are improved, and the issue of trust in third parties is avoided.
Smart Images

Figure CN114386954B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of blockchain, and in particular to an atomic cross-chain transaction interaction method and system. Background Art
[0002] The statements in this part merely provide background technical information related to the present invention and do not necessarily constitute prior art.
[0003] Blockchain is a distributed ledger technology maintained by multiple parties, which can achieve consistent data storage, is difficult to tamper with, and is traceable. It is widely used in multiple fields. However, the underlying blockchain networks relied on between different application fields are mutually closed and independent, making cross-chain interaction very difficult. Cross-chain technology is the key to realizing information sharing and value interconnection between different blockchains. However, existing cross-chain technologies are still in the exploration and development stage, and more and more cross-chain requirements pose new challenges to cross-chain technology in terms of security and performance.
[0004] A cross-chain transaction often consists of sub-transactions distributed on multiple different blockchains. The most important aspect of the security of cross-chain technology is reflected in being able to ensure the atomicity of cross-chain transactions, that is, the sub-transactions included in the cross-chain transaction either all finally execute or all do not execute, and there is no third state; the cross-chain performance requires that the cost of cross-chain interaction can be as low as possible, and the cross-chain interaction cost can be measured by indicators such as storage, transaction fees, and throughput. However, existing cross-chain technologies have certain limitations in terms of security and performance.
[0005] Under the traditional notary mechanism, the notary has complete control over cross-chain transactions. On the one hand, there is no good transaction failure rollback mechanism to ensure the atomicity of cross-chain transactions. On the other hand, the intermediary fee makes the cross-chain transaction cost high; the side-chain / relay solution relies on the information anchoring of the side-chain to the main chain (such as block header information). However, the anchored information increases the storage pressure on the side-chain, and when the number of main chains to be anchored increases, this storage pressure will be greater; the hash locking technology can pre-lock assets using smart contracts and scripts, and realize the automatic transfer of assets by submitting hidden hash values within a limited time. It has stronger decentralization compared with the notary mechanism and smaller storage overhead than the side-chain / relay. However, this solution has strict time requirements, and there is a risk of asset loss in case of timeout. In the latest hash-locking-based solution, the method of using an intermediate network is used to record the cross-chain transaction status to overcome the original time risk. However, in this way, it cannot resist the risk of malicious mining, and when the cross-chain transaction density is large, this solution has great room for improvement in terms of storage and transaction fees. Summary of the Invention
[0006] To solve the above problems, the present invention proposes an atomic cross-chain transaction interaction method and system. By selecting a witness chain to record the cross-chain transaction status, the cross-chain transaction becomes more transparent, avoiding the trust problem with respect to a third party. At the same time, the cross-chain transaction is divided into an exchangeable stage and a refundable stage. In each stage, different blockchains interact through submitting evidence information, making the cross-chain interaction process safer.
[0007] To achieve the above object, the present invention adopts the following technical solutions:
[0008] In a first aspect, the present invention provides an atomic cross-chain transaction interaction method, which is applied to a witness chain and includes:
[0009] Receiving the locked cross-chain transaction information sent by a transaction chain and generating a transaction identifier, where the cross-chain transaction information is locked by a transaction initiator of the transaction chain in a transaction contract;
[0010] Receiving an exchangeable proposal or a refundable proposal sent by the transaction chain, judging the validity of the exchangeable proposal or the refundable proposal. When the proposal is valid, changing the cross-chain transaction status in the transaction identifier to an exchangeable status or a refundable status, so that the transaction chain unlocks assets according to the cross-chain transaction status;
[0011] Wherein, the asset unlocking process is that the transaction chain verifies the received block header information, and the block header information is the block header information between when the cross-chain transaction information is locked and when the cross-chain transaction status is changed; after the block header information verification passes, the assets are unlocked according to the cross-chain transaction status, so as to transfer the assets to the corresponding transaction party according to the cross-chain transaction information.
[0012] As an alternative implementation manner, the cross-chain transaction information includes a cross-chain transaction graph, public key information of a transaction party, transaction chain information, and an exchangeable period duration.
[0013] As an alternative implementation manner, the exchangeable proposal includes a transaction signature of the transaction recipient for the locked assets and a transaction identifier.
[0014] As an alternative implementation manner, the refundable proposal includes a transaction signature of the transaction initiator for the locked assets and a transaction identifier.
[0015] As an alternative implementation manner, the process of judging the validity of the exchangeable proposal and changing the cross-chain transaction status in the transaction identifier to an exchangeable status includes: after the transaction recipient of the transaction chain passes the locking verification of the cross-chain transaction information, receiving the exchangeable proposal, verifying whether the proposal submission time is within the exchangeable period, whether the input transaction identifier exists, whether the transaction signature matches the recorded public key information, and whether the number of proposal evidence information is the same as the number of transactions. If all the verifications pass, the exchangeable proposal is valid, and the cross-chain transaction status in the transaction identifier is changed to an exchangeable status.
[0016] As an alternative implementation, the process of determining the validity of a refundable proposal and changing the cross-chain transaction status in the transaction identifier to the refundable status includes: verifying whether the proposal submission time is within the refundable period, whether the current transaction identifier is the initial value, whether the input transaction identifier exists, and whether the transaction signature matches the recorded public key information. If all verifications pass, the refundable proposal is valid, and the cross-chain transaction status in the transaction identifier is changed to the refundable status.
[0017] As an alternative implementation, the process of verifying the received block header information includes: verifying whether the format of the block header information is correct, whether the block headers are connected in sequence by hash values, whether the SPV proof of the transaction is valid, and whether the block header information is submitted completely.
[0018] As an alternative implementation, the process of unlocking assets according to the cross-chain transaction status includes: if the cross-chain transaction status is the exchangeable status, unlocking the assets to the transaction recipient; if the cross-chain transaction status is the refundable status, unlocking the assets to the transaction initiator.
[0019] As an alternative implementation, the locking verification process of the cross-chain transaction information by the transaction recipient of the transaction chain includes: verifying whether the cross-chain transaction is correctly locked according to the agreement of the cross-chain transaction graph, specifically including: whether the locking address meets the settings in the transaction contract of the transaction chain, whether the cross-chain transaction is the agreed asset, and whether the asset unlocking conditions are correct; after all verifications pass, it is further determined whether the cross-chain transaction has been packaged and uploaded to the chain and whether the expected security interval has passed. When all verifications pass, the locking verification passes.
[0020] As an alternative implementation, the verification process of whether the block header information is submitted completely includes: obtaining the block header information h in the witness chain when the assets are locked, the latest block header information hnow recorded in the transaction contract of the current transaction chain, and the block header information hnew after the cross-chain transaction status changes and after a stable time interval; if h = hnow, the submitted block header information is the block header information between h and hnew; if h < hnow ≤ hnew, the submitted block header information is the block header information between hnow and hnew, and the SPV proof of the transaction that causes the cross-chain status to change is submitted.
[0021] In a second aspect, the present invention provides an atomic cross-chain transaction interaction method, which is applied to the transaction initiator of the transaction chain and includes:
[0022] Lock the cross-chain transaction information in the transaction contract, and send the cross-chain transaction information to the witness chain to obtain a transaction identifier, so that the witness chain can receive and verify the exchangeable proposal or refundable proposal uploaded by the transaction recipient. When the proposal is valid, change the cross-chain transaction status in the transaction identifier to the exchangeable status or the refundable status;
[0023] Obtain the block header information and verify it. The block header information is the block header information between the time when the cross-chain transaction information is locked and the change of the cross-chain transaction status. After the verification passes, unlock the assets according to the cross-chain transaction status, and transfer the assets to the corresponding trading party according to the cross-chain transaction information.
[0024] Thirdly, the present invention provides an atomic cross-chain transaction interaction method, which is applied to the transaction recipient of the transaction chain and includes:
[0025] After performing locking verification on the cross-chain transaction information, send an exchangeable proposal or a refundable proposal to the witness chain, so that the witness chain can judge the validity of the exchangeable proposal or the refundable proposal. When the proposal is valid, change the cross-chain transaction status in the transaction identifier to the exchangeable status or the refundable status;
[0026] Wherein, the cross-chain transaction information is locked in the transaction contract by the transaction initiator of the transaction chain; the transaction identifier is generated after the witness chain receives the locked cross-chain transaction information sent by the transaction initiator;
[0027] Receive and verify the block header information sent by the transaction initiator. The block header information is the block header information between the time when the cross-chain transaction information is locked and the change of the cross-chain transaction status; after the block header information verification passes, unlock the assets according to the cross-chain transaction status, so as to transfer the assets to the corresponding trading party according to the cross-chain transaction information.
[0028] Fourthly, the present invention provides an atomic cross-chain transaction interaction system, including:
[0029] A transaction identifier generation module, configured to receive the locked cross-chain transaction information sent by the transaction chain and generate a transaction identifier, where the cross-chain transaction information is locked in the transaction contract by the transaction initiator of the transaction chain;
[0030] The cross-chain transaction module is configured to receive an exchangeable proposal or a refundable proposal sent by a transaction chain, determine the validity of the exchangeable proposal or the refundable proposal, and when the proposal is valid, change the cross-chain transaction status in the transaction identifier to an exchangeable status or a refundable status, so that the transaction chain unlocks assets according to the cross-chain transaction status; wherein, the asset unlocking process is that the transaction chain verifies the received block header information, and the block header information is the block header information between the time when the cross-chain transaction information is locked and the change of the cross-chain transaction status; after the verification of the block header information passes, the assets are unlocked according to the cross-chain transaction status, so as to transfer the assets to the corresponding trading party according to the cross-chain transaction information.
[0031] In a fifth aspect, the present invention provides an atomic cross-chain transaction interaction system, including:
[0032] The locking module is configured to lock the cross-chain transaction information in a transaction contract, send the cross-chain transaction information to a witness chain to obtain a transaction identifier, so that the witness chain receives and verifies an exchangeable proposal or a refundable proposal uploaded by a transaction recipient, and when the proposal is valid, change the cross-chain transaction status in the transaction identifier to an exchangeable status or a refundable status;
[0033] The unlocking module is configured to obtain and verify block header information, where the block header information is the block header information between the time when the cross-chain transaction information is locked and the change of the cross-chain transaction status, and after the verification passes, unlock the assets according to the cross-chain transaction status, and transfer the assets to the corresponding trading party according to the cross-chain transaction information.
[0034] In a sixth aspect, the present invention provides an atomic cross-chain transaction interaction system, including:
[0035] The locking and verification module is configured to send an exchangeable proposal or a refundable proposal to a witness chain after locking and verifying the cross-chain transaction information, so that the witness chain determines the validity of the exchangeable proposal or the refundable proposal, and when the proposal is valid, change the cross-chain transaction status in the transaction identifier to an exchangeable status or a refundable status; wherein, the cross-chain transaction information is locked in a transaction contract by a transaction initiator; the transaction identifier is generated after the witness chain receives the locked cross-chain transaction information sent by the transaction initiator;
[0036] The unlocking module is configured to receive and verify the block header information sent by the transaction initiator, where the block header information is the block header information between the time when the cross-chain transaction information is locked and the change of the cross-chain transaction status; after the verification of the block header information passes, unlock the assets according to the cross-chain transaction status, so as to transfer the assets to the corresponding trading party according to the cross-chain transaction information.
[0037] In a seventh aspect, the present invention provides an electronic device, including a memory, a processor, and computer instructions stored on the memory and running on the processor. When the computer instructions are run by the processor, the methods described in the first aspect, the second aspect, or the third aspect are completed.
[0038] In an eighth aspect, the present invention provides a computer-readable storage medium for storing computer instructions. When the computer instructions are executed by a processor, the methods described in the first aspect, the second aspect, or the third aspect are completed.
[0039] Compared with the prior art, the beneficial effects of the present invention are as follows:
[0040] An atomic cross-chain transaction interaction method and system proposed by the present invention selects a blockchain as a witness chain, uses the witness chain to record the status of cross-chain transactions, coordinates the entire cross-chain transaction, and triggers corresponding asset interaction operations through smart contracts, making the cross-chain transaction more transparent, not controlled by a third party, and avoiding the trust problem of the third party.
[0041] An atomic cross-chain transaction interaction method and system proposed by the present invention designs a cross-chain interaction process in stages, divides the cross-chain transaction into an exchangeable stage and a refundable stage. In each stage, different blockchains perform interaction operations by submitting evidence information, and wait for a certain safe time before proceeding to the next operation, making the cross-chain interaction process safer. The proposal information in the exchangeable stage means that the trader actively promotes the cross-chain transaction, and the refundable stage represents the trader's intention to withdraw the initiated cross-chain transaction. Different from HTLC, the cross-chain transaction in the present invention is carried out in different time periods with the witness chain as the global clock and persistent evidence, ensuring that the transaction result can always be correctly executed without considering malicious fork fraud attacks.
[0042] When the present invention performs cross-chain interaction, the proposal information initiated by the trader to the witness chain is realized through a signature mechanism, and the unlocking information submitted to the transaction chain is realized by recording part of the block information of the witness chain. Compared with the traditional method of anchoring the main chain information, the verification method provided by the present invention can reduce the storage and transmission costs caused by cross-chain information interaction.
[0043] The present invention designs a new resource reuse strategy, including reusing existing smart contracts and already submitted block header information, reducing the storage overhead and transaction fee overhead of cross-chain transactions, while not affecting the throughput of the involved blockchains. It meets the increasingly high cross-chain interaction requirements, ensures the atomicity of each sub-transaction participating in the cross-chain interaction, improves the interaction security, improves the cross-chain interaction efficiency, and reduces the cross-chain interaction cost.
[0044] Advantages of additional aspects of the present invention will be given in part in the following description, become apparent in part from the following description, or be learned by practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] The accompanying drawings forming a part of this specification are used to provide a further understanding of the present invention. The schematic embodiments and descriptions thereof of the present invention are used to explain the present invention and do not unduly limit the present invention.
[0046] Figure 1 It is a cross-chain transaction interaction model diagram provided for Embodiment 1 of the present invention;
[0047] Figure 2 It is an asset locking flowchart provided for Embodiment 1 of the present invention;
[0048] Figure 3 It is a flowchart of cross-chain interaction in the convertible stage provided for Embodiment 1 of the present invention;
[0049] Figure 4 It is a flowchart of cross-chain interaction in the refundable stage provided for Embodiment 1 of the present invention;
[0050] Figure 5 It is an asset unlocking flowchart provided for Embodiment 1 of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0051] The present invention will be further described below in conjunction with the accompanying drawings and embodiments.
[0052] It should be noted that the following detailed description is exemplary and is intended to provide further explanation of the present invention. Unless otherwise specified, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the technical field to which the present invention belongs.
[0053] It should be noted that the terms used herein are only for describing specific embodiments and are not intended to limit the exemplary embodiments according to the present invention. As used herein, unless the context clearly indicates otherwise, the singular forms are also intended to include the plural forms. In addition, it should be understood that the terms "comprising" and "having" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product or device that includes a series of steps or units does not necessarily have to be limited to those steps or units clearly listed, but may include other steps or units not clearly listed or inherent to these processes, methods, products or devices.
[0054] In the case of no conflict, the embodiments in the present invention and the features in the embodiments may be combined with each other.
[0055] Embodiment 1
[0056] AsFigure 1 As shown in the figure, this embodiment provides a cross-chain transaction interaction model based on a witness chain to record the cross-chain transaction status. This model includes users, a witness chain, and a transaction chain. Among them, the user is the trading party for cross-chain asset interaction, and has corresponding account addresses on each chain to identify the identity, and implements cross-chain asset interaction operations through contract calls. The witness chain is a blockchain selected through discussion between the two trading parties, and records cross-chain transactions by deploying a witness contract. The transaction chain is the blockchain where the users conducting cross-chain transactions are located. Each transaction chain, as an independent blockchain, can not only process ordinary cross-chain transactions on its own chain, but also implement cross-chain asset interaction through specific transaction contracts.
[0057] Therefore, this embodiment provides an atomic cross-chain transaction interaction method, which is applied to the witness chain and includes:
[0058] Receiving the locked cross-chain transaction information sent by the transaction chain and generating a transaction identifier. The cross-chain transaction information is locked in the transaction contract by the transaction initiator of the transaction chain.
[0059] Receiving an exchangeable proposal or a refundable proposal sent by the transaction chain, judging the validity of the exchangeable proposal or the refundable proposal. When the proposal is valid, changing the cross-chain transaction status in the transaction identifier to the exchangeable status or the refundable status, so that the transaction chain unlocks assets according to the cross-chain transaction status.
[0060] Among them, the asset unlocking process is that the transaction chain verifies the received block header information. The block header information is the block header information between when the cross-chain transaction information is locked and when the cross-chain transaction status is changed. After the block header information verification passes, the assets are unlocked according to the cross-chain transaction status, and the assets are transferred to the corresponding trading party according to the cross-chain transaction information.
[0061] In this embodiment, the cross-chain transaction information includes a cross-chain transaction graph, the public key information of the trading party, transaction chain information, the duration of the exchangeable period, etc.
[0062] In this embodiment, smart contracts for cross-chain interaction are deployed in both the witness chain and the transaction chain. Among them, a smart transaction contract SCt for locking and unlocking assets is deployed on the transaction chain, including a method for locking assets lock, a method for exchanging assets doExchange, a method for refunding assets doBack, a method for verifying block header information check, and a method for submitting block information commit.
[0063] A smart witness contract SCw for coordinating cross-chain transactions is deployed on the witness chain, including a method for publishing cross-chain transactions register, a method for receiving exchangeable proposal information changeToExchange, and a method for receiving refundable proposal information changeToBack.
[0064] In this embodiment, the process of locking the cross-chain transaction information by the transaction initiator of the transaction chain in the transaction contract is as follows: after registering the cross-chain transaction information on the witness chain, each transaction initiator, as the asset sender, locks the asset in the transaction contract in the form of initiating a transaction on each transaction chain, and sets the asset unlocking condition to the cross-chain transaction information recorded on the witness chain;
[0065] As Figure 2 shown, it specifically includes:
[0066] S11: The trader calls the Register method of the witness contract on the witness chain to generate a unique transaction identifier SUID for the cross-chain transaction. At this time, SUID is the initial value;
[0067] S12: The trader determines whether the registered cross-chain transaction information has been successfully called and packaged onto the chain. If so, execute S13; otherwise, execute S11;
[0068] S13: In each transaction chain, according to the transaction graph, the transaction initiator calls the lock method in the transaction contract to lock the asset in the transaction contract of this chain, and sets the unlocking condition of the asset to the value of SUID;
[0069] At the same time, in order to verify the cross-chain transaction status on the witness chain subsequently, record the stable block header information h and the stable time interval of the witness chain at this moment.
[0070] In this embodiment, when the transaction initiator initiates a cross-chain transaction, the transaction initiator generates a cross-chain transaction graph off-chain to record the cross-chain transaction. The vertices in the cross-chain transaction graph are the traders participating in the cross-chain transaction, and the edges are the sub-transactions executed on each transaction chain, including the transaction initiator, the transaction recipient, and the transaction amount. Each trader needs to sign and confirm the constructed cross-chain transaction graph with the private key; then one of the traders will call the register method of the witness chain smart contract SCw, passing in parameters such as the cross-chain transaction graph and the public key. At this time, the witness chain will record this cross-chain transaction and generate a unique transaction identifier serial number SUID; for a specific SUID, there are 3 corresponding values to record the cross-chain transaction, namely the initial state, the exchangeable state, and the refundable state.
[0071] In this embodiment, a phased cross-chain interaction process is established to ensure the security of cross-chain interaction. When the cross-chain transaction is successfully registered on the witness chain, the value of SUID is in the initial state, and the cross-chain interaction enters the exchangeable stage; after m blocks in the exchangeable stage, the cross-chain interaction enters the refundable stage; where the size of m is determined by the negotiation of the traders and recorded in the witness contract of the witness chain.
[0072] In this embodiment, when the value of the SUID that identifies the cross-chain transaction changes, the trader can trigger the corresponding asset transfer by calling the corresponding method in the SCt contract. When the SUID value is exchangeable, doExchange is called; when it is refundable, doBack is called.
[0073] In this embodiment, after the transaction initiator locks the assets, after the asset recipient monitors the locked assets, it calls the witness contract on the witness chain to submit proposal information and requests to change the value of the SUID to exchangeable; then the process of receiving the exchangeable proposal sent by the transaction recipient and performing validity judgment is as Figure 3 shown and specifically includes:
[0074] S21: According to the cross-chain transaction graph, the transaction recipient monitors the cross-chain transaction information sent from the address of the transaction initiator;
[0075] S22: After the transaction recipient monitors the cross-chain transaction, it verifies whether the cross-chain transaction is correctly locked according to the agreement of the cross-chain transaction graph; the verification content includes: whether the lock address belongs to the transaction contract on the transaction chain, whether it is the agreed asset, whether the asset unlocking condition is correct, etc.;
[0076] After the above verifications all pass, it is further determined whether the cross-chain transaction has been packaged and uploaded to the chain and whether the expected security interval has passed. After all verifications pass, S23 is executed; otherwise, S21 is executed;
[0077] S23: The transaction recipient calls the changeToExchange method in the witness contract of the witness chain to submit an exchangeable proposal; among them, the exchangeable proposal includes the sub-transaction ID signature of the locked assets by the transaction recipient and the transaction identifier SUID;
[0078] S24: After the witness contract on the witness chain is called with the changeToExchange method, it automatically executes the verification logic to verify whether the proposal submission time is within the exchangeable period, whether the input SUID exists, and whether the sub-transaction ID signature matches the recorded public key information. After all the above verifications pass, the exchangeable proposal is valid and S25 is executed; otherwise, S27 is executed;
[0079] S25: The witness contract further determines whether the number of evidence information submitted is the same as the number of transactions according to the SUID. If they are the same, it means that the evidence quantity is sufficient and S26 is executed; otherwise, S23 is executed;
[0080] S26: The witness contract changes the value of the SUID to exchangeable;
[0081] S27: The exchangeable proposal fails the verification and the proposal ends.
[0082] In this embodiment, in the refundable stage, if the witness contract fails to collect sufficient proposal information, that is, if the SUID is still the initial value, any trader can submit a refundable proposal to end the cross-chain transaction, request to change the status value corresponding to the SUID to refundable, and redeem the locked assets; then the process of judging the validity of the refundable proposal is as follows Figure 4 shown, and specifically includes:
[0083] S28: The transaction recipient calls the changeToBack method in the witness contract of the witness chain to submit a refundable proposal; the refundable proposal includes the sub-transaction ID signature of the locked assets by the transaction initiator and the transaction identifier SUID;
[0084] S29: After the witness contract on the witness chain is called with the changeToBack method, it automatically executes the verification logic to verify whether the proposal submission time is within the refundable period, whether the current value of the SUID is the initial value, whether the input SUID exists, and whether the sub-transaction ID signature matches the recorded public key information; if all the above verifications pass, the refundable proposal is valid, and S210 is executed, otherwise S211 is executed;
[0085] S210: The witness contract changes the value of the SUID to refundable;
[0086] S211: The refundable proposal fails the verification, and the proposal process ends.
[0087] In this embodiment, when the value of the SUID changes, the trader can unlock the locked assets under different conditions by submitting evidence information to the transaction chain; at this time, since this embodiment allows multiple cross-chain transactions to implement cross-chain asset interaction through a cross-chain contract, when submitting evidence information, it is allowed to use the submitted evidence information to save the cross-chain asset interaction cost.
[0088] When performing asset transfer operations, it is necessary to record the block information in the witness chain at the same time for verifying the corresponding value of the SUID, that is, the trader calls the commit method of submitting block information in the SCt contract; as Figure 5 shown is the flow chart of the trader submitting evidence information to the transaction chain to unlock assets, and specifically includes:
[0089] S31: Obtain the witness chain information h recorded when locking the assets, the latest block header information hnow recorded in the contract of the current transaction chain, and the block header information hnew after the cross-chain transaction status changes in the witness chain and after a stable time interval d;
[0090] When h = hnow, the submitted block header information is all the block header information between h and hnew;
[0091] When h < hnow ≤ hnew, the submitted block header information is the block header information between hnow and hnew; at the same time, it is also necessary to submit the SPV proof of the transaction that causes the cross-chain status to change.
[0092] S32: After calling the commit method to submit the block header information, the transaction contract automatically calls the check method to verify the validity of the block header information; the verification content includes: whether the format of the block header information is correct, whether the block headers can be connected in sequence through the hash value, whether the SPV of the transaction is valid, etc.;
[0093] After passing the verification, execute S33, otherwise execute S39;
[0094] S33: The transaction contract on the transaction chain records the witnessed chain block information that has passed the verification;
[0095] S34: Determine whether all the block header information between h and hnew has been submitted. If so, execute S35, otherwise execute S31;
[0096] S35: Determine the changed cross-chain transaction status. If the SUID value is exchangeable, execute S36; if the SUID value is refundable, execute S37; otherwise execute S38;
[0097] S36: According to the transaction graph record, unlock the assets from the contract to the transaction recipient;
[0098] S37: According to the transaction graph record, unlock the assets from the contract to the transaction initiator;
[0099] S38: The cross-chain status is determined not to meet the unlocking conditions, and the assets are not transferred;
[0100] S39: The block header information is invalid, and the submitted block header information is not recorded.
[0101] In this embodiment, a cross-chain resource reuse strategy and different inter-chain interaction verification methods are established to reduce the cost of cross-chain asset interaction and improve the interaction efficiency. When performing cross-chain interaction, as the cross-chain requirements increase, the transaction chains and witnessed chains corresponding to different cross-chain transactions may be the same. By reusing the existing smart contracts SCt and SCw to record different cross-chain transactions, the overhead caused by publishing contracts can be reduced.
[0102] In this embodiment, in the proposal information submitted by the trader to the witnessed chain, the idea of Nash equilibrium is used in this embodiment to prompt the trader to honestly submit the proposal information;
[0103] When the proposal direction is exchangeable, the task of verifying whether the transaction chain effectively locks the assets is handed over to the asset recipient. An honest recipient will always try its best to verify the locked transaction. As the asset sender, if the assets are not transferred as agreed, it will only cause the cross-chain transaction to fail and there will be no risk of any asset loss to the recipient, that is, ensuring the security of the method in this embodiment;
[0104] When the proposal direction is refundable, it only requires the locked asset trader to submit their signature for this transaction during the refundable period; at the same time, submitting a signature has a smaller volume compared to submitting consecutive block header information, which can effectively reduce the cost overhead in aspects such as cross-chain interaction in transmission, storage, and transaction fees.
[0105] In this embodiment, among the information for asset transfer submitted by the trader to the transaction chain, this embodiment uses a method of anchoring some information in the latest improved cross-chain research results; that is, when the trader calls the lock method in the SCt contract, it is necessary to record the most recent stable block header information of the witness chain at this time; when the corresponding value of the SUID on the witness chain changes, the trader needs to wait for the block where the changed transaction is located to pass through the stable interval, and then trigger the asset transfer by submitting the missing block header information during this period to the SCt. Compared with the original method of anchoring some information, the solution proposed in this embodiment can reuse the already submitted information, thereby further reducing resource overhead and the higher the cross-chain transaction density.
[0106] Embodiment 2
[0107] This embodiment provides an atomic cross-chain transaction interaction method, which is applied to the transaction initiator of the transaction chain and includes:
[0108] Lock the cross-chain transaction information in the transaction contract, send the cross-chain transaction information to the witness chain to obtain a transaction identifier, so that the witness chain can receive and verify the exchangeable proposal or refundable proposal uploaded by the transaction recipient. When the proposal is valid, change the cross-chain transaction status in the transaction identifier to the exchangeable status or refundable status;
[0109] Obtain the block header information and verify it. The block header information is the block header information between the time when the cross-chain transaction information is locked and the change of the cross-chain transaction status. After the verification passes, unlock the assets according to the cross-chain transaction status, and transfer the assets to the corresponding transaction party according to the cross-chain transaction information.
[0110] The remaining processes of this method are the same as those of the method described in Embodiment 1. For the sake of brevity, they will not be elaborated here.
[0111] Embodiment 3
[0112] This embodiment provides an atomic cross-chain transaction interaction method, which is applied to the transaction recipient of the transaction chain and includes:
[0113] After locking and verifying the cross-chain transaction information, send an exchangeable proposal or a refundable proposal to the witness chain, so that the witness chain can judge the validity of the exchangeable proposal or the refundable proposal. When the proposal is valid, change the cross-chain transaction status in the transaction identifier to the exchangeable status or the refundable status;
[0114] Among them, the cross-chain transaction information is locked in the transaction contract by the transaction initiator; the transaction identifier is generated after the witness chain receives the locked cross-chain transaction information sent by the transaction initiator;
[0115] Receive and verify the block header information sent by the transaction initiator. The block header information is the block header information from the time when the cross-chain transaction information is locked to the time when the cross-chain transaction status is changed; after the block header information is verified, unlock the assets according to the cross-chain transaction status, so as to transfer the assets to the corresponding trading party according to the cross-chain transaction information.
[0116] The remaining processes of this method are the same as those described in Embodiment 1. For the sake of brevity, they will not be elaborated here.
[0117] Embodiment 4
[0118] This embodiment provides an atomic cross-chain transaction interaction system, including:
[0119] A transaction identifier generation module, configured to receive the locked cross-chain transaction information sent by the transaction chain and generate a transaction identifier, where the cross-chain transaction information is locked in the transaction contract by the transaction initiator of the transaction chain;
[0120] A cross-chain transaction module, configured to receive an exchangeable proposal or a refundable proposal sent by the transaction chain, judge the validity of the exchangeable proposal or the refundable proposal, and when the proposal is valid, change the cross-chain transaction status in the transaction identifier to the exchangeable status or the refundable status, so that the transaction chain unlocks the assets according to the cross-chain transaction status; among them, the asset unlocking process is that the transaction chain verifies the received block header information, and the block header information is the block header information from the time when the cross-chain transaction information is locked to the time when the cross-chain transaction status is changed; after the block header information is verified, unlock the assets according to the cross-chain transaction status, so as to transfer the assets to the corresponding trading party according to the cross-chain transaction information.
[0121] It should be noted here that the above modules correspond to the steps described in Embodiment 1, and the examples and application scenarios implemented by the above modules and the corresponding steps are the same, but are not limited to the content disclosed in Embodiment 1 above. It should be noted that the above modules, as part of the system, can be executed in a computer system such as a set of computer executable instructions.
[0122] Embodiment 5
[0123] This embodiment provides an atomic cross-chain transaction interaction system, including:
[0124] A locking module, configured to lock cross-chain transaction information in a transaction contract, send the cross-chain transaction information to a witness chain to obtain a transaction identifier, so that the witness chain receives and verifies an exchangeable proposal or a refundable proposal uploaded by a transaction recipient, and when the proposal is valid, change the cross-chain transaction status in the transaction identifier to an exchangeable status or a refundable status;
[0125] An unlocking module, configured to obtain and verify block header information, where the block header information is the block header information between when the cross-chain transaction information is locked and when the cross-chain transaction status changes. After the verification passes, unlock assets according to the cross-chain transaction status, and transfer the assets to the corresponding trading party according to the cross-chain transaction information.
[0126] It should be noted here that the above modules correspond to the steps described in Embodiment 1. The examples and application scenarios implemented by the above modules and the corresponding steps are the same, but are not limited to the content disclosed in the above Embodiment 1. It should be noted that the above modules can be executed in a computer system such as a set of computer executable instructions as part of the system.
[0127] Embodiment 6
[0128] This embodiment provides an atomic cross-chain transaction interaction system, including:
[0129] A locking and verification module, configured to send an exchangeable proposal or a refundable proposal to a witness chain after performing locking verification on cross-chain transaction information, so that the witness chain determines the validity of the exchangeable proposal or the refundable proposal, and when the proposal is valid, change the cross-chain transaction status in the transaction identifier to an exchangeable status or a refundable status; wherein, the cross-chain transaction information is locked in a transaction contract by a transaction initiator; the transaction identifier is generated after the witness chain receives the locked cross-chain transaction information sent by the transaction initiator;
[0130] An unlocking module, configured to receive and verify block header information sent by a transaction initiator, where the block header information is the block header information between when the cross-chain transaction information is locked and when the cross-chain transaction status changes; after the block header information verification passes, unlock assets according to the cross-chain transaction status to transfer the assets to the corresponding trading party according to the cross-chain transaction information.
[0131] It should be noted here that the above modules correspond to the steps described in Embodiment 1. The examples and application scenarios implemented by the above modules and the corresponding steps are the same, but are not limited to the content disclosed in the above Embodiment 1. It should be noted that the above modules can be executed in a computer system such as a set of computer executable instructions as part of the system.
[0132] In more embodiments, the following is also provided:
[0133] An electronic device includes a memory, a processor, and computer instructions stored on the memory and running on the processor. When the computer instructions are run by the processor, the method described in Embodiment 1 is completed. For the sake of brevity, it will not be elaborated here.
[0134] It should be understood that in this embodiment, the processor may be a central processing unit (CPU), and the processor may also be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), off-the-shelf programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.
[0135] The memory may include a read-only memory and a random access memory, and provide instructions and data to the processor. A part of the memory may also include a non-volatile random access memory. For example, the memory may also store information about the device type.
[0136] A computer-readable storage medium is used to store computer instructions. When the computer instructions are executed by the processor, the method described in Embodiment 1 is completed.
[0137] The method in Embodiment 1 can be directly embodied as being executed by a hardware processor, or by a combination of hardware and software modules in the processor. The software modules may be located in mature storage media in the art such as random access memory, flash memory, read-only memory, programmable read-only memory, or electrically erasable programmable memory, registers, etc. This storage medium is located in the memory, and the processor reads the information in the memory and combines its hardware to complete the steps of the above method. To avoid repetition, it will not be described in detail here.
[0138] Those of ordinary skill in the art can realize that the units and algorithm steps of each example described in combination with this embodiment can be implemented by electronic hardware or a combination of computer software and electronic hardware. Whether these functions are executed in a hardware or software manner depends on the specific application and design constraints of the technical solution. Professional technicians can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of this application.
[0139] Although the specific implementation manners of the present invention have been described above in conjunction with the accompanying drawings, it is not a limitation on the protection scope of the present invention. Those skilled in the art should understand that based on the technical solution of the present invention, various modifications or deformations that can be made by those skilled in the art without creative labor are still within the protection scope of the present invention.
Claims
1. An atomic cross-chain transaction interaction method, characterized in that, Applied to the witness chain, including: Receiving the locked cross-chain transaction information sent by the transaction chain and generating a transaction identifier. The cross-chain transaction information is locked in a transaction contract by the transaction initiator of the transaction chain, and the witness chain block header information and the stable time interval at the time of locking are recorded; Receiving an exchangeable proposal or a refundable proposal sent by the transaction chain, judging the validity of the exchangeable proposal or the refundable proposal. When the proposal is valid, changing the cross-chain transaction status in the transaction identifier to the exchangeable status or the refundable status, so that the transaction chain unlocks assets according to the cross-chain transaction status; Among them, the asset unlocking process is that the transaction chain verifies the received block header information, and the block header information is the block header information between the time when the cross-chain transaction information is locked and the change of the cross-chain transaction status; after the block header information verification passes, the assets are unlocked according to the cross-chain transaction status to transfer the assets to the corresponding trading party according to the cross-chain transaction information. The process of verifying the received block header information includes: verifying whether the format of the block header information is correct, whether the block headers are connected in sequence by hash values, whether the SPV proof of the transaction is valid, and whether the block header information is submitted completely; the process of verifying whether the block header information is submitted completely includes: obtaining the block header information h in the witness chain when the assets are locked, the latest block header information hnow recorded in the transaction contract of the current transaction chain, and the block header information hnew after the cross-chain transaction status changes and after the stable time interval; if h = hnow, the submitted block header information is the block header information between h and hnew; if h < hnow ≤ hnew, the submitted block header information is the block header information between hnow and hnew, and the SPV proof of the transaction that causes the cross-chain status to change is submitted; Among them, the cross-chain transaction includes an exchangeable stage and a refundable stage; after m blocks in the exchangeable stage, the cross-chain interaction enters the refundable stage; the size of m is determined by negotiation between the traders and recorded in the witness contract of the witness chain.
2. The atomic cross-chain transaction interaction method according to claim 1, characterized in that, The cross-chain transaction information includes a cross-chain transaction graph, the public key information of the trading party, the transaction chain information, and the exchangeable period duration; or, the exchangeable proposal includes the transaction signature of the transaction recipient for the locked assets and the transaction identifier; Or, the refundable proposal includes the transaction signature of the transaction initiator for the locked assets and the transaction identifier; or, the process of judging the validity of the exchangeable proposal and changing the cross-chain transaction status in the transaction identifier to the exchangeable status includes: after the lock verification of the cross-chain transaction information by the transaction recipient of the transaction chain passes, receiving the exchangeable proposal, verifying whether the proposal submission time is within the exchangeable period, whether the input transaction identifier exists, whether the transaction signature matches the recorded public key information, and whether the number of proposal evidence information is the same as the number of transactions. If all verifications pass, the exchangeable proposal is valid, and the cross-chain transaction status in the transaction identifier is changed to the exchangeable status; Alternatively, the process of judging the validity of a refundable proposal and changing the cross-chain transaction status in the transaction identifier to the refundable status includes: verifying whether the proposal submission time is within the refundable period, whether the current transaction identifier is the initial value, whether the input transaction identifier exists, and whether the transaction signature matches the recorded public key information. If all verifications pass, the refundable proposal is valid, and the cross-chain transaction status in the transaction identifier is changed to the refundable status; Alternatively, the process of unlocking assets according to the cross-chain transaction status includes: if the cross-chain transaction status is the exchangeable status, unlocking the assets to the transaction recipient; if the cross-chain transaction status is the refundable status, unlocking the assets to the transaction initiator.
3. The atomic cross-chain transaction interaction method according to claim 2, characterized in that, The process of locking verification of the cross-chain transaction information by the transaction recipient of the transaction chain includes: verifying whether the cross-chain transaction is correctly locked according to the agreement of the cross-chain transaction graph, specifically including: whether the locked address meets the settings in the transaction contract of the transaction chain, whether the cross-chain transaction is the agreed asset, and whether the asset unlocking conditions are correct; after all verifications pass, it is determined again whether the cross-chain transaction has been packaged and uploaded to the chain and whether the expected security interval has passed. When all verifications pass, the locking verification passes.
4. An atomic cross-chain transaction interaction method, characterized in that, Applied to the transaction initiator of the transaction chain, it includes: Locking the cross-chain transaction information in the transaction contract, and sending the cross-chain transaction information to the witness chain to obtain a transaction identifier, so that the witness chain receives and verifies the exchangeable proposal or refundable proposal uploaded by the transaction recipient. When the proposal is valid, changing the cross-chain transaction status in the transaction identifier to the exchangeable status or the refundable status, and recording the witness chain block header information and the stable time interval at the time of locking; Obtaining and verifying the block header information, where the block header information is the block header information between the time when the cross-chain transaction information is locked and the change of the cross-chain transaction status. After the verification passes, unlocking the assets according to the cross-chain transaction status, and transferring the assets to the corresponding transaction party according to the cross-chain transaction information; the process of verifying the received block header information includes: verifying whether the format of the block header information is correct, whether the block headers are connected in sequence by the hash value, whether the SPV proof of the transaction is valid, and whether the block header information is submitted completely; the process of verifying whether the block header information is submitted completely includes: obtaining the block header information h in the witness chain when the assets are locked, the latest block header information hnow recorded in the transaction contract of the current transaction chain, and the block header information hnew after the cross-chain transaction status changes and after the stable time interval; if h = hnow, the submitted block header information is the block header information between h and hnew; if h < hnow ≤ hnew, the submitted block header information is the block header information between hnow and hnew, and the SPV proof of the transaction that causes the cross-chain status to change is submitted; Among them, the cross-chain transaction includes an exchangeable stage and a refundable stage; after m blocks in the exchangeable stage, the cross-chain interaction enters the refundable stage; the size of m is determined by negotiation between the traders and recorded in the witness contract of the witness chain.
5. An atomic cross-chain transaction interaction method, characterized in that, Applied to the transaction recipient of the transaction chain, it includes: After locking and verifying the cross-chain transaction information, send an exchangeable proposal or a refundable proposal to the witness chain, so that the witness chain can judge the validity of the exchangeable proposal or the refundable proposal. When the proposal is valid, change the cross-chain transaction status in the transaction identifier to the exchangeable status or the refundable status; Among them, the cross-chain transaction information is locked in the transaction contract by the transaction initiator; the transaction identifier is generated after the witness chain receives the locked cross-chain transaction information sent by the transaction initiator; Receive and verify the block header information sent by the transaction initiator. The block header information is the block header information from the time when the cross-chain transaction information is locked to the time when the cross-chain transaction status is changed; after the block header information is verified, unlock the assets according to the cross-chain transaction status, so as to transfer the assets to the corresponding trading party according to the cross-chain transaction information; the process of verifying the received block header information includes: verifying whether the format of the block header information is correct, whether the block headers are connected in sequence by hash values, whether the SPV proof of the transaction is valid, and whether the block header information is submitted completely; the process of verifying whether the block header information is submitted completely includes: obtaining the block header information h in the witness chain when the assets are locked, the latest block header information hnow recorded in the transaction contract of the current transaction chain, and the block header information hnew after the cross-chain transaction status is changed and after a stable time interval; if h = hnow, the submitted block header information is the block header information between h and hnew; if h < hnow ≤ hnew, the submitted block header information is the block header information between hnow and hnew, and submit the SPV proof of the transaction that causes the cross-chain status to change; Among them, the cross-chain transaction includes an exchangeable stage and a refundable stage; after m blocks are experienced in the exchangeable stage, the cross-chain interaction enters the refundable stage; the size of m is determined by negotiation among the traders and is recorded in the witness contract of the witness chain.
6. An atomic cross-chain transaction interaction system, characterized in that, Applied to the witness chain, it includes: A transaction identifier generation module, configured to receive the locked cross-chain transaction information sent by the transaction chain and generate a transaction identifier. The cross-chain transaction information is locked in the transaction contract by the transaction initiator of the transaction chain, and records the block header information of the witness chain and the stable time interval at the time of locking; The cross-chain transaction module is configured to receive an exchangeable proposal or a refundable proposal sent by a transaction chain, determine the validity of the exchangeable proposal or the refundable proposal, and when the proposal is valid, change the cross-chain transaction status in the transaction identifier to an exchangeable status or a refundable status, so that the transaction chain unlocks assets according to the cross-chain transaction status; wherein, the asset unlocking process is that the transaction chain verifies the received block header information, and the block header information is the block header information between the time when the cross-chain transaction information is locked and the change of the cross-chain transaction status; after the verification of the block header information passes, the assets are unlocked according to the cross-chain transaction status, so as to transfer the assets to the corresponding trading party according to the cross-chain transaction information; the process of verifying the received block header information includes: verifying whether the format of the block header information is correct, whether the block headers are connected in sequence by hash values, whether the SPV proof of the transaction is valid, and whether the block header information is submitted completely; the process of verifying whether the block header information is submitted completely includes: obtaining the block header information h in the witness chain when the assets are locked, the latest block header information hnow recorded in the transaction contract of the current transaction chain, and the block header information hnew after the cross-chain transaction status changes and after a stable time interval; if h = hnow, the submitted block header information is the block header information between h and hnew; if h < hnow ≤ hnew, the submitted block header information is the block header information between hnow and hnew, and the SPV proof of the transaction that causes the cross-chain status to change is submitted; wherein, the cross-chain transaction includes an exchangeable stage and a refundable stage; after m blocks are experienced in the exchangeable stage, the cross-chain interaction enters the refundable stage; the size of m is determined by negotiation among the traders and is recorded in the witness contract of the witness chain.
7. An atomic cross-chain transaction interaction system, characterized in that, Applied to the transaction initiator of the transaction chain, including: The locking module is configured to lock the cross-chain transaction information in the transaction contract, send the cross-chain transaction information to the witness chain to obtain a transaction identifier, so that the witness chain receives and verifies the exchangeable proposal or the refundable proposal uploaded by the transaction recipient, and when the proposal is valid, change the cross-chain transaction status in the transaction identifier to an exchangeable status or a refundable status, and record the block header information of the witness chain and the stable time interval at the time of locking. The unlocking module is configured to obtain and verify block header information, where the block header information is the block header information between when the cross-chain transaction information is locked and when the cross-chain transaction status changes. After successful verification, asset unlocking is performed according to the cross-chain transaction status, and assets are transferred to the corresponding trading party according to the cross-chain transaction information. The process of verifying the received block header information includes: verifying whether the format of the block header information is correct, whether the block headers are connected in sequence through hash values, whether the SPV proof of the transaction is valid, and whether the block header information is submitted completely. The process of verifying whether the block header information is submitted completely includes: obtaining the block header information h in the witness chain when the assets are locked, the latest block header information hnow recorded in the transaction contract of the current transaction chain, and the block header information hnew after the cross-chain transaction status changes and after a stable time interval. If h = hnow, the submitted block header information is the block header information between h and hnew. If h < hnow ≤ hnew, the submitted block header information is the block header information between hnow and hnew, and the SPV proof of the transaction that causes the cross-chain status to change is submitted. Among them, the cross-chain transaction includes an exchangeable stage and a refundable stage. After m blocks are experienced in the exchangeable stage, the cross-chain interaction enters the refundable stage. The size of m is determined by negotiation between the traders and recorded in the witness contract of the witness chain.
8. An atomic cross-chain transaction interaction system, characterized in that, Applied to the transaction recipient of the transaction chain, including: The locking verification module is configured to send an exchangeable proposal or a refundable proposal to the witness chain after locking and verifying the cross-chain transaction information, so that the witness chain can judge the validity of the exchangeable proposal or the refundable proposal. When the proposal is valid, the cross-chain transaction status in the transaction identifier is changed to the exchangeable state or the refundable state. Among them, the cross-chain transaction information is locked in the transaction contract by the transaction initiator. The transaction identifier is generated after the witness chain receives the locked cross-chain transaction information sent by the transaction initiator. An unlocking module, configured to receive and verify the block header information sent by a transaction initiator, where the block header information is the block header information between when the cross-chain transaction information is locked and when the cross-chain transaction status changes; after the block header information is verified to be passed, asset unlocking is performed according to the cross-chain transaction status, so as to transfer the assets to the corresponding trading party according to the cross-chain transaction information; the process of verifying the received block header information includes: verifying whether the format of the block header information is correct, whether the block headers are connected before and after by hash values, whether the SPV proof of the transaction is valid, and whether the block header information is submitted completely; the process of verifying whether the block header information is submitted completely includes: obtaining the block header information h in the witness chain when the assets are locked, the latest block header information hnow recorded in the transaction contract of the current transaction chain, and the block header information hnew after the cross-chain transaction status changes and after a stable time interval; if h = hnow, the submitted block header information is the block header information between h and hnew; if h < hnow ≤ hnew, the submitted block header information is the block header information between hnow and hnew, and the SPV proof of the transaction that causes the cross-chain status to change is submitted. Among them, the cross-chain transaction includes an exchangeable stage and a refundable stage; after m blocks are experienced in the exchangeable stage, the cross-chain interaction enters the refundable stage; the size of m is determined by negotiation among the traders and is recorded in the witness contract of the witness chain.
9. An electronic device, characterized in that, It includes a memory, a processor, and computer instructions stored on the memory and running on the processor. When the computer instructions are run by the processor, the method described in any one of claims 1-3, or the method described in claim 4, or the method described in claim 5 is completed.
10. A computer-readable storage medium, characterized in that For storing computer instructions, when the computer instructions are executed by the processor, the method described in any one of claims 1-3, or the method described in claim 4, or the method described in claim 5 is completed.