CN112927075A - Processing method and device for cross-chain transaction, electronic equipment and readable storage medium - Google Patents

Processing method and device for cross-chain transaction, electronic equipment and readable storage medium Download PDF

Info

Publication number
CN112927075A
CN112927075A CN202110213614.8A CN202110213614A CN112927075A CN 112927075 A CN112927075 A CN 112927075A CN 202110213614 A CN202110213614 A CN 202110213614A CN 112927075 A CN112927075 A CN 112927075A
Authority
CN
China
Prior art keywords
resource
event
blockchain
cross
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.)
Granted
Application number
CN202110213614.8A
Other languages
Chinese (zh)
Other versions
CN112927075B (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.)
Beijing Baidu Netcom Science and Technology Co Ltd
Original Assignee
Beijing Baidu Netcom Science and 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 Beijing Baidu Netcom Science and Technology Co Ltd filed Critical Beijing Baidu Netcom Science and Technology Co Ltd
Priority to CN202110213614.8A priority Critical patent/CN112927075B/en
Publication of CN112927075A publication Critical patent/CN112927075A/en
Application granted granted Critical
Publication of CN112927075B publication Critical patent/CN112927075B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

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
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching
    • G06F9/4843Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
    • G06F9/485Task life-cycle, e.g. stopping, restarting, resuming execution
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching
    • G06F9/4843Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
    • G06F9/485Task life-cycle, e.g. stopping, restarting, resuming execution
    • G06F9/4856Task life-cycle, e.g. stopping, restarting, resuming execution resumption being on a different machine, e.g. task migration, virtual machine migration
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5011Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals
    • G06F9/5022Mechanisms to release resources
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5083Techniques for rebalancing the load in a distributed system
    • G06F9/5088Techniques for rebalancing the load in a distributed system involving task migration
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/542Event management; Broadcasting; Multicasting; Notifications
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Business, Economics & Management (AREA)
  • Accounting & Taxation (AREA)
  • Finance (AREA)
  • Development Economics (AREA)
  • General Business, Economics & Management (AREA)
  • Technology Law (AREA)
  • Strategic Management (AREA)
  • Multimedia (AREA)
  • Marketing (AREA)
  • Economics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Financial Or Insurance-Related Operations Such As Payment And Settlement (AREA)

Abstract

The embodiment of the application provides a processing method and device for cross-chain transaction, electronic equipment and a readable storage medium. The method comprises the following steps: when the cross-link relay monitors a first resource locking event of a first resource triggered in a first block chain, determining a specified time period based on event information of the first resource locking event; and generating a corresponding processing request based on whether a second resource locking event for a second resource triggered in a second block chain is monitored in a specified time period, and respectively sending the processing request to the first block chain and the second block chain so that the first block chain and the second block chain respectively process the processing request. In the scheme, the timing task in the cross-chain transaction is realized through the cross-chain relay, so that the cross-chain transaction does not depend on the timing task capability of the block chain any more, and the universality of the cross-chain transaction scheme is promoted.

Description

