CN112491959B - Cross-link resource exchange method, device and system based on relay link - Google Patents

Cross-link resource exchange method, device and system based on relay link Download PDF

Info

Publication number
CN112491959B
CN112491959B CN202011168318.2A CN202011168318A CN112491959B CN 112491959 B CN112491959 B CN 112491959B CN 202011168318 A CN202011168318 A CN 202011168318A CN 112491959 B CN112491959 B CN 112491959B
Authority
CN
China
Prior art keywords
transaction
chain
cross
state
request
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.)
Active
Application number
CN202011168318.2A
Other languages
Chinese (zh)
Other versions
CN112491959A (en
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.)
Hangzhou Qulian Technology Co Ltd
Original Assignee
Hangzhou Qulian Technology 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 Hangzhou Qulian Technology Co Ltd filed Critical Hangzhou Qulian Technology Co Ltd
Priority to CN202011168318.2A priority Critical patent/CN112491959B/en
Publication of CN112491959A publication Critical patent/CN112491959A/en
Application granted granted Critical
Publication of CN112491959B publication Critical patent/CN112491959B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/104Peer-to-peer [P2P] networks
    • 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
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/08Network architectures or network communication protocols for network security for authentication of entities
    • H04L63/0876Network architectures or network communication protocols for network security for authentication of entities based on the identity of the terminal or configuration, e.g. MAC address, hardware or software configuration or device fingerprint
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/104Peer-to-peer [P2P] networks
    • H04L67/1061Peer-to-peer [P2P] networks using node-based peer discovery mechanisms
    • H04L67/1065Discovery involving distributed pre-established resource-based relationships among peers, e.g. based on distributed hash tables [DHT] 
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/32Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials
    • H04L9/3247Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials involving digital signatures
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/50Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols using hash chains, e.g. blockchains or hash trees

Abstract

The application relates to a method, a device and a system for cross-link resource exchange based on a relay link. The method comprises the following steps: receiving a request transaction initiated by a transaction requesting party, generating a cross-chain transaction according to the request transaction, setting the state of the cross-chain transaction as an initial state, receiving the participation transaction of a transaction participating party, updating the state of the cross-chain transaction to a submission state, generating a submission message body containing a cross-chain transaction identifier and the submission state, respectively sending the submission message body to the transaction requesting party and the transaction participating party, and executing exchange of transaction resources after the transaction requesting party and the transaction participating party receive the submission message body. By adopting the method, the dependency of the cross-chain resource exchange on time can be eliminated, the initiator and the participator of the transaction carry out resource exchange under the condition of receiving the submitted message body, and the atomicity of the cross-chain transaction is realized.

Description

