Data Processing Method, Apparatus, Computer-Readable Storage Medium, and Electronic Device

By generating zero-knowledge proof in cross-blockchain transactions, verifying the trustworthiness of blockchain, creating hash time lock contracts, and using the relay chain for secondary verification, the problem of low reliability of cross-blockchain transactions is solved, secure asset transfer and identity verification are achieved, and transaction reliability is improved.

CN119579314BActive Publication Date: 2025-07-29TRAVELSKY TECHNOLOGY LIMITED
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202411696590.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-11-25
Publication Date
2025-07-29
Estimated Expiration
2044-11-25

AI Technical Summary

Technical Problem

Cross-blockchain transactions have low reliability, especially when transferring value between different blockchain networks.

Method used

By receiving user information from the first blockchain and the second blockchain, generating zero-knowledge proofs and verifying their credibility, creating a hash time lock contract, and indicating asset transfer on the first blockchain after verification is passed, using the relay chain for secondary verification and unlocking, ensuring the security and reliability of transactions.

Benefits of technology

It improves the reliability of cross-blockchain transactions, avoids double payments, ensures the security and transparency of transactions, and realizes the authentication of the blockchains of both parties and the security locking of assets.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119579314B_ABST
    Figure CN119579314B_ABST
Patent Text Reader

Abstract

The present invention discloses a data processing method, apparatus, computer-readable storage medium, and electronic device. It relates to the field of blockchain. The method includes: receiving user information of a first user sent by a first blockchain and receiving user information of a second user sent by a second blockchain; generating a first zero-knowledge proof and a second zero-knowledge proof based on the user information of the first user and the second user, and verifying the credibility of the first blockchain and the second blockchain based on the first zero-knowledge proof and the second zero-knowledge proof; creating a hash time-lock contract on the first blockchain when the first blockchain and the second blockchain pass the verification; generating a target hash value based on a target value and transaction data on the first blockchain, and receiving a first hash value sent by the second blockchain. When the target hash value is the same as the first hash value, sending target information to the first blockchain. The present invention solves the technical problem of low reliability of cross-blockchain transactions in the related art.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of blockchain, and in particular, to a data processing method, apparatus, computer-readable storage medium, and electronic device. Background Art

[0002] With the continuous development of blockchain technology and the expansion of its application scope, micropayments (i.e., small payments) have become increasingly important in various digital services. Micropayments allow users to conduct transactions with extremely small amounts, which have broad application potential in scenarios such as content payment, communication between Internet of Things devices, decentralized applications (DApps), and in-app purchases in online games. In existing micropayment systems, especially when transferring value between different blockchain networks, assets are directly transferred between different chains, resulting in low reliability.

[0003] For the above problems, no effective solution has been proposed yet. Summary of the Invention

[0004] Embodiments of the present invention provide a data processing method, apparatus, computer-readable storage medium, and electronic device to at least solve the technical problem of low reliability in cross-blockchain transactions in related technologies.

[0005] According to one aspect of embodiments of the present invention, a data processing method is provided, including: receiving user information of a first user sent by a first blockchain, and receiving user information of a second user sent by a second blockchain, where the first user is to pay assets to the second user, the first blockchain is the blockchain where the assets of the first user are located, and the second blockchain is the blockchain where the assets of the second user are located; generating a first zero-knowledge proof based on the user information of the first user, generating a second zero-knowledge proof based on the user information of the second user, and verifying the credibility of the first blockchain based on the first zero-knowledge proof and verifying the credibility of the second blockchain based on the second zero-knowledge proof; creating a hash time-lock contract on the first blockchain in the case where the first blockchain and the second blockchain are verified to pass, where the hash time-lock contract is at least used to lock the assets of the first user; generating a target hash value based on a target value and transaction data on the first blockchain, and receiving a first hash value sent by the second blockchain, and in the case where the target hash value is the same as the first hash value, sending target information to the first blockchain, where the target information is used to instruct the first blockchain to transfer the locked assets in the first blockchain to the second blockchain.

[0006] Further, the data processing method further includes: sending the first zero-knowledge proof and the second zero-knowledge proof to a relay chain, where the relay chain is used to verify the credibility of the first blockchain based on the first zero-knowledge proof and verify the credibility of the second blockchain based on the second zero-knowledge proof; receiving the verification result feedback by the relay chain, and determining whether the first blockchain and the second blockchain pass the verification according to the verification result.

[0007] Further, the data processing method further includes: before receiving the first hash value sent by the second blockchain, generating a random number based on a pseudorandom number generator, and determining the random number as the target value; sending the target value to the second user in an off-chain manner.

[0008] Further, the hash time lock contract includes a first condition, and the first condition indicates unlocking the asset when the hash value sent by the second blockchain is the same as the target hash value. The data processing method further includes: after sending the target information to the first blockchain, when the first blockchain receives the target information, transferring the asset locked in the first blockchain to the relay chain, where a hash time lock contract is created on the relay chain; receiving the second hash value sent by the second blockchain through the relay chain, and when the second hash value is the same as the target hash value, unlocking the asset locked in the relay chain and transferring the unlocked asset to the second blockchain.

