CN112927073A - Cross-link data interchange method, system, device and electronic equipment - Google Patents

Cross-link data interchange method, system, device and electronic equipment Download PDF

Info

Publication number
CN112927073A
CN112927073A CN202110202966.3A CN202110202966A CN112927073A CN 112927073 A CN112927073 A CN 112927073A CN 202110202966 A CN202110202966 A CN 202110202966A CN 112927073 A CN112927073 A CN 112927073A
Authority
CN
China
Prior art keywords
transaction
asset
cross
chain
locking
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202110202966.3A
Other languages
Chinese (zh)
Inventor
王挺
曹崇瑞
顾费勇
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Netease Hangzhou Network Co Ltd
Original Assignee
Netease Hangzhou Network Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Netease Hangzhou Network Co Ltd filed Critical Netease Hangzhou Network Co Ltd
Priority to CN202110202966.3A priority Critical patent/CN112927073A/en
Publication of CN112927073A publication Critical patent/CN112927073A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q40/00Finance; Insurance; Tax strategies; Processing of corporate or income taxes
    • G06Q40/04Trading; Exchange, e.g. stocks, commodities, derivatives or currency exchange
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/64Protecting data integrity, e.g. using checksums, certificates or signatures

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Business, Economics & Management (AREA)
  • Physics & Mathematics (AREA)
  • Accounting & Taxation (AREA)
  • Finance (AREA)
  • Computer Security & Cryptography (AREA)
  • General Physics & Mathematics (AREA)
  • General Business, Economics & Management (AREA)
  • Technology Law (AREA)
  • Strategic Management (AREA)
  • Marketing (AREA)
  • Economics (AREA)
  • Development Economics (AREA)
  • Health & Medical Sciences (AREA)
  • Bioethics (AREA)
  • General Health & Medical Sciences (AREA)
  • Computer Hardware Design (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Financial Or Insurance-Related Operations Such As Payment And Settlement (AREA)

Abstract

The application provides a method, a system, a device and an electronic device for cross-link data interchange, wherein the method comprises the following steps: according to proposal data sent by a client, sending an asset interchange request to a cross-chain platform; receiving a transaction preparation instruction returned by a cross-chain platform responding to an asset interchange request; responding to the transaction preparation instruction, locking the transaction assets indicated by the proposal data and returning asset locking results; if a transaction submitting instruction returned by the cross-chain platform based on the asset locking result is received, transferring the transaction asset and returning a transaction success message; the transaction submitting instruction is sent by the cross-chain platform when receiving a message that all the blockchain nodes participating in the asset interchange return asset locking success. The scheme ensures the safety of transaction, can realize asset exchange between different block chain networks through two stages of locking and transferring, and is convenient and quick.

Description

Cross-link data interchange method, system, device and electronic equipment
Technical Field
The present application relates to the field of block chain technologies, and in particular, to a method for exchanging cross-chain data, a system for exchanging cross-chain data, a device for exchanging cross-chain data, an electronic device, and a computer-readable storage medium.
Background
Blockchains refer to a completely new distributed infrastructure and computing paradigm that uses blockchain-like data structures to verify and store data, uses distributed node consensus algorithms to generate and update data, uses cryptography to secure data transmission and access, and uses intelligent contracts composed of automated script codes to program and manipulate data.
The chain crossing means that information and values on originally different and independent block chains are exchanged and circulated through technical means. In a narrow sense, the process of inter-operability between two relatively independent blockchain accounts; the method is a process for performing asset and data interoperation between two independent accounts in a broad sense. Whether for public chain or private chain, the good medicine that the cross-chain technology rescued blockchain from dispersed island is the bridge that the blockchain outwards expanded and connected.
A Hash Time Lock Contract (HTLC) is a technique for exchanging assets between blockchain networks. In the process of asset exchange, in order to ensure the asset safety of each block chain, the asset transfer is either completely completed or not completed, and no intermediate state exists. The Hash time locking is realized based on a Hash algorithm and a timeout mechanism, the execution flow is complex, and the time efficiency is low.
Disclosure of Invention
The embodiment of the application provides a cross-link data interchange method, which is used for simplifying an asset interchange process and improving time efficiency.
The embodiment of the application provides a cross-chain data interchange method, which is executed by a block chain node, and comprises the following steps:
according to proposal data sent by a client, sending an asset interchange request to a cross-chain platform;
receiving a transaction preparation instruction returned by the cross-chain platform in response to the asset interchange request;
responding to the transaction preparation instruction, locking the transaction assets indicated by the proposal data and returning asset locking results;
if a transaction submitting instruction returned by the cross-chain platform based on the asset locking result is received, transferring the transaction asset and returning a transaction success message;
and the transaction submitting instruction is sent by the cross-chain platform when receiving an asset locking success message returned by all the blockchain nodes participating in the asset interchange.
In one embodiment, the locking the transaction asset indicated by the proposal data and returning an asset locking result in response to the transaction preparation instruction includes:
responding to the transaction preparation instruction, and judging whether a sender indicated by the proposal data is an account corresponding to the client;
if the sender is the account corresponding to the client, judging whether the residual assets of the sender are more than or equal to the transaction assets;
and if the residual assets of the sender are more than or equal to the transaction assets, locking the transaction assets indicated by the proposal data and returning an asset locking success message.
In an embodiment, the method further comprises:
and if the sender is not the account corresponding to the client or the residual assets of the sender are smaller than the transaction assets, returning an asset locking failure message.
In one embodiment, after the locking the transaction asset indicated by the proposal data, the method further comprises:
storing the proposal data locally at the block link point.
In an embodiment, the method further comprises:
if a transaction rollback instruction returned by the cross-chain platform based on the asset locking result is received, unlocking the locked transaction asset;
the transaction rollback instruction is sent by the cross-chain platform when at least one blockchain node participating in asset interchange returns an asset locking failure message.
In an embodiment, after said transferring said transaction asset, said method further comprises:
deleting the proposal data from the to-be-completed proposal list.
The embodiment of the application also provides a cross-chain data interchange method, which is executed by a cross-chain platform, wherein the cross-chain platform interacts with a plurality of block chain nodes, and the plurality of block chain nodes belong to different block chain networks; the method comprises the following steps:
when receiving an asset interchange request containing the same proposal identification sent by the plurality of block chain nodes, sending an exchange preparation instruction to the plurality of block chain nodes; the transaction preparation instruction is sent to trigger the plurality of block chain link points to lock transaction assets and return asset locking results;
when receiving that all the block chain nodes return asset locking success information, sending transaction submitting instructions to the block chain nodes; the transaction submitting instruction is sent to trigger the block chain nodes to transfer the transaction assets and return a transaction success message;
and when receiving that the plurality of block chain nodes all return transaction success messages, determining that the asset interchange of the current round is finished.
In an embodiment, the method further comprises:
when receiving at least one block chain node point return asset locking failure message, sending transaction rollback instructions to the plurality of block chain node points;
and triggering the plurality of block link points to unlock the transaction assets through the transmission of the transaction submission instruction.
An embodiment of the present application further provides a system for exchanging cross-chain data, including:
a cross-chain platform;
a plurality of blockchain nodes communicatively coupled to the inter-chain platform; the plurality of block chain nodes belong to different block chain networks respectively;
the cross-chain platform is used for sending transaction preparation instructions to the plurality of block chain nodes when receiving asset interchange requests containing the same proposal identification sent by the plurality of block chain nodes; when receiving a message that all the block chain nodes return asset locking success, sending a transaction submitting instruction to the block chain nodes;
the block chain nodes are used for receiving the transaction preparation instruction, locking a transaction asset and returning an asset locking result; receiving the transaction submitting instruction, transferring the transaction assets and returning a transaction success message;
and the cross-chain platform is further used for determining that the asset interchange of the current round is finished when the transaction success messages returned by the block chain nodes are received.
An embodiment of the present application further provides a device for exchanging inter-chain data, where the device is applied to a blockchain node, and the device includes:
the request sending module is used for sending an asset interchange request to the cross-chain platform according to the proposal data sent by the client;
the instruction receiving module is used for receiving a transaction preparation instruction returned by the cross-chain platform in response to the asset interchange request;
the asset locking module is used for responding to the transaction preparation instruction, locking the transaction assets indicated by the proposal data and returning asset locking results;
the asset transfer module is used for transferring the transaction asset and returning a transaction success message if a transaction submission instruction returned by the cross-chain platform based on the asset locking result is received;
and the transaction submitting instruction is sent by the cross-chain platform when receiving an asset locking success message returned by all the blockchain nodes participating in the asset interchange.
An embodiment of the present application further provides an electronic device, where the electronic device includes:
a processor;
a memory for storing processor-executable instructions;
wherein the processor is configured to perform the above cross-chain data interchange method.
The embodiment of the application also provides a computer readable storage medium, wherein the storage medium stores a computer program, and the computer program can be executed by a processor to complete the cross-chain data interchange method.
According to the technical scheme provided by the embodiment of the application, the blockchain nodes in different blockchain networks can lock transaction assets and return asset locking results when transaction preparation instructions are received, and when all the blockchain nodes in different blockchain networks return asset locking success messages, the blockchain nodes can receive transaction submission instructions sent by a cross-chain platform and then perform asset transfer, so that the transaction safety is ensured, the asset exchange between different blockchain networks can be realized through two stages of locking and transferring, and the method is convenient and fast.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required to be used in the embodiments of the present application will be briefly described below.
FIG. 1 is a block diagram of a cross-chain data interchange system according to an embodiment of the present application;
FIG. 2 is a schematic diagram of XA implementing distributed transactions;
fig. 3 is a schematic structural diagram of an electronic device provided in an embodiment of the present application;
FIG. 4 is a flowchart illustrating a cross-chain data interchange method according to an embodiment of the present application;
FIG. 5 is a flowchart showing details of step 430 in the corresponding embodiment of FIG. 4;
FIG. 6 is a schematic flow chart of a cross-link platform interacting with a cross-link node of two chains to realize asset interchange;
FIG. 7 is a schematic flow chart of the cross-link platform interacting with the cross-link nodes of N chains to realize asset interchange;
FIG. 8 is a flowchart illustrating a method for exchanging data across chains according to another embodiment of the present application;
FIG. 9 is a schematic diagram of a cross-chain asset interchange flow based on a Hash time lock;
FIG. 10 is a block diagram of a cross-chain data interchange device according to an embodiment of the present application;
fig. 11 is a block diagram of a cross-chain data interchange device according to another embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be described below with reference to the drawings in the embodiments of the present application.
Like reference numbers and letters refer to like items in the following figures, and thus, once an item is defined in one figure, it need not be further defined and explained in subsequent figures. Meanwhile, in the description of the present application, the terms "first", "second", and the like are used only for distinguishing the description, and are not to be construed as indicating or implying relative importance.
Fig. 1 is a schematic architecture diagram of a cross-chain data interchange system according to an embodiment of the present invention, and as shown in fig. 1, the system includes a cross-chain platform 150 and a plurality of blockchain nodes 160. The plurality of blockchain nodes 160 belong to different blockchain networks. For example, one blockchain node 160 belongs to a first blockchain network and another blockchain node 160 belongs to a second blockchain network. Cross-chain platform 150 includes a plurality of cross-link points 151, and cross-link points 151 and block-link points 160 may be mining machines, desktop computers, laptop computers, servers. A plurality of blockchain nodes 160 communicatively coupled to the cross-chain platform 150.
The system may also include a client 140, and the client 140 may communicate with the blockchain node 160 to send proposal data to the blockchain node 160, such that the blockchain node 160 sends an asset swap request to the cross-chain platform 150. The proposal data may include a proposal identification, sender information (e.g., sender account number), receiver information (e.g., receiver account number), transaction assets (i.e., transfer amount), and the like.
Wherein, when receiving the asset interchange request containing the same proposal identifier sent by the multiple blockchain nodes 160, the cross-chain platform 150 sends a transaction preparation instruction to the multiple blockchain nodes 160; a plurality of blockchain nodes 160 receive the trade preparation instructions, lock the traded assets and return asset lock results.
When receiving that all of the plurality of blockchain nodes 160 return an asset locking success message, the inter-chain platform 150 sends a transaction commit instruction to the plurality of blockchain nodes 1460; the plurality of blockchain nodes 160 receive the transaction commit instruction, transfer the transaction asset and return a transaction success message.
And when receiving that the transaction success messages are returned by all the blockchain nodes 160, the cross-chain platform 150 determines that the asset interchange of the current round is finished.
In an embodiment, when receiving an asset locking failure message returned by at least one blockchain node, the inter-chain platform 150 may send a transaction rollback instruction to a plurality of blockchain nodes;
and the plurality of block chain nodes receive the transaction rollback instruction and unlock the locked transaction assets.
In the present application, the cross-chain platform is equivalent to a transaction manager, and the block link node is equivalent to a local resource manager. The cross-chain asset interchange applied to blockchains is implemented through a preparation phase (pre phase) and a commit phase (commit phase) in a similar fashion to database XA distributed transactions. Hash time locks are removed and execution efficiency is improved. XA is a distributed transaction protocol, proposed by Tuxedo. XA is roughly divided into two parts: a transaction manager and a local resource manager. Where local resource managers are often implemented by databases, such as Oracle, DB2, which all implement the XA interface that provides a standard interface for communication between resource managers and transaction managers. And the transaction manager is used as a global scheduler and is responsible for submitting and rolling back various local resources. The principle of XA implementing distributed transactions is shown in fig. 2.
In the first stage, the transaction manager sends a preparation instruction to a plurality of local resource managers, and after the preparation is successful, the local resource managers return a preparation success message to the practice manager. And in the second stage, the transaction manager sends a commit instruction to the local resource managers, and after the commit is completed, the local resource managers return a commit success message. Therefore, the cross-chain asset exchange can also realize asset exchange through a preparation stage and a submission stage, hash time locks are not needed, and execution efficiency is improved.
Fig. 3 is a schematic structural diagram of an electronic device provided in an embodiment of the present application. The electronic device may be used as a cross-chain platform or a block link point, and the electronic device 100 may be used to execute the cross-chain data interchange method provided by the embodiment of the present application. As shown in fig. 3, the electronic device 100 includes: one or more processors 102, and one or more memories 104 storing processor-executable instructions. Wherein the processor 102 is configured to execute the cross-chain data interchange method provided in the following embodiments of the present application.
The processor 102 may be a device containing a Central Processing Unit (CPU), a Graphics Processing Unit (GPU) or other form of processing unit having data processing capabilities and/or instruction execution capabilities, may process data for other components in the electronic device 100, and may control other components in the electronic device 100 to perform desired functions.
The memory 104 may include one or more computer program products that may include various forms of computer-readable storage media, such as volatile memory and/or non-volatile memory. The volatile memory may include, for example, Random Access Memory (RAM), cache memory (cache), and/or the like. The non-volatile memory may include, for example, Read Only Memory (ROM), hard disk, flash memory, etc. One or more computer program instructions may be stored on the computer-readable storage medium and executed by processor 102 to implement the cross-chain data interchange method described below. Various applications and various data, such as various data used and/or generated by the applications, may also be stored in the computer-readable storage medium.
In one embodiment, the electronic device 100 shown in FIG. 3 may also include an input device 106, an output device 108, and a data acquisition device 110, which may be interconnected via a bus system 112 and/or other form of connection mechanism (not shown). It should be noted that the components and structure of the electronic device 100 shown in fig. 3 are exemplary only, and not limiting, and the electronic device 100 may have other components and structures as desired.
The input device 106 may be a device used by a user to input instructions and may include one or more of a keyboard, a mouse, a microphone, a touch screen, and the like. The output device 108 may output various information (e.g., images or sounds) to the outside (e.g., a user), and may include one or more of a display, a speaker, and the like. The data acquisition device 110 may acquire an image of a subject and store the acquired image in the memory 104 for use by other components. Illustratively, the data acquisition device 110 may be a camera.
In an embodiment, the devices in the example electronic device 100 for implementing the cross-chain data interchange method according to the embodiment of the present application may be integrally disposed or may be separately disposed, such as the processor 102, the memory 104, the input device 106, and the output device 108 being integrally disposed, and the data acquisition device 110 being separately disposed.
In an embodiment, the example electronic device 100 for implementing the cross-chain data interchange method of the embodiments of the present application may be implemented as an intelligent device such as a computer, server, mining machine, or the like.
Fig. 4 is a schematic flowchart of a cross-chain data interchange method provided in an embodiment of the present application. The method may be performed by block link points. As shown in fig. 4, the flow includes steps S410 to S440.
Step S410: and the block chain node sends an asset interchange request to the cross-chain platform according to the proposal data sent by the client.
It should be noted that, during the initialization phase, the cross-chain platform can deploy xaLock intelligent contracts in the blockchain network respectively. The intelligent contract can be a contract of a solid implementation version, and can also be an intelligent contract of other forms in practical application, such as chain code. The input parameters of the intelligent contract are a fund contract address, for example, a1 asset contract address of the user A in the blockchain A and a2 asset contract address of the blockchain B, and the contract address, the k1 contract address of the blockchain A and the k2 contract address of the blockchain B are obtained after the deployment is completed. The cross-chain platform makes the link of each block chain node, and the fund contract of the block chain node needs to authorize the cross-chain contract of the cross-chain platform to have the right to operate the locked fund.
The proposal data may include, among other things, a proposal identification, sender information (e.g., sender account number), recipient information (e.g., recipient account number), transaction assets (i.e., transfer amount), and the like.
For example, the client of user a and the client of user B negotiate a proposal through interaction, and the chain a proposal data (called initiator proposal) may include: proposal identification t1, sender accountA1, recipient accountB1, and transfer amount 20 coin. The client of user a signs the proposal using the account accountA1 to facilitate uplink. For example, chain B proposal data (referred to as an adversary proposal) may include: proposal identification t1, sender accountB2, recipient accountA2, and transfer amount 10 coin. The client of user B signs the proposal with the account accountB2, facilitating the uplink. That is, user A needs to transfer 20 coins to user B in the A chain, and in exchange, user B needs to transfer 10 coins to user A in the B chain. The blockchain node may be one of the nodes of the a-chain or one of the nodes of the B-chain.
And the block chain link point receives proposal data sent by the client and can send an asset interchange request to the cross-chain platform. The asset interchange request may contain a proposal identification contained in the proposal data. The receipt of an asset swap request by the cross-chain platform may return transaction preparation instructions to the block chain nodes.
Step S420: and the block chain link point receives a transaction preparation instruction returned by the cross-chain platform in response to the asset interchange request.
Wherein the transaction preparation instructions may include a proposal identification.
Step S430: and the block link point responds to the transaction preparation instruction, locks the transaction assets indicated by the proposal data and returns asset locking results.
After receiving the transaction preparation instruction, the block link node can lock the transaction assets of the sender indicated in the proposal data corresponding to the proposal identifier according to the proposal identifier carried by the transaction preparation instruction. For example, "proposal identifier t1, sender accountB1, receiver accountB1, transfer amount 20 coin" may lock 20 coins whose account is accountA1 first. Locking means that the 20 coins are restricted to be transferred to account accountB 1. Regardless of whether the lock is successful, the blockchain node sends the asset lock result to the cross-chain platform. The result of the asset lock may be a lock success or a lock failure.
Step S440: and if the block link point receives a transaction submitting instruction returned by the cross-chain platform based on the asset locking result, transferring the transaction asset and returning a transaction success message.
And the transaction submitting instruction is sent by the cross-chain platform when receiving an asset locking success message returned by all the blockchain nodes participating in the asset interchange.
In one embodiment, a block chain node may send an asset lock success message to the cross-chain platform if the trading asset lock is successful, the asset lock success message being one of the asset lock results. If the transaction asset lock fails, the blockchain node may send an asset lock failure message to the cross-chain platform, the asset lock failure message being another asset lock result.
If a plurality of blockchain nodes participating in the round of asset interchange all send asset locking success messages to the cross-chain platform, the cross-chain platform can send transaction submission instructions to the blockchain nodes. The transaction submission instructions may include a proposal identification. After the block link node receives the transaction submitting instruction, the transaction assets locked by the sender account can be transferred to the received account according to the sender account and the receiver account indicated by the proposal data, and a transaction success message is sent to the cross-link platform. The transaction success message may include a proposal identification. And if the cross-link platform receives the transaction success messages sent by all the blockchain nodes, the asset interchange is finished. The block link point may delete the completed proposal data from the to-do proposal list.
According to the technical scheme provided by the embodiment of the application, the blockchain nodes in different blockchain networks can lock transaction assets and return asset locking results when transaction preparation instructions are received, and when all the blockchain nodes in different blockchain networks return asset locking success messages, the blockchain nodes can receive transaction submission instructions sent by a cross-chain platform and then perform asset transfer, so that the transaction safety is ensured, the asset exchange between different blockchain networks can be realized through two stages of locking and transferring, and the method is convenient and fast.
In an embodiment, as shown in fig. 5, the step S430 specifically includes steps S431 to S433.
Step S431: and responding to the transaction preparation instruction, and judging whether a sender indicated by the proposal data is an account corresponding to the client.
Step S432: and if the sender is the account corresponding to the client, judging whether the residual assets of the sender are more than or equal to the transaction assets.
Step S433: and if the residual assets of the sender are more than or equal to the transaction assets, locking the transaction assets indicated by the proposal data and returning an asset locking success message.
In one embodiment, the block link point may save the proposal data locally after the lock is successful.
Step S433': and if the sender is not the account corresponding to the client or the residual assets of the sender are smaller than the transaction assets, returning an asset locking failure message.
That is, the block link point needs to check whether the sender's account is the client's own account, whether the sender's account balance is sufficient, and if so, invoke the asset contract to lock the sender's transaction asset (transfer amount). For example, chain A locks 20 coins for user A's accountA1 account; chain B locks the 10 coins of user B's accountB2 account.
In one embodiment, assuming that a block link point does not receive a transaction commit command, but receives a transaction rollback command returned by the cross-chain platform based on the asset locking result, the block link point needs to unlock the locked transaction asset.
Wherein the transaction rollback instruction is issued by the cross-chain platform when at least one blockchain node participating in the asset interchange returns an asset locking failure message.
That is, if a block link point participating in an asset swap fails to lock a user's trading asset, an asset lock failure message is sent to the cross-link platform. And when the cross-chain platform receives the asset locking failure message, sending an exchange rollback instruction to all the block chain nodes. The transaction rollback instruction may include a proposal identification. And the block link receives the transaction rollback instruction and unlocks the locked transaction assets according to the locked transaction assets corresponding to the proposal identification. Unlocking is relative to locking, meaning that the transaction asset is not limited to being transferred to the recipient defined in the proposal data, but may also be transferred to other third persons. After the block chain node completes unlocking, an unlocking success message can be sent to the cross-chain platform, and the round of asset exchange ends in failure.
Fig. 6 is a schematic flow chart illustrating a process of implementing the exchange of assets between two chains by the interaction between the cross-chain platform and the cross-link nodes of the two chains, and implementing the transfer from the user a to the user B in the chain a, and the transfer from the user B to the user a in the chain B. FIG. 7 is a schematic flowchart of a process for implementing asset interchange of N users in N chains by interaction between a cross-chain platform and cross-link nodes in N chains.
As can be seen from fig. 6 and 7, as follows: users of different chains, user 1, user 2, and user N negotiate a proposal (as follows), and the proposal goes through the pre stage-asset locking uplink, commit stage, and asset transfer uplink processes to complete the asset interchange.
Chain a proposal details (called initiator proposal): { proposal taskId: t1, sender accountX1, receiver accountY1, transfer amount 20coin }.
Chain B proposal details (called counterparty proposal): { proposal taskId: t1, sender accountY2, receiver accountZ2, transfer amount 10coin }.
Chain N proposal details (called counterparty proposal): { proposal taskId: t1, sender accountZn, receiver accountRnn, transfer amount n _ in }.
Pre stage: the assets between all chains are locked simultaneously, and all the locks are known to be successful; the transfer is then carried out during the commit phase. Therefore, the method realizes cross-chaining through an XA two-stage transaction mode, unifies the original scheme (proposal and locking step) of the Hash time lock into pre-stage operation, unifies the transfer step into the submission stage operation, achieves cross-chaining interchange of assets, removes Hash limitation and time limitation, and achieves improvement of execution efficiency and reliability of transactions.
Fig. 8 is a flowchart illustrating a cross-chain data interchange method according to another embodiment of the present application. As shown in fig. 8, the method may be performed by a cross-chain platform interacting with a plurality of blockchain nodes belonging to different blockchain networks. The method includes the following steps S810 to S830.
Step S810: when a cross-chain platform receives an asset interchange request containing the same proposal identification sent by a plurality of block chain nodes, sending an exchange preparation instruction to the plurality of block chain nodes; and triggering the plurality of block link points to lock the transaction assets and returning asset locking results when the transaction preparation instruction is sent. Wherein, sending a plurality of block link points containing the same proposal identifier can be regarded as a plurality of block link nodes participating in the round of asset exchange.
Step S820: when the cross-chain platform receives that all the block chain nodes return asset locking success messages, a transaction submitting instruction is sent to the block chain nodes; and triggering the plurality of block chain nodes to transfer the transaction assets and returning a transaction success message when the transaction submission instruction is sent.
Step S820': when the cross-chain platform receives an asset locking failure message returned by at least one block chain node, sending an exchange rollback instruction to the plurality of block chain nodes; and triggering the plurality of block link points to unlock the transaction assets through the transmission of the transaction submission instruction.
Step S830: and when the cross-chain platform receives that the plurality of blockchain nodes all return transaction success messages, determining that the asset interchange of the current round is finished.
The above-mentioned cross-link data interchange method performed by the cross-link platform may refer to the above-mentioned cross-link data interchange method embodiment performed by the block link point.
To fully embody the technical effects of the cross-chain data interchange method provided by the embodiment of the present application, fig. 9 shows a cross-chain asset interchange process based on a hash time lock.
Background: chain a account number: a user A holds an account 1 and an asset 1000, and a user B holds an account 2; chain B account number: user B holds account 3, asset 800, and user a holds account 4.
The target is as follows: through the cross-chain platform, account 1 transfers 500 to account 2 in chain A, account 3 transfers 300 to account 4 in chain B, and cross-chain asset exchange is achieved in sequence.
Specifically, the hash time lock cross-chain transfer process is as follows:
1. the user A firstly selects a secret key random number S, calculates the hash value H of the S by using a hash algorithm to be used as a proposal number, sends the H to the user B, and simultaneously negotiates two time points T0 and T1 by the user A and the user B to ensure that T0 is greater than T1. (proposal flow)
2. The cross-chain platform locks user a 'S asset (1000) to a hash time lock contract (htllock. sol) based on an H proposal, the intelligent contract locks user a' S asset, can be transferred to user B using key S for time T0, and if not unlocked before T0, the lock is automatically released without any asset transfer. (locking procedure)
3. The cross-chain platform locks user B 'S asset (800) to a hash time lock contract (htllock. sol) based on an H proposal, the smart contract will lock user B' S asset, may be transferred to user a within time T1 using key S, will automatically undo the lock if not unlocked before T1, and there will not be any asset transfer. (locking procedure)
4. After the two parties complete locking at the same time, the cross-link node uses the random number S of A, calls the intelligent contract of the Hash time lock on B, and transfers the asset (800) to A. (transfer procedure)
5. Through the steps, the key random number S is obtained by the key B, the S obtained by the key B is used by the cross-chain node, the asset (1000) is transferred to the key B, and asset exchange is completed. (transfer procedure)
6. If either A or B does not execute the operation after time out, the B asset will cancel the lock after T1 time point, and the A asset will cancel the lock and restore the initial state after T0 time point. (rollback procedure)
The hash time lock ensures the safety of user funds, but the execution flow is complex (proposal, locking, transfer and rollback), each step involves complex uplink operation, and the hash lock and the time lock are all relied on. The transfer process must be performed serially between chains, which is time inefficient. Asset locking and asset transfer between chains cannot occur simultaneously.
And through a mode similar to database XA distributed transaction, the method is applied to cross-chain asset interchange of the block chain, and is realized through a preparation stage and a submission stage, so that the removal of a hash time lock, asset locking among chains and asset transfer can be simultaneously carried out, and the execution efficiency is improved.
The following is an embodiment of the apparatus of the present application, which can be used to execute the above-mentioned embodiments of the cross-link data interchange method of the present application. For details not disclosed in the embodiments of the apparatus of the present application, please refer to the embodiments of the cross-link data interchange method of the present application.
Fig. 10 is a block diagram of a cross-chain data interchange device according to an embodiment of the present application. The apparatus may be applied to a blockchain node, as shown in fig. 10, and includes: a request sending module 910, an instruction receiving module 920, an asset locking module 930, and an asset transfer module 940.
A request sending module 910, configured to send an asset interchange request to the cross-chain platform according to the proposal data sent by the client;
an instruction receiving module 920, configured to receive a transaction preparation instruction returned by the cross-chain platform in response to the asset interchange request;
an asset locking module 930, configured to lock the transaction asset indicated by the proposal data and return an asset locking result in response to the transaction preparation instruction;
an asset transfer module 940, configured to transfer the transaction asset and return a transaction success message if a transaction submission instruction returned by the cross-chain platform based on the asset locking result is received;
and the transaction submitting instruction is sent by the cross-chain platform when receiving an asset locking success message returned by all the blockchain nodes participating in the asset interchange.
Fig. 11 is a block diagram of a cross-chain data interchange device according to another embodiment of the present application. The device can be applied to a chain-spanning platform, the chain-spanning platform interacts with a plurality of block chain nodes, and the block chain nodes belong to different block chain networks; as shown in fig. 11, the apparatus may include: a preparation instruction sending module 1010, a commit instruction sending module 1020, and a success message receiving module 1030.
A preparation instruction sending module 1010, configured to send an exchange preparation instruction to the plurality of block nodes when receiving an asset interchange request including the same proposal identifier sent by the plurality of block nodes; the transaction preparation instruction is sent to trigger the plurality of block chain link points to lock transaction assets and return asset locking results;
a commit instruction sending module 1020, configured to send a transaction commit instruction to the plurality of blockchain nodes when receiving that all of the plurality of blockchain nodes return asset locking success messages; the transaction submitting instruction is sent to trigger the block chain nodes to transfer the transaction assets and return a transaction success message;
and a success message receiving module 1030, configured to determine that the asset interchange of the current round is finished when receiving that all the block chain nodes return the transaction success message.
The implementation process of the functions and actions of each module in the above device is specifically detailed in the implementation process of the corresponding step in the above cross-link data exchange method, and is not described herein again.
In the embodiments provided in the present application, the disclosed apparatus and method can be implemented in other ways. The apparatus embodiments described above are merely illustrative, and for example, the flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of apparatus, methods and computer program products according to various embodiments of the present application. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). In some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
In addition, functional modules in the embodiments of the present application may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.
The functions, if implemented in the form of software functional modules and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present application or portions thereof that substantially contribute to the prior art may be embodied in the form of a software product stored in a storage medium and including instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.