Cross-link resource exchange method, device and system based on relay link
Technical Field
The present application relates to the field of block chain technologies, and in particular, to a method, an apparatus, a system, a computer device, and a storage medium for cross-link resource exchange based on a relay chain.
Background
The current cross-link resource exchange mainly uses a hash time locking technology. A Hash Time Lock (Hash Time Locked Contract, HTLC for short) is a cross-chain atomic exchange protocol. It completes point-to-point cross-chain interchange among users in a decentralized mode. The main principle of the technology is as follows: suppose users a and B have resources on block chains ChainA and ChainB, respectively, and want to perform resource exchange. User a generates a random value S, calculates its hash value H, tells user B the random value, and a and B negotiate two times T1 and T2, with T1 being later than T2.A and B lock the resource to the intelligent contract on each chain, and stipulate the other party can only obtain the resource if providing the correct original text of the hash value H within a specific time, if overtime, return the resource to the locker. And A provides S to the intelligent contract of chain ChainB before T2 time to obtain the resource of the user B, B obtains the original text S of the hash value H at the moment, and provides S to the intelligent contract of chain ChainA before T1 time to obtain the resource of the user A.
However, the hash time lock technique has the following disadvantages: if the user B cannot provide S to the chain ChainA intelligent contract before T1 time due to network problems, device problems, or user forgetting, the user B cannot obtain resources. At this time, the user a successfully acquires the resource, but the user B fails to acquire the resource, so that the scheme cannot guarantee atomicity of the cross-chain transaction. In addition, the technology is time-dependent, but the block-out time of many blockchains, especially alliance chains, is not fixed, so that the blockchains participating in the resource exchange cannot have a uniform time standard. In which case the solution cannot be used.
Aiming at the problem of strong time dependence of cross-link resource exchange in the related technology, no effective solution is provided at present.
Disclosure of Invention
In view of the foregoing, it is necessary to provide a method, an apparatus, a system, a computer device, and a storage medium for exchanging cross-link resources based on a relay link.
In a first aspect, an embodiment of the present application provides a method for exchanging cross-link resources based on a relay link, where the method includes:
receiving a request transaction initiated by a transaction requester, generating a cross-chain transaction according to the request transaction, and setting the state of the cross-chain transaction as an initial state, wherein the request transaction comprises the transaction requester, a transaction participant, a transaction resource and a cross-chain transaction identifier, and the cross-chain transaction identifier corresponds to the cross-chain transaction;
receiving a participation transaction of the transaction participant, updating the state of the cross-chain transaction to a commit state, and generating a commit message body containing the cross-chain transaction identifier and the commit state, wherein the participation transaction is a transaction generated by the transaction participant after receiving the request transaction;
and respectively sending the submission message body to the transaction requesting party and the transaction participating party, wherein the transaction requesting party and the transaction participating party execute the exchange of transaction resources after receiving the submission message body.
In one embodiment, after the setting the state of the cross-chain transaction to the initial state, the method further includes:
and sending a cross-chain message to the transaction participant, wherein the transaction participant generates the participation transaction according to the cross-chain message, the cross-chain message is generated according to the request transaction, and the cross-chain message comprises the transaction requester, the transaction participant, the transaction resource and the cross-chain transaction identifier.
In one embodiment, after generating the commit message body including the cross-chain transaction identifier and the commit status, the method further comprises:
and signing the submitted message body to obtain signature content, and respectively sending the signature content to the transaction requesting party and the transaction participating party, wherein the transaction requesting party and the transaction participating party execute exchange of the transaction resources after verifying the signature content.
In one embodiment, the receiving a request transaction initiated by a transaction requester, generating a cross-chain transaction according to the request transaction, and setting a state of the cross-chain transaction to an initial state includes:
receiving a request transaction initiated by a transaction requester, and initializing a cross-chain transaction according to the request transaction under the condition that the authentication of the transaction requester is passed and the asset freezing of the transaction resource is completed by the transaction requester, wherein the transaction resource is a transaction asset.
In one embodiment, after the generating a cross-chain transaction according to the request transaction and setting the state of the cross-chain transaction as an initial state, the method further includes:
receiving an undo transaction, and inquiring the state of the cross-chain transaction according to the cross-chain transaction identifier in the undo transaction;
changing the state of the cross-chain transaction into a rollback state under the condition that the state of the cross-chain transaction is an initialization state, and generating a rollback message body containing the cross-chain transaction identifier and the rollback state;
and signing the rollback message body, sending the signed rollback message body to the transaction participant, and executing transaction rollback by the transaction participant according to the rollback message body.
In one embodiment, after querying the state of the cross-chain transaction according to the cross-chain transaction identifier in the undo transaction, before generating a rollback message body containing the cross-chain transaction identifier and the rollback state, the method further includes:
verifying the initiator of the revocation transaction when the state of the cross-chain transaction is an initialization state;
and changing the state of the cross-chain transaction into a rollback state under the condition that the initiator of the reversal transaction is the transaction requester or the transaction participant.
In a second aspect, an embodiment of the present application further provides a method for exchanging cross-link resources based on a relay link, where the method includes:
a first application chain initiates a request transaction, wherein the request transaction comprises the first application chain, a transaction participant, a transaction resource and a cross-chain transaction identifier;
a relay chain receives the request transaction, generates a cross-chain transaction according to the cross-chain transaction identifier, sets the state of the cross-chain transaction as an initial state, and sends a cross-chain message to a second application chain, wherein the cross-chain transaction identifier corresponds to the cross-chain transaction, and the transaction participant comprises the second application chain;
the second application chain receives the cross-chain message, generates a participation transaction and sends the participation transaction to the relay chain;
the relay chain receives the participation transaction, updates the state of the cross-chain transaction to a submission state, generates a submission message body containing the cross-chain transaction identifier and the submission state, and sends the submission message body to the first application chain and the second application chain;
the first application chain and the second application chain perform the transaction resource exchange upon receiving the submission message body.
In one embodiment, after generating the commit message body containing the cross-chain transaction identifier and the commit status, the method includes:
signing the submitted message body to obtain signature contents, and respectively sending the signature contents to the first application chain and the second application chain;
and the first application chain and the second application chain verify the signature content after receiving the signature content, and perform exchange of the transaction resources under the condition of passing the verification.
In one embodiment, the method further comprises:
the first application chain receives a first transaction, generates the request transaction according to the first transaction and freezes assets according to the transaction resources in the request transaction, wherein the frozen assets correspond to the cross-chain transaction identifier, and the transaction resources are transaction assets;
the second application link receives the cross-chain message to generate a participation transaction, performs asset freezing according to the cross-chain message, wherein the frozen asset corresponds to the cross-chain transaction identifier, and sends the participation transaction to the relay link, and the cross-chain message comprises the transaction asset and the cross-chain transaction identifier;
and after receiving the submission message body, the first application chain and the second application chain acquire the frozen assets according to the cross-link transaction identifier in the submission message body and perform asset exchange.
In a third aspect, an embodiment of the present application provides a relay link-based cross-link resource switching apparatus, where the apparatus includes an initialization module, a submission module, and a sending module:
the initialization module is used for receiving a request transaction initiated by a transaction requester, generating a cross-chain transaction according to the request transaction, and setting the state of the cross-chain transaction as an initial state, wherein the request transaction comprises the transaction requester, a transaction participant, a transaction asset and a cross-chain transaction identifier, and the cross-chain transaction identifier corresponds to the cross-chain transaction;
the commit module is used for receiving a participation transaction of the transaction participant, updating the state of the cross-chain transaction to a commit state, and generating a commit message body containing the cross-chain transaction identifier and the commit state, wherein the participation transaction is a transaction generated by the transaction participant after receiving the request transaction;
the sending module is used for sending the submission message body to the transaction requesting party and the transaction participating party respectively, wherein the transaction requesting party and the transaction participating party execute the exchange of the transaction resources after receiving the submission message body.
In a fourth aspect, an embodiment of the present application provides a system for exchanging cross-link resources based on a relay link, where the system includes a relay link, and the relay link is configured to receive a request transaction initiated by a transaction requester, generate a cross-link transaction according to the request transaction, set a state of the cross-link transaction to an initial state, receive a participation transaction of a transaction participant, update a state of the cross-link transaction to a commit state, generate a commit message body including a cross-link transaction identifier and the commit state, and send the commit message body to the transaction requester and the transaction participant respectively, where the request transaction includes the transaction requester, the transaction participant, a transaction resource, and a cross-link transaction identifier, the cross-link transaction identifier corresponds to the cross-link transaction, the participation transaction is a transaction generated by the transaction participant after receiving the request transaction, and the transaction participant performs exchange of the transaction resource after receiving the commit message body.
In a fifth aspect, the present application provides a computer device, which includes a memory, a processor, and a computer program stored on the memory and executable on the processor, and when the processor executes the computer program, the processor implements the relay link-based cross-link resource exchange method described above.
In a sixth aspect, an embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements the relay link-based cross-link resource exchange method described above.
According to the relay link-based cross-link resource exchange method, the device, the computer equipment and the storage medium, by receiving a request transaction initiated by a transaction request party, generating a cross-link transaction according to the request transaction, setting the state of the cross-link transaction as an initial state, receiving a participation transaction of a transaction participant, updating the state of the cross-link transaction to a submission state, generating a submission message body containing a cross-link transaction identifier and the submission state, and respectively sending the submission message body to the transaction request party and the transaction participant, wherein the transaction request party and the transaction participant execute exchange of transaction resources after receiving the submission message body, so that the time dependency of cross-link resource exchange is removed, and the initiator and the participant of the transaction perform resource exchange under the condition of receiving the submission message body, thereby realizing the atomicity of the cross-link transaction.
Drawings
The accompanying drawings, which are included to provide a further understanding of the application and are incorporated in and constitute a part of this application, illustrate embodiment(s) of the application and together with the description serve to explain the application and not to limit the application. In the drawings:
fig. 1 is an application scenario diagram of a relay link-based cross-link resource exchange method according to an embodiment of the present invention;
FIG. 2 is a flow chart of a method for cross-link resource exchange based on a relay link according to an embodiment of the invention;
FIG. 3 is a flow chart of a message body signature submission in a relay chain-based cross-link resource exchange method according to an embodiment of the invention;
FIG. 4 is a flowchart of resource exchange revocation in a relay link-based cross-link resource exchange method according to an embodiment of the present invention;
FIG. 5 is a flow chart of a relay link based cross-link resource exchange method according to another embodiment of the present invention;
FIG. 6 is a timing diagram of a relay chain based cross-link resource exchange method in accordance with a preferred embodiment of the present invention;
fig. 7 is a schematic structural diagram of a relay link-based cross-link resource switching apparatus according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more clearly understood, the present application is described and illustrated below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of and not restrictive on the broad application. All other embodiments obtained by a person of ordinary skill in the art based on the embodiments provided in the present application without any inventive step are within the scope of protection of the present application.
It is obvious that the drawings in the following description are only examples or embodiments of the present application, and that it is also possible for a person skilled in the art to apply the present application to other similar contexts on the basis of these drawings without inventive effort. Moreover, it should be appreciated that in the development of any such actual implementation, as in any engineering or design project, numerous implementation-specific decisions must be made to achieve the developers' specific goals, such as compliance with system-related and business-related constraints, which may vary from one implementation to another.
Reference in the specification to "an embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment can be included in at least one embodiment of the specification. The appearances of the phrase in various places in the specification are not necessarily all referring to the same embodiment, nor are separate or alternative embodiments mutually exclusive of other embodiments. Those of ordinary skill in the art will explicitly and implicitly appreciate that the embodiments described herein may be combined with other embodiments without conflict.
Unless defined otherwise, technical or scientific terms referred to herein shall have the ordinary meaning as understood by those of ordinary skill in the art to which this application belongs. The use of the terms "a" and "an" and "the" and similar referents in the context of describing the invention (including a single reference) are to be construed in a non-limiting sense as indicating either the singular or the plural. The present application is directed to the use of the terms "including," "comprising," "having," and any variations thereof, which are intended to cover non-exclusive inclusions; for example, a process, method, system, article, or apparatus that comprises a list of steps or modules (elements) is not limited to the listed steps or elements, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus. Reference to "connected," "coupled," and the like in this application is not intended to be limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. The term "plurality" as referred to herein means two or more. "and/or" describes the association relationship of the associated object, indicating that there may be three relationships, for example, "a and/or B" may indicate: a exists alone, A and B exist simultaneously, and B exists alone. The character "/" generally indicates that the former and latter associated objects are in an "or" relationship. Reference herein to the terms "first," "second," "third," and the like, are merely to distinguish similar objects and do not denote a particular ordering for the objects.
Fig. 1 is a diagram of an application scenario of a relay link-based cross-link resource exchange method according to an embodiment of the present invention, and the method embodiment provided in this embodiment may be applied to the scenario shown in fig. 1. As shown in fig. 1, the application scenario of cross-chain resource exchange includes a relay chain 102, an application chain a104, and an application chain B106, where the application chain a104 and the application chain B106 are two parts for performing cross-chain resource atomic exchangeA block chain; the relay chain 102 is a blockchain for access participation in cross-chain, is a special-purpose application chain, and can be used for realizing verification and routing of cross-chain transactions. In the above exchange of cross-chain resources, the cross-chain resources may be information, funds, assets, or the like held by each application chain. Application chain a104 and application chain B106, which do the cross-chain resource atomic exchange, need to register the IDs of the application chains on relay chain 102. Node a 112 corresponding to user a is on application chain a and user a holds resource a, node B122 corresponding to user B is on application chain B and user B holds resource B, user a wants to exchange resource B of user B with resource a. Wherein, the user A has accounts on both the application chain A104 and the application chain B106, and the user B has accounts on both the application chain A104 and the application chain B106. Application chain a104 and application chain B106 use relay chain 102 to implement verification and routing of cross-chain transactions, and the IDs registered by application chain a104 and application chain B106 on relay chain 102 are ChainIDa and ChainIDb, respectively. A resource exchange management contract SC is deployed on the relay chain 102 r . It should be noted that the application scenario diagrams described above are not used to limit the relay chain-based cross-link resource exchange method, for example, in an implementation application, the number of application chains may be greater than two.
In an embodiment, fig. 2 is a flowchart of a relay link-based cross-link resource exchange method according to an embodiment of the present invention, and as shown in fig. 2, a relay link-based cross-link resource exchange method is provided, which is described by taking the relay link 102 in the application scenario in fig. 1 as an example, and includes the following steps:
step S210, the relay link receives the request transaction initiated by the transaction request party, generates a cross-link transaction according to the request transaction, and sets the state of the cross-link transaction as an initial state. For example, the transaction requester is application chain a, and the request transaction includes the transaction requester, the transaction participants, the transaction resource, and the cross-chain transaction identifier. Request transaction submitting to relay chain, calling relay chain resource exchange management contract SC r According to the cross-chain transaction identifier in the request transaction, registering the corresponding transaction request content to the resource exchange management contract SC r And is arranged atThe cross-chain transaction state corresponding to the cross-chain transaction identifier is an initial state (INIT). Optionally, the transaction request content includes a registration ID of an application chain corresponding to the transaction requesting party on the intermediate chain, a registration ID of an application chain corresponding to the transaction participating party on the intermediate chain, a transaction resource of the transaction requesting party, a transaction resource of the transaction participating party, and the like.
In some embodiments, in the case that the transaction resource is a transaction asset, the relay link receives a request transaction initiated by a transaction requester, and the process of initializing a cross-link transaction according to the request transaction further includes: and receiving a request transaction initiated by a transaction request party, and initializing a cross-chain transaction according to the request transaction under the conditions that the identity of the transaction request party is verified and the transaction request party completes fund freezing. In this embodiment, when the request transaction is submitted to the relay link, the resource exchange management contract SC of the relay link is invoked r The transaction initialization method in (1), which will also perform authentication and fund verification, e.g. verifying that the request transaction indeed came from application chain a and that the transaction asset for the resource exchange has indeed been frozen in application chain a. After the verification passes, SC r The transaction initialization method registers the corresponding transaction request content to the resource exchange management contract SC according to the cross-chain transaction identifier in the request transaction r And setting the cross-chain transaction state corresponding to the cross-chain transaction identifier as an initialization state (INIT), thereby improving the reliability and the safety of resource exchange.
Step S220, the relay chain receives the participation transaction of the transaction participant, updates the state of the cross-chain transaction to a submission state, and generates a submission message body containing the cross-chain transaction identifier and the submission state. In step S210, the request transaction initiated by the transaction requester may be sent directly to the transaction participants through a relay link, or sent to the transaction participants through other information routing manners. After the transaction participants are informed of the specific contents of the resource exchange in any way, the transaction participants generate participation transactions after receiving the request transaction, and the participation transactions are generated for confirmation and feedback of the participation resource exchange. The ginsengThe associated transaction will be sent to the relay chain. The participated transaction is submitted to the relay chain, and the resource exchange management contract SC of the relay chain is called r The related method of transaction preparation completion in (1) considers a cross-chain transaction to be ready for completion, updates the state of the cross-chain transaction to a COMMIT state (COMMIT), and generates a COMMIT message body [ cross-chain transaction ID | | COMMIT ] containing a cross-chain transaction identifier and the COMMIT state]。
Step S230, the relay link sends the submission message bodies to the transaction requester and the transaction participant, respectively. After the transaction request party and the transaction participant receive the submission message body, transaction resources needing to be exchanged and each transaction party carrying out resource exchange are confirmed according to the cross-chain transaction ID in the submission message body, and resource exchange is carried out.
In steps S210 to S230, the relay link receives a request transaction initiated by the transaction requester, initializes a cross-link transaction according to the request transaction, receives a participation transaction of a transaction participant, updates a state of the cross-link transaction to a commit state according to the participation transaction, generates a commit message body including a cross-link transaction identifier and the commit state, and sends the commit message body to the transaction requester and the transaction participant, respectively, and the transaction requester and the transaction participant perform exchange of transaction resources after receiving the commit message body. Resources in the existing hash time locking technology need to be actively initiated by a user to be acquired, if a network problem occurs or the user forgets to execute an acquisition operation, the later acquisition party may be overtime, so that the resources cannot be acquired, and the atomicity of cross-link resource exchange cannot be ensured; and the hash time locking technology is time-dependent, but the block output time of many blockchains, especially alliance chains, is not fixed, so that the blockchains participating in resource exchange cannot have a uniform time standard. By the embodiment, the application chain triggering resource exchange does not depend on time, is only related to the message body sent to the application chain by the relay chain, and the operation executed by the two application chains on the same received message body is the same. When the application chain receives the submission message body, the application chain can actively trigger the resource to be transferred to the transaction party, so that the problems that one party acquires the resource and the other party is overtime are avoided. Therefore, the embodiment realizes cross-link resource exchange through the relay link, overcomes the dependency of resource exchange on time and network state in the related technology, and realizes the atomicity of cross-link resource exchange.
In one embodiment, the relay chain generates a cross-chain transaction according to the request transaction, sets the state of the cross-chain transaction as an initial state, and then generates a cross-chain message according to the request transaction and sends the cross-chain message to the transaction participants. The cross-chain message comprises resource exchange related contents such as a transaction requesting party, a transaction participating party, a transaction resource, a cross-chain transaction identifier and the like. And the transaction participant generates a participation transaction according to the cross-chain message. In this embodiment, the relay link is also responsible for generating a cross-link message according to the request transaction after receiving the request transaction and sending the cross-link message to each transaction participant, and the transaction requester does not need to directly send the message to the transaction participant or send the message to the transaction participant by means of other message routing methods, so that the efficiency of transaction resource exchange can be improved.
In an embodiment, fig. 3 is a flowchart of a commit message body signature in a relay chain-based cross-link resource exchange method according to an embodiment of the present invention, and as shown in fig. 3, after generating a commit message body including a cross-link transaction identifier and a commit status, the method further includes the following steps:
and step S310, each node of the relay chain signs the submitted message body to obtain signature content, and the signature content is respectively sent to the transaction request party and the transaction participant. Each node of the relay chain signs [ cross-chain transaction ID | | COMMIT ], and sends the signed content [ cross-chain transaction ID | | | COMMI | | | multi-sig ] to each application chain participating in the transaction. And the application chain corresponding to the requester and the transaction participant verifies that the signatures really come from a plurality of nodes of the relay chain, the COMMIT in the signature content indicates that the transaction can be submitted, the transaction related information is found according to the transaction ID, and the resource corresponding to the cross-chain transaction ID is sent to the target user corresponding to the cross-chain transaction ID. Therefore, the safety and reliability of the relay chain-based cross-link resource exchange are further improved.
In an embodiment, fig. 4 is a flowchart of resource exchange revocation in a relay chain-based cross-link resource exchange method according to an embodiment of the present invention, and as shown in fig. 4, a cross-link transaction is generated according to a request transaction, and after setting a state of the cross-link transaction as an initial state, the method further includes the following steps:
step S410, the relay link receives the cancel transaction, and the state of the cross-link transaction is inquired according to the cross-link transaction identifier in the cancel transaction. Any party of the resource exchange can submit the revocation transaction, and after the revocation transaction is submitted to the relay chain, the intelligent contract SC on the relay chain is called r Method for related transaction cancellation, relay chain intelligent contract SC r And inquiring the transaction information according to the transaction ID and acquiring the current state of the transaction.
In some embodiments, after querying the state of the cross-chain transaction according to the cross-chain transaction identifier in the revocation transaction, the relay chain verifies the identity of the initiator of the revocation transaction if the state of the cross-chain transaction is an initialization state; and in the case that the initiator of the reversal transaction is a transaction requester or a transaction participant, changing the state of the cross-chain transaction into a rollback state. Only the transaction party involved in the cross-chain transaction is qualified for resource exchange revocation, so that the irrelevant access party is prevented from interfering the cross-chain transaction, and the reliability of resource revocation is further improved.
Step S420, when the state of the cross-link transaction is the initialization state, the relay chain changes the state of the cross-link transaction to the rollback state, and generates a rollback message body including the cross-link transaction identifier and the rollback state. Under the condition that the intelligent convergence of the relay chain confirms that the current transaction state is INIT, updating the transaction state into a ROLLBACK; otherwise, the rollback is regarded as failed, and a corresponding message can be returned to prompt that the current transaction cannot execute the rollback.
And step S430, each node of the relay chain signs the rollback message body, sends the signed rollback message body to the transaction participant, and the transaction participant executes transaction rollback according to the rollback message body. Each node of the relay chain signs [ cross-chain transaction ID | | | ROLLBACK ], and sends the signed content [ cross-chain transaction ID | | | ROLLBACK | | | multi-sig ] to the application chain participating in the transaction, and optionally, the signed content opens an intelligent contract on the calling application chain to a ROLLBACK interface of the relay chain. And the application chain participating in the transaction verifies that the signatures really come from a plurality of nodes of the relay chain, a ROLLBACK in the signature content indicates that the transaction needs to be rolled back, and optionally, the related information of the transaction is found according to the ID of the transaction, and the frozen assets are returned to the original user.
Steps S410 to S430 provide a resource exchange revocation method, which implements rollback of cross-link resource exchange transactions through the relay link, overcomes the dependency of resource exchange transactions on time and network state in the related art, and implements atomicity of rollback of cross-link resource exchange transactions. Before the cross-chain transaction is in the COMMIT state, the resource exchange transaction can be simply and reliably rolled back, so that the cross-chain resource exchange is more flexible and controllable.
In an embodiment, fig. 5 is a flowchart of a relay link-based cross-link resource exchange method according to another embodiment of the present invention, and as shown in fig. 5, the present invention provides a relay link-based cross-link resource exchange method, where the method includes:
step S510, the first application chain initiates a request transaction, where the request transaction includes the first application chain, a transaction participant, a transaction resource, and a cross-chain transaction identifier.
Step S520, the relay link receives the request transaction, generates a cross-link transaction according to the cross-link transaction identifier, sets the state of the cross-link transaction as an initial state, and sends a cross-link message to a second application chain, wherein the cross-link transaction identifier corresponds to the cross-link transaction, and the transaction participant comprises the second application chain.
Step S530, the second application chain receives the cross-chain message to generate a participation transaction, and sends the participation transaction to the relay chain.
Step S540, the relay link receives the participation transaction and updates the state of the cross-link transaction to a commit state, generates a commit message body including the cross-link transaction identifier and the commit state, and sends the commit message body to the first application chain and the second application chain.
In step S550, the first application chain and the second application chain perform transaction resource exchange after receiving the submission message body.
In steps S510 to S550, the first application chain initiates a request transaction, the relay chain receives the request transaction initiated by the first application chain, initializes a cross-chain transaction according to the request transaction and sends a cross-chain message to the second application chain, the second application chain generates a participation transaction according to the cross-chain message and sends the participation transaction to the relay chain, the relay chain receives the participation transaction, updates a state of the cross-chain transaction to a commit state according to the participation transaction, generates a commit message body including a cross-chain transaction identifier and the commit state, and sends the commit message body to the transaction requesting party and the transaction participating party, and the transaction requesting party and the transaction participating party perform exchange of transaction resources after receiving the commit message body. Through the embodiment, the resource exchange triggered by the application chains does not depend on time, is only related to the message body sent to the application chains by the relay chains, the operation executed by the two application chains on the same received message body is the same, and the application chains can actively trigger the resource to be transferred to a transaction party when receiving the submitted message body, so that the problems that one party acquires the resource and the other party is overtime are avoided. Therefore, the embodiment realizes cross-link resource exchange through the relay link, overcomes the dependency of resource exchange on time and network state in the related technology, and realizes the atomicity of cross-link resource exchange.
In some embodiments, after a commit message body containing a cross-chain transaction identifier and a commit status is generated, each node of the relay chain signs the commit message body to obtain signature contents, and sends the signature contents to the first application chain and the second application chain respectively; the first application chain and the second application chain verify the signature content after receiving the signature content, and exchange of transaction resources is executed under the condition that the verification is passed. Therefore, the safety and reliability of the relay chain-based cross-link resource exchange are further improved.
In some embodiments, where the transaction resource is an asset, the intelligent contract SC is deployed on the first application chain a The first application chain receives the first transaction, generates a request transaction according to the first transaction, and freezes assets according to the transaction assets in the request transaction, wherein the frozen assets correspond to the cross-chain transaction identifier. The above freezing calls the intelligent contract SC immediately a Will need toTransfer of assets to freeze to SC a The address of (2). The second application chain is provided with an intelligent contract SC b The second application chain receiving the cross-chain message will invoke the SC b Through SC b Performing an asset freeze of the second application chain that transfers assets requiring freeze to the SC and generating a participation transaction b The frozen asset also corresponds to the cross-chain transaction identifier. In this embodiment, there are pre-deployed intelligent contracts on the first application chain and the second application chain for performing fund freezing and corresponding the frozen fund to the cross-chain transaction identifier. On one hand, the fund freezing process can be executed more reliably, and on the other hand, even if a plurality of cross-chain transactions exchanged on the application chain are to be executed, the resource exchange can be carried out quickly and accurately according to the cross-chain transaction identification.
In some embodiments, where the transactional resource is cross-chain information, the intelligent contract SC deployed on the first application chain a The method can be used for temporarily storing the information to be exchanged uploaded by the user, the first application chain receives the first transaction, generates a request transaction according to the first transaction, temporarily stores the information to be exchanged in the request transaction, and corresponds the temporarily stored information to be exchanged with the cross-chain transaction identifier. Optionally, the above-mentioned temporary storage procedure is to transfer the information to be temporary stored to the SC a The address of (c). Intelligent contract SC deployed on second application chain b Or temporarily storing the information to be exchanged of the other party for information exchange. The second application chain receiving the cross-chain message will invoke the SC b Through SC b And carrying out temporary storage of information of the second application chain and generating participation transaction, wherein the information also corresponds to the cross-chain transaction identifier. Submitting the participated transaction to the relay chain, and calling the resource exchange management contract SC of the relay chain r The related method of transaction preparation completion in (1) considers a cross-chain transaction to be ready for completion, updates the state of the cross-chain transaction to a COMMIT state (COMMIT), and generates a COMMIT message body [ cross-chain transaction ID | | COMMIT ] containing a cross-chain transaction identifier and the COMMIT state]. The relay chain sends the submitted message bodies to the transaction requesting party and the transaction participating party, namely, each information exchange party. Information exchange party receiving submission message bodyAnd then, confirming the information to be exchanged which needs to be exchanged and each transaction party for exchanging the information according to the cross-chain transaction ID in the submitted message body, and executing the information exchange.
The embodiments of the present application are described and illustrated below by way of preferred embodiments. Fig. 6 is a sequence diagram of a relay-link-based cross-link resource exchange method in a preferred embodiment of the present invention, in which a transaction resource is a transaction asset, as shown in fig. 6, a user a holds an asset a on an application chain a, a user B holds an asset B on an application chain B, and the user a wants to exchange the asset B of the user B with the asset a. The application chain A, B uses the relay chain R to realize verification and routing of cross-chain transaction, and the IDs registered on the relay chain by the application chains a and B are respectively chainids a And ChainID b . Users A, B each deploy intelligent contracts SC on chain A, B a 、SC b At the same time, an asset exchange management contract SC is deployed on the relay chain R r
The asset exchange between user A and user B across the chain includes the following processes:
user A initiates a transaction TX1 to application chain A, which invokes smart contract SCa, freezes (transfers to SC) user A's asset A a Address of (c), initiating a cross-chain transaction TX2 with a destination chain being a blockchain B, the ChainID of the application chain a being carried in TX2 a ChainID of application chain B b The addresses of users a and B at application chain B and the assets a and B to be exchanged, and the cross-chain transaction ID. Simultaneous intelligent contract SC a The cross-chain transaction ID corresponds to the asset freeze record of the user A and the address of the user B to exchange the asset in the application chain A.
TX2 submission to Relay chain R, asset exchange management contract SC invoking R r The transaction initialization method of (1). This method verifies that transaction TX2 indeed came from application chain a and that user a of application chain a indeed freezes asset a, and then passes this cross-chain transaction ID and the corresponding content (ChainID of blockchain B) b ChainID of asset B and blockchain A a And asset A) registration to an asset exchange management contract SC r And simultaneously setting the state of the cross-chain transaction as INIT.
The relay chain R routes the cross-chain message to the regional applicationChain B, intelligent contract SC invoking Block chain B b . Cross-chain message contains ChainID of application chain A a ChainID of application chain B b The addresses of users a and B at application chain B and the assets a and B to be exchanged, and the cross-chain transaction ID.
User B monitors intelligent contract SC b Corresponding event of (2), smart contract SC of blockchain B b And throwing out the user B of the cross-chain event notification block chain B, informing the user A of the application chain A of having frozen the asset A, and waiting for the user B to freeze the asset B.
User B of block chain B monitors intelligent contract SC b An event to itself initiates a transaction TX3 to blockchain B, which invokes the intelligent contract SC in blockchain B b Freezing asset B of user B to SC b And recording the asset freezing record of the user B and the address of the user A of the asset to be exchanged in the application chain B by taking the current cross-chain transaction ID as a key, and simultaneously initiating a transaction TX4 to the relay chain.
Intelligent contract SC for TX4 invoking Relay chain R r Transaction preparation completes the associated method. Relay chain intelligent contract SC r Can identify the transaction as from the ID ChainID b And user B does freeze asset B, believes that transaction ITX1 is ready to complete, the state of the cross-chain transaction is updated to COMMIT, while the relay chain nodes will [ cross-chain transaction ID | | COMMIT |)]Signing is carried out, and the signed content [ cross-chain transaction ID | | COMMI | | | multi-sig]Sending to the application chains a and B participating in the transaction, and calling the intelligent contracts on the application chains a and B, namely the transactions TX5 and TX6 respectively.
The intelligent contract on the application chain verifies that the signature really comes from a plurality of nodes of the relay chain, the COMMIT in the signature content indicates that the transaction can be submitted, the information related to the transaction is found according to the ID of the transaction, and the assets frozen before are sent to the target user.
Further, in the event that user A wants to revoke the asset exchange, an asset revocation request may be initiated. The specific process is as follows (this process is not shown in fig. 6):
intelligent contract SC from user A to application chain A a Initiating a transaction TX5, the transaction carrying a Cross-chain transaction ID, invoking SC a Open to the user a rollback transaction related method;
intelligent contract SC a Finding out related affairs, initiating a transaction TX6 to the relay chain, and calling a relay chain intelligent contract SC with the cross-chain affair ID and related information r Undo the transaction related method;
relay chain intelligent contract SC r Inquiring transaction information according to the transaction ID, confirming that the current transaction state is INIT, verifying that the ID of the transaction source application chain is consistent with the ID of one application chain in the transaction content, updating the transaction state to ROLLBACK, otherwise failing to roll back. Simultaneously, each node of the relay chain will [ cross-chain transaction ID | | ROLLBACK]Signing is carried out, and signed content [ cross-chain transaction ID | | | ROLLBACK | | | multi-sig |)]Sending the information to the application chains A and B participating in the transaction, and calling the intelligent contracts on the application chains A and B to open the rollback interfaces of the relay chains;
and (3) verifying that the signatures really come from a plurality of nodes of the relay chain by using an intelligent contract on the application chain, wherein a ROLLBACK in the signature content indicates that the transaction needs to be rolled back, and related information of the transaction is found according to the transaction ID, so that the frozen assets are returned to the original user.
According to the cross-link resource exchange method based on the relay chain, even if network problems occur in the asset exchange process, the A, B account does not affect asset exchange on the two block chains, and the intelligent contract can send the frozen assets to the corresponding user accounts under the condition that external transactions are triggered, and records each operation on the block chains. Even if the network is interrupted, as long as the cross-link transaction state on the relay link is COMMIT, after the network is recovered, the previous submission message body can be continuously sent to the application link, and as long as the submission message body of the relay link is received by the application link, the frozen asset can be transferred to the user, so that the condition of overtime caused by network disconnection can be avoided; and if the problem occurs in a link before the state of the cross-chain transaction is COMMIT, the cross-chain transaction on the relay chain can not change the state, and the atomicity of asset exchange of a subsequent application chain can not be influenced. Therefore, the relay link-based cross-link resource exchange method in this embodiment implements cross-link resource exchange through the relay link, overcomes the dependency of resource exchange on time and network state in the related art, and implements atomicity of cross-link resource exchange.
It should be understood that, although the steps in the flowcharts of fig. 2 to 6 are shown in sequence as indicated by the arrows, the steps are not necessarily performed in sequence as indicated by the arrows. The steps are not performed in the exact order shown and described, and may be performed in other orders, unless explicitly stated otherwise. Moreover, at least some of the steps in fig. 2-6 may include multiple sub-steps or multiple stages that are not necessarily performed at the same time, but may be performed at different times, and the order of performing the sub-steps or stages is not necessarily sequential, but may be performed in turn or alternately with other steps or at least some of the sub-steps or stages of other steps.
In an embodiment, fig. 7 is a schematic structural diagram of a relay link-based cross-link resource switching apparatus according to an embodiment of the present invention, and as shown in fig. 7, there is provided a relay link-based cross-link resource switching apparatus, including an initialization module 72, a submission module 74, and a sending module 76:
the initialization module 72 is configured to receive a request transaction initiated by a transaction requester, generate a cross-chain transaction according to the request transaction, and set a state of the cross-chain transaction as an initial state, where the request transaction includes a transaction requester, a transaction participant, a transaction resource, and a cross-chain transaction identifier, and the cross-chain transaction identifier corresponds to the cross-chain transaction;
the commit module 74 is configured to receive a participation transaction of a transaction participant, update a state of the cross-chain transaction to a commit state, and generate a commit message body including a cross-chain transaction identifier and the commit state, where the participation transaction is a transaction generated by the transaction participant after receiving a request transaction;
the sending module 76 is configured to send the submission message body to the transaction requesting party and the transaction participating party, respectively, where the transaction requesting party and the transaction participating party perform exchange of transaction resources after receiving the submission message body.
For specific limitations of the relay chain-based cross-link resource exchanging device, reference may be made to the above limitations on the relay chain-based cross-link resource exchanging method, which is not described herein again. The modules in the relay link-based cross-link resource exchanging device can be wholly or partially implemented by software, hardware and a combination thereof. The modules can be embedded in a hardware form or independent from a processor in the computer device, and can also be stored in a memory in the computer device in a software form, so that the processor can call and execute operations corresponding to the modules.
According to the relay link-based cross-link resource exchange device, the request transaction initiated by the transaction request party is received, the cross-link transaction is generated according to the request transaction, the state of the cross-link transaction is set to be an initial state, the participation transaction of the transaction participant is received, the state of the cross-link transaction is updated to be a submission state, a submission message body containing the cross-link transaction identifier and the submission state is generated, the submission message body is respectively sent to the transaction request party and the transaction participant, the transaction request party and the transaction participant execute the exchange of transaction resources after receiving the submission message body, the dependency of cross-link resource exchange on time is removed, the resource exchange is carried out by the transaction initiator and the participant under the condition that the submission message body is received, and the atomicity of the cross-link transaction is realized.
In one embodiment, the system comprises a relay chain, wherein the relay chain is used for receiving a request transaction initiated by a transaction requesting party, generating a cross-chain transaction according to the request transaction, setting the state of the cross-chain transaction to be an initial state, receiving a participation transaction of a transaction participating party, updating the state of the cross-chain transaction to be a submission state, generating a submission message body containing a cross-chain transaction identifier and the submission state, and sending the submission message body to the transaction requesting party and the transaction participating party respectively, wherein the request transaction comprises the transaction requesting party, the transaction participating party, transaction resources and the cross-chain transaction identifier, the cross-chain transaction identifier corresponds to the cross-chain transaction, the participation transaction is a transaction generated by the transaction participating party after receiving the request transaction, and the transaction requesting party and the transaction participating party perform exchange of transaction resources after receiving the submission message body.
For specific limitations of the relay chain-based cross-link resource exchange system, reference may be made to the above limitations on the relay chain-based cross-link resource exchange method, which is not described herein again. According to the relay link-based cross-link resource exchange system, the request transaction initiated by the transaction request party is received, the cross-link transaction is generated according to the request transaction, the state of the cross-link transaction is set to be an initial state, the participation transaction of the transaction participant is received, the state of the cross-link transaction is updated to be a submission state, a submission message body containing the cross-link transaction identifier and the submission state is generated, the submission message body is respectively sent to the transaction request party and the transaction participant, the transaction request party and the transaction participant execute exchange of transaction resources after receiving the submission message body, the dependency of cross-link resource exchange on time is removed, the resource exchange is carried out by the transaction initiator and the participant under the condition that the submission message body is received, and the atomicity of the cross-link transaction is realized.
In one embodiment, a computer device is provided, comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, the processor implementing the following steps when executing the computer program:
receiving a request transaction initiated by a transaction requester, generating a cross-chain transaction according to the request transaction, setting the state of the cross-chain transaction as an initial state, wherein the request transaction comprises a transaction requester, a transaction participant, a transaction resource and a cross-chain transaction identifier, and the cross-chain transaction identifier corresponds to the cross-chain transaction;
receiving a participation transaction of a transaction participant, updating the state of the cross-chain transaction to a commit state, and generating a commit message body containing a cross-chain transaction identifier and the commit state, wherein the participation transaction is a transaction generated by the transaction participant after receiving a request transaction;
and respectively sending the submission message body to a transaction request party and a transaction participant, wherein the transaction request party and the transaction participant execute exchange of transaction resources after receiving the submission message body.
According to the relay link-based cross-link resource exchange computer equipment, a cross-link transaction is generated according to a request transaction by receiving the request transaction initiated by a transaction request party, the state of the cross-link transaction is set to be an initial state, the participation transaction of a transaction participant is received, the state of the cross-link transaction is updated to be a submission state, a submission message body containing a cross-link transaction identifier and the submission state is generated, the submission message body is respectively sent to the transaction request party and the transaction participant, the transaction request party and the transaction participant execute exchange of transaction resources after receiving the submission message body, the dependency of cross-link resource exchange on time is removed, the initiator and the participant of the transaction perform resource exchange under the condition of receiving the submission message body, and the atomicity of the cross-link transaction is realized.
In one embodiment, a computer-readable storage medium is provided, having a computer program stored thereon, which when executed by a processor, performs the steps of:
receiving a request transaction initiated by a transaction request party, generating a cross-chain transaction according to the request transaction, setting the state of the cross-chain transaction as an initial state, wherein the request transaction comprises a transaction request party, a transaction participant, a transaction resource and a cross-chain transaction identifier, and the cross-chain transaction identifier corresponds to the cross-chain transaction;
receiving a participation transaction of a transaction participant, updating the state of the cross-chain transaction to a commit state, and generating a commit message body containing a cross-chain transaction identifier and the commit state, wherein the participation transaction is a transaction generated by the transaction participant after receiving a request transaction;
and respectively sending the submission message body to a transaction requesting party and a transaction participating party, wherein the transaction requesting party and the transaction participating party execute exchange of transaction resources after receiving the submission message body.
According to the relay link-based cross-link resource exchange storage medium, a request transaction initiated by a transaction request party is received, a cross-link transaction is generated according to the request transaction, the state of the cross-link transaction is set to be an initial state, a participation transaction of a transaction participant is received, the state of the cross-link transaction is updated to be a submission state, a submission message body containing a cross-link transaction identifier and the submission state is generated, the submission message body is respectively sent to the transaction request party and the transaction participant, the transaction request party and the transaction participant execute exchange of transaction resources after receiving the submission message body, the dependency of cross-link resource exchange on time is removed, the initiator and the participant of the transaction perform resource exchange under the condition that the submission message body is received, and the atomicity of the cross-link transaction is realized.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above may be implemented by hardware instructions of a computer program, which may be stored in a non-volatile computer-readable storage medium, and when executed, may include the processes of the embodiments of the methods described above. Any reference to memory, storage, database, or other medium used in the embodiments provided herein may include non-volatile and/or volatile memory, among others. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically Programmable ROM (EPROM), electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms such as Static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double Data Rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous Link DRAM (SLDRAM), rambus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
The technical features of the above embodiments can be arbitrarily combined, and for the sake of brevity, all possible combinations of the technical features in the above embodiments are not described, but should be considered as the scope of the present specification as long as there is no contradiction between the combinations of the technical features.
The above-mentioned embodiments only express several embodiments of the present application, and the description thereof is more specific and detailed, but not construed as limiting the scope of the invention. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the concept of the present application, which falls within the scope of protection of the present application. Therefore, the protection scope of the present patent shall be subject to the appended claims.

Claims (13)

1. A method for exchanging cross-link resources based on a relay link is characterized in that the method comprises the following steps:
receiving a request transaction initiated by a transaction requester, generating a cross-chain transaction according to the request transaction, and setting the state of the cross-chain transaction as an initial state, wherein the request transaction comprises the transaction requester, a transaction participant, a transaction resource and a cross-chain transaction identifier, and the cross-chain transaction identifier corresponds to the cross-chain transaction; generating a cross-chain transaction according to the request transaction, and setting the state of the cross-chain transaction as an initial state, wherein the method comprises the following steps: registering the corresponding transaction request content into a resource exchange management contract SCR according to the cross-chain transaction identifier in the request transaction, and setting the cross-chain transaction state corresponding to the cross-chain transaction identifier as an initial state;
receiving a participation transaction of the transaction participant, updating the state of the cross-chain transaction to a commit state, and generating a commit message body containing the cross-chain transaction identifier and the commit state, wherein the participation transaction is a transaction generated by the transaction participant after receiving the request transaction;
and respectively sending the submission message body to the transaction requesting party and the transaction participating party, wherein the transaction requesting party and the transaction participating party execute the exchange of transaction resources after receiving the submission message body.
2. The method of claim 1, wherein after setting the state of the cross-chain transaction to an initial state, the method further comprises:
and sending a cross-chain message to the transaction participant, wherein the transaction participant generates the participation transaction according to the cross-chain message, the cross-chain message is generated according to the request transaction, and the cross-chain message comprises the transaction requester, the transaction participant, the transaction resource and the cross-chain transaction identifier.
3. The method of claim 1, wherein after generating a commit message body that includes the cross-chain transaction identifier and the commit status, the method further comprises:
and signing the submitted message body to obtain signature content, and respectively sending the signature content to the transaction requesting party and the transaction participating party, wherein the transaction requesting party and the transaction participating party execute exchange of the transaction resources after verifying the signature content.
4. The method of claim 1, wherein receiving a request transaction initiated by a transaction requestor, generating a cross-chain transaction according to the request transaction, and setting a state of the cross-chain transaction to an initial state comprises:
receiving a request transaction initiated by a transaction request party, generating a cross-chain transaction according to the request transaction under the condition that the identity verification of the transaction request party is passed and the transaction request party completes the asset freezing of the transaction resources, and setting the state of the cross-chain transaction as an initial state, wherein the transaction resources are transaction assets.
5. The method of any one of claims 1 to 4, wherein after generating a cross-chain transaction according to the request transaction and setting a state of the cross-chain transaction to an initial state, the method further comprises:
receiving an undo transaction, and inquiring the state of the cross-chain transaction according to the cross-chain transaction identifier in the undo transaction;
changing the state of the cross-chain transaction into a rollback state under the condition that the state of the cross-chain transaction is an initialization state, and generating a rollback message body containing the cross-chain transaction identifier and the rollback state;
and signing the rollback message body, sending the signed rollback message body to the transaction participant, and executing transaction rollback by the transaction participant according to the rollback message body.
6. The method of claim 5, wherein after querying the state of the cross-chain transaction according to the cross-chain transaction identifier in the undo transaction, before generating a rollback message body containing the cross-chain transaction identifier and the rollback state, the method further comprises:
verifying the initiator of the revocation transaction if the state of the cross-chain transaction is an initialization state;
and changing the state of the cross-chain transaction into a rollback state under the condition that the initiator of the reversal transaction is the transaction requester or the transaction participant.
7. A method for exchanging cross-link resources based on a relay link is characterized in that the method comprises the following steps:
a first application chain initiates a request transaction, wherein the request transaction comprises the first application chain, a transaction participant, a transaction resource and a cross-chain transaction identifier;
a relay chain receives the request transaction, generates a cross-chain transaction according to the cross-chain transaction identifier, sets the state of the cross-chain transaction as an initial state, and sends a cross-chain message to a second application chain, wherein the cross-chain transaction identifier corresponds to the cross-chain transaction, and the transaction participant comprises the second application chain; generating a cross-chain transaction according to the request transaction, and setting the state of the cross-chain transaction as an initial state, wherein the method comprises the following steps: according to the cross-chain transaction identifier in the request transaction, registering the corresponding transaction request content into a resource exchange management contract SCR, and setting the cross-chain transaction state corresponding to the cross-chain transaction identifier as an initial state;
the second application chain receives the cross-chain message, generates a participation transaction and sends the participation transaction to the relay chain;
the relay chain receives the participation transaction, updates the state of the cross-chain transaction to a submission state, generates a submission message body containing the cross-chain transaction identifier and the submission state, and sends the submission message body to the first application chain and the second application chain;
the first application chain and the second application chain perform the transaction resource exchange upon receiving the submission message body.
8. The method of claim 7, wherein after generating a commit message body containing the cross-chain transaction identifier and the commit status, the method comprises:
signing the submitted message body to obtain signature contents, and respectively sending the signature contents to the first application chain and the second application chain;
and the first application chain and the second application chain verify the signature content after receiving the signature content, and perform exchange of the transaction resources under the condition of passing the verification.
9. The method of claim 7, further comprising:
the first application chain receives a first transaction, generates the request transaction according to the first transaction and freezes assets according to the transaction resources in the request transaction, wherein the frozen assets correspond to the cross-chain transaction identifier, and the transaction resources are transaction assets;
the second application link receives the cross-chain message to generate a participation transaction, performs asset freezing according to the cross-chain message, wherein the frozen asset corresponds to the cross-chain transaction identifier, and sends the participation transaction to the relay link, and the cross-chain message comprises the transaction asset and the cross-chain transaction identifier;
and after receiving the submission message body, the first application chain and the second application chain acquire the frozen assets according to the cross-link transaction identifier in the submission message body and perform asset exchange.
10. A relay chain-based cross-link resource exchange device is characterized in that the device comprises an initialization module, a submission module and a sending module:
the initialization module is used for receiving a request transaction initiated by a transaction requester, generating a cross-chain transaction according to the request transaction, and setting the state of the cross-chain transaction as an initial state, wherein the request transaction comprises the transaction requester, a transaction participant, a transaction resource and a cross-chain transaction identifier, and the cross-chain transaction identifier corresponds to the cross-chain transaction; generating a cross-chain transaction according to the request transaction, and setting the state of the cross-chain transaction as an initial state, wherein the method comprises the following steps: according to the cross-chain transaction identifier in the request transaction, registering the corresponding transaction request content into a resource exchange management contract SCR, and setting the cross-chain transaction state corresponding to the cross-chain transaction identifier as an initial state;
the commit module is used for receiving the participation transaction of the transaction participant, updating the state of the cross-chain transaction to a commit state, and generating a commit message body containing the cross-chain transaction identifier and the commit state, wherein the participation transaction is the transaction generated by the transaction participant after receiving the request transaction;
the sending module is used for sending the submission message body to the transaction requesting party and the transaction participating party respectively, wherein the transaction requesting party and the transaction participating party execute the exchange of the transaction resources after receiving the submission message body.
11. A cross-link resource exchange system based on a relay link is characterized by comprising the relay link, wherein the relay link is used for receiving a request transaction initiated by a transaction request party, generating a cross-link transaction according to the request transaction, setting the state of the cross-link transaction to be an initial state, receiving a participation transaction of a transaction participant, updating the state of the cross-link transaction to be a submission state, generating a submission message body containing a cross-link transaction identifier and the submission state, and sending the submission message body to the transaction request party and the transaction participant respectively, wherein the request transaction comprises the transaction request party, a transaction participant, a transaction resource and a cross-link transaction identifier, the cross-link transaction identifier corresponds to the cross-link transaction, the participation transaction is a transaction generated by the transaction participant after receiving the request transaction, and the transaction request party and the transaction participant perform exchange of the transaction resource after receiving the submission message body; generating a cross-chain transaction according to the request transaction, and setting the state of the cross-chain transaction as an initial state, wherein the method comprises the following steps: according to the cross-chain transaction identifier in the request transaction, registering the corresponding transaction request content into a resource exchange management contract SCR, and setting the cross-chain transaction state corresponding to the cross-chain transaction identifier as an initial state.
12. A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the steps of the method of any of claims 1 to 9 are implemented when the computer program is executed by the processor.
13. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the method of any one of claims 1 to 9.
CN202011168318.2A 2020-10-28 2020-10-28 Cross-link resource exchange method, device and system based on relay link Active CN112491959B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011168318.2A CN112491959B (en) 2020-10-28 2020-10-28 Cross-link resource exchange method, device and system based on relay link

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011168318.2A CN112491959B (en) 2020-10-28 2020-10-28 Cross-link resource exchange method, device and system based on relay link

Publications (2)

Publication Number Publication Date
CN112491959A CN112491959A (en) 2021-03-12
CN112491959B true CN112491959B (en) 2023-03-24

Family

ID=74927213

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011168318.2A Active CN112491959B (en) 2020-10-28 2020-10-28 Cross-link resource exchange method, device and system based on relay link

Country Status (1)

Country Link
CN (1) CN112491959B (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113191900A (en) * 2021-05-11 2021-07-30 预言机(重庆)科技有限公司 Trans-block chain equity transfer method and system based on relay chain
CN113242305B (en) * 2021-05-13 2022-11-11 杭州趣链科技有限公司 Cross-chain transaction processing method, device, computer equipment and medium
CN114579611B (en) * 2022-05-05 2022-07-05 北京理工大学 Data parallel query method and device of cross-link system
CN116708463B (en) * 2023-08-04 2023-10-03 腾讯科技(深圳)有限公司 Information processing method, device, equipment and medium based on multi-block chain

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107248076A (en) * 2017-06-24 2017-10-13 北京天德科技有限公司 A kind of core algorithm of the double-chain block chain the Internet model merchandised across chain
CN107301600A (en) * 2017-06-23 2017-10-27 北京天德科技有限公司 A kind of core algorithm for the block chain the Internet model merchandised across chain
CN108269190A (en) * 2018-01-17 2018-07-10 深圳四方精创资讯股份有限公司 Across chain method and its system based on across chain relaying platform
CN110650189A (en) * 2019-09-20 2020-01-03 深圳供电局有限公司 Relay-based block chain interaction system and method

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US11146380B2 (en) * 2017-08-03 2021-10-12 Parity Technologies Ltd. Methods and systems for a heterogeneous multi-chain framework

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107301600A (en) * 2017-06-23 2017-10-27 北京天德科技有限公司 A kind of core algorithm for the block chain the Internet model merchandised across chain
CN107248076A (en) * 2017-06-24 2017-10-13 北京天德科技有限公司 A kind of core algorithm of the double-chain block chain the Internet model merchandised across chain
CN108269190A (en) * 2018-01-17 2018-07-10 深圳四方精创资讯股份有限公司 Across chain method and its system based on across chain relaying platform
CN110650189A (en) * 2019-09-20 2020-01-03 深圳供电局有限公司 Relay-based block chain interaction system and method

Also Published As

Publication number Publication date
CN112491959A (en) 2021-03-12

Similar Documents

Publication Publication Date Title
CN112491959B (en) Cross-link resource exchange method, device and system based on relay link
CN109426949B (en) Cross-chain transaction method and device
CN107993149B (en) Account information management method, system and readable storage medium
WO2020258848A1 (en) Method and apparatus for cross-chain transmission of resources
US11336451B2 (en) Cross-blockchain resource transmission
WO2020258846A1 (en) Method and apparatus for sending certifiable messages across chains
CN108197913B (en) Payment method, system and computer readable storage medium based on block chain
CN109493072B (en) Privacy contract protection method based on alliance block chain
CN109981646B (en) Resource transfer method and device based on block chain and electronic equipment
CN111640017A (en) Transaction correctness verification method and device applied to alliance chain cross-chain transfer
CN111046110B (en) Method, node and computing device for node management of blockchain system
CN110502319B (en) Distributed transaction processing method and device, electronic equipment and storage medium
WO2021098139A1 (en) Method and device for storing state data of cross-chain transaction, and storage medium
WO2022206438A1 (en) Method and apparatus for providing cross-chain message
KR20140047230A (en) Method for optimizing distributed transaction in distributed system and distributed system with optimized distributed transaction
CN110941622A (en) Data processing method and device
CN111143040A (en) Transaction processing method, device, system and storage medium
CN113610520A (en) Data processing method, system, device, computer equipment and storage medium
CN113570071A (en) Method and system for publishing federated learning model service
CN115145997A (en) Distributed transaction implementation method and distributed system
CN113538150A (en) Block chain asset cross-chain transaction method
CN111932326A (en) Data processing method based on block chain network and related equipment
CN112598520A (en) Transaction management method, device, electronic equipment and storage medium
CN112950180A (en) Community certificate method and system based on alliance chain, electronic device and storage medium
CN117151712B (en) Blockchain transaction processing method, device, computer equipment and 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
GR01 Patent grant
GR01 Patent grant