[0009] Further, the data processing method further includes: after transferring the unlocked asset to the second blockchain, receiving the transaction status change data sent by the first blockchain to obtain the first data; receiving the transaction status change data sent by the second blockchain to obtain the second data; uploading the first data, the second data, and the transaction data to the relay chain, and publishing the first data, the second data, and the transaction data in the relay chain.

[0010] Further, the hash time lock contract further includes a second condition, and the second condition indicates unlocking the asset when the locked asset is not transferred to the second blockchain within a preset time range and the hash value generated by the first blockchain is the same as the target hash value. Wherein, the data processing method further includes: after sending the target information to the first blockchain, when the relay chain does not transfer the locked asset to the second blockchain within the preset time range, if receiving the third hash value sent by the first blockchain, comparing whether the third hash value is the same as the target hash value; through the relay chain, when the third hash value is the same as the target hash value, unlocking the asset locked in the relay chain and transferring the unlocked asset to the first blockchain.

[0011] Further, the data processing method further includes: after verifying the credibility of the first blockchain based on the first zero-knowledge proof and verifying the credibility of the second blockchain based on the second zero-knowledge proof, in the case where the verification of the first blockchain and the second blockchain fails, prohibiting the creation of a hash time lock contract on the first blockchain.

[0012] According to another aspect of the embodiments of the present invention, there is also provided a data processing apparatus, including: a first receiving module, configured to receive user information of a first user sent by a first blockchain and receive user information of a second user sent by a second blockchain, where the first user is to pay assets to the second user, the first blockchain is the blockchain where the assets of the first user are located, and the second blockchain is the blockchain where the assets of the second user are located; a verification module, configured to generate a first zero-knowledge proof based on the user information of the first user, generate a second zero-knowledge proof based on the user information of the second user, verify the credibility of the first blockchain based on the first zero-knowledge proof, and verify the credibility of the second blockchain based on the second zero-knowledge proof; a creation module, configured to create a hash time lock contract on the first blockchain in the case where the first blockchain and the second blockchain are verified to pass, where the hash time lock contract is at least used to lock the assets of the first user; a first sending module, configured to generate a target hash value based on a target value and transaction data on the first blockchain, receive a first hash value sent by the second blockchain, and in the case where the target hash value is the same as the first hash value, send target information to the first blockchain, where the target information is used to instruct the first blockchain to transfer the locked assets in the first blockchain to the second blockchain.

[0013] According to another aspect of the embodiments of the present invention, there is also provided a computer-readable storage medium, in which a computer program is stored, where the computer program is configured to execute the above-mentioned data processing method when running.

[0014] According to another aspect of the embodiments of the present invention, there is also provided an electronic device, the electronic device includes one or more processors; a memory, configured to store one or more programs, when the one or more programs are executed by the one or more processors, enabling the one or more processors to implement a program for running, where the program is configured to execute the above-mentioned data processing method when running.

[0015] In an embodiment of the present invention, a method for securely verifying two blockchains during a cross-blockchain transaction is adopted. By receiving the user information of a first user sent by a first blockchain and receiving the user information of a second user sent by a second blockchain, a first zero-knowledge proof is generated based on the user information of the first user, a second zero-knowledge proof is generated based on the user information of the second user, the credibility of the first blockchain is verified based on the first zero-knowledge proof, and the credibility of the second blockchain is verified based on the second zero-knowledge proof. Then, when the first blockchain and the second blockchain pass the verification, a hash time-lock contract is created on the first blockchain, so as to generate a target hash value based on a target value and transaction data on the first blockchain, and receive a first hash value sent by the second blockchain. When the target hash value is the same as the first hash value, target information is sent to the first blockchain. Wherein, the first user is to pay assets to the second user, the first blockchain is the blockchain where the assets of the first user are located, the second blockchain is the blockchain where the assets of the second user are located, the hash time-lock contract is at least used to lock the assets of the first user, and the target information is used to instruct the first blockchain to transfer the locked assets in the first blockchain to the second blockchain.

[0016] In the above process, by verifying the credibility of the first blockchain based on the first zero-knowledge proof and verifying the credibility of the second blockchain based on the second zero-knowledge proof, the identity verification of the first blockchain and the second blockchain is realized. By creating a hash time-lock contract on the first blockchain when the first blockchain and the second blockchain pass the verification, the secure locking of the assets to be transferred by the first user is realized, avoiding the occurrence of double-spending. By instructing the first blockchain to transfer the locked assets in the first blockchain to the second blockchain when the first hash value sent by the second blockchain is the same as the target hash value, the secondary verification of the second blockchain is realized, and the first user is allowed to pay assets to the second user when the secondary verification passes, thus effectively improving the reliability of cross-blockchain transactions.

[0017] It can be seen that the solution provided by this application achieves the purpose of securely verifying two blockchains during a cross-blockchain transaction, thereby realizing the technical effect of improving the reliability of cross-blockchain transactions, and further solving the technical problem of low reliability of cross-blockchain transactions in the related art. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of this application. The schematic embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation to the present invention. In the drawings:

[0019] Figure 1 is a flowchart of an optional data processing method according to an embodiment of the present invention;

[0020] Figure 2 is a working schematic diagram of an optional target processing system according to an embodiment of the present invention;

[0021] Figure 3 is a schematic diagram of an optional data processing device according to an embodiment of the present invention;

[0022] Figure 4 is a schematic diagram of an optional electronic device according to an embodiment of the present invention. Detailed implementation manners

[0023] In order to enable those skilled in the art to better understand the solution of the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present invention.

[0024] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and do not necessarily need to describe a specific order or sequence. It should be understood that such data can be interchanged under appropriate circumstances so that the embodiments of the present invention described here can be implemented in an order other than those illustrated or described here. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product or device including a series of steps or units does not necessarily have to be limited to those clearly listed steps or units, but may include other steps or units not clearly listed or inherent to these processes, methods, products or devices.

[0025] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data need to comply with the relevant laws, regulations and standards in the relevant regions, and corresponding operation entrances are provided for users to choose to authorize or refuse.

[0026] Embodiment 1

[0027] According to an embodiment of the present invention, an embodiment of a data processing method is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions, and although the logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in a different order than here.

[0028] Figure 1 is a flowchart of an optional data processing method according to an embodiment of the present invention. As Figure 1 shown, this method is applied to a target processing system and includes the following steps:

[0029] Step S101, receive the user information of the first user sent by the first blockchain, and receive the user information of the second user sent by the second blockchain, where the first user is to pay assets to the second user, the first blockchain is the blockchain where the assets of the first user are located, and the second blockchain is the blockchain where the assets of the second user are located.

[0030] Optionally, Figure 2 is a schematic diagram of the operation of an optional target processing system according to an embodiment of the present invention. As Figure 2 shown, the target processing system may include a verification module, a generation module, a blockchain uploading module, and a rollback module. The target processing system can execute the data processing method in this embodiment based on the verification module, the generation module, the blockchain uploading module, and the rollback module.

[0031] Optionally, the data processing method in this embodiment is applied to an online payment scenario. Specifically, it is applied to a scenario where a user pays another user. The first user is to pay assets to the second user, that is, the first user is equivalent to the asset payer, and the second user is equivalent to the asset recipient. The first user and the second user can be individual users, merchants, or other types of users.

[0032] Optionally, as Figure 2 shown, when an online payment transaction occurs between the first user and the second user, the first user can send the user information of the first user to the target processing system through the first blockchain, and the second user can send the user information of the second user to the target processing system through the second blockchain. Optionally, the user information of the first user is stored on the first blockchain, and the user information of the second user is stored on the second blockchain. The user information at least includes the transaction number of the payment transaction corresponding to the user (i.e., the aforementioned first user or second user), the identity information of the user (such as the user unique identifier, etc.), and the transaction identifier of the user. The transaction identifier includes the asset payer identifier and the asset recipient identifier.

[0033] Optionally, the target processing system may receive the user information of the first user sent by the first blockchain, and receive the user information of the second user sent by the second blockchain, and match the first user and the second user belonging to the same payment transaction according to the transaction numbers in the user information.

[0034] Step S102: Generate a first zero-knowledge proof based on the user information of the first user, generate a second zero-knowledge proof based on the user information of the second user, verify the credibility of the first blockchain based on the first zero-knowledge proof, and verify the credibility of the second blockchain based on the second zero-knowledge proof.

[0035] Optionally, the first zero-knowledge proof and the second zero-knowledge proof may be generated by a verification module in the target processing system. Among them, the verification module may use ZK-STARKs (Zero-Knowledge Scalable Transparent Argument of Knowledge) to generate zero-knowledge proofs, and ZK-STARKs is a zero-knowledge proof scheme.

[0036] As Figure 2 shown, after generating the first zero-knowledge proof and the second zero-knowledge proof, the target processing system may send the first zero-knowledge proof and the second zero-knowledge proof to the relay chain, so as to verify the credibility of the first blockchain based on the first zero-knowledge proof and verify the credibility of the second blockchain based on the second zero-knowledge proof. Optionally, the relay chain is at least used to implement communication and data transmission between different chains.

[0037] Step S103: Create a hash time-locked contract on the first blockchain when the first blockchain and the second blockchain are verified to pass, where the hash time-locked contract is at least used to lock the assets of the first user.

[0038] Optionally, when the first blockchain and the second blockchain are verified to pass, the target processing system may create hash time-locked contracts (HTLCs) on the first blockchain. HTLCs are a special type of smart contract that combines the hash lock and time lock mechanisms to ensure the atomicity and security of transactions.

[0039] Optionally, the hash time-locked contract is at least used to lock the assets of the first user, the assets locked by the hash time-locked contract are the assets that the first user is to pay to the second user, and the hash time-locked contract allows the assets of the first user to be unlocked under specific conditions.

[0040] Step S104: Generate a target hash value based on the target value and the transaction data on the first blockchain, and receive the first hash value sent by the second blockchain. When the target hash value is the same as the first hash value, send target information to the first blockchain, where the target information is used to instruct the first blockchain to transfer the locked assets in the first blockchain to the second blockchain.

[0041] Optionally, the transaction data at least includes the payment information of the first user and the identity identifier of the second user. The payment information includes, but is not limited to, the payment amount, payment time, order number (i.e., transaction number), etc.

[0042] Optionally, the target hash value can be generated by the generation module in the target processing system based on the target value and the transaction data on the first blockchain. Among them, the target value can be a preset value or a random number randomly generated by the generation module.

[0043] Optionally, the target processing system can send the target value to the second user in an off-chain manner so that the second user can obtain the target value. After obtaining the target value, the second user can generate a hash value based on the target value and the transaction data through the second blockchain and send the generated hash value to the target processing system. The target processing system determines the hash value sent by the second blockchain received as the first hash value. Among them, when an online payment transaction occurs between the first user and the second user, the second user can obtain the aforementioned transaction data.

[0044] Optionally, the generation module is responsible for receiving the first hash value sent by the second blockchain and comparing whether the received first hash value is the same as the target hash value. Thus, when the target hash value is the same as the first hash value, it is determined that the second blockchain passes the secondary verification. In this case, send the target information to the first blockchain. Optionally, after receiving the target information, the first blockchain transfers the locked assets to the second blockchain.

[0045] Based on the solution defined in the above steps S101 to S104, it can be known that in the embodiment of the present invention, a method of performing security verification on both blockchains during cross-blockchain transactions is adopted. By receiving the user information of the first user sent by the first blockchain and receiving the user information of the second user sent by the second blockchain, then generating a first zero-knowledge proof based on the user information of the first user, generating a second zero-knowledge proof based on the user information of the second user, and verifying the credibility of the first blockchain based on the first zero-knowledge proof and verifying the credibility of the second blockchain based on the second zero-knowledge proof. Then, when the first blockchain and the second blockchain are verified to be passed, a hash time lock contract is created on the first blockchain, so as to generate a target hash value based on the target value and the transaction data on the first blockchain, and receive the first hash value sent by the second blockchain. When the target hash value is the same as the first hash value, the target information is sent to the first blockchain. Wherein, the first user is to pay assets to the second user, the first blockchain is the blockchain where the assets of the first user are located, the second blockchain is the blockchain where the assets of the second user are located, the hash time lock contract is at least used to lock the assets of the first user, and the target information is used to instruct the first blockchain to transfer the locked assets in the first blockchain to the second blockchain.

[0046] It is easy to notice that in the above process, by verifying the credibility of the first blockchain based on the first zero-knowledge proof and verifying the credibility of the second blockchain based on the second zero-knowledge proof, the identity verification of the first blockchain and the second blockchain is realized. By creating a hash time lock contract on the first blockchain when the first blockchain and the second blockchain are verified to be passed, the secure locking of the assets to be transferred by the first user is realized, avoiding the occurrence of double spending. By instructing the first blockchain to transfer the locked assets in the first blockchain to the second blockchain when the first hash value sent by the second blockchain is the same as the target hash value, the secondary verification of the second blockchain is realized, and the first user is allowed to pay assets to the second user when the secondary verification is passed, thus effectively improving the reliability of cross-blockchain transactions.

[0047] It can be seen that the solution provided by the present application achieves the purpose of performing security verification on both blockchains during cross-blockchain transactions, thereby realizing the technical effect of improving the reliability of cross-blockchain transactions, and further solving the technical problem of low reliability of cross-blockchain transactions in the related art.

[0048] In an alternative embodiment, in the process of verifying the credibility of the first blockchain based on the first zero-knowledge proof and verifying the credibility of the second blockchain based on the second zero-knowledge proof, the target processing system may send the first zero-knowledge proof and the second zero-knowledge proof to the relay chain, so as to receive the verification result feedback by the relay chain, and determine whether the first blockchain and the second blockchain pass the verification according to the verification result, where the relay chain is used to verify the credibility of the first blockchain based on the first zero-knowledge proof and verify the credibility of the second blockchain based on the second zero-knowledge proof.

[0049] Optionally, after generating the first zero-knowledge proof and the second zero-knowledge proof, the verification module in the target processing system may send the first zero-knowledge proof and the second zero-knowledge proof to the relay chain. After receiving the first zero-knowledge proof and the second zero-knowledge proof, the relay chain may use a preset verification algorithm to verify the first zero-knowledge proof and the second zero-knowledge proof to obtain a verification result. Among them, the verification algorithm is implemented based on the mathematical principle of ZK-STARKs.

[0050] Optionally, the verification result is used to indicate whether the first blockchain and the second blockchain pass the verification. The verification module receives the verification result feedback by the relay chain, and determines that the first blockchain and the second blockchain pass the verification when the verification result indicates that the first blockchain and the second blockchain pass the verification.

[0051] It should be noted that verifying the zero-knowledge proof through the relay chain improves the security and privacy of cross-chain transactions. At the same time, the transparency and traceability of transactions are maintained through distributed ledger technology, thereby improving the reliability of cross-chain transactions.

[0052] In an alternative embodiment, before receiving the first hash value sent by the second blockchain, the target processing system may generate a random number based on a pseudorandom number generator, determine the random number as the target value, and send the target value to the second user in an off-chain manner.

[0053] Optionally, the generation module may use a secure pseudorandom number generator to generate a 32-byte random number (i.e., the aforementioned target value), and send the random number to the second user in an off-chain manner. And the generation module may use the random number to generate a ciphertext hash (i.e., the target hash value) through the SHA256 algorithm according to the transaction data on the first blockchain.

[0054] Optionally, after receiving the random number, the second user may generate a hash value through the second blockchain based on the random number and the transaction data through the SHA256 algorithm, and send the hash value to the target processing system for the generation module to determine the received hash value as the first hash value and compare it with the target hash value.

[0055] It should be noted that by determining the randomly generated random number as the target value, the randomness of the target value is improved, thereby enhancing the reliability of verifying the identity of the second blockchain. By sending the target value to the second user, it is convenient for the second user to generate the first hash value.

[0056] In an alternative embodiment, the hash time lock contract includes a first condition, which indicates that the assets are unlocked when the hash value sent by the second blockchain is the same as the target hash value. Among them, after sending the target information to the first blockchain, when the first blockchain receives the target information, it transfers the locked assets in the first blockchain to the relay chain, receives the second hash value sent by the second blockchain through the relay chain, and when the second hash value is the same as the target hash value, unlocks the assets locked in the relay chain and transfers the unlocked assets to the second blockchain, where a hash time lock contract is created on the relay chain.

[0057] Optionally, as Figure 2 shown, when the first blockchain receives the target information, it can transfer the locked assets to the relay chain, and a hash time lock contract is also created on the relay chain. The hash time lock contract on the relay chain is used to lock the assets transferred from the first blockchain to the relay chain.

[0058] Optionally, when the target processing system sends the target information to the first blockchain, it can also send the target information to the second blockchain to prompt the second blockchain that it can conduct transactions with the first blockchain. When the second blockchain receives the target information, it generates a hash value again based on the target value and the transaction data, and as Figure 2 shown, sends the generated hash value to the relay chain. The relay chain determines the received hash value sent by the second blockchain as the second hash value. Among them, the aforementioned first hash value may be the same or different. For example, when the transaction data is tampered with, or the target value is tampered with, the first hash value is different from the second hash value. Another example is that when the second hash value is tampered with during the transmission process, the first hash value is different from the second hash value.

[0059] Optionally, after receiving the second hash value, the relay chain compares the second hash value with the target hash value. Thus, when the second hash value is the same as the target hash value, it is determined that the first condition in the hash time lock contract is satisfied. Then, in this case, as Figure 2 shown, unlocks the assets locked in the relay chain and transfers the unlocked assets to the second blockchain. The relay chain can obtain the target hash value from the target processing system. Optionally, if the second hash value is different from the target hash value, unlocking the assets locked in the relay chain is prohibited.

[0060] It should be noted that through the above process, the third identity authentication of the second blockchain during the transaction process is realized through the relay chain, which can further improve the reliability of cross-chain transactions.

[0061] In an optional embodiment, after transferring the unlocked assets to the second blockchain, the target processing system can receive the transaction status change data sent by the first blockchain to obtain the first data, and receive the transaction status change data sent by the second blockchain to obtain the second data, so as to upload the first data, the second data, and the transaction data to the relay chain, and publish the first data, the second data, and the transaction data in the relay chain.

[0062] Optionally, after transferring the unlocked assets to the second blockchain, the first blockchain and the second blockchain can send their respective transaction status change data to the target processing system. For example, the transaction status change data of the first blockchain may include the time of locking the assets, the time of transferring the assets to the relay chain, the time of transferring the assets back from the relay chain, etc., and the transaction status change data of the second blockchain may include the time of obtaining the assets from the relay chain, etc.

[0063] Optionally, the on-chain module in the target processing system can upload the obtained first data, second data, and the aforementioned transaction data to the relay chain, and publish the first data, second data, and transaction data in the relay chain.

[0064] In some embodiments, the on-chain module includes a transaction details recording unit, a status change recording unit, a timestamp recording unit, a ledger storage unit, and an access control unit. Among them, the transaction details recording unit is used to record the specific information of each transaction in detail, the status change recording unit is used to record the change history of the transaction status on the target processing system side (such as the time when zero-knowledge verification passes or fails, the time when hash comparison succeeds or fails), the timestamp recording unit is used to add timestamps to each transaction step to ensure the accuracy of the time sequence, the ledger storage unit is used to store transaction records, the access control unit is used to manage the access rights to the ledger data to ensure that only authorized relevant parties can access the transaction records, and the verification unit is used to provide the verification function of the transaction records to ensure the consistency and integrity of the data. Optionally, during the process of uploading the first data, the second data, and the transaction data to the relay chain, the target processing system can also upload the transaction records generated by the on-chain module itself to the relay chain.

[0065] In some embodiments, regardless of whether the transaction is successful or failed, the on-chain module will upload and publish the transaction-related data to the relay chain. That is, in some embodiments, the target processing system can receive the transaction status change data sent by the first blockchain and the transaction status change data sent by the second blockchain in real time, then count and upload them to the relay chain, and publish them in the blockchain.

[0066] It should be noted that by uploading the first data, the second data, and the transaction data to the relay chain and making them public, the first blockchain and the second blockchain can obtain these data from the relay chain, thereby ensuring the transparency and traceability of transactions and improving the reliability of transactions.

[0067] In an alternative embodiment, the hash time lock contract further includes a second condition, which represents that the locked asset is not transferred to the second blockchain within a preset time range, and the asset is unlocked when the hash value generated by the first blockchain is the same as the target hash value. Among them, after sending the target information to the first blockchain, if the relay chain does not transfer the locked asset to the second blockchain within the preset time range, and if the third hash value sent by the first blockchain is received, then compare whether the third hash value and the target hash value are the same. When the third hash value is the same as the target hash value through the relay chain, unlock the locked asset in the relay chain and transfer the unlocked asset to the first blockchain.

[0068] Optionally, the second condition is the time lock timeout condition in the hash time lock contract. If the locked asset is not transferred to the second blockchain within the preset time range, it is determined that the time lock timeout condition is triggered. In this case, the first blockchain can generate a hash value based on the transaction data and the target value and send the generated hash value to the relay chain, so that the relay chain determines the received hash value sent by the first blockchain as the third hash value. Among them, the first blockchain can obtain the target value from the rollback module at the target processing system. The aforementioned preset time range starts from the time point when the asset is locked, and the length of the preset time range is a fixed value.

[0069] Optionally, as Figure 2 shown, the relay chain can unlock the locked asset in the relay chain when the third hash value is the same as the target hash value and transfer the unlocked asset to the first blockchain. Optionally, if the third hash value is different from the target hash value, unlocking the locked asset in the relay chain is prohibited.

[0070] In some embodiments, before transferring the locked asset in the first blockchain to the relay chain information, if it is determined that the locked asset is not transferred to the second blockchain within the preset time range, the locked asset in the first blockchain is unlocked by generating a hash value based on the target value and the transaction data.

[0071] It should be noted that through the above process, when the transaction fails, the asset is unlocked and retained in the first blockchain, thereby ensuring the security and integrity of the transaction and improving the reliability of cross-chain transactions.

[0072] In an alternative embodiment, after verifying the credibility of the first blockchain based on the first zero-knowledge proof and verifying the credibility of the second blockchain based on the second zero-knowledge proof, the target processing system may prohibit the creation of a hash time lock contract on the first blockchain if the verification of the first blockchain and the second blockchain fails.

[0073] Optionally, if the verification of the first blockchain and the second blockchain fails, the creation of a hash time lock contract on the first blockchain is prohibited, that is, cross-chain transactions between the first blockchain and the second blockchain are prohibited.

[0074] Optionally, if the target hash value is different from the first hash value, the creation of a hash time lock contract on the first blockchain is also prohibited, that is, cross-chain transactions between the first blockchain and the second blockchain are prohibited.

[0075] It should be noted that through the above process, the conditions for cross-chain transactions between the first blockchain and the second blockchain are effectively defined, thereby effectively improving the reliability of transactions.

[0076] It can be seen that the solution provided by this application achieves the purpose of securely verifying both blockchains during cross-blockchain transactions, thereby realizing the technical effect of improving the reliability of cross-blockchain transactions, and further solving the technical problem of low reliability of cross-blockchain transactions in related technologies.

[0077] Embodiment 2

[0078] According to an embodiment of the present invention, an embodiment of a data processing device is provided, wherein Figure 3 is a schematic diagram of an alternative data processing device according to an embodiment of the present invention, as Figure 3 shown, the device includes:

[0079] A first receiving module 301, configured to receive user information of a first user sent by the first blockchain and receive user information of a second user sent by the second blockchain, where the first user is to pay assets to the second user, the first blockchain is the blockchain where the assets of the first user are located, and the second blockchain is the blockchain where the assets of the second user are located;

[0080] A verification module 302, configured to generate a first zero-knowledge proof based on the user information of the first user, generate a second zero-knowledge proof based on the user information of the second user, and verify the credibility of the first blockchain based on the first zero-knowledge proof and verify the credibility of the second blockchain based on the second zero-knowledge proof;

[0081] A creation module 303, configured to create a hash time lock contract on the first blockchain if the verification of the first blockchain and the second blockchain is passed, where the hash time lock contract is at least used to lock the assets of the first user;

[0082] The first sending module 304 is configured to generate a target hash value based on a target value and transaction data on the first blockchain, and receive a first hash value sent by the second blockchain. When the target hash value is the same as the first hash value, the first sending module 304 sends target information to the first blockchain, where the target information is used to instruct the first blockchain to transfer the locked assets in the first blockchain to the second blockchain.

[0083] It should be noted that the above first receiving module 301, verification module 302, creation module 303, and first sending module 304 correspond to steps S101 to S104 in the above embodiment. The examples and application scenarios implemented by the four modules and the corresponding steps are the same, but are not limited to the content disclosed in the above embodiment 1.

[0084] Optionally, the verification module further includes: a sending sub-module, configured to send a first zero-knowledge proof and a second zero-knowledge proof to a relay chain, where the relay chain is configured to verify the credibility of the first blockchain based on the first zero-knowledge proof and verify the credibility of the second blockchain based on the second zero-knowledge proof; a determining sub-module, configured to receive a verification result fed back by the relay chain and determine whether the first blockchain and the second blockchain pass the verification according to the verification result.

[0085] Optionally, the data processing device further includes: a generating module, configured to generate a random number based on a pseudorandom number generator and determine the random number as the target value; a second sending module, configured to send the target value to a second user in an off-chain manner.

[0086] Optionally, the data processing device further includes: a first processing module, configured to, when the first blockchain receives the target information, transfer the locked assets in the first blockchain to the relay chain, where a hash time lock contract is created on the relay chain; a second processing module, configured to receive a second hash value sent by the second blockchain through the relay chain, and when the second hash value is the same as the target hash value, unlock the assets locked in the relay chain and transfer the unlocked assets to the second blockchain.

[0087] Optionally, the data processing device further includes: a second receiving module, configured to receive transaction status change data sent by the first blockchain to obtain first data; a third receiving module, configured to receive transaction status change data sent by the second blockchain to obtain second data; a third processing module, configured to upload the first data, the second data, and the transaction data to the relay chain and publish the first data, the second data, and the transaction data in the relay chain.

[0088] Optionally, the data processing device further includes: a comparison module, configured to, when the relay chain fails to transfer the locked assets to the second blockchain within a preset time range, compare whether the third hash value received from the first blockchain is the same as the target hash value if the third hash value is received; a fourth processing module, configured to unlock the locked assets in the relay chain and transfer the unlocked assets to the first blockchain when the third hash value is the same as the target hash value through the relay chain.

[0089] Optionally, the data processing device further includes: a fifth processing module, configured to prohibit creating a hash time lock contract on the first blockchain when the verification between the first blockchain and the second blockchain fails.

[0090] Embodiment 3

[0091] On the other hand, according to an embodiment of the present invention, there is also provided a computer-readable storage medium storing a computer program, where the computer program is configured to execute the above-mentioned data processing method when running.

[0092] Embodiment 4

[0093] On the other hand, according to an embodiment of the present invention, there is also provided an electronic device, where Figure 4 is a schematic diagram of an optional electronic device according to an embodiment of the present invention, as Figure 4 shown, the electronic device includes one or more processors; a memory for storing one or more programs, and when the one or more programs are executed by the one or more processors, the one or more processors are caused to implement running the program, where the program is configured to execute the above-mentioned data processing method when running.

[0094] The serial numbers of the above embodiments of the present invention are only for description and do not represent the superiority or inferiority of the embodiments.

[0095] In the above embodiments of the present invention, the descriptions of the various embodiments have their own emphases. For parts not detailed in a certain embodiment, reference may be made to the relevant descriptions of other embodiments.

[0096] In several embodiments provided in the present application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only illustrative. For example, the division of units can be a logical function division, and there may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point, the displayed or discussed mutual coupling or direct coupling or communication connection can be through some interfaces, and the indirect coupling or communication connection of units or modules can be in an electrical or other form.

[0097] The unit described as a separation component may or may not be physically separated, and the component displayed as a unit may or may not be a physical unit, that is, it may be located in one place or may be distributed over multiple units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0098] In addition, each functional unit in various embodiments of the present invention may be integrated in a processing unit, may exist separately as individual physical units, or two or more units may be integrated in one unit. The above-mentioned integrated units can be implemented in the form of hardware or in the form of software functional units.

[0099] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions for causing a computer device (which can be a personal computer, a server or a network device, etc.) to execute all or part of the steps of the methods in various embodiments of the present invention. The foregoing storage medium includes: USB flash drives, read-only memories (ROMs), random access memories (RAMs), mobile hard disks, magnetic disks or optical discs and other various media that can store program codes.

[0100] The above are only the preferred embodiments of the present invention. It should be noted that for those of ordinary skill in the art, without departing from the principle of the present invention, several improvements and modifications can be made, and these improvements and modifications should also be regarded as the protection scope of the present invention.

Claims

1. A data processing method, characterized in that: Applied to a target processing system, the method includes: Receiving user information of a first user sent by a first blockchain and receiving user information of a second user sent by a second blockchain, where the first user is to pay assets to the second user, the first blockchain is the blockchain where the assets of the first user are located, and the second blockchain is the blockchain where the assets of the second user are located; Generating a first zero-knowledge proof based on the user information of the first user, generating a second zero-knowledge proof based on the user information of the second user, and verifying the credibility of the first blockchain based on the first zero-knowledge proof and verifying the credibility of the second blockchain based on the second zero-knowledge proof; When the first blockchain and the second blockchain pass the verification, creating a hash time-lock contract on the first blockchain, where the hash time-lock contract is at least used to lock the assets of the first user; Generating a target hash value based on a target value and transaction data on the first blockchain, and receiving a first hash value sent by the second blockchain. When the target hash value is the same as the first hash value, sending target information to the first blockchain, where the target information is used to instruct the first blockchain to transfer the locked assets in the first blockchain to the second blockchain; The hash time-lock contract includes a first condition, and the first condition represents unlocking the assets when the hash value sent by the second blockchain is the same as the target hash value. After sending the target information to the first blockchain, the method further includes: When the first blockchain receives the target information, transferring the locked assets in the first blockchain to a relay chain, where a hash time-lock contract is created on the relay chain; Receiving a second hash value sent by the second blockchain through the relay chain, and when the second hash value is the same as the target hash value, unlocking the assets locked in the relay chain and transferring the unlocked assets to the second blockchain.