Claims (12)

1. A method of inter-chain data exchange, the method being performed by a block chain node, the method comprising:
according to proposal data sent by a client, sending an asset interchange request to a cross-chain platform;
receiving a transaction preparation instruction returned by the cross-chain platform in response to the asset interchange request;
responding to the transaction preparation instruction, locking the transaction assets indicated by the proposal data and returning asset locking results;
if a transaction submitting instruction returned by the cross-chain platform based on the asset locking result is received, transferring the transaction asset and returning a transaction success message;
and the transaction submitting instruction is sent by the cross-chain platform when receiving an asset locking success message returned by all the blockchain nodes participating in the asset interchange.
2. The method of claim 1, wherein locking the traded asset indicated by the proposal data and returning an asset locking result in response to the trade preparation instructions comprises:
responding to the transaction preparation instruction, and judging whether a sender indicated by the proposal data is an account corresponding to the client;
if the sender is the account corresponding to the client, judging whether the residual assets of the sender are more than or equal to the transaction assets;
and if the residual assets of the sender are more than or equal to the transaction assets, locking the transaction assets indicated by the proposal data and returning an asset locking success message.
3. The method of claim 2, further comprising:
and if the sender is not the account corresponding to the client or the residual assets of the sender are smaller than the transaction assets, returning an asset locking failure message.
4. The method of claim 2, wherein after locking the transactional asset indicated by the proposal data, the method further comprises:
storing the proposal data locally at the block link point.
5. The method of claim 1, further comprising:
if a transaction rollback instruction returned by the cross-chain platform based on the asset locking result is received, unlocking the locked transaction asset;
the transaction rollback instruction is sent by the cross-chain platform when at least one blockchain node participating in asset interchange returns an asset locking failure message.
6. The method of claim 1, wherein after said transferring said transaction asset, said method further comprises:
deleting the proposal data from the to-be-completed proposal list.
7. A method for exchanging cross-chain data is characterized in that the method is executed by a cross-chain platform, the cross-chain platform interacts with a plurality of block chain nodes, and the block chain nodes belong to different block chain networks; the method comprises the following steps:
when receiving an asset interchange request containing the same proposal identification sent by the plurality of block chain nodes, sending an exchange preparation instruction to the plurality of block chain nodes; the transaction preparation instruction is sent to trigger the plurality of block chain link points to lock transaction assets and return asset locking results;
when receiving that all the block chain nodes return asset locking success information, sending transaction submitting instructions to the block chain nodes; the transaction submitting instruction is sent to trigger the block chain nodes to transfer the transaction assets and return a transaction success message;
and when receiving that the plurality of block chain nodes all return transaction success messages, determining that the asset interchange of the current round is finished.
8. The method of claim 7, further comprising:
when receiving at least one block chain node point return asset locking failure message, sending transaction rollback instructions to the plurality of block chain node points;
and triggering the plurality of block link points to unlock the transaction assets through the transmission of the transaction submission instruction.
9. A cross-chain data interchange system, comprising:
a cross-chain platform;
a plurality of blockchain nodes communicatively coupled to the inter-chain platform; the plurality of block chain nodes belong to different block chain networks respectively;
the cross-chain platform is used for sending transaction preparation instructions to the plurality of block chain nodes when receiving asset interchange requests containing the same proposal identification sent by the plurality of block chain nodes; when receiving a message that all the block chain nodes return asset locking success, sending a transaction submitting instruction to the block chain nodes;
the block chain nodes are used for receiving the transaction preparation instruction, locking a transaction asset and returning an asset locking result; receiving the transaction submitting instruction, transferring the transaction assets and returning a transaction success message;
and the cross-chain platform is further used for determining that the asset interchange of the current round is finished when the transaction success messages returned by the block chain nodes are received.
10. An inter-chain data exchange device, the device being applied to a blockchain node, the device comprising:
the request sending module is used for sending an asset interchange request to the cross-chain platform according to the proposal data sent by the client;
the instruction receiving module is used for receiving a transaction preparation instruction returned by the cross-chain platform in response to the asset interchange request;
the asset locking module is used for responding to the transaction preparation instruction, locking the transaction assets indicated by the proposal data and returning asset locking results;
the asset transfer module is used for transferring the transaction asset and returning a transaction success message if a transaction submission instruction returned by the cross-chain platform based on the asset locking result is received;
and the transaction submitting instruction is sent by the cross-chain platform when receiving an asset locking success message returned by all the blockchain nodes participating in the asset interchange.
11. An electronic device, characterized in that the electronic device comprises:
a processor;
a memory for storing processor-executable instructions;
wherein the processor is configured to perform the cross-chain data interchange method of any one of claims 1-8.
12. A computer-readable storage medium, wherein the storage medium stores a computer program, the computer program being executable by a processor to perform the method for cross-chain data interchange of any one of claims 1-8.
CN202110202966.3A 2021-02-23 2021-02-23 Cross-link data interchange method, system, device and electronic equipment Pending CN112927073A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110202966.3A CN112927073A (en) 2021-02-23 2021-02-23 Cross-link data interchange method, system, device and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110202966.3A CN112927073A (en) 2021-02-23 2021-02-23 Cross-link data interchange method, system, device and electronic equipment