Processing method and device for cross-chain transaction, electronic equipment and readable storage medium
Technical Field
The present application relates to the field of blockchain technologies, and in particular, to a method and an apparatus for processing a cross-chain transaction, an electronic device, and a readable storage medium.
Background
The block chain technology is developed to date, a plurality of different block chains are produced, and data on the chains of the block chains are isolated, so that the block chains become a data isolated island, and the different block chains cannot be interconnected and intercommunicated.
The cross-chain technology is a technology for solving data interaction between two or more blockchains, so that data can cross the barriers of the chains and the price value can be circulated among different blockchains.
Currently, cross-chain transactions generally require that a participating blockchain has a capability of a timing task, so as to rollback a locked resource after a transaction is overtime, but most blockchains currently do not have the capability of the timing task, and therefore, when a blockchain without the capability of the timing task performs cross-chain transactions, the locked resource cannot be rolled back after the transaction is overtime, and the cross-chain transactions cannot be completed, which results in poor universality of a current cross-chain transaction scheme.
Disclosure of Invention
The present application aims to solve at least one of the above technical drawbacks. The technical scheme adopted by the application is as follows:
in a first aspect, an embodiment of the present application provides a method for processing a cross-chain transaction, where the method includes:
when the cross-link relay monitors a first resource locking event of a first resource triggered in a first block chain, determining a specified time period based on event information of the first resource locking event;
and generating a corresponding processing request based on whether a second resource locking event for a second resource triggered in a second block chain is monitored in a specified time period, and respectively sending the processing request to the first block chain and the second block chain so that the first block chain and the second block chain respectively process the processing request.
Optionally, the processing request is an asset transfer request or an asset rollback request, and the generating of the corresponding processing request based on whether a second resource lock event for a second resource triggered in a second blockchain is monitored within a specified time period includes:
generating an asset transfer request if a second resource locking event for a second resource triggered in a second blockchain is monitored within a specified time period;
if a second resource lock event for a second resource triggered in a second blockchain is not monitored within a specified time period, an asset rollback request is generated.
Optionally, generating an asset transfer request comprises:
querying the first blockchain for a first resource locking event so that the first blockchain returns first existence certification information of a query result of the first resource locking event;
querying a second resource locking event for the second blockchain, so that the second blockchain returns second existence certification information of a query result of the second resource locking event;
a resource transfer request is generated based on the first presence credential information and the second presence credential information.
Optionally, if the processing request is an asset transfer request, sending the processing request to the first blockchain and the second blockchain, so that the first blockchain and the second blockchain respectively process the cross-chain transaction, including:
and respectively sending the asset transfer request to the first blockchain and the second blockchain, so that the first blockchain and the second blockchain respectively verify the first existence certification information and the second existence certification information carried in the asset transfer request, and transfer the first resource and the second resource when the first existence certification information and the second existence certification information are verified.
Optionally, generating an asset rollback request comprises:
querying the second blockchain for a second resource locking event so that the second blockchain returns third existence certification information of a query result of the second resource locking event;
a resource rollback request is generated based on the third presence credential information.
Optionally, if the processing request is an asset rollback request, sending the processing request to the first blockchain and the second blockchain, respectively, so that the first blockchain and the second blockchain process the processing request, respectively, including:
and respectively sending the asset rollback request to the first block chain and the second block chain, so that the first block chain verifies third existence certification information carried in the asset rollback request, and rolls back the first resource when the verification is passed, so that the second block chain verifies the third existence certification information carried in the asset rollback request, and rolls back the second resource when the verification is passed.
Optionally, determining the specified time period based on the time information of the first resource lock event comprises:
the specified period is determined based on a timeout timestamp included in the event information of the first resource lock event.
In a second aspect, an embodiment of the present application provides another method for processing a cross-chain transaction, where the method includes:
when an asset locking request aiming at a first resource is received, locking the first resource and triggering a first resource locking event;
and processing the processing request when receiving the processing request sent by the cross-link relay, wherein the processing request is generated by the cross-link relay when monitoring a first resource locking event and based on whether a second resource locking event of a second resource triggered in a second block chain is monitored within a specified time period, and the specified time period is determined based on the event information of the first resource locking event.
Optionally, the method further includes:
when receiving a query request of a cross-link relay for a first resource locking event, determining a query result of the first resource locking event;
and generating first existence certification information of the query result of the first resource locking event, and returning the first existence certification information to the cross-link relay.
Optionally, the processing request is an asset transfer request or an asset rollback request, wherein the asset transfer request is generated when the cross-chain relay has heard the second resource locking event within a specified time period, and the asset rollback request is generated when the cross-chain relay has not heard the second resource locking event within the specified time period;
if the processing request is an asset transfer request, processing the processing request, including:
verifying first existence certification information and second existence certification information carried in the asset transfer request, and transferring the first resource and the second resource when the first existence certification information and the second existence certification information are verified, wherein the second existence certification information is provided for the cross-link relay by a second block chain when the cross-link relay monitors a second resource locking event in a specified time period;
if the processing request is an asset rollback request, processing the processing request, including:
and verifying third existence certification information carried in the asset transfer request, and rolling back the first resource when the third existence certification information is verified, wherein the third existence certification information is provided for the cross-link relay by the second block chain when the cross-link relay does not monitor the second resource locking event within a specified time period.
Optionally, the first resource locks a timeout timestamp included in the event information of the event, and the timeout timestamp is used for causing the cross-link relay to determine the specified period.
In a third aspect, an embodiment of the present application provides an apparatus for processing a cross-chain transaction, where the apparatus includes:
the system comprises a specified time interval determining module, a first resource locking event processing module and a second resource locking event processing module, wherein the specified time interval determining module is used for determining a specified time interval based on event information of the first resource locking event when a first resource locking event of a first resource triggered in a first block chain is monitored by a cross-link relay;
and the processing request generating module is used for generating corresponding processing requests based on whether a second resource locking event for a second resource triggered in the second block chain is monitored in a specified time period, and sending the processing requests to the first block chain and the second block chain respectively so as to enable the first block chain and the second block chain to process the processing requests respectively.
Optionally, the processing request is an asset transfer request or an asset rollback request, and the processing request generating module is specifically configured to, when generating the corresponding processing request based on whether a second resource locking event for the second resource triggered in the second block chain is monitored within a specified time period:
generating an asset transfer request if a second resource locking event for a second resource triggered in a second blockchain is monitored within a specified time period;
if a second resource lock event for a second resource triggered in a second blockchain is not monitored within a specified time period, an asset rollback request is generated.
Optionally, the processing request generating module is specifically configured to, when generating the asset transfer request:
querying the first blockchain for a first resource locking event so that the first blockchain returns first existence certification information of a query result of the first resource locking event;
querying a second resource locking event for the second blockchain, so that the second blockchain returns second existence certification information of a query result of the second resource locking event;
a resource transfer request is generated based on the first presence credential information and the second presence credential information.
Optionally, if the processing request is an asset transfer request, the processing request generating module is specifically configured to, when sending the processing request to the first blockchain and the second blockchain respectively so that the first blockchain and the second blockchain process the processing request respectively:
and respectively sending the asset transfer request to the first blockchain and the second blockchain, so that the first blockchain and the second blockchain respectively verify the first existence certification information and the second existence certification information carried in the asset transfer request, and transfer the first resource and the second resource when the first existence certification information and the second existence certification information are verified.
Optionally, when the processing request generating module generates the asset rollback request, the processing request generating module is specifically configured to:
querying the second blockchain for a second resource locking event so that the second blockchain returns third existence certification information of a query result of the second resource locking event;
a resource rollback request is generated based on the third presence credential information.
Optionally, if the processing request is an asset rollback request, the processing request generating module is specifically configured to, when sending the processing request to the first blockchain and the second blockchain respectively so that the first blockchain and the second blockchain process the processing request respectively:
and respectively sending the asset rollback request to the first block chain and the second block chain, so that the first block chain verifies third existence certification information carried in the asset rollback request, and rolls back the first resource when the verification is passed, so that the second block chain verifies the third existence certification information carried in the asset rollback request, and rolls back the second resource when the verification is passed.
Optionally, when determining the designated time period based on the time information of the first resource locking event, the designated time period determining module is specifically configured to:
the specified period is determined based on a timeout timestamp included in the event information of the first resource lock event.
In a fourth aspect, an embodiment of the present application provides another processing apparatus for a cross-chain transaction, where the apparatus includes:
the resource locking module is used for locking a first resource and triggering a first resource locking event when an asset locking request aiming at the first resource is received;
and the transaction processing module is used for processing the processing request when receiving the processing request sent by the cross-link relay, wherein the processing request is generated by the cross-link relay when monitoring a first resource locking event and based on whether monitoring a second resource locking event of a second resource triggered in a second block chain within a specified time period, and the specified time period is determined based on the event information of the first resource locking event.
Optionally, the apparatus further includes a presence attestation information returning module, where the presence attestation information returning module is configured to:
when receiving a query request of a cross-link relay for a first resource locking event, determining a query result of the first resource locking event;
and generating first existence certification information of the query result of the first resource locking event, and returning the first existence certification information to the cross-link relay.
Optionally, the processing request is an asset transfer request or an asset rollback request, wherein the asset transfer request is generated when the cross-chain relay has heard the second resource locking event within a specified time period, and the asset rollback request is generated when the cross-chain relay has not heard the second resource locking event within the specified time period;
if the processing request is an asset transfer request, the transaction processing module is specifically configured to, when processing the processing request:
verifying first existence certification information and second existence certification information carried in the asset transfer request, and transferring the first resource and the second resource when the first existence certification information and the second existence certification information are verified, wherein the second existence certification information is provided for the cross-link relay by a second block chain when the cross-link relay monitors a second resource locking event in a specified time period;
if the processing request is an asset rollback request, the transaction processing module is specifically configured to, when processing the processing request:
and verifying third existence certification information carried in the asset transfer request, and rolling back the first resource when the third existence certification information is verified, wherein the third existence certification information is provided for the cross-link relay by the second block chain when the cross-link relay does not monitor the second resource locking event within a specified time period.
Optionally, the first resource locks a timeout timestamp included in the event information of the event, and the timeout timestamp is used for causing the cross-link relay to determine the specified period.
In a fifth aspect, an embodiment of the present application provides an electronic device, including: a processor and a memory;
a memory for storing operating instructions;
a processor configured to execute a processing method of a cross-chain transaction as shown in any implementation of the first aspect of the present application or in any implementation of the second aspect of the present application by calling an operation instruction.
In a sixth aspect, embodiments of the present application provide a computer-readable storage medium on which is stored a computer program, which when executed by a processor implements a method for processing a cross-chain transaction as shown in any of the embodiments of the first aspect of the present application or any of the embodiments of the second aspect of the present application.
In a seventh aspect, the present application provides a computer program product comprising a computer program that, when executed by a processor, implements the processing method of a cross-chain transaction as shown in any implementation of the first aspect of the present application or any implementation of the second aspect of the present application.
The technical scheme provided by the embodiment of the application has the following beneficial effects:
according to the scheme provided by the embodiment of the application, when the cross-link relay monitors a first resource locking event for a first resource triggered in a first block chain, a specified time period is determined based on event information of the first resource locking event, a corresponding processing request is generated based on whether a second resource locking event for a second resource triggered in a second block chain is monitored in the specified time period, and the processing request is respectively sent to the first block chain and the second block chain, so that the first block chain and the second block chain respectively process the processing request. In the scheme, the timing task in the cross-chain transaction is realized through the cross-chain relay, so that the cross-chain transaction does not depend on the timing task capability of the block chain any more, and the universality of the cross-chain transaction scheme is promoted.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings used in the description of the embodiments of the present application will be briefly described below.
Fig. 1 is a schematic flowchart of a processing method for a cross-chain transaction according to an embodiment of the present application;
fig. 2 is a schematic flowchart of another processing method for cross-chain transactions according to an embodiment of the present disclosure;
fig. 3 is a schematic structural diagram of a processing apparatus for cross-chain transactions according to an embodiment of the present application;
fig. 4 is a schematic structural diagram of another processing apparatus for cross-chain transactions according to an embodiment of the present application;
fig. 5 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
Reference will now be made in detail to embodiments of the present application, examples of which are illustrated in the accompanying drawings, wherein like or similar reference numerals refer to the same or similar elements or elements having the same or similar function throughout. The embodiments described below with reference to the drawings are exemplary only for the purpose of explaining the present application and are not to be construed as limiting the present invention.
As used herein, the singular forms "a", "an", "the" and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It will be further understood that the terms "comprises" and/or "comprising," when used in this specification, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof. It will be understood that when an element is referred to as being "connected" or "coupled" to another element, it can be directly connected or coupled to the other element or intervening elements may also be present. Further, "connected" or "coupled" as used herein may include wirelessly connected or wirelessly coupled. As used herein, the term "and/or" includes all or any element and all combinations of one or more of the associated listed items.
To make the objects, technical solutions and advantages of the present application more clear, embodiments of the present application will be described in further detail below with reference to the accompanying drawings.
Solving the transactional nature of cross-chain transactions is a difficult problem faced in cross-chain technology. A complete cross-chain transaction can be split into a plurality of sub-transactions belonging to respective blockchain systems, and the sub-transactions form a transaction which should have the ACID characteristics including atomicity, consistency, isolation and persistence.
Atomic (atomic): operations in a cross-chain transaction either all occur or none occur;
identity (uniformity): a cross-chain transaction must transition all block chains from one coherency state to another;
isolation (isolation): the concurrent execution of each cross-chain transaction cannot interfere with each other;
durability (durabilty): once a cross-chain transaction is committed, its changes to the data in the blockchain are permanent and do not roll back without reason.
For a cross-chain transaction scene of asset exchange, a Hash locking scheme is mainly adopted at present, and fair transaction is realized by asset locking and setting corresponding timeout duration and unlocking conditions. The basic flow of hash locking is as follows:
(1) and generating a random number s by the account A on the block chain X, generating a hash value hash(s) of the random number s, and sending the hash(s) to the account B on the block chain Y.
(2) Account A locks money on blockchain X, transfers to account B if blockchain X receives s within time TA (current time +2X), and returns to account A otherwise. Where x is the timeout duration.
(3) And (5) the account B receives the hash(s), after the locking currency of the account A is determined and the preset time is determined, the currency is locked on the block chain Y, if the block chain Y receives s in the time TA-x, the currency is transferred to the account A, otherwise, the currency is returned to the account B.
(4) After determining the locking currency of the account B, the account A sends s to the block chain Y within the time TA-x to obtain the currency of the block chain Y.
(5) And after receiving s, the account B sends s to the block chain X within the time TA to obtain the coins of the block chain X.
In the hash locking scheme, a blockchain participating in cross-chain transaction needs to have the capability of a timing task, but most blockchains do not have the capability of the timing task at present, so that when the cross-chain transaction is performed on the blockchain without the capability of the timing task, the locked resource cannot be rolled back after the transaction is over time, and the universality of the existing cross-chain transaction scheme is poor.
The processing method, the processing device, the electronic device and the readable storage medium for cross-chain transaction provided by the embodiments of the application aim to solve at least one of the above technical problems in the prior art.
The following describes the technical solutions of the present application and how to solve the above technical problems with specific embodiments. The following several specific embodiments may be combined with each other, and details of the same or similar concepts or processes may not be repeated in some embodiments. Embodiments of the present application will be described below with reference to the accompanying drawings.
Fig. 1 shows a flowchart of a processing method for a cross-link transaction provided in an embodiment of the present application, where the method is applied to a cross-link relay, and as shown in fig. 1, the method mainly includes:
step 110: when the cross-link relay monitors a first resource locking event of a first resource triggered in a first block chain, determining a specified time period based on event information of the first resource locking event;
step 120: and generating a corresponding processing request based on whether a second resource locking event for a second resource triggered in a second block chain is monitored in a specified time period, and respectively sending the processing request to the first block chain and the second block chain so that the first block chain and the second block chain respectively process the processing request.
The first blockchain and the second blockchain may be two blockchains participating in a cross-chain transaction, the cross-chain relay may be a device independent of the first blockchain and the second blockchain, and the cross-chain relay may establish communication connections with the first blockchain and the second blockchain, respectively.
The first resource and the second resource are resources involved in a cross-chain transaction, and may be, for example, blockchain currency.
The first block chain and the second block chain need to be respectively provided with a cross-chaining contract, and the cross-chaining contract can realize the following interfaces:
(1) and the resource locking interface is used for locking the resources involved in the cross-chain transaction. The method is called by a user and can trigger a corresponding resource locking event;
(2) and the resource transfer interface is used for transferring the locked resources and is called by the cross-link relay at a specific stage.
(3) And the resource rollback interface is used for rolling back the locked resources. The call is taken care of at a particular stage by the cross-link relay.
When performing a cross-chain transaction, the first blockchain and the second blockchain may lock the corresponding resource and trigger a corresponding resource locking event when receiving a resource locking request of a user, respectively. In particular, a user may issue a resource lock request through a resource lock interface.
The cross-link relay may monitor a first resource lock event of the first blockchain and a second resource lock event of the second blockchain, respectively.
In the embodiment of the present application, the first monitored block chain triggering the resource locking event in the cross-chain relay may be referred to as a first block chain, and there is no essential difference between the processing steps in the first block chain and the processing steps in the second block chain in the cross-chain transaction.
Upon listening for a first resource lock event across a chain relay, a specified period of time may be determined based on event information for the first resource lock event, which may be used to determine whether a second resource lock event times out.
According to whether a second resource locking event for a second resource triggered in a second block chain is monitored in a specified time period, a cross-link relay can generate a corresponding processing request, and the processing request is respectively sent to a first block chain and the second block chain for processing.
The appointed time interval is determined through the event information of the resource locking event, and whether the second resource locking event is monitored in the appointed time interval is determined through the cross-chain relay, namely, the timing task is realized through the cross-chain relay, so that the cross-chain transaction is realized, and the cross-chain transaction does not depend on the timing task capability of the block chain.
According to the method provided by the embodiment of the application, when a cross-link relay monitors a first resource locking event for a first resource triggered in a first block chain, a specified time period is determined based on event information of the first resource locking event, a corresponding processing request is generated based on whether a second resource locking event for a second resource triggered in a second block chain is monitored in the specified time period, and the processing request is respectively sent to the first block chain and the second block chain, so that the first block chain and the second block chain respectively process the processing request. In the scheme, the timing task in the cross-chain transaction is realized through the cross-chain relay, so that the cross-chain transaction does not depend on the timing task capability of the block chain any more, and the universality of the cross-chain transaction scheme is promoted.
In an optional manner of the embodiment of the present application, the processing request is an asset transfer request or an asset rollback request, and the generating of the corresponding processing request is based on whether a second resource locking event for a second resource triggered in a second blockchain is monitored within a specified time period includes:
generating an asset transfer request if a second resource locking event for a second resource triggered in a second blockchain is monitored within a specified time period;
if a second resource lock event for a second resource triggered in a second blockchain is not monitored within a specified time period, an asset rollback request is generated.
In the embodiment of the present application, if the cross-link relay monitors the second resource locking event within a specified time period, it may be considered that the transaction is not timed out, and at this time, an asset transfer request may be generated.
If the cross-link relay fails to monitor the second resource lock event within a specified period of time, the transaction may be considered to be timed out, at which point an asset rollback request may be generated.
In an optional manner of the embodiment of the present application, generating an asset transfer request includes:
querying the first blockchain for a first resource locking event so that the first blockchain returns first existence certification information of a query result of the first resource locking event;
querying a second resource locking event for the second blockchain, so that the second blockchain returns second existence certification information of a query result of the second resource locking event;
a resource transfer request is generated based on the first presence credential information and the second presence credential information.
In an embodiment of the present application, when generating an asset transfer request, a cross-link relay may query a first blockchain for a first resource lock event and query a second blockchain for a second resource lock event. The first blockchain may query the first resource locking event to obtain a query result of the first resource locking event, and the presence of the first resource locking event may be determined based on the query result of the first resource locking event. First presence credential information for the query result of the first resource lock event may then be generated and returned to the cross-link relay. Similarly, the second blockchain may query for the second resource locking event to obtain a query result of the second resource locking event, and the presence of the second resource locking event can be determined based on the query result of the second resource locking event. Second presence credential information for the query result for the second resource lock event can then be generated and returned to the cross-link relay.
The cross-link relay may generate the resource transfer request using the first presence attestation information and the second presence attestation information as parameters.
In an optional manner of this embodiment of the present application, if the processing request is an asset transfer request, the sending the processing request to the first blockchain and the second blockchain, respectively, so that the first blockchain and the second blockchain process the processing request, respectively, includes:
the asset transfer request is respectively sent to the first blockchain and the second blockchain, so that the first blockchain and the second blockchain respectively verify the validity of the first existence certification information and the second existence certification information carried in the asset transfer request, and transfer the first resource and the second resource when the first existence certification information and the second existence certification information are verified.
In this embodiment of the application, the cross-link relay may send the asset transfer request to the first blockchain and the second blockchain, respectively, and specifically, may call the resource transfer interface to send the asset transfer request to a node in the first blockchain and a node in the second blockchain.
The first blockchain and the second blockchain can respectively verify the validity of the first existence certification information and the validity of the second existence certification information, and when the first blockchain and the second blockchain are verified, the current cross-chain transaction is considered to meet the requirements, and the first resource and the second resource can be transferred. In particular, the second resource may be transferred to the first blockchain, and the first resource may be transferred to the second blockchain.
Since the asset transfer request carries the first presence certificate information and the second presence certificate information, in order to avoid leakage of the first presence certificate information and the second presence certificate information in the process of sending the asset transfer request to the first blockchain and the second blockchain, the first presence certificate information and the second presence certificate information may be encrypted to ensure security of the first presence certificate information and the second presence certificate information. Specifically, the encryption may be implemented by data obfuscating the first presence credential information and the second presence credential information, respectively.
As an example, the first presence certificate information and the second presence certificate information may be respectively obfuscated based on a preset data obfuscating rule, and the obfuscated first presence certificate information and the obfuscated second presence certificate information may be used as parameters of the resource transfer request. When the first block chain and the second block chain receive the resource transfer request, the obfuscated first presence attestation information may be converted into first presence attestation information according to the data obfuscation rule, and the obfuscated second presence attestation information may be converted into second presence attestation information, and then the validity of the first presence attestation information and the validity of the second presence attestation information may be verified respectively.
In an optional manner of the embodiment of the present application, generating an asset rollback request includes:
querying a second resource locking event for the second blockchain to enable the second blockchain to return third existence certification information of a query result of the second resource locking event;
a resource rollback request is generated based on the third presence credential information.
In this embodiment, when the cross-link relay does not monitor the second resource lock event within the specified time period, the cross-link relay may query the second blockchain for the second resource lock event. The second blockchain may query the second resource locking event to obtain a query result of the second resource locking event, and it may be determined that the second resource locking event does not exist based on the query result of the second resource locking event. Third presence credential information for the second resource lock event query result may then be generated and returned to the cross-link relay.
The cross-link relay may generate the resource rollback request using the third presence credential information as a parameter.
In an optional manner of this embodiment of the present application, if the processing request is an asset rollback request, the sending the processing request to the first blockchain and the second blockchain respectively, so that the first blockchain and the second blockchain process the processing request respectively includes:
and respectively sending the asset rollback request to the first block chain and the second block chain, so that the first block chain verifies third existence certification information carried in the asset rollback request, and rolls back the first resource when the verification is passed, so that the second block chain verifies the third existence certification information carried in the asset rollback request, and rolls back the second resource when the verification is passed.
In this embodiment of the application, the cross-link relay may send the asset rollback request to the first blockchain and the second blockchain, and specifically, may call the resource rollback interface to send the asset rollback request to a node in the first blockchain and a node in the second blockchain.
The first blockchain may verify the validity of the third presence credential information carried in the asset rollback request and rollback the first resource when the verification passes. The second blockchain may verify the validity of the third presence credential information carried in the asset rollback request and rollback the second resource when the verification passes.
Since the asset rollback request carries the third presence certificate information, in order to avoid leakage of the third presence certificate information in the process of sending the asset rollback request to the first blockchain and the second blockchain, the third presence certificate information may be encrypted to ensure security of the third presence certificate information. Specifically, encryption may be implemented in a manner that data obfuscates the third presence credential information.
As an example, the third presence credential information may be obfuscated based on a preset data obfuscation rule, and the obfuscated third presence credential information may be used as a parameter of the resource rollback request. When the first block chain and the second block chain receive the resource rollback request, the obfuscated third existence certification information may be converted into third existence certification information according to the data obfuscation rule, and then validity of the third existence certification information may be verified.
In an optional manner of the embodiment of the present application, determining the specified time period based on the time information of the first resource lock event includes:
the specified period is determined based on a timeout timestamp included in the event information of the first resource lock event.
In the embodiment of the application, the event information of the first resource locking event may include a timeout timestamp, and the specified time period may be determined according to the timeout timestamp. The timeout timestamp can be specified according to actual situation needs. In actual use, the specified period may also be determined by specifying the block height, i.e., such that the specified block height is included in the event information.
The event information of the first resource locking event may further include an Identity Document (ID), and the transaction ID may be used for querying the first resource locking event and the second resource locking event.
Accordingly, the event information of the second resource lock event may also include a timeout timestamp and a transaction ID, or may include a specified block height and a transaction ID.
Fig. 2 is a schematic flowchart illustrating another processing method for a cross-chain transaction according to an embodiment of the present application, where the method is applied to a first node on a first blockchain, and as shown in fig. 2, the method mainly includes:
step S210: when an asset locking request aiming at a first resource is received, locking the first resource and triggering a first resource locking event;
step S220: and processing the processing request when receiving the processing request sent by the cross-link relay, wherein the processing request is generated by the cross-link relay when monitoring a first resource locking event and based on whether a second resource locking event of a second resource triggered in a second block chain is monitored within a specified time period, and the specified time period is determined based on the event information of the first resource locking event.
In this embodiment, the first node may be a node in the first blockchain that establishes a communication connection with the inter-link relay.
When a cross-chain transaction is carried out, a first block chain can lock a first resource and trigger a first resource locking event when receiving a resource locking request of a user.
Upon listening for a first resource lock event across a chain relay, a specified period of time may be determined based on event information for the first resource lock event, which may be used to determine whether a second resource lock event times out.
According to whether a second resource locking event for a second resource triggered in a second block chain is monitored in a specified time period, a cross-link relay can generate a corresponding processing request and send the processing request to the first block chain for processing.
According to the method provided by the embodiment of the application, when an asset locking request aiming at a first resource is received, the first resource is locked, a first resource locking event is triggered, and when a processing request sent by a cross-link relay is received, the processing request is processed, wherein the processing request is generated by monitoring a second resource locking event of a second resource triggered in a second block chain by the cross-link relay in a specified time period, and the specified time period is determined based on event information of the first resource locking event. In the scheme, the timing task in the cross-chain transaction is realized through the cross-chain relay, so that the cross-chain transaction does not depend on the timing task capability of the block chain any more, and the universality of the cross-chain transaction scheme is promoted.
A second node in the second blockchain may be used as the first node, so that the method provided in fig. 2 may also be applied to the second node.
In an optional manner of the embodiment of the present application, the method further includes:
when receiving a query request of a cross-link relay for a first resource locking event, determining a query result of the first resource locking event;
and generating first existence certification information of the query result of the first resource locking event, and returning the first existence certification information to the cross-link relay.
In the embodiment of the application, when the processing request is generated by the cross-link relay, if the cross-link relay monitors a second resource locking event for a second resource triggered in a second block chain within a specified time period, the cross-link relay may query the first block chain for the first resource locking event, and the first block chain may query the first resource locking event to obtain a query result of the first resource locking event, and then may generate first existence certification information of the query result of the first resource locking event, and return the first existence certification information to the cross-link relay.
The cross-link relay may query the second blockchain for the second resource locking event at the same time, and the second blockchain may query the second resource locking event to obtain a query result of the second resource locking event, and then may generate second existence certification information of the query result of the second resource locking event, and return the second existence certification information to the cross-link relay.
The cross-link relay may generate the resource transfer request using the first presence attestation information and the second presence attestation information as parameters.
In this embodiment, when the cross-link relay does not monitor the second resource locking event within the specified time period, the cross-link relay may query the second blockchain for the second resource locking event. The second blockchain may query for a second resource locking event, resulting in a second resource locking event query result, based on which it may be determined that the second resource locking event does not exist. Third presence credential information for the second resource lock event query result may then be generated and returned to the cross-link relay.
The cross-link relay may generate the resource rollback request using the third presence credential information as a parameter.
In an optional manner of the embodiment of the present application, the processing request is an asset transfer request or an asset rollback request, where the asset transfer request is generated when the cross-link relay monitors the second resource locking event within a specified time period, and the asset rollback request is generated when the cross-link relay does not monitor the second resource locking event within the specified time period;
if the processing request is an asset transfer request, processing the processing request, including:
verifying first existence certification information and second existence certification information carried in the asset transfer request, and transferring the first resource and the second resource when the first existence certification information and the second existence certification information are verified, wherein the second existence certification information is provided for the cross-link relay by a second block chain when the cross-link relay monitors a second resource locking event in a specified time period;
if the processing request is an asset rollback request, processing the processing request, including:
and verifying third existence certification information carried in the asset transfer request, and rolling back the first resource when the third existence certification information is verified, wherein the third existence certification information is provided for the cross-link relay by the second block chain when the cross-link relay does not monitor the second resource locking event within a specified time period.
In this embodiment of the application, if the cross-link relay monitors the second resource locking event within a specified time period, it may be considered that the transaction is not overtime, and at this time, the cross-link relay may generate an asset transfer request and send the asset transfer request to the first blockchain and the second blockchain, respectively.
The process of generating the asset transfer request by the cross-link relay comprises the following steps: the cross-link relay queries the first blockchain for a first resource lock event and queries the second blockchain for a second resource lock event. The first blockchain may query the first resource locking event to obtain a query result of the first resource locking event, and the presence of the first resource locking event may be determined based on the query result of the first resource locking event. First presence credential information for the query result of the first resource lock event may then be generated and returned to the cross-link relay. The second blockchain may query the second resource locking event to obtain a query result of the second resource locking event, and the existence of the second resource locking event may be determined based on the query result of the second resource locking event. Second presence credential information for the query result for the second resource lock event can then be generated and returned to the cross-link relay. The cross-link relay may generate the resource transfer request using the first presence attestation information and the second presence attestation information as parameters.
The cross-link relay may send the asset transfer request to the first blockchain and the second blockchain, respectively, and specifically, may call the resource transfer interface to send the asset transfer request to the first node in the first blockchain and the second node in the second blockchain.
The first blockchain and the second blockchain can respectively verify the validity of the first existence certification information and the validity of the second existence certification information carried in the asset transfer request, and when the two are verified to pass, the current cross-chain transaction is considered to meet the requirements, and the first resource and the second resource can be transferred. In particular, the second resource may be transferred to the first blockchain, and the first resource may be transferred to the second blockchain.
In the embodiment of the application, if the cross-link relay fails to monitor the second resource locking event within a specified time period, the transaction may be considered to be overtime, and at this time, the cross-link relay may generate an asset rollback request and send the asset rollback request to the first blockchain and the second blockchain, respectively.
The process of generating the asset rollback request by the cross-link relay comprises the following steps: the cross-link relay queries the second blockchain for a second resource lock event. The second blockchain may query the second resource locking event to obtain a second resource locking event query result, and based on the second resource locking event query result, it may be determined that the second resource locking event does not exist. Third presence credential information for the query result of the second resource lock event may then be generated and returned to the cross-link relay. The cross-link relay may generate the resource rollback request using the third presence credential information as a parameter.
The cross-link relay may send the asset rollback request to the first blockchain and the second blockchain, respectively, and specifically, may call the resource rollback interface to send the asset rollback request to the first node in the first blockchain and the second node in the second blockchain.
The first blockchain may verify the validity of the third presence credential information carried in the asset rollback request and rollback the first resource when the verification passes. Accordingly, the second blockchain may verify the validity of the third presence credential information carried in the asset rollback request and rollback the second resource when the verification passes.
In an optional manner of the embodiment of the present application, the first resource locks a timeout timestamp included in the event information of the event, where the timeout timestamp is used to enable the cross-link relay to determine the specified time period.
In the embodiment of the application, the event information of the first resource locking event may include a timeout timestamp, the inter-link relay may determine the specified time period according to the timeout timestamp, and in actual use, the event information may also include a specified block height, so that the inter-link relay may determine the specified time period according to the specified block height.
The event information of the first resource locking event may further include a transaction ID (Identity) for querying the first resource locking event and the second resource locking event.
Accordingly, the event information of the second resource lock event may also include a timeout timestamp and a transaction ID, or may include a specified block height and a transaction ID.
Based on the same principle as the method shown in fig. 1, fig. 3 shows a schematic structural diagram of a processing apparatus for cross-chain transaction provided by an embodiment of the present application, and as shown in fig. 3, the processing apparatus 30 for cross-chain transaction may include:
a designated time period determination module 310, configured to determine a designated time period based on event information of a first resource lock event when a first resource lock event for a first resource triggered in a first block chain is monitored by a cross-link relay;
the processing request generating module 320 is configured to generate a corresponding processing request based on whether a second resource locking event for a second resource triggered in a second blockchain is monitored within a specified time period, and send the processing request to the first blockchain and the second blockchain, respectively, so that the first blockchain and the second blockchain process the processing request, respectively.
The apparatus provided in the embodiment of the present application, when a cross-link relay monitors a first resource locking event for a first resource triggered in a first block chain, determines a specified time period based on event information of the first resource locking event, generates a corresponding processing request based on whether a second resource locking event for a second resource triggered in a second block chain is monitored in the specified time period, and sends the processing request to the first block chain and the second block chain, so that the first block chain and the second block chain process the processing request respectively. In the scheme, the timing task in the cross-chain transaction is realized through the cross-chain relay, so that the cross-chain transaction does not depend on the timing task capability of the block chain any more, and the universality of the cross-chain transaction scheme is promoted.
Optionally, the processing request is an asset transfer request or an asset rollback request, and the processing request generating module is specifically configured to, when generating the corresponding processing request based on whether a second resource locking event for the second resource triggered in the second block chain is monitored within a specified time period:
generating an asset transfer request if a second resource locking event for a second resource triggered in a second blockchain is monitored within a specified time period;
if a second resource lock event for a second resource triggered in a second blockchain is not monitored within a specified time period, an asset rollback request is generated.
Optionally, the processing request generating module is specifically configured to, when generating the asset transfer request:
querying the first blockchain for a first resource locking event so that the first blockchain returns first existence certification information of a query result of the first resource locking event;
querying a second resource locking event for the second blockchain, so that the second blockchain returns second existence certification information of a query result of the second resource locking event;
a resource transfer request is generated based on the first presence credential information and the second presence credential information.
Optionally, if the processing request is an asset transfer request, the processing request generating module is specifically configured to, when sending the processing request to the first blockchain and the second blockchain respectively so that the first blockchain and the second blockchain process the processing request respectively:
and respectively sending the asset transfer request to the first blockchain and the second blockchain, so that the first blockchain and the second blockchain respectively verify the first existence certification information and the second existence certification information carried in the asset transfer request, and transfer the first resource and the second resource when the first existence certification information and the second existence certification information are verified.
Optionally, when the processing request generating module generates the asset rollback request, the processing request generating module is specifically configured to:
querying the second blockchain for a second resource locking event so that the second blockchain returns third existence certification information of a query result of the second resource locking event;
a resource rollback request is generated based on the third presence credential information.
Optionally, if the processing request is an asset rollback request, the processing request generating module is specifically configured to, when sending the processing request to the first blockchain and the second blockchain respectively so that the first blockchain and the second blockchain process the processing request respectively:
and respectively sending the asset rollback request to the first block chain and the second block chain, so that the first block chain verifies third existence certification information carried in the asset rollback request, and rolls back the first resource when the verification is passed, so that the second block chain verifies the third existence certification information carried in the asset rollback request, and rolls back the second resource when the verification is passed.
Optionally, when determining the designated time period based on the time information of the first resource locking event, the designated time period determining module is specifically configured to:
the specified period is determined based on a timeout timestamp included in the event information of the first resource lock event.
It is understood that the above modules of the processing apparatus for cross-chain transactions in the embodiment have functions of implementing the corresponding steps of the processing method for cross-chain transactions in the embodiment shown in fig. 1. The function can be realized by hardware, and can also be realized by executing corresponding software by hardware. The hardware or software includes one or more modules corresponding to the functions described above. The modules can be software and/or hardware, and each module can be implemented independently or by integrating a plurality of modules. For the functional description of each module of the processing apparatus for cross-chain transaction, reference may be specifically made to the corresponding description of the processing method for cross-chain transaction in the embodiment shown in fig. 1, and details are not repeated here.
Based on the same principle as the method shown in fig. 2, fig. 4 shows a schematic structural diagram of a processing apparatus for cross-chain transaction provided by an embodiment of the present application, and as shown in fig. 4, the processing apparatus 40 for cross-chain transaction may include:
a resource locking module 410, configured to lock a first resource and trigger a first resource locking event when an asset locking request for the first resource is received;
and the transaction processing module 420 is configured to process the processing request when receiving the processing request sent by the cross-link relay, where the processing request is generated by the cross-link relay when monitoring the first resource locking event and is based on whether a second resource locking event for the second resource triggered in the second blockchain is monitored within a specified time period, and the specified time period is determined based on the event information of the first resource locking event.
The device provided by the embodiment of the application locks the first resource and triggers a first resource locking event when receiving an asset locking request for the first resource, and processes a processing request when receiving the processing request sent by a cross-link relay, wherein the processing request is generated by the cross-link relay when monitoring the first resource locking event and based on whether a second resource locking event triggered in a second block chain is monitored within a specified time period, and the specified time period is determined based on event information of the first resource locking event. In the scheme, the timing task in the cross-chain transaction is realized through the cross-chain relay, so that the cross-chain transaction does not depend on the timing task capability of the block chain any more, and the universality of the cross-chain transaction scheme is promoted.
Optionally, the apparatus further includes a presence attestation information returning module, where the presence attestation information returning module is configured to:
when receiving a query request of a cross-link relay for a first resource locking event, determining a query result of the first resource locking event;
and generating first existence certification information of the query result of the first resource locking event, and returning the first existence certification information to the cross-link relay.
Optionally, the processing request is an asset transfer request or an asset rollback request, wherein the asset transfer request is generated when the cross-chain relay has heard the second resource locking event within a specified time period, and the asset rollback request is generated when the cross-chain relay has not heard the second resource locking event within the specified time period;
if the processing request is an asset transfer request, the transaction processing module is specifically configured to, when processing the processing request:
verifying first existence certification information and second existence certification information carried in the asset transfer request, and transferring the first resource and the second resource when the first existence certification information and the second existence certification information are verified, wherein the second existence certification information is provided for the cross-link relay by a second block chain when the cross-link relay monitors a second resource locking event in a specified time period;
if the processing request is an asset rollback request, the transaction processing module is specifically configured to, when processing the processing request:
and verifying third existence certification information carried in the asset transfer request, and rolling back the first resource when the third existence certification information is verified, wherein the third existence certification information is provided for the cross-link relay by the second block chain when the cross-link relay does not monitor the second resource locking event within a specified time period.
Optionally, the first resource locks a timeout timestamp included in the event information of the event, and the timeout timestamp is used for causing the cross-link relay to determine the specified period.
It is understood that the above modules of the processing apparatus for cross-chain transactions in the embodiment have functions of implementing the corresponding steps of the processing method for cross-chain transactions in the embodiment shown in fig. 2. The function can be realized by hardware, and can also be realized by executing corresponding software by hardware. The hardware or software includes one or more modules corresponding to the functions described above. The modules can be software and/or hardware, and each module can be implemented independently or by integrating a plurality of modules. For the functional description of each module of the processing apparatus for cross-chain transaction, reference may be specifically made to the corresponding description of the processing method for cross-chain transaction in the embodiment shown in fig. 2, and details are not repeated here.
The embodiment of the application provides an electronic device, which comprises a processor and a memory;
a memory for storing operating instructions;
and the processor is used for executing the processing method of the cross-chain transaction provided by any embodiment of the application by calling the operation instruction.
As an example, fig. 5 shows a schematic structural diagram of an electronic device to which an embodiment of the present application is applicable, and as shown in fig. 5, the electronic device 2000 includes: a processor 2001 and a memory 2003. Wherein the processor 2001 is coupled to a memory 2003, such as via a bus 2002. Optionally, the electronic device 2000 may also include a transceiver 2004. It should be noted that the transceiver 2004 is not limited to one in practical applications, and the structure of the electronic device 2000 is not limited to the embodiment of the present application.
The processor 2001 is applied to the embodiment of the present application to implement the method shown in the above method embodiment. The transceiver 2004 may include a receiver and a transmitter, and the transceiver 2004 is applied to the embodiments of the present application to implement the functions of the electronic device of the embodiments of the present application to communicate with other devices when executed.
The Processor 2001 may be a CPU (Central Processing Unit), general Processor, DSP (Digital Signal Processor), ASIC (Application Specific Integrated Circuit), FPGA (Field Programmable Gate Array) or other Programmable logic device, transistor logic device, hardware component, or any combination thereof. Which may implement or perform the various illustrative logical blocks, modules, and circuits described in connection with the disclosure. The processor 2001 may also be a combination of computing functions, e.g., comprising one or more microprocessors, DSPs and microprocessors, and the like.
Bus 2002 may include a path that conveys information between the aforementioned components. The bus 2002 may be a PCI (Peripheral Component Interconnect) bus, an EISA (Extended Industry Standard Architecture) bus, or the like. The bus 2002 may be divided into an address bus, a data bus, a control bus, and the like. For ease of illustration, only one thick line is shown in FIG. 5, but this is not intended to represent only one bus or type of bus.
The Memory 2003 may be a ROM (Read Only Memory) or other type of static storage device that can store static information and instructions, a RAM (Random Access Memory) or other type of dynamic storage device that can store information and instructions, an EEPROM (Electrically Erasable Programmable Read Only Memory), a CD-ROM (Compact Disc Read Only Memory) or other optical Disc storage, optical Disc storage (including Compact Disc, laser Disc, optical Disc, digital versatile Disc, blu-ray Disc, etc.), a magnetic disk storage medium or other magnetic storage device, or any other medium that can be used to carry or store desired program code in the form of instructions or data structures and that can be accessed by a computer, but is not limited to these.
Optionally, the memory 2003 is used for storing application program code for performing the disclosed aspects, and is controlled in execution by the processor 2001. The processor 2001 is configured to execute the application program code stored in the memory 2003 to implement the method for processing a cross-chain transaction provided in any of the embodiments of the present application.
The electronic device provided by the embodiment of the application is applicable to any embodiment of the method, and is not described herein again.
Compared with the prior art, when a cross-link relay monitors a first resource locking event for a first resource triggered in a first block chain, a specified time period is determined based on event information of the first resource locking event, a corresponding processing request is generated based on whether a second resource locking event for a second resource triggered in a second block chain is monitored in the specified time period, and the processing request is sent to the first block chain and the second block chain respectively, so that the first block chain and the second block chain process the processing request respectively. In the scheme, the timing task in the cross-chain transaction is realized through the cross-chain relay, so that the cross-chain transaction does not depend on the timing task capability of the block chain any more, and the universality of the cross-chain transaction scheme is promoted.
The embodiment of the present application provides a computer-readable storage medium, on which a computer program is stored, and when the program is executed by a processor, the computer program implements the processing method of the cross-chain transaction shown in the above method embodiment.
The computer-readable storage medium provided in the embodiments of the present application is applicable to any of the embodiments of the foregoing method, and is not described herein again.
Compared with the prior art, when a cross-link relay monitors a first resource locking event for a first resource triggered in a first block chain, a specified time period is determined based on event information of the first resource locking event, a corresponding processing request is generated based on whether a second resource locking event for a second resource triggered in a second block chain is monitored in the specified time period, and the processing request is sent to the first block chain and the second block chain respectively, so that the first block chain and the second block chain process the processing request respectively. In the scheme, the timing task in the cross-chain transaction is realized through the cross-chain relay, so that the cross-chain transaction does not depend on the timing task capability of the block chain any more, and the universality of the cross-chain transaction scheme is promoted.
The present application provides a computer program product, and the computer readable storage medium stores a computer program, and the program, when executed by a processor, implements the processing method of cross-chain transaction shown in the above method embodiments.
The computer program product provided in the embodiments of the present application is applicable to any of the embodiments of the method described above, and is not described herein again.
Compared with the prior art, when a cross-link relay monitors a first resource locking event for a first resource triggered in a first block chain, a specified time interval is determined based on event information of the first resource locking event, a corresponding processing request is generated based on whether a second resource locking event for a second resource triggered in a second block chain is monitored in the specified time interval, and the processing request is respectively sent to the first block chain and the second block chain, so that the first block chain and the second block chain respectively process the processing request. In the scheme, the timing task in the cross-chain transaction is realized through the cross-chain relay, so that the cross-chain transaction does not depend on the timing task capability of the block chain any more, and the universality of the cross-chain transaction scheme is promoted.
It should be understood that, although the steps in the flowcharts of the figures are shown in order as indicated by the arrows, the steps are not necessarily performed in order as indicated by the arrows. The steps are not performed in the exact order shown and may be performed in other orders unless explicitly stated herein. Moreover, at least a portion of the steps in the flow chart of the figure may include multiple sub-steps or multiple stages, which are not necessarily performed at the same time, but may be performed at different times, which are not necessarily performed in sequence, but may be performed alternately or alternately with other steps or at least a portion of the sub-steps or stages of other steps.
The foregoing is only a partial embodiment of the present invention, and it should be noted that, for those skilled in the art, various modifications and decorations can be made without departing from the principle of the present invention, and these modifications and decorations should also be regarded as the protection scope of the present invention.

Claims (16)

1. A method for processing cross-chain transactions is characterized by comprising the following steps:
when a cross-link relay monitors a first resource locking event of a first resource triggered in a first block chain, determining a specified time period based on event information of the first resource locking event;
and generating a corresponding processing request based on whether a second resource locking event for a second resource triggered in a second block chain is monitored in the specified time period, and sending the processing request to the first block chain and the second block chain respectively so that the processing request is processed by the first block chain and the second block chain respectively.
2. The method of claim 1, wherein the processing request is an asset transfer request or an asset rollback request, and wherein generating the corresponding processing request based on whether a second resource lock event for a second resource triggered in a second blockchain is monitored within the specified time period comprises:
generating an asset transfer request if a second resource locking event for a second resource triggered in a second blockchain is monitored within the specified time period;
generating an asset rollback request if a second resource lock event for a second resource triggered in a second blockchain is not monitored within the specified time period.
3. The method of claim 2, wherein generating the asset transfer request comprises:
querying the first blockchain for the first resource lock event to cause the first blockchain to return first presence credential information for the query result for the first resource lock event;
querying the second blockchain for the second resource lock event to cause the second blockchain to return second presence credential information for the query result for the second resource lock event;
generating a resource transfer request based on the first and second proof of presence information.
4. The method of claim 3, wherein if the processing request is an asset transfer request, sending the processing request to the first blockchain and the second blockchain respectively, so that the processing request is processed by the first blockchain and the second blockchain respectively, comprises:
the asset transfer request is respectively sent to the first blockchain and the second blockchain, so that the first blockchain and the second blockchain respectively verify the first existence certification information and the second existence certification information carried in the asset transfer request, and transfer the first resource and the second resource when the first existence certification information and the second existence certification information are verified.
5. The method of claim 2, wherein generating the asset rollback request comprises:
querying the second blockchain for the second resource lock event to cause the second blockchain to return third presence credential information for the query result for the second resource lock event;
generating a resource rollback request based on the third presence credential information.
6. The method of claim 5, wherein if the processing request is an asset rollback request, the sending the processing request to the first blockchain and the second blockchain respectively to enable the first blockchain and the second blockchain to process the processing request respectively comprises:
and respectively sending the asset rollback request to the first block chain and the second block chain, so that the first block chain verifies third existence certification information carried in the asset rollback request, and rolls back the first resource when the verification is passed, so that the second block chain verifies the third existence certification information carried in the asset rollback request, and rolls back the second resource when the verification is passed.
7. The method of any of claims 1-6, wherein determining the specified time period based on the time information of the first resource lock event comprises:
determining a specified period of time based on a timeout timestamp included in the event information of the first resource lock event.
8. A method for processing a cross-chain transaction, applied to a first node on a first blockchain, the method comprising:
when an asset locking request aiming at a first resource is received, locking the first resource and triggering a first resource locking event;
when a processing request sent by a cross-link relay is received, the processing request is processed, wherein the processing request is generated by the cross-link relay when the cross-link relay monitors the first resource locking event and is based on whether a second resource locking event of a second resource triggered in a second block chain is monitored within the specified time period, and the specified time period is determined based on event information of the first resource locking event.
9. The method of claim 8, further comprising:
when receiving a query request of the cross-link relay for the first resource locking event, determining a query result of the first resource locking event;
and generating first existence certification information of the query result of the first resource locking event, and returning the first existence certification information to the cross-link relay.
10. The method of claim 9, wherein the processing request is an asset transfer request or an asset rollback request, wherein the asset transfer request is generated when the cross-chain relay has heard the second resource lock event within the specified time period, and wherein the asset rollback request is generated when the cross-chain relay has not heard the second resource lock event within the specified time period;
if the processing request is an asset transfer request, processing the processing request, including:
verifying the first and second presence attestation information carried in the asset transfer request, and transferring the first and second resources when both the first and second presence attestation information are verified, wherein the second presence attestation information is provided to the cross-link relay by the second blockchain when the cross-link relay monitors the second resource locking event within the specified time period;
if the processing request is an asset rollback request, processing the processing request, including:
verifying the third presence credential information carried in the asset transfer request, and rolling back the first resource when the third presence credential information is verified, wherein the third presence credential information is provided to the cross-link relay by the second blockchain when the cross-link relay does not monitor the second resource lock event within the specified time period.
11. The method of any of claims 8-10, wherein a timeout timestamp included in the event information of the first resource lock event is used to cause the cross-link relay to determine the specified time period.
12. A device for processing a cross-chain transaction, comprising:
the system comprises a specified time interval determining module, a first resource locking event monitoring module and a second resource locking event monitoring module, wherein the specified time interval determining module is used for determining a specified time interval based on event information of the first resource locking event when a first resource locking event of a first resource triggered in a first block chain is monitored by a cross-link relay;
and a processing request generating module, configured to generate a corresponding processing request based on whether a second resource locking event for a second resource triggered in a second blockchain is monitored in the specified time period, and send the processing request to the first blockchain and the second blockchain, respectively, so that the first blockchain and the second blockchain process the processing request, respectively.
13. A device for processing a cross-chain transaction, comprising:
the system comprises a resource locking module, a resource locking module and a resource locking module, wherein the resource locking module is used for locking a first resource and triggering a first resource locking event when receiving an asset locking request aiming at the first resource;
and the transaction processing module is used for processing the processing request when receiving the processing request sent by the cross-link relay, wherein the processing request is generated by the cross-link relay when monitoring the first resource locking event and based on whether monitoring a second resource locking event of a second resource triggered in a second block chain within the specified time period, and the specified time period is determined based on the event information of the first resource locking event.
14. An electronic device comprising a processor and a memory;
the memory is used for storing operation instructions;
the processor is used for executing the method of any one of claims 1-11 by calling the operation instruction.
15. A computer-readable storage medium, characterized in that the storage medium has stored thereon a computer program which, when being executed by a processor, carries out the method of any one of claims 1-11.
16. A computer program product, characterized in that it comprises a computer program which, when being executed by a processor, carries out the method according to any one of claims 1-11.
CN202110213614.8A 2021-02-26 2021-02-26 Processing method and device of cross-chain transaction, electronic equipment and readable storage medium Active CN112927075B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110213614.8A CN112927075B (en) 2021-02-26 2021-02-26 Processing method and device of cross-chain transaction, electronic equipment and readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110213614.8A CN112927075B (en) 2021-02-26 2021-02-26 Processing method and device of cross-chain transaction, electronic equipment and readable storage medium

Publications (2)

Publication Number Publication Date
CN112927075A true CN112927075A (en) 2021-06-08
CN112927075B CN112927075B (en) 2023-11-17

Family

ID=76172000

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110213614.8A Active CN112927075B (en) 2021-02-26 2021-02-26 Processing method and device of cross-chain transaction, electronic equipment and readable storage medium

Country Status (1)

Country Link
CN (1) CN112927075B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113377875A (en) * 2021-06-29 2021-09-10 北京百度网讯科技有限公司 Cross-link data processing method and device, electronic equipment and readable storage medium

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108269190A (en) * 2018-01-17 2018-07-10 深圳四方精创资讯股份有限公司 Across chain method and its system based on across chain relaying platform
CN109685489A (en) * 2018-12-28 2019-04-26 杭州云象网络技术有限公司 A kind of assets across chain method of commerce between block chain
CN110245517A (en) * 2019-05-29 2019-09-17 杭州秘猿科技有限公司 A kind of across chain method, apparatus, system and the electronic equipment of block chain
US20190347657A1 (en) * 2017-06-12 2019-11-14 Tencent Technology (Shenzhen) Company Limited Resource transfer method and apparatus, storage medium, and computer device
CN111784518A (en) * 2020-06-30 2020-10-16 北京海益同展信息科技有限公司 Block chain cross-chain processing 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 (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20190347657A1 (en) * 2017-06-12 2019-11-14 Tencent Technology (Shenzhen) Company Limited Resource transfer method and apparatus, storage medium, and computer device
CN108269190A (en) * 2018-01-17 2018-07-10 深圳四方精创资讯股份有限公司 Across chain method and its system based on across chain relaying platform
CN109685489A (en) * 2018-12-28 2019-04-26 杭州云象网络技术有限公司 A kind of assets across chain method of commerce between block chain
CN110245517A (en) * 2019-05-29 2019-09-17 杭州秘猿科技有限公司 A kind of across chain method, apparatus, system and the electronic equipment of block chain
CA3149396A1 (en) * 2019-08-06 2021-02-11 Zeu Technologies, Inc. Distributed blockchain transaction system
CN111784518A (en) * 2020-06-30 2020-10-16 北京海益同展信息科技有限公司 Block chain cross-chain processing method and device, computer equipment and storage medium

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
NARGES SHADAB; FARZIN HOUSHMAND; MOHSEN LESANI: "Cross-chain Transactions", IEEE *
叶少杰;汪小益;徐才巢;孙建伶;: "BitXHub:基于侧链中继的异构区块链互操作平台", 计算机科学, no. 06 *
郭朝;郭帅印;张胜利;宋令阳;王晖;: "区块链跨链技术分析", 物联网学报, no. 02 *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113377875A (en) * 2021-06-29 2021-09-10 北京百度网讯科技有限公司 Cross-link data processing method and device, electronic equipment and readable storage medium
CN113377875B (en) * 2021-06-29 2024-03-22 北京百度网讯科技有限公司 Cross-chain data processing method and device, electronic equipment and readable storage medium

Also Published As

Publication number Publication date
CN112927075B (en) 2023-11-17

Similar Documents

Publication Publication Date Title
CN110011996B (en) Application authorization method and device based on block chain and electronic equipment
CN109146679B (en) Intelligent contract calling method and device based on block chain and electronic equipment
WO2021209052A1 (en) Blockchain-based data processing
CN109981646B (en) Resource transfer method and device based on block chain and electronic equipment
EP3247070B1 (en) Cryptocurrency-based event participation verification
US20220284011A1 (en) Distributed blockchain transaction system
CN117544296A (en) Controlled release of encrypted private keys
CN111985007A (en) Contract signing and executing method and device based on block chain
CN114896639A (en) Data processing method and device, electronic equipment and storage medium
CN113987526A (en) Resource exchange method, device and equipment based on block chain and readable storage medium
CN111666541A (en) Copyright purchasing and using method and device, electronic equipment and readable storage medium
CN113377875B (en) Cross-chain data processing method and device, electronic equipment and readable storage medium
CN112927075A (en) Processing method and device for cross-chain transaction, electronic equipment and readable storage medium
CN115086394A (en) Service information processing method and device and electronic equipment
Eizinger et al. Open problems in cross-chain protocols
CN112291321B (en) Service processing method, device and system
CN110033367A (en) Based on the contract record method and device of block chain, electronic equipment
CN112396427A (en) Cross-chain interchange operation method for general scenes
CN111241188A (en) Consensus method in block chain network, node and storage medium
CN111062057B (en) Neutral data application method, device and system
CN110458541B (en) Object replacement method and device based on block chain
CN111124631A (en) Task processing method and device based on block chain network
CN114139121A (en) Identity verification method and device, electronic equipment and computer readable storage medium
CN112861184A (en) Asset certification verification and generation method and device and electronic equipment
CN111639129A (en) Transaction processing method and device, electronic equipment and computer-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
GR01 Patent grant
GR01 Patent grant