2. The method according to claim 1, characterized in that, Verifying the credibility of the first blockchain based on the first zero-knowledge proof and verifying the credibility of the second blockchain based on the second zero-knowledge proof, including: Sending the first zero-knowledge proof and the second zero-knowledge proof to the relay chain, where the relay chain is used to verify the credibility of the first blockchain based on the first zero-knowledge proof and verify the credibility of the second blockchain based on the second zero-knowledge proof; Receiving the verification result feedback by the relay chain and determining whether the first blockchain and the second blockchain pass the verification according to the verification result.

3. The method according to claim 1, characterized in that Before receiving the first hash value sent by the second blockchain, the method further includes: Generating a random number based on a pseudorandom number generator and determining the random number as the target value; Sending the target value to the second user in an off-chain manner.

4. The method according to claim 1, wherein After transferring the unlocked assets to the second blockchain, the method further includes: Receiving transaction status change data sent by the first blockchain to obtain first data; Receive the transaction status change data sent by the second blockchain to obtain second data; Upload the first data, the second data, and the transaction data to the relay chain, and publish the first data, the second data, and the transaction data in the relay chain.

5. The method according to claim 1, characterized in that The hash time lock contract on the relay chain further includes a second condition, where the second condition indicates that the locked asset is not transferred to the second blockchain within a preset time range, and the asset is unlocked when the hash value generated by the first blockchain is the same as the target hash value. After sending the target information to the first blockchain, the method further includes: When the relay chain does not transfer the locked asset to the second blockchain within the preset time range, if the third hash value sent by the first blockchain is received, compare whether the third hash value is the same as the target hash value; Through the relay chain, when the third hash value is the same as the target hash value, unlock the locked asset in the relay chain, and transfer the unlocked asset to the first blockchain.

6. The method according to claim 1, characterized in that, After verifying the credibility of the first blockchain based on the first zero-knowledge proof and verifying the credibility of the second blockchain based on the second zero-knowledge proof, the method further includes: When the verification of the first blockchain and the second blockchain fails, prohibit creating the hash time lock contract on the first blockchain.

7. A data processing device, characterized in that, Applied to a target processing system, the device includes: A first receiving module, configured to receive the user information of a first user sent by the first blockchain, and receive the user information of a second user sent by the second blockchain, where the first user is to pay assets to the second user, the first blockchain is the blockchain where the assets of the first user are located, and the second blockchain is the blockchain where the assets of the second user are located; A verification module, configured to generate a first zero-knowledge proof based on the user information of the first user, generate a second zero-knowledge proof based on the user information of the second user, verify the credibility of the first blockchain based on the first zero-knowledge proof, and verify the credibility of the second blockchain based on the second zero-knowledge proof; A creation module, configured to create a hash time lock contract on the first blockchain when the verification of the first blockchain and the second blockchain passes, where the hash time lock contract is at least used to lock the assets of the first user; A first sending module, configured to generate a target hash value based on a target value and the transaction data on the first blockchain, and receive the first hash value sent by the second blockchain. When the target hash value is the same as the first hash value, send target information to the first blockchain, where the target information is used to instruct the first blockchain to transfer the locked asset in the first blockchain to the second blockchain; The hash time lock contract includes a first condition, where the first condition indicates that the asset is unlocked when the hash value sent by the second blockchain is the same as the target hash value. The data processing device further includes: A first processing module, configured to, when the first blockchain receives the target information, transfer the assets locked in the first blockchain to a relay chain, where a hash time lock contract is created on the relay chain; A second processing module, configured to receive a second hash value sent by the second blockchain through the relay chain, and unlock the assets locked in the relay chain when the second hash value is the same as the target hash value, and transfer the unlocked assets to the second blockchain.

8. A computer-readable storage medium, characterized in that, A computer program is stored in the computer-readable storage medium, where the computer program is configured to execute the data processing method described in any one of claims 1 to 6 when running.

9. An electronic device, characterized in that: The electronic device includes one or more processors; A memory, configured to store one or more programs, and when the one or more programs are executed by the one or more processors, cause the one or more processors to implement running the program, where the program is configured to execute the data processing method described in any one of claims 1 to 6 when running.

Citation Information

Patent Citations

  • MethodS, system and apparatus for managing transactions in multiple blockchain networks

    CN113568946A

  • Power data uploading system and method based on zero-knowledge proof

    CN113660092A

  • Heterogeneous cross-chain system based on relay chain and Hash time locking contract

    CN117650881A

  • Block chain-based bond issuing transaction method, system and device, and medium

    CN118154309A