Publications (1)

Publication Number Publication Date
CN112927073A true CN112927073A (en) 2021-06-08

Family

ID=76170494

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110202966.3A Pending CN112927073A (en) 2021-02-23 2021-02-23 Cross-link data interchange method, system, device and electronic equipment

Country Status (1)

Country Link
CN (1) CN112927073A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113763178A (en) * 2021-09-24 2021-12-07 成都质数斯达克科技有限公司 Multi-block chain cross-chain transaction method, device, equipment and readable storage medium
WO2023229765A1 (en) * 2022-05-24 2023-11-30 Mastercard International Incorporated Method and system for processing an asset swap across two blockchains
WO2024103856A1 (en) * 2022-11-14 2024-05-23 腾讯科技(深圳)有限公司 Blockchain-based data processing method, and device and readable storage medium

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106899698A (en) * 2017-04-11 2017-06-27 张铮文 A kind of across chain mutual operation method between block chain
CN107679857A (en) * 2017-10-10 2018-02-09 马晶瑶 Across the chain method of commerce and storage medium of block chain
CN110266655A (en) * 2019-05-30 2019-09-20 中国工商银行股份有限公司 A kind of across chain interconnected method, equipment and system based on block chain
CN111080449A (en) * 2019-12-03 2020-04-28 深圳前海微众银行股份有限公司 Block chain cross-chain transaction method, management node and block chain network
CN111210350A (en) * 2020-01-03 2020-05-29 平安科技(深圳)有限公司 Block chain transaction method and device, computer equipment and storage medium
CA3149396A1 (en) * 2019-08-06 2021-02-11 Zeu Technologies, Inc. Distributed blockchain transaction system

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106899698A (en) * 2017-04-11 2017-06-27 张铮文 A kind of across chain mutual operation method between block chain
CN107679857A (en) * 2017-10-10 2018-02-09 马晶瑶 Across the chain method of commerce and storage medium of block chain
CN110266655A (en) * 2019-05-30 2019-09-20 中国工商银行股份有限公司 A kind of across chain interconnected method, equipment and system based on block chain
CA3149396A1 (en) * 2019-08-06 2021-02-11 Zeu Technologies, Inc. Distributed blockchain transaction system
WO2021022369A1 (en) * 2019-08-06 2021-02-11 Zeu Crypto Networks Inc. Distributed blockchain transaction system
CN111080449A (en) * 2019-12-03 2020-04-28 深圳前海微众银行股份有限公司 Block chain cross-chain transaction method, management node and block chain network
CN111210350A (en) * 2020-01-03 2020-05-29 平安科技(深圳)有限公司 Block chain transaction method and device, computer equipment and storage medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
李昭原: "《数据库技术新进展》", 31 May 1997, 清华大学出版社, pages: 82 *

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113763178A (en) * 2021-09-24 2021-12-07 成都质数斯达克科技有限公司 Multi-block chain cross-chain transaction method, device, equipment and readable storage medium
WO2023229765A1 (en) * 2022-05-24 2023-11-30 Mastercard International Incorporated Method and system for processing an asset swap across two blockchains
WO2024103856A1 (en) * 2022-11-14 2024-05-23 腾讯科技(深圳)有限公司 Blockchain-based data processing method, and device and readable storage medium

Similar Documents

Publication Publication Date Title
CN112927073A (en) Cross-link data interchange method, system, device and electronic equipment
CN112837048B (en) Cross-block-chain data processing method, device, equipment and computer storage medium
CN110199302B (en) Event-driven blockchain workflow processing
CN111213340B (en) Selecting attestation delegation for cryptographic functions and making it secure
CN109087080B (en) Cross-chain transaction method, device and storage medium
US20230421355A1 (en) Systems and methods for storage, generation and verification of tokens used to control access to a resource
US7356532B2 (en) Systems and methods for maintaining transactional persistence
US20200294009A1 (en) Blockchain-based state machine maintenance
CN110502319B (en) Distributed transaction processing method and device, electronic equipment and storage medium
CN110770770A (en) Method and system for mining blockchain transactions provided by verifier nodes
US20220284011A1 (en) Distributed blockchain transaction system
WO2020224235A1 (en) Cross-chain transaction method and apparatus, device, and storage medium
EP3852040B1 (en) Blockchain transfer processing method and apparatus, device, and medium
CN112688799B (en) Redis cluster-based client number distribution method and distribution device
CA3041211C (en) Utilizing nonce table to resolve concurrent blockchain transaction failure
CN112053149A (en) Method and device for preventing repeated payment, electronic equipment and readable storage medium
CN108762895B (en) Method and device for processing distributed transaction
CN114327799B (en) Distributed transaction processing method and device, electronic equipment and storage medium
CN111597077A (en) Data processing method, data processing device, computer equipment and storage medium
US20200202349A1 (en) Multiple asset transactions
CN111639309A (en) Data processing method and device, node equipment and storage medium
US6934948B2 (en) System and method for grouping diverse operations
CN112995262A (en) Distributed transaction submission method, system and computing equipment
US20200202344A1 (en) Private asset transactions
CN113377875A (en) Cross-link data processing method and device, electronic equipment and readable storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination