Cross-platform asset migration method based on double hash time locks
By deploying dual hash time lock smart contracts on the blockchain platform, the problem of timeout vulnerability in the existing technology mid-to-cross-platform asset migration has been solved, and higher security, reliability and efficiency have been achieved.
Patent Information
- Application Number
- CN202411541660.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-31
- Publication Date
- 2025-02-21
AI Technical Summary
There is a timeout vulnerability in the existing cross-platform asset migration method based on hash time locks, causing users to lose their locked assets due to timeouts when migrating assets.
Using the design of double hash time lock, the dual hash time lock smart contract is deployed on the original blockchain platform and the target blockchain platform respectively. By adding an additional time lock mechanism, it ensures that user assets will not be affected by any problems during the migration process. Timeout problem lost.
It effectively eliminates timeout vulnerabilities, improves the security and reliability of cross-platform asset transfers, reduces dependence on third-party trust, reduces storage and synchronization costs, and improves the efficiency of asset migration.
Smart Images

Figure CN119494733A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to blockchain technology and its application in cross-platform asset transfer, specifically to a cross-platform asset migration method based on double hash time lock, which mainly solves the potential timeout problem in the process of secure transfer of digital assets between different blockchain platforms. Background Art
[0002] With the development of blockchain technology, cross-blockchain asset transfer has gradually become an important means to solve the interoperability problem between different blockchain platforms. Cross-chain asset transfer refers to the process of transferring digital assets from one blockchain network to another. Existing cross-chain asset transfer methods include notary-based asset migration, sidechain or relay chain-based asset migration, and hash time lock-based asset migration methods.
[0003] The notary-based cross-platform asset migration method elects one or more notaries, monitors asset destruction events on the original blockchain platform, and creates assets of equal value for users on the new blockchain platform. However, this method relies on the honesty of the notary, has a high centralization risk, has potential problems of single point failure or notary dishonesty, and may even be attacked by notary collusion, threatening the security of assets.
[0004] The cross-chain asset migration method based on sidechain or relay chain creates an asset destruction transaction on the original blockchain platform and uses the Merkle tree existence proof to create assets of equal value on the new blockchain platform. This type of method does not rely on a notary, but requires storing and synchronizing the block header data of the original blockchain on the new blockchain platform, resulting in large storage and synchronization costs. In addition, since this method cannot obtain the full picture of the original blockchain, it is difficult to achieve comprehensive transaction verification during the verification process.
[0005] The cross-platform asset migration method based on hash time lock runs the hash time lock smart contract on the original blockchain platform and the new blockchain platform at the same time, and users can complete asset migration by calling the contract. This method does not rely on any trusted third party and does not need to store or synchronize the block header data of the original blockchain. It is relatively more decentralized and has lower costs. However, there are security and efficiency issues in the cross-platform asset transfer process, especially the timeout vulnerability of the existing cross-platform asset migration method based on hash time lock (HTLC). The existing methods often cause users to lose their locked assets due to timeout when migrating assets due to incompatibility between heterogeneous blockchain platforms and unreasonable smart contract time settings.
[0006] In view of the shortcomings of the above-mentioned prior art, the present invention proposes a cross-platform asset migration method based on double hash time lock. The method eliminates the timeout vulnerability in the existing cross-chain asset migration method based on hash time lock by deploying double hash time lock smart contracts on the original blockchain platform and the target blockchain platform respectively, ensuring that users can migrate assets between different blockchain platforms safely and efficiently without relying on any third party. Summary of the invention
[0007] Purpose of the invention: In view of the problems in the background technology, the present invention provides a cross-platform asset migration method based on double hash time lock, which ensures that user assets will not be lost due to any timeout problems during the migration process by adding an additional time lock mechanism, thereby improving the security and reliability of cross-platform asset transfer.
[0008] Technical solution: The present invention provides a cross-platform asset migration method based on double hash time lock, comprising the following steps:
[0009] S1. The asset rebuilder deploys the LockForSource double hash time lock smart contract on the original blockchain platform to manage the user's asset locking and destruction process;
[0010] S2. The asset rebuilder deploys the LockForTarget double-hash time lock smart contract on the new blockchain platform to receive and manage the user's migrated assets;
[0011] S3. The asset reconstructor generates the first original image Preimage1, calculates its hash value H(Preimage1), and then sends H(Preimage1) to the user;
[0012] S4. The user generates a second preimage Preimage2, calculates its hash value H(Preimage2), and then sends H(Preimage2) to the asset reconstructor;
[0013] S5. The user uses the public key pk of the asset reconstructor T Generate the destruction address burnAddr = GenBurnAddr (k, pk T );
[0014] S6. The asset reconstructor calls the LockForTarget double hash time lock smart contract to create the first double hash time lock DHL 1 , where the calling parameters include hashLock1=H(Preimage1), hashLock2=H(Preimage2), and the receiver address is addr T , and there is no time limit;
[0015] S7.User confirms DHL 1 After being locked, call the LockForSource double hash time lock smart contract to create a second double hash time lock DHL 2 , where the calling parameters include hashLock1=H(Preimage1), hashLock2=H(Preimage2), the receiver address is burnAddr, and the validity period is t1;
[0016] S8.Asset Reconstructor in DHL 2 If the timeout does not expire, the LockForSource double hash time lock smart contract is called to destroy the user's assets on the original blockchain platform, and Preimage1 is exposed to the user to prove the validity of the destruction;
[0017] S9. After obtaining Preimage1, the user calls the LockForTarget double hash time lock smart contract to obtain new assets from the new blockchain platform.
[0018] Furthermore, the LockForSource double hash time lock smart contract and the LockForTarget double hash time lock smart contract are both composed of a double hash time lock and three functions: CreateLock, Withdraw and Refund.
[0019] Furthermore, the LockForSource double hash time lock smart contract and the LockForTarget double hash time lock smart contract have the same structure, and the structure of the double hash time lock is specifically as follows:
[0020] The address sender of the asset migration initiator. On the original blockchain platform, the asset migration initiator is the user of the blockchain application. On the new blockchain platform, the asset migration initiator is the asset rebuilder.
[0021] The address of the asset receiver. On the original blockchain platform, the address of the asset receiver is the destruction address. On the new blockchain platform, the address of the asset receiver is the new address of the user on the new blockchain platform.
[0022] The number of assets v that the asset rebuilder wants to migrate;
[0023] Hash time lock 1hashLock1 is the hash value H(Preimage1) of the preimage Preimage1 generated by the asset reconstructor, which is also the first double hash time lock DHL 1 Identification;
[0024] Hash time lock 2hashLock2 is the hash value H(Preimage2) of the preimage Preimage2 generated by the user, which is also the second double hash time lock DHL 2 Identification;
[0025] Hash lock expiration, in the LockForSource double hash time lock smart contract, the first double hash time lock DHL 1 It will time out after the hash lock validity period; in the LockForTarget double hash time lock smart contract, the hash lock validity period expiration is empty, and the second double hash time lock DHL 2 There is no timeout situation;
[0026] The flag unlocked indicates whether the hash lock has been unlocked.
[0027] Furthermore, the CreateLock function is specifically:
[0028] The CreateLock function is used to create a double hash time lock. On the original blockchain platform, users use the CreateLock function to lock assets at the validityTime time of the LockForSource double hash time lock smart contract, that is, to migrate user assets to the address of the LockForSource double hash time lock smart contract for temporary safekeeping. Once the user's assets are locked, the user will lose control of the assets within the validityTime time; on the new blockchain platform, the asset rebuilder uses the CreateLock function to lock the created assets indefinitely in the LockForTarget double hash time lock smart contract, that is, to migrate the created assets to the address of the LockForTarget double hash time lock smart contract for safekeeping.
[0029] Furthermore, the Withdraw function is used to withdraw assets locked in a double hash time lock. On the original blockchain platform, as long as the first double hash time lock DHL 1 Before the timeout, the asset reconstructor uses the preimage Preimage1 to destroy the user assets locked in the double hash time lock, that is, to migrate the assets locked in the contract to burnAddr; in the new blockchain platform, the second double hash time lock DHL 2 There is no timeout set. Users can use the Preimage1 exposed by the asset rebuilder as proof of asset destruction at any time to extract the assets locked in the double hash time lock, that is, to migrate the assets locked in the contract to the user's address addr on the new blockchain platform. T .
[0030] Furthermore, the Refund function is used to return the locked assets of the user. On the original blockchain platform, in the first double hash time lock DHL 1 After the timeout, the user uses the preimage Preimage2 to retrieve the user assets locked in the double hash time lock, that is, to migrate the locked assets to the user's address addr on the original blockchain platform. S ; Second double hash time lock DHL on new blockchain platform 2 There is no timeout set, and the asset rebuilder can use the user-exposed Preimage2 to retrieve the assets locked in the double hash time lock at any time, that is, migrate the locked assets to the asset rebuilder's address on the new blockchain platform.
[0031] Furthermore, in S5, the user uses the public key of the asset rebuilder on the new blockchain platform to generate a destruction address. The specific process includes:
[0032] The user calls GenBurnAddr(k,pk T ) Generate an unspendable destruction address burnAddr; the specific process of GenBurnAddr includes:
[0033] S5.1: The public key pk of the asset reconstructor T Perform hash operation and get h = H (pk T );
[0034] S5.2: Then perform a bitwise XOR operation on h and the constant 1, and finally generate a hash value with a bit length of k bits.
[0035] S5.3: Get the final destruction address
[0036] Furthermore, the specific process of S6 is as follows:
[0037] S6.1: The asset reconstructor calls the CreateLock function of the LockForTarget double hash time lock smart contract on the new blockchain platform to create the first double hash time lock DHL 1 ;
[0038] The calling parameters are hashLock1=H(Preimage1), hashLock2=H(Preimage2), receiver=addr T ,validityTime=null, where H() is the hash function and the recipient address is the user’s new blockchain address addr T , DHL 1 No time limit;
[0039] S6.2: The CreateLock function of the LockForTarget double hash time lock smart contract is called successfully, and the assets created by the asset rebuilder will be locked in DHL 1 In this case, the asset rebuilder will migrate the created assets to the address of the LockForTarge double hash time lock smart contract.
[0040] Furthermore, the specific process of S7 is as follows:
[0041] S7.1: The User ensures that the Asset Reconstructor locks the created Asset in DHL 1 ;
[0042] S7.2: The user calls the CreateLock function of the LockForSource double hash time lock smart contract on the original blockchain platform to create a second double hash time lock DHL 2 ;
[0043] The calling parameters are hashLock1=H(Preimage1), hashLock2=H(Preimage2), receiver=burnAddr, validityTime=t1; that is, the receiver address is set to the destruction address burnAddr, and the validity period of the asset lock is t1;
[0044] S7.3: The CreateLock function of the LockForSource double hash time lock smart contract is called successfully, and the user's assets will be locked in DHL 2 That is, the user transfers his assets to the address of LockForSource.
[0045] Furthermore, the specific process of step S9 is as follows:
[0046] S9.1: After obtaining the first original image Preimage1, the user calls the Withdraw function of the LockForTarget double hash time lock smart contract;
[0047] S9.2: Withdraw function calls parameter Preimage = Preimage1, which will lock in DHL 1 The assets in the migration user's address addr on the new blockchain platform T ;
[0048] S9.3 The asset rebuilder successfully calls the Withdraw function of the LockForSource double hash time lock smart contract, and the user's assets will be recreated on the new blockchain platform.
[0049] Furthermore, when the asset reconstructor calls the Withdraw of the LockForSource double-hash time lock smart contract, DHL 2 When the time has expired, the user’s assets on the original blockchain platform cannot be destroyed. 2 After the timeout, the user calls the LockForSource double hash time lock smart contract to retrieve the lock in DHL 2 The asset in the DHL, calling parameters hashLock = H (Preimage1), preimage = Preimage2, the user calls the LockForSource double hash time lock smart contract Refund successfully, then the called transaction will be recorded on the blockchain, the user will expose Preimage2, the asset rebuilder can only call the LockForTarget double hash time lock smart contract Refund to retrieve the asset locked in DHL 1 assets in.
[0050] Beneficial Effects
[0051] The present invention uses a dual hash time lock design to deploy two independent time locks on each platform to ensure that the user's assets will not be lost due to the time lock timeout of either party. Users can flexibly use the second hash lock to retrieve assets during the asset migration process, greatly improving the security of asset migration.
[0052] The present invention does not rely on notaries or other third-party organizations. Users can directly complete cross-chain migration of assets through a double-hash time lock mechanism, thus achieving truly decentralized operations. Compared with methods based on notaries or side chains, the present invention reduces reliance on third-party trust and avoids the risk of single point failure or collusion attacks by notaries due to centralization. At the same time, since there is no need to synchronize the block header data of the original blockchain platform, the storage and synchronization costs are greatly reduced, and the efficiency of asset migration is improved.
[0053] In this invention, users have full control over their assets on both the original blockchain platform and the new blockchain platform. Through the double hash time lock mechanism, users can control the migration progress of their assets at any time without relying on intermediaries or third-party operations. In addition, if any problems occur, users can still use the Refund operation in the double hash lock mechanism to retrieve their assets in time, which increases the security and flexibility of the migration process.
[0054] The present invention provides a clear asset migration process between dual-chain platforms. Users only need to complete contract deployment, locking and unlocking operations to successfully complete cross-platform asset migration. Compared with the traditional hash time lock solution, the operation is simpler and the user experience is smoother.
[0055] The present invention effectively solves the timeout vulnerability problem in the prior art through a double hash time lock mechanism, enhances the security, decentralization and efficiency of cross-platform asset migration, and has significant practical value. BRIEF DESCRIPTION OF THE DRAWINGS
[0056] Figure 1 An asset migration flow chart for users of the present invention using a user asset migration method based on a double hash time lock;
[0057] Figure 2 This is a pseudo code diagram of the LockForTarget double hash time lock smart contract of the present invention;
[0058] Figure 3 This is a pseudo code diagram of the LockForSource double hash time lock smart contract of the present invention. DETAILED DESCRIPTION
[0059] In order to achieve the technical goal of the cross-platform asset transfer process based on double hash time lock of the present invention, the method structure designed by the present invention consists of the following four core parts:
[0060] The present invention discloses a cross-platform asset migration method based on double hash time lock. Some of the names used are explained as follows:
[0061] 1. User: The user is the entity that initiates the cross-chain migration of assets, locks their assets on the original blockchain platform, and ensures that their assets are successfully rebuilt on the new blockchain platform through a double hash time lock mechanism. The user generates the second preimage Preimage2, and extracts new assets from the new blockchain platform after the asset reconstructor exposes Preimage1.
[0062] 2. Original blockchain platform: The original blockchain platform is the initial custody platform for user assets. On this platform, the user's assets are temporarily locked by calling the CreateLock function of the LockForSource double hash time lock smart contract, and the validity period is set to t1. The platform is responsible for handling the destruction of assets and completes the irreversible destruction of assets by exposing Preimage1.
[0063] 3. New blockchain platform (target blockchain platform): The new blockchain platform is the target platform for users to migrate assets. On this platform, the asset rebuilder is responsible for generating assets of equal value for users and locking the newly created assets through the CreateLock function of the LockForTarget double hash time lock smart contract. After the user obtains Preimage1, he can withdraw the newly created assets from the new blockchain platform by calling the Withdraw function.
[0064] 4. Asset Reconstructor (Blockchain Application Developer): The asset reconstructor is responsible for creating new assets for users on the new blockchain platform. The asset reconstructor generates the first preimage Preimage1 and sends its hash value H(Preimage1) to the user. The asset reconstructor is also responsible for destroying user assets on the original blockchain platform to complete the destruction proof of cross-chain asset transfer.
[0065] The present invention will be further described below in conjunction with the accompanying drawings. The following embodiments are only used to more clearly illustrate the technical solutions of the present invention and are not intended to limit the protection scope of the present invention.
[0066] The present invention provides a cross-platform asset transfer method based on double hash time lock. Figure 1 As shown, the following steps are included:
[0067] S1: The asset reconstructor deploys the LockForSource double hash time lock smart contract on the original blockchain platform (such as Figure 3 The main function of this contract is to manage the locking and destruction of user assets.
[0068] The LockForSource double hash time lock smart contract consists of the following three functions:
[0069] CreateLock: Create the first double hash time lock DHL 1 , lock user assets to the destruction address.
[0070] Withdraw: used for asset destruction. The caller unlocks and destroys the asset by providing the first preimage Preimage1.
[0071] Refund: If the hash lock times out, users can retrieve their assets through Preimage2.
[0072] S2: The asset reconstructor deploys the LockForTarget double-hash time lock smart contract on the new blockchain platform (such as Figure 2 ), used to receive and lock assets on the new blockchain platform after migration.
[0073] The LockForTarget double hash time lock smart contract also consists of the following three functions:
[0074] CreateLock: Create a second double hash time lock DHL 2 , locking assets on the new blockchain platform.
[0075] Withdraw: It is used by users to withdraw assets locked on the new blockchain platform. The caller unlocks the assets by providing Preimage1.
[0076] Refund: If the user fails to unlock within the specified time, the asset rebuilder can get the asset back through Preimage2.
[0077] S3: The asset reconstructor generates the first preimage Preimage1 and calculates its hash value H(Preimage1), which is used to create DHL 1 and DHL 2 The asset reconstructor sends H(Preimage1) to the user for subsequent operations.
[0078] S4: The user generates a second preimage Preimage2 and calculates its hash value H(Preimage2), and sends H(Preimage2) to the asset reconstructor.
[0079] The double hash lock mechanism uses these two hash values (H(Preimage1) and H(Preimage2)) to ensure that the asset can only be unlocked when the correct preimage is provided.
[0080] S5: The user passes the public key pk of the asset reconstructor T Generate the destruction address burnAddr, the algorithm is as follows:
[0081] GenBurnAddr(k,pk T ) is based on the public key pk of the asset reconstructor T and security parameter k. The function processes the input data through the hash function H to ensure that the generated destruction address meets the unspendability property. The specific process of GenBurnAddr includes:
[0082] S5.1: The public key pk of the asset reconstructor T Perform hash operation and get h = H (pk T ).
[0083] S5.2: Then, a bitwise XOR operation is performed on h and the constant 1, and the resulting hash value has a bit length of k bits and is a binary string.
[0084] S5.3: Get the final destruction address
[0085] In S5, the user uses the public key of the asset rebuilder on the new blockchain platform to generate the destruction address, which is unspendable through BurnAddrVerify(1 κ ,t,burnAddr) verification, ensuring that it is almost impossible for any entity to derive the private key corresponding to the destruction address.
[0086] The specific logic of BurnAddrVerify is: given a tag string t∈{0,1} * , security parameter k, the result of the bitwise XOR operation of the hash function H(t) and 1 should be equal to the generated burnAddr, that is If the verification is successful, it indicates that the address is an unspendable address; otherwise, it returns false. The destruction address is used to lock assets in the LockForSource double hash time lock smart contract, so that the asset locking process on the original blockchain platform cannot be reversed or extracted, ensuring that the destruction of assets is irreversible.
[0087] The spending attack of the destruction address in S5 is protected by:
[0088] If the attacker can successfully launch a spending attack, even if SPEND- True, it must generate t,m,σ,pk in polynomial time so that BurnAddrVerify(1 k ,t,GenAddr(1 k ,pk)) is true and SigVerify(m,σ,pk) is true. That is, the attacker can generate a pair of public and private keys (sk,pk) and a tag string t∈{0,1} in polynomial time. * Make GenAddr(1 κ ,pk)==GenBurnAddr(1 κ ,t).
[0089] The spending attack of the destruction address in S5 ensures the security of the destruction address through the following mechanism:
[0090] The SPEND-ATTACK model describes the potential steps an attacker might take to try to crack the burn address and spend the assets:
[0091] enter:
[0092] k: security factor, indicating the bit length of the generated hash value.
[0093] m: transaction or message.
[0094] σ: Signature, the signature of m using the public key pk.
[0095] pk: Public key, the attacker attempts to generate a public key that matches the destruction address.
[0096] t: Tag string used to generate the destruction address.
[0097] Output:
[0098] Returns true or false, indicating whether the attack was successful.
[0099] Specific steps:
[0100] burnAddr=GenBurnAddr(k,pk T ): First, the attacker tries to generate a public key pk that matches the burn address, and calls the burn address generation algorithm GenBurnAddr to generate the target burn address burnAddr.
[0101] BurnAddrVerify(k, t, burnAddr): The attacker provides a tag string t and calls BurnAddrVerify to verify whether the burn address is valid. If BurnAddrVerify returns true, it means the verification is successful and the next step is continued; if it returns false, it means the attack has failed.
[0102] SigVerify(m,σ,pk): The attacker attempts to verify the signature and calls the signature verification algorithm SigVerify(m,σ,pk) to ensure that the signature σ matches the message m and the public key pk. If the verification passes, true is returned, indicating that the attack is successful; otherwise, false is returned, indicating that the attack failed.
[0103] Reasons why the attack failed:
[0104] The attacker must generate a valid public-private key pair (pk, sk) and a tag string t in polynomial time so that burnAddr = GenBurnAddr(k, pk) and pass verification by BurnAddrVerify and SigVerify.
[0105] Due to the one-way nature of the hash function and the irreversibility of the XOR operation, it is almost impossible for an attacker to find a valid private key sk or a matching pk within polynomial time, making the attack unsuccessful.
[0106] S6: The asset reconstructor calls the CreateLock function of the LockForTarget double hash time lock smart contract to create the first double hash lock DHL 1 .DHL 1 Use hashLock1=H(Preimage1) and hashLock2=H(Preimage2) to lock assets without timeout limit.
[0107] S6.1: The asset reconstructor calls the CreateLock function of the LockForTarget double hash time lock smart contract on the new blockchain platform to create the first double hash time lock DHL 1;
[0108] The calling parameters are hashLock1=H(Preimage1), hashLock2=H(Preimage2), receiver=addr T ,validityTime=null, where H() is the hash function and the recipient address is the user’s new blockchain address addr T , DHL 1 There is no timeout limit.
[0109] S6.2: The CreateLock function of the LockForTarget double hash time lock smart contract is called successfully, and the assets created by the asset rebuilder will be locked in DHL 1 In this case, the asset rebuilder will migrate the created assets to the address of the LockForTarge double hash time lock smart contract.
[0110] S7: User confirms DHL 1 After being locked, call CreateLock of LockForSource double hash time lock smart contract to create a second double hash lock DHL 2 .DHL 2 Use hashLock1=H(Preimage1) and hashLock2=H(Preimage2) to lock assets, the recipient address is burnAddr, and there is a time limit t1.
[0111] S7.1: The User ensures that the Asset Reconstructor locks the created Asset in DHL 1 .
[0112] S7.2: The user calls the CreateLock function of the LockForSource double hash time lock smart contract on the original blockchain platform to create a second double hash time lock DHL 2 .
[0113] The calling parameters are hashLock1=H(Preimage1), hashLock2=H(Preimage2), receiver=burnAddr, validityTime=t1; that is, the receiver address is set to the destruction address burnAddr, and the validity period of the asset lock is t1.
[0114] S7.3: The CreateLock function of the LockForSource double hash time lock smart contract is called successfully, and the user's assets will be locked in DHL 2That is, the user transfers his assets to the address of LockForSource.
[0115] S8: Asset Reconstructor Destroys User Assets and Exposes Preimage1
[0116] Asset Reconstructor at DHL 2 Before the timeout, the Withdraw of the LockForSource double hash time lock smart contract is called to destroy the user's assets by exposing Preimage1. The assets are destroyed through burnAddr and cannot be recovered. After the destruction operation is completed, Preimage1 is made public, allowing users to withdraw their new assets on the new blockchain platform.
[0117] S9: The user calls Withdraw of the LockForTarget double-hash time lock smart contract through the exposed Preimage1 to unlock and withdraw the newly created assets.
[0118] S9.1: After obtaining the first original image Preimage1, the user calls the Withdraw function of the LockForTarget double hash time lock smart contract.
[0119] S9.2: Withdraw function calls parameter Preimage = Preimage1, which will lock in DHL 1 The assets in the migration user's address addr on the new blockchain platform T .
[0120] S9.3 The asset rebuilder successfully calls the Withdraw function of the LockForSource double hash time lock smart contract, and the user's assets will be recreated on the new blockchain platform.
[0121] At this point, user assets are rebuilt on the new blockchain platform and are no longer subject to the original blockchain platform.
[0122] The user asset migration method based on double hash time lock can eliminate the timeout vulnerability problem existing in the existing asset migration research based on hash time lock. When the asset reconstructor calls the Withdraw of LockForSource double hash time lock smart contract, DHL 2 When the time has expired, the smart contract will not be able to destroy the user's assets on the original blockchain platform. 2 After the timeout, the user can call the LockForSource double hash time lock smart contract to retrieve the funds locked in DHL. 2The call parameters are hashLock=H(Preimage1), preimage=Preimage2. Once the user successfully calls the LockForSource double hash time lock smart contract Refund, the call transaction will be recorded on the blockchain, which means that the user will expose Preimage2. Only when the asset rebuilder holds Preimage2 can he call the LockForTarget double hash time lock smart contract Refund to retrieve the assets locked in DHL. 1 In addition, DHL 1 There is no timeout set. As long as the asset rebuilder calls the Withdraw of the LockForSource double hash time lock smart contract to destroy the user's assets on the original blockchain platform, the user can use the Preimage1 exposed when the asset rebuilder destroys the assets to call the Withdraw of the LockForTarget double hash time lock smart contract at any time to obtain assets of equal value on the new blockchain platform. 1 Timeout and inability to acquire assets of equal value to the destroyed assets.
[0123] At this point, the specific implementation steps of the present invention are all completed.
[0124] The above embodiments are only for illustrating the technical concept and features of the present invention, and their purpose is to enable people familiar with the technology to understand the content of the present invention and implement it accordingly, and they cannot be used to limit the protection scope of the present invention. Any equivalent transformation or modification made according to the spirit of the present invention should be included in the protection scope of the present invention.
Claims
1. A cross-platform asset migration method based on double hash time lock, characterized in that: The following steps are involved: S1. The asset rebuilder deploys the LockForSource double hash time lock smart contract on the original blockchain platform to manage the user's asset locking and destruction process; S2. The asset rebuilder deploys the LockForTarget double-hash time lock smart contract on the new blockchain platform to receive and manage the user's migrated assets; S3. The asset reconstructor generates the first original image Preimage1, calculates its hash value H(Preimage1), and then sends H(Preimage1) to the user; S4. The user generates a second preimage Preimage2, calculates its hash value H(Preimage2), and then sends H(Preimage2) to the asset reconstructor; S5. The user uses the public key pk of the asset reconstructor T Generate the destruction address burnAddr = GenBurnAddr (k, pk T ), k is the safety factor; S6. The asset rebuilder calls the LockForTarget double hash time lock smart contract to create the first double hash time lock DHL1, where the calling parameters include hashLock1=H(Preimage1), hashLock2=H(Preimage2), and the recipient address is addr T , and there is no time limit; S7. After confirming that DHL1 has been locked, the user calls the LockForSource double hash time lock smart contract to create a second double hash time lock DHL2, where the calling parameters include hashLock1=H(Preimage1), hashLock2=H(Preimage2), the recipient address is burnAddr, and the validity period is t1; S8. The asset rebuilder calls the LockForSource double hash time lock smart contract to destroy the user's assets on the original blockchain platform when DHL2 has not timed out, and exposes Preimage1 to the user to prove the validity of the destruction; S9. After obtaining Preimage1, the user calls the LockForTarget double hash time lock smart contract to obtain new assets from the new blockchain platform.
2. The cross-platform asset migration method based on double hash time lock according to claim 1 is characterized in that: The LockForSource double hash time lock smart contract and the LockForTarget double hash time lock smart contract are both composed of a double hash time lock and three functions: CreateLock, Withdraw and Refund.
3. The cross-platform asset migration method based on double hash time lock according to claim 2 is characterized in that: The LockForSource double hash time lock smart contract and the LockForTarget double hash time lock smart contract have the same structure, and the structure of the double hash time lock is as follows: The address sender of the asset migration initiator. On the original blockchain platform, the asset migration initiator is the user of the blockchain application. On the new blockchain platform, the asset migration initiator is the asset rebuilder. The address of the asset receiver. On the original blockchain platform, the address of the asset receiver is the destruction address. On the new blockchain platform, the address of the asset receiver is the new address of the user on the new blockchain platform. The number of assets v that the asset rebuilder wants to migrate; Hash time lock 1hashLock1 is the hash value H(Preimage1) of the preimage Preimage1 generated by the asset reconstructor, and is also the identifier of the first double hash time lock DHL1; Hash time lock 2hashLock2 is the hash value H(Preimage2) of the preimage Preimage2 generated by the user, and is also the identifier of the second double hash time lock DHL2; Hash lock expiration. In the LockForSource double hash time lock smart contract, the first double hash time lock DHL1 will time out after the hash lock expiration time. In the LockForTarget double hash time lock smart contract, the hash lock expiration is empty, and the second double hash time lock DHL2 does not time out; The flag unlocked indicates whether the hash lock has been unlocked.
4. The cross-platform asset migration method based on double hash time lock according to claim 3 is characterized in that: The CreateLock function is as follows: The CreateLock function is used to create a double hash time lock. On the original blockchain platform, users use the CreateLock function to lock assets at the validityTime time of the LockForSource double hash time lock smart contract, that is, to migrate user assets to the address of the LockForSource double hash time lock smart contract for temporary safekeeping. Once the user's assets are locked, the user will lose control of the assets within the validityTime time; on the new blockchain platform, the asset rebuilder uses the CreateLock function to lock the created assets indefinitely in the LockForTarget double hash time lock smart contract, that is, to migrate the created assets to the address of the LockForTarget double hash time lock smart contract for safekeeping.
5. The cross-platform asset migration method based on double hash time lock according to claim 3 is characterized in that: The Withdraw function is used to extract assets locked in the double hash time lock. On the original blockchain platform, as long as the first double hash time lock DHL1 has not timed out, the asset rebuilder uses the preimage Preimage1 to destroy the user assets locked in the double hash time lock, that is, to migrate the assets locked in the contract to burnAddr; in the new blockchain platform, the second double hash time lock DHL2 has no timeout set. The user can use the Preimage1 exposed by the asset rebuilder as proof of asset destruction at any time to extract the assets locked in the double hash time lock, that is, to migrate the assets locked in the contract to the user's address addr on the new blockchain platform. T .
6. The cross-platform asset migration method based on double hash time lock according to claim 3 is characterized in that: The Refund function is used to return the locked assets of the user. On the original blockchain platform, after the first double hash time lock DHL1 times out, the user uses the preimage Preimage2 to retrieve the user assets locked in the double hash time lock, that is, to migrate the locked assets to the user's address addr on the original blockchain platform. S ; On the new blockchain platform, the second double hash time lock DHL2 does not have a timeout period. The asset rebuilder can use the user-exposed Preimage2 to retrieve the assets locked in the double hash time lock at any time, that is, to migrate the locked assets to the asset rebuilder's address on the new blockchain platform.
7. The cross-platform asset migration method based on double hash time lock according to claim 1 is characterized in that: In S5, the user uses the public key of the asset rebuilder on the new blockchain platform to generate a destruction address. The specific process includes: The user calls GenBurnAddr(k,pk T ) Generate an unspendable destruction address burnAddr; GenBurnAddr(k,pk T ) is based on the public key pk of the asset reconstructor T and security parameter k. The function processes the input data through the hash function H to ensure that the generated destruction address meets the unspendability property. The specific process of GenBurnAddr includes: S5.1: The public key pk of the asset reconstructor T Perform hash operation and get h = H (pk T ); S5.2: Then perform a bitwise XOR operation on h and the constant 1, and finally generate a hash value with a bit length of k bits. S5.3: Get the final destruction address 8. The cross-platform asset migration method based on double hash time lock according to claim 4 is characterized in that: The specific process of S6 is as follows: S6.1: The asset rebuilder calls the CreateLock function of the LockForTarget double hash time lock smart contract on the new blockchain platform to create the first double hash time lock DHL1; The calling parameters are hashLock1=H(Preimage1), hashLock2=H(Preimage2), receiver=addr T ,validityTime=null, where H() is the hash function and the recipient address is the user’s new blockchain address addr T , DHL1 has no timeout limit; S6.2: The CreateLock function of the LockForTarget double hash time lock smart contract is called successfully, and the assets created by the asset rebuilder will be locked in DHL1, that is, the asset rebuilder will migrate the created assets to the address of the LockForTarge double hash time lock smart contract.
9. The cross-platform asset migration method based on double hash time lock according to claim 8 is characterized in that: The specific process of S7 is as follows: S7.1: The user ensures that the asset reconstructor locks the created asset in DHL1; S7.2: The user calls the CreateLock function of the LockForSource double hash time lock smart contract on the original blockchain platform to create the second double hash time lock DHL2; The calling parameters are hashLock1=H(Preimage1), hashLock2=H(Preimage2), receiver=burnAddr, validityTime=t1; that is, the receiver address is set to the destruction address burnAddr, and the validity period of the asset lock is t1; S7.3: The CreateLock function of the LockForSource double hash time lock smart contract is called successfully, and the user's assets will be locked in DHL2, that is, the user will transfer his assets to the address of LockForSource.
10. The cross-platform asset migration method based on double hash time lock according to claim 2 is characterized in that: When the asset rebuilder calls Withdraw of the LockForSource double hash time lock smart contract and DHL2 has timed out, the user's assets on the original blockchain platform cannot be destroyed. After DHL2 times out, the user calls Refund of the LockForSource double hash time lock smart contract to retrieve the assets locked in DHL2. The calling parameters are hashLock=H(Preimage1), preimage=Preimage2. If the user successfully calls Refund of the LockForSource double hash time lock smart contract, the called transaction will be recorded on the blockchain, and the user will expose Preimage2. The asset rebuilder can only call Refund of the LockForTarget double hash time lock smart contract to retrieve its assets locked in DHL1 if it holds Preimage2.