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

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

Info

Publication number
CN112927075B
CN112927075B CN202110213614.8A CN202110213614A CN112927075B CN 112927075 B CN112927075 B CN 112927075B CN 202110213614 A CN202110213614 A CN 202110213614A CN 112927075 B CN112927075 B CN 112927075B
Authority
CN
China
Prior art keywords
resource
blockchain
request
cross
event
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202110213614.8A
Other languages
Chinese (zh)
Other versions
CN112927075A (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

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 method and a device for processing a cross-chain transaction, electronic equipment and a readable storage medium. The method comprises the following steps: determining a specified period of time based on event information of a first resource lock event when the cross-chain relay monitors a first resource lock event for the first resource triggered in the first blockchain; based on whether a second resource locking event for a second resource triggered in the second blockchain is monitored within a specified period, a corresponding processing request is generated, and the processing request is respectively sent to the first blockchain and the second blockchain, so that the first blockchain and the second blockchain 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 is not dependent on the timing task capacity of the blockchain any more, and the universality of the cross-chain transaction scheme is improved.

Description

Processing method and device of cross-chain transaction, electronic equipment and readable storage medium
Technical Field
The application relates to the technical field of blockchain, in particular to a processing method, a device, electronic equipment and a readable storage medium for cross-chain transactions.
Background
The development of the block chain technology to date creates countless different block chains, and data on each block chain is isolated, so that the block chains become a data island, and interconnection and intercommunication between different block chains cannot be realized.
Cross-chain technology is a technology for addressing data interactions between two or more blockchains, such that data can cross chain-to-chain obstacles, allowing value to circulate between different blockchains.
Currently, a cross-chain transaction generally requires that the participating blockchains have the capability of timing tasks so as to roll back the locked resources after the transaction is overtime, but most blockchains do not have the capability of timing tasks at present, so when the blockchains without the capability of timing tasks perform the cross-chain transaction, the locked resources cannot be rolled back after the transaction is overtime, and the cross-chain transaction cannot be completed, so that the current cross-chain transaction scheme has poor universality.
Disclosure of Invention
The object of the present application is to solve at least one of the technical drawbacks mentioned above. 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:
Determining a specified period of time based on event information of a first resource lock event when the cross-chain relay monitors a first resource lock event for the first resource triggered in the first blockchain;
based on whether a second resource locking event for a second resource triggered in the second blockchain is monitored within a specified period, a corresponding processing request is generated, and the processing request is respectively sent to the first blockchain and the second blockchain, so that the first blockchain and the second blockchain respectively process the processing request.
Optionally, the processing request is an asset transfer request or an asset rollback request, and generating the corresponding processing request based on whether a second resource lock event for a second resource triggered in a second blockchain is detected within a specified period of time includes:
if a second resource locking event for a second resource triggered in a second blockchain is monitored within a specified period of time, generating an asset transfer request;
if a second resource lock event to a second resource triggered in a second blockchain is not monitored within a specified period of time, an asset rollback request is generated.
Optionally, generating the asset transfer request includes:
querying the first blockchain for a first resource locking event, such that the first blockchain returns first presence attestation information of a query result of the first resource locking event;
Querying a second blockchain for a second resource locking event such that the second blockchain returns second presence attestation information of the query result of the second resource locking event;
a resource transfer request is generated based on the first presence attestation information and the second presence attestation information.
Optionally, if the processing request is an asset transfer request, sending the processing request to the first blockchain and the second blockchain to enable the first blockchain and the second blockchain to process the cross-chain transaction respectively, including:
and respectively sending the asset transfer request to the first block chain and the second block chain, so that the first block chain and the second block chain respectively verify the first presence proving information and the second presence proving information carried in the asset transfer request, and transferring the first resource and the second resource when the first presence proving information and the second presence proving information pass the verification.
Optionally, generating the asset rollback request includes:
querying a second blockchain for a second resource locking event such that the second blockchain returns third presence attestation information of a query result of the second resource locking event;
a resource rollback request is generated based on the third proof of presence 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 blockchain and the second blockchain, so that the first blockchain verifies the third presence proving information carried in the asset rollback request, rolls back the first resource when the verification passes, and verifies the third presence proving information carried in the asset rollback request, and rolls back the second resource when the verification passes.
Optionally, determining the specified period based on the time information of the first resource locking event includes:
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 for a first resource is received, locking the first resource and triggering a first resource locking event;
and when receiving a processing request sent by the cross-chain relay, processing the processing request, wherein the processing request is generated by the cross-chain relay when monitoring the first resource locking event based on whether a second resource locking event triggered in a second blockchain is monitored within a specified period of time, and the specified period of time is determined based on event information of the first resource locking event.
Optionally, the method further comprises:
when a query request of the cross-chain relay for the first resource locking event is received, determining a query result of the first resource locking event;
and generating first presence proving information of the query result of the first resource locking event, and returning the first presence proving information to the cross-chain 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 monitors the second resource locking event within a specified period of time, and the asset rollback request is generated when the cross-chain relay does not monitor the second resource locking event within the specified period of time;
if the processing request is an asset transfer request, processing the processing request includes:
verifying first presence proving information and second presence proving information carried in an asset transfer request, and transferring the first resource and the second resource when the first presence proving information and the second presence proving information pass through verification, wherein the second presence proving information is provided for a cross-chain relay by a second blockchain when the cross-chain relay monitors a second resource locking event within a specified period;
If the processing request is an asset rollback request, processing the processing request includes:
and verifying third presence proving information carried in the asset transfer request, and rolling back the first resource when the third presence proving information passes the verification, wherein the third presence proving information is provided for the cross-chain relay by the second blockchain when the cross-chain relay does not monitor the second resource locking event within a specified period of time.
Optionally, a timeout timestamp included in the event information of the first resource locking event is used to cause the cross-chain relay to determine the specified period.
In a third aspect, an embodiment of the present application provides a processing apparatus for a cross-chain transaction, where the apparatus includes:
the specified time period determining module is used for determining a specified time period based on event information of a first resource locking event when the cross-chain relay monitors the first resource locking event of the first resource triggered in the first blockchain;
and the processing request generation module is used for generating corresponding processing requests based on whether a second resource locking event of the second resource triggered in the second blockchain is monitored within a specified period, and respectively sending the processing requests to the first blockchain and the second blockchain so that the first blockchain and the second blockchain respectively process the processing requests.
Optionally, the processing request is an asset transfer request or an asset rollback request, and the processing request generation module is specifically configured to, when generating the corresponding processing request based on whether a second resource lock event for a second resource triggered in the second blockchain is monitored within a specified period of time:
if a second resource locking event for a second resource triggered in a second blockchain is monitored within a specified period of time, generating an asset transfer request;
if a second resource lock event to a second resource triggered in a second blockchain is not monitored within a specified period of time, an asset rollback request is generated.
Optionally, the processing request generation module is specifically configured to, when generating the asset transfer request:
querying the first blockchain for a first resource locking event, such that the first blockchain returns first presence attestation information of a query result of the first resource locking event;
querying a second blockchain for a second resource locking event such that the second blockchain returns second presence attestation information of the query result of the second resource locking event;
a resource transfer request is generated based on the first presence attestation information and the second presence attestation information.
Optionally, if the processing request is an asset transfer request, the processing request generation 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 block chain and the second block chain, so that the first block chain and the second block chain respectively verify the first presence proving information and the second presence proving information carried in the asset transfer request, and transferring the first resource and the second resource when the first presence proving information and the second presence proving information pass the verification.
Optionally, the processing request generation module is specifically configured to, when generating the asset rollback request:
querying a second blockchain for a second resource locking event such that the second blockchain returns third presence attestation information of a query result of the second resource locking event;
a resource rollback request is generated based on the third proof of presence information.
Optionally, if the processing request is an asset rollback request, the processing request generation 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 blockchain and the second blockchain, so that the first blockchain verifies the third presence proving information carried in the asset rollback request, rolls back the first resource when the verification passes, and verifies the third presence proving information carried in the asset rollback request, and rolls back the second resource when the verification passes.
Optionally, the specified period determining module is specifically configured to, when determining the specified period based on the time information of the first resource locking event:
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 the first resource and triggering a first resource locking event when receiving an asset locking request for the first resource;
and the transaction processing module is used for processing the processing request when receiving the processing request sent by the cross-chain relay, wherein the processing request is generated by the cross-chain relay when monitoring the first resource locking event based on whether the second resource locking event of the second resource triggered in the second blockchain is monitored within a specified period of time, and the specified period of time is determined based on the event information of the first resource locking event.
Optionally, the device further includes a presence proving information return module, where the presence proving information return module is configured to:
when a query request of the cross-chain relay for the first resource locking event is received, determining a query result of the first resource locking event;
And generating first presence proving information of the query result of the first resource locking event, and returning the first presence proving information to the cross-chain 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 monitors the second resource locking event within a specified period of time, and the asset rollback request is generated when the cross-chain relay does not monitor the second resource locking event within the specified period of time;
if the processing request is an asset transfer request, the transaction processing module is specifically configured to, when processing the processing request:
verifying first presence proving information and second presence proving information carried in an asset transfer request, and transferring the first resource and the second resource when the first presence proving information and the second presence proving information pass through verification, wherein the second presence proving information is provided for a cross-chain relay by a second blockchain when the cross-chain relay monitors a second resource locking event within a specified 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 presence proving information carried in the asset transfer request, and rolling back the first resource when the third presence proving information passes the verification, wherein the third presence proving information is provided for the cross-chain relay by the second blockchain when the cross-chain relay does not monitor the second resource locking event within a specified period of time.
Optionally, a timeout timestamp included in the event information of the first resource locking event is used to cause the cross-chain 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 operation instructions;
a processor for executing a method of processing a cross-chain transaction as shown in any of the embodiments of the first aspect of the application or in any of the embodiments of the second aspect of the application by invoking an operation instruction.
In a sixth aspect, embodiments of the present application provide a computer readable storage medium having stored thereon a computer program which when executed by a processor implements a method of processing a cross-chain transaction as shown in any of the embodiments of the first aspect of the present application or in any of the embodiments of the second aspect of the present application.
In a seventh aspect, the present embodiments provide a computer program product comprising a computer program which, when executed by a processor, implements a method of processing a cross-chain transaction as shown in any of the embodiments of the first aspect of the present application or in any of the embodiments of the second aspect of the present application.
The technical scheme provided by the embodiment of the application has the beneficial effects that:
according to the scheme provided by the embodiment of the application, when the cross-chain relay monitors the first resource locking event of the first resource triggered in the first blockchain, a designated period is determined based on the event information of the first resource locking event, and based on whether the second resource locking event of the second resource triggered in the second blockchain is monitored in the designated period, a corresponding processing request is generated and is respectively sent to the first blockchain and the second blockchain, so that the first blockchain and the second blockchain 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 is not dependent on the timing task capacity of the blockchain any more, and the universality of the cross-chain transaction scheme is improved.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings that are required to be used in the description of the embodiments of the present application will be briefly described below.
FIG. 1 is a schematic flow chart of a method for processing a cross-chain transaction according to an embodiment of the present application;
FIG. 2 is a flowchart of another method for processing a cross-chain transaction according to an embodiment of the present application;
fig. 3 is a schematic structural diagram of a processing device for cross-chain transaction according to an embodiment of the present application;
FIG. 4 is a schematic structural diagram of another processing device 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.
Description of the embodiments
Embodiments of the present application are described in detail below, examples of which are illustrated in the accompanying drawings, wherein like or similar reference numerals refer to like or similar elements or elements having like or similar functions throughout. The embodiments described below by referring to the drawings are illustrative only and are not to be construed as limiting the application.
As used herein, the singular forms "a", "an", "the" and "the" are intended to include the plural forms as well, unless expressly stated otherwise, as understood by those skilled in the art. 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. The term "and/or" as used herein includes all or any element and all combination of one or more of the associated listed items.
For the purpose of making the objects, technical solutions and advantages of the present application more apparent, the embodiments of the present application will be described in further detail with reference to the accompanying drawings.
Solving the transactional nature of cross-chain transactions is a challenge faced in cross-chain technology. A complete cross-chain transaction may be split into multiple sub-transactions belonging to respective blockchain systems that form a transaction that should have ACID properties including atomicity, consistency, isolation, and persistence.
Atomicity (atomicity): operations in a cross-chain transaction either occur or do not occur;
consistency (atom): a cross-chain transaction must cause all blockchains to transition from one coherency state to another;
isolation (isolation): the cross-chain transactions executed concurrently cannot interfere with each other;
durability (durability): once a cross-chain transaction is committed, its changes to the data in the blockchain are permanent and do not rollback without reason.
Aiming at a cross-chain transaction scene of asset exchange, a hash locking scheme is mainly adopted at present, and fair transaction is realized by locking the asset and setting corresponding timeout duration and unlocking conditions.
In the above hash locking scheme, the blockchains which participate in the cross-chain transaction are required to have the capability of timing tasks, but most blockchains do not have the capability of timing tasks at present, so when the blockchains without the capability of timing tasks perform the cross-chain transaction, the locked resources cannot be rolled back after the transaction is overtime, which results in poor universality of the existing cross-chain transaction scheme.
The embodiment of the application provides a processing method, a device, electronic equipment and a readable storage medium for cross-chain transaction, which aim to solve at least one of the technical problems in the prior art.
The following describes the technical scheme of the present application and how the technical scheme of the present application solves the above technical problems in detail with specific embodiments. The following embodiments may be combined with each other, and the same or similar concepts or processes may not be described in detail in some embodiments. Embodiments of the present application will be described below with reference to the accompanying drawings.
Fig. 1 shows a flow chart of a method for processing a cross-link transaction according to an embodiment of the present application, where the method is applied to a cross-link relay, as shown in fig. 1, and the method may mainly include:
step 110: determining a specified period of time based on event information of a first resource lock event when the cross-chain relay monitors a first resource lock event for the first resource triggered in the first blockchain;
Step 120: based on whether a second resource locking event for a second resource triggered in the second blockchain is monitored within a specified period, a corresponding processing request is generated, and the processing request is respectively sent to the first blockchain and the second blockchain, so that the first blockchain and the second blockchain 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 connection with the first blockchain and the second blockchain, respectively.
The first resource and the second resource are resources involved in a cross-chain transaction.
The first blockchain and the second blockchain are required to be respectively provided with a cross-link contract, and the cross-link contract can realize the following interfaces:
(1) And the resource locking interface is used for locking resources related to the cross-chain transaction. The method comprises the steps that the user calls the resource locking event and triggers the corresponding resource locking event;
(2) And the resource transfer interface is used for transferring the locked resources and is called in a specific stage by the cross-chain relay.
(3) And the resource rollback interface rolls back the locked resources. The invocation is responsible for a particular phase by the cross-chain relay.
When a cross-chain transaction is performed, the first blockchain and the second blockchain can lock corresponding resources and trigger corresponding resource locking events when receiving a resource locking request of a user respectively. Specifically, a user may issue a resource lock request through a resource lock interface.
The cross-chain relay may snoop for a first resource lock event of a first blockchain and a second resource lock event of a second blockchain, respectively.
In the embodiment of the application, the blockchain which is monitored in the cross-chain and triggers the resource locking event in advance can be recorded as the first blockchain, and the processing steps in the first blockchain and the processing steps in the second blockchain in the cross-chain transaction are not essentially different.
When the cross-chain relay monitors the first resource locking event, a specified period of time may be determined based on event information of the first resource locking event, and the specified period of time may be used to determine whether the second resource locking event times out.
According to whether a second resource locking event of a second resource triggered in the second blockchain is monitored in a specified period, the cross-chain relay can generate a corresponding processing request, and the processing request is respectively sent to the first blockchain and the second blockchain for processing.
The method comprises the steps of determining a designated time period through event information of a resource locking event, and determining whether a second resource locking event is monitored in the designated time period through a cross-chain relay, namely, realizing a timing task through the cross-chain relay, so that the cross-chain transaction is not dependent on timing task capacity of a block chain any more.
When the cross-chain relay monitors a first resource locking event of a first resource triggered in a first blockchain, determining a designated period based on event information of the first resource locking event, generating a corresponding processing request based on whether a second resource locking event of a second resource triggered in a second blockchain is monitored in the designated period, and respectively sending the processing request to the first blockchain and the second blockchain so that the first blockchain and the second blockchain 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 is not dependent on the timing task capacity of the blockchain any more, and the universality of the cross-chain transaction scheme is improved.
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 generating a 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 period of time includes:
If a second resource locking event for a second resource triggered in a second blockchain is monitored within a specified period of time, generating an asset transfer request;
if a second resource lock event to a second resource triggered in a second blockchain is not monitored within a specified period of time, an asset rollback request is generated.
In the embodiment of the application, if the cross-chain relay monitors the second resource locking event within the appointed time period, the transaction is considered not to be overtime, and then the asset transfer request can be generated.
If the cross-chain relay is unable to monitor the second resource lock event within a specified period of time, the transaction may be deemed to be timeout, at which time an asset rollback request may be generated.
In an alternative manner of the embodiment of the present application, generating an asset transfer request includes:
querying the first blockchain for a first resource locking event, such that the first blockchain returns first presence attestation information of a query result of the first resource locking event;
querying a second blockchain for a second resource locking event such that the second blockchain returns second presence attestation information of the query result of the second resource locking event;
a resource transfer request is generated based on the first presence attestation information and the second presence attestation information.
In the embodiment of the application, when the asset transfer request is generated, the cross-chain relay can inquire the first resource locking event from the first block chain and inquire the second resource locking event from the second block chain. The first blockchain can inquire the first resource locking event to obtain an inquiry result of the first resource locking event, and the existence of the first resource locking event can be determined based on the inquiry result of the first resource locking event. First presence document information of the query result of the first resource locking event can be generated, and the first presence document information is returned to the cross-chain relay. Likewise, the second blockchain may query the second resource locking event to obtain a query result of the second resource locking event, and determine that the second resource locking event exists based on the query result of the second resource locking event. And then second presence document information of the query result of the second resource locking event can be generated, and the second presence document information is returned to the cross-chain relay.
The cross-chain relay may generate the resource transfer request using the first presence attestation information and the second presence attestation information as parameters.
In an alternative manner of the embodiment of the present application, if the processing request is an asset transfer request, the processing request is sent to the first blockchain and the second blockchain, so that the first blockchain and the second blockchain process the processing request respectively, 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 validity of the first presence proving information and the second presence proving information carried in the asset transfer request, and transferring the first resource and the second resource when the first presence proving information and the second presence proving information pass the verification.
In the embodiment of the application, the cross-chain relay can respectively send the asset transfer request to the first blockchain and the second blockchain, and particularly, can call the resource transfer interface to send the asset transfer request to the nodes in the first blockchain and the nodes in the second blockchain.
The first blockchain and the second blockchain can respectively verify the validity of the first presence proving information and the validity of the second presence proving information, and when both the first and the second presence proving information pass the verification, 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.
Because the asset transfer request carries the first presence proving information and the second presence proving information, in order to avoid the leakage of the first presence proving information and the second presence proving information in the process that the asset transfer request is sent to the first blockchain and the second blockchain, the first presence proving information and the second presence proving information can be encrypted so as to ensure the security of the first presence proving information and the second presence proving information. Specifically, encryption may be implemented in such a manner that the first presence document information and the second presence document information are respectively subjected to data confusion.
As an example, the first presence proving information and the second presence proving information may be respectively mixed based on a preset data mixing rule, and the mixed first presence proving information and the mixed second presence proving information are used as parameters of the resource transfer request. When the first blockchain and the second blockchain receive the resource transfer request, the confused first presence proving information can be converted into first presence proving information according to the data confusion rule, the confused second presence proving information is converted into second presence proving information, and then the validity of the first presence proving information and the validity of the second presence proving information can be respectively verified.
In an alternative manner of the embodiment of the present application, generating an asset rollback request includes:
querying a second blockchain for a second resource locking event, such that the second blockchain returns third presence attestation information for a query result of the second resource locking event;
a resource rollback request is generated based on the third proof of presence information.
In the embodiment of the application, when the cross-chain relay does not monitor the second resource locking event within the appointed time period, the cross-chain relay can inquire the second resource locking event from the second blockchain. The second blockchain can query the second resource locking event to obtain a query result of the second resource locking event, and the absence of the second resource locking event can be determined based on the query result of the second resource locking event. Third presence document information of the second resource locking event query result can be generated, and the third presence document information is returned to the cross-chain relay.
The cross-chain relay may generate a resource rollback request using the third presence attestation information as a parameter.
In an alternative manner of the embodiment of the present application, if the processing request is an asset rollback request, the processing request is sent 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 blockchain and the second blockchain, so that the first blockchain verifies the third presence proving information carried in the asset rollback request, rolls back the first resource when the verification passes, and verifies the third presence proving information carried in the asset rollback request, and rolls back the second resource when the verification passes.
In the embodiment of the application, the cross-chain relay can respectively send the asset rollback request to the first block chain and the second block chain, and particularly, can call the resource rollback interface to send the asset rollback request to the nodes in the first block chain and the nodes in the second block chain.
The first blockchain may verify the validity of the third presence attestation 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 attestation information carried in the asset rollback request and rollback the second resource when the verification passes.
Because the asset rollback request carries the third presence proving information, in order to avoid the leakage of the third presence proving information in the process that the asset rollback request is sent to the first blockchain and the second blockchain, the third presence proving information can be encrypted so as to ensure the security of the third presence proving information. Specifically, encryption may be implemented in such a manner that the third presence document information is subjected to data confusion.
As an example, the third presence document may be obfuscated based on a preset data obfuscation rule, and the obfuscated third presence document may be used as a parameter of the resource rollback request. When the first blockchain and the second blockchain receive the resource rollback request, the confused third presence proving information can be converted into third presence proving information according to the data confusion rule, and then the validity of the third presence proving information can be verified.
In an optional manner of the embodiment of the present application, determining the specified period based on the time information of the first resource locking 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 can include a timeout timestamp, and the designated period can be determined according to the timeout timestamp. The timeout timestamp may be specified according to actual situation needs. In practical 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 a transaction ID (Identity document, identification), which may be used for querying the first resource locking event and the second resource locking event.
Accordingly, the event information of the second resource locking 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 flow chart illustrating another method for processing 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, as shown in fig. 2, and the method may mainly include:
step S210: when an asset locking request for a first resource is received, locking the first resource and triggering a first resource locking event;
step S220: and when receiving a processing request sent by the cross-chain relay, processing the processing request, wherein the processing request is generated by the cross-chain relay when monitoring the first resource locking event based on whether a second resource locking event triggered in a second blockchain is monitored within a specified period of time, and the specified period of time is determined based on event information of the first resource locking event.
In the embodiment of the present application, the first node may be a node in the first blockchain that establishes communication connection with the inter-link relay.
When a cross-chain transaction is performed, the first blockchain can lock the first resource and trigger a first resource locking event when a resource locking request of a user is received.
When the cross-chain relay monitors the first resource locking event, a specified period of time may be determined based on event information of the first resource locking event, and the specified period of time may be used to determine whether the second resource locking event times out.
According to whether a second resource locking event for a second resource triggered in the second blockchain is monitored in a specified period, the cross-chain relay can generate a corresponding processing request and send the processing request to the first blockchain for processing.
The method provided by the embodiment of the application locks the first resource and triggers a first resource locking event when receiving the asset locking request aiming at the first resource, and processes the processing request when receiving the processing request sent by the cross-chain relay, wherein the processing request is generated by the cross-chain relay when monitoring the first resource locking event based on whether a second resource locking event triggered in the second blockchain is monitored within a specified period of time, and the specified period of time is determined based on the 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 is not dependent on the timing task capacity of the blockchain any more, and the universality of the cross-chain transaction scheme is improved.
The second node in the second blockchain may be referred to as the first node, such that the method provided in fig. 2 described above may also be applied to the second node.
In an optional manner of the embodiment of the present application, the method further includes:
when a query request of the cross-chain relay for the first resource locking event is received, determining a query result of the first resource locking event;
and generating first presence proving information of the query result of the first resource locking event, and returning the first presence proving information to the cross-chain relay.
In the embodiment of the application, when the cross-chain relay generates a processing request, if the cross-chain relay monitors a second resource locking event of a second resource triggered in a second blockchain within a specified period, the cross-chain relay can inquire a first resource locking event from a first blockchain, the first blockchain can inquire the first resource locking event to obtain an inquiry result of the first resource locking event, and then first presence proving information of the inquiry result of the first resource locking event can be generated and returned to the cross-chain relay.
The cross-chain relay can query the second blockchain for the second resource locking event at the same time, the second blockchain can query the second resource locking event to obtain a query result of the second resource locking event, and then second presence proving information of the query result of the second resource locking event can be generated and returned to the cross-chain relay.
The cross-chain relay may generate the resource transfer request using the first presence attestation information and the second presence attestation information as parameters.
In the embodiment of the application, when the cross-chain relay does not monitor the second resource locking event in the appointed time period, the cross-chain relay can inquire the second resource locking event from the second blockchain. The second blockchain may query a 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 document information of the second resource locking event query result can be generated, and the third presence document information is returned to the cross-chain relay.
The cross-chain relay may generate a resource rollback request using the third presence attestation 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-chain relay monitors the second resource locking event within a specified period of time, and the asset rollback request is generated when the cross-chain relay does not monitor the second resource locking event within the specified period of time;
If the processing request is an asset transfer request, processing the processing request includes:
verifying first presence proving information and second presence proving information carried in an asset transfer request, and transferring the first resource and the second resource when the first presence proving information and the second presence proving information pass through verification, wherein the second presence proving information is provided for a cross-chain relay by a second blockchain when the cross-chain relay monitors a second resource locking event within a specified period;
if the processing request is an asset rollback request, processing the processing request includes:
and verifying third presence proving information carried in the asset transfer request, and rolling back the first resource when the third presence proving information passes the verification, wherein the third presence proving information is provided for the cross-chain relay by the second blockchain when the cross-chain relay does not monitor the second resource locking event within a specified period of time.
In the embodiment of the application, if the cross-chain relay monitors the second resource locking event within the appointed time period, the transaction is considered to be not overtime, and at the moment, the cross-chain relay can generate an asset transfer request and respectively send the asset transfer request to the first blockchain and the second blockchain.
The process of generating asset transfer requests across chain relays is: the cross-chain relay queries a first blockchain for a first resource locking event and queries a second blockchain for a second resource locking event. The first blockchain can inquire the first resource locking event to obtain an inquiry result of the first resource locking event, and the existence of the first resource locking event can be determined based on the inquiry result of the first resource locking event. First presence document information of the query result of the first resource locking event can be generated, and the first presence document information is returned to the cross-chain relay. The second blockchain can inquire the second resource locking event to obtain an inquiry result of the second resource locking event, and the existence of the second resource locking event can be determined based on the inquiry result of the second resource locking event. And then second presence document information of the query result of the second resource locking event can be generated, and the second presence document information is returned to the cross-chain relay. The cross-chain relay may generate the resource transfer request using the first presence attestation information and the second presence attestation information as parameters.
The cross-chain relay may send asset transfer requests to the first and second blockchains, respectively, and in particular, may invoke the resource transfer interface to send asset transfer requests 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 presence proving information and the validity of the second presence proving information carried in the asset transfer request, and when the two are verified, the current cross-chain transaction is considered to meet the requirement, 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-chain relay cannot monitor the second resource locking event within the appointed time period, the transaction can be considered to be overtime, and then the cross-chain relay can generate an asset rollback request and respectively send the asset rollback request to the first blockchain and the second blockchain.
The process of generating asset rollback requests across chain relays is: the cross-chain relay queries a second blockchain for a second resource locking event. The second blockchain can inquire the second resource locking event to obtain a second resource locking event inquiry result, and the absence of the second resource locking event can be determined based on the second resource locking event inquiry result. Third presence document information of the query result of the second resource locking event can be generated, and the third presence document information is returned to the cross-chain relay. The cross-chain relay may generate a resource rollback request using the third presence attestation information as a parameter.
The cross-chain relay may send asset rollback requests to the first and second blockchains, respectively, and in particular, may invoke the resource rollback interface to send asset rollback requests 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 attestation 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 attestation information carried in the asset rollback request and rollback the second resource when the verification passes.
In an alternative manner of the embodiment of the present application, a timeout timestamp included in the event information of the first resource locking event is used to enable the cross-chain relay to determine the specified period.
In the embodiment of the application, the event information of the first resource locking event can include a timeout timestamp, and the cross-link relay can determine the specified period according to the timeout timestamp.
The event information of the first resource locking event may further include a transaction ID (Identity document, identifier) for querying the first resource locking event and the second resource locking event.
Accordingly, the event information of the second resource locking 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 a cross-link transaction according to an embodiment of the present application, and as shown in fig. 3, the processing apparatus 30 for a cross-link transaction may include:
a specified period determining module 310, configured to determine, when the cross-chain relay monitors a first resource lock event triggered in the first blockchain for the first resource, a specified period based on event information of the first resource lock event;
the processing request generating module 320 is configured to generate a corresponding processing request based on whether a second resource locking event triggered in the second blockchain is detected in a specified period of time, and send the processing request to the first blockchain and the second blockchain respectively, so that the first blockchain and the second blockchain respectively process the processing request.
When the cross-chain relay monitors a first resource locking event of a first resource triggered in a first blockchain, determining a designated period based on event information of the first resource locking event, generating a corresponding processing request based on whether a second resource locking event of a second resource triggered in a second blockchain is monitored in the designated period, and respectively sending the processing request to the first blockchain and the second blockchain so that the first blockchain and the second blockchain 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 is not dependent on the timing task capacity of the blockchain any more, and the universality of the cross-chain transaction scheme is improved.
Optionally, the processing request is an asset transfer request or an asset rollback request, and the processing request generation module is specifically configured to, when generating the corresponding processing request based on whether a second resource lock event for a second resource triggered in the second blockchain is monitored within a specified period of time:
if a second resource locking event for a second resource triggered in a second blockchain is monitored within a specified period of time, generating an asset transfer request;
If a second resource lock event to a second resource triggered in a second blockchain is not monitored within a specified period of time, an asset rollback request is generated.
Optionally, the processing request generation module is specifically configured to, when generating the asset transfer request:
querying the first blockchain for a first resource locking event, such that the first blockchain returns first presence attestation information of a query result of the first resource locking event;
querying a second blockchain for a second resource locking event such that the second blockchain returns second presence attestation information of the query result of the second resource locking event;
a resource transfer request is generated based on the first presence attestation information and the second presence attestation information.
Optionally, if the processing request is an asset transfer request, the processing request generation 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 block chain and the second block chain, so that the first block chain and the second block chain respectively verify the first presence proving information and the second presence proving information carried in the asset transfer request, and transferring the first resource and the second resource when the first presence proving information and the second presence proving information pass the verification.
Optionally, the processing request generation module is specifically configured to, when generating the asset rollback request:
querying a second blockchain for a second resource locking event such that the second blockchain returns third presence attestation information of a query result of the second resource locking event;
a resource rollback request is generated based on the third proof of presence information.
Optionally, if the processing request is an asset rollback request, the processing request generation 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 blockchain and the second blockchain, so that the first blockchain verifies the third presence proving information carried in the asset rollback request, rolls back the first resource when the verification passes, and verifies the third presence proving information carried in the asset rollback request, and rolls back the second resource when the verification passes.
Optionally, the specified period determining module is specifically configured to, when determining the specified period based on the time information of the first resource locking event:
The specified period is determined based on a timeout timestamp included in the event information of the first resource lock event.
It will be appreciated that the above modules of the processing apparatus for cross-chain transactions in this embodiment have functions of implementing the corresponding steps of the processing method for cross-chain transactions in the embodiment shown in fig. 1. The functions 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 may be software and/or hardware, and each module may be implemented separately or may be implemented by integrating multiple modules. The functional description of each module of the above processing device for cross-link transaction may be specifically referred to the corresponding description of the processing method for cross-link transaction in the embodiment shown in fig. 1, which is not repeated herein.
Based on the same principle as the method shown in fig. 2, fig. 4 shows a schematic structural diagram of a processing apparatus for a cross-link transaction according to an embodiment of the present application, and as shown in fig. 4, the processing apparatus 40 for a cross-link 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;
The transaction processing module 420 is configured to, when receiving a processing request sent by the cross-chain relay, process the processing request, where the processing request is generated by the cross-chain relay when monitoring the first resource lock event based on whether a second resource lock event triggered in the second blockchain is monitored within a specified period of time, and the specified period of time is determined based on event information of the first resource lock event.
The device provided by the embodiment of the application locks the first resource and triggers a first resource locking event when receiving the asset locking request aiming at the first resource, and processes the processing request when receiving the processing request sent by the cross-chain relay, wherein the processing request is generated by the cross-chain relay when monitoring the first resource locking event based on whether a second resource locking event triggered in the second blockchain is monitored within a specified period of time, and the specified period of time is determined based on the 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 is not dependent on the timing task capacity of the blockchain any more, and the universality of the cross-chain transaction scheme is improved.
Optionally, the device further includes a presence proving information return module, where the presence proving information return module is configured to:
when a query request of the cross-chain relay for the first resource locking event is received, determining a query result of the first resource locking event;
and generating first presence proving information of the query result of the first resource locking event, and returning the first presence proving information to the cross-chain 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 monitors the second resource locking event within a specified period of time, and the asset rollback request is generated when the cross-chain relay does not monitor the second resource locking event within the specified period of time;
if the processing request is an asset transfer request, the transaction processing module is specifically configured to, when processing the processing request:
verifying first presence proving information and second presence proving information carried in an asset transfer request, and transferring the first resource and the second resource when the first presence proving information and the second presence proving information pass through verification, wherein the second presence proving information is provided for a cross-chain relay by a second blockchain when the cross-chain relay monitors a second resource locking event within a specified 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 presence proving information carried in the asset transfer request, and rolling back the first resource when the third presence proving information passes the verification, wherein the third presence proving information is provided for the cross-chain relay by the second blockchain when the cross-chain relay does not monitor the second resource locking event within a specified period of time.
Optionally, a timeout timestamp included in the event information of the first resource locking event is used to cause the cross-chain relay to determine the specified period.
It will be appreciated that the above modules of the processing apparatus for cross-chain transactions in this embodiment have the function of implementing the corresponding steps of the processing method for cross-chain transactions in the embodiment shown in fig. 2. The functions 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 may be software and/or hardware, and each module may be implemented separately or may be implemented by integrating multiple modules. The functional description of each module of the above processing device for the cross-link transaction may be specifically referred to the corresponding description of the processing method for the cross-link transaction in the embodiment shown in fig. 2, which is not repeated herein.
The embodiment of the application provides electronic equipment, which comprises a processor and a memory;
a memory for storing operation instructions;
and the processor is used for executing the processing method of the cross-chain transaction provided in 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 applied, and as shown in fig. 5, the electronic device 2000 includes: a processor 2001 and a memory 2003. 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, in practical applications, the transceiver 2004 is not limited to one, and the structure of the electronic device 2000 is not limited to the embodiment of the present application.
The processor 2001 is used in 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 employed in embodiments of the present application to perform functions that enable an electronic device of embodiments of the present application to communicate with other devices.
The processor 2001 may be a CPU (Central Processing Unit ), general purpose processor, DSP (Digital Signal Processor, data signal processor), ASIC (Application Specific Integrated Circuit ), FPGA (Field Programmable Gate Array, field programmable gate array) or other programmable logic device, transistor logic device, hardware components, or any combination thereof. Which may implement or perform the various exemplary logic blocks, modules and circuits described in connection with this disclosure. The processor 2001 may also be a combination of computing functions, e.g., comprising one or more microprocessor combinations, a combination of a DSP and a microprocessor, etc.
Bus 2002 may include a path to transfer information between the components. Bus 2002 may be a PCI (Peripheral Component Interconnect, peripheral component interconnect Standard) bus or 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 not only one bus or one type of bus.
The Memory 2003 may be, but is not limited to, 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, compact disc Read Only Memory) or other optical disk storage, optical disk storage (including compact discs, laser discs, optical discs, digital versatile discs, blu-ray discs, etc.), magnetic disk storage media or other magnetic storage devices, 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.
Optionally, a memory 2003 is used for storing application code for executing aspects of the present application and is controlled for execution by the processor 2001. Processor 2001 is operative to execute application code stored in memory 2003 to implement the method of processing cross-chain transactions provided in any of the embodiments of the present application.
The electronic device provided by the embodiment of the present application is applicable to any embodiment of the above method, and will not be described herein.
Compared with the prior art, when a first resource locking event of a first resource triggered in a first blockchain is monitored by cross-chain relay, a designated 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 of a second resource triggered in a second blockchain is monitored in the designated period, and the processing request is respectively sent to the first blockchain and the second blockchain, so that the first blockchain and the second blockchain 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 is not dependent on the timing task capacity of the blockchain any more, and the universality of the cross-chain transaction scheme is improved.
The embodiment of the application provides a computer readable storage medium, and a computer program is stored on the computer readable storage medium, and when the program is executed by a processor, the processing method of the cross-chain transaction shown in the embodiment of the method is realized.
The computer readable storage medium provided in the embodiments of the present application is applicable to any one of the embodiments of the above method, and will not be described herein.
Compared with the prior art, when a first resource locking event of a first resource triggered in a first blockchain is monitored by cross-chain relay, a designated 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 of a second resource triggered in a second blockchain is monitored in the designated period, and the processing request is respectively sent to the first blockchain and the second blockchain, so that the first blockchain and the second blockchain 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 is not dependent on the timing task capacity of the blockchain any more, and the universality of the cross-chain transaction scheme is improved.
An embodiment of the present application provides a computer program product, where a computer program is stored on a computer readable storage medium, and when the program is executed by a processor, the method for processing a cross-chain transaction shown in the foregoing method embodiment is implemented.
The computer program product provided in the embodiments of the present application is applicable to any one of the embodiments of the above method, and will not be described herein.
Compared with the prior art, when a first resource locking event of a first resource triggered in a first blockchain is monitored by cross-chain relay, a designated 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 of a second resource triggered in a second blockchain is monitored in the designated period, and the processing request is respectively sent to the first blockchain and the second blockchain, so that the first blockchain and the second blockchain 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 is not dependent on the timing task capacity of the blockchain any more, and the universality of the cross-chain transaction scheme is improved.
It should be understood that, although the steps in the flowcharts of the figures are shown in order as indicated by the arrows, these steps are not necessarily performed in order as indicated by the arrows. The steps are not strictly limited in order and may be performed in other orders, unless explicitly stated herein. Moreover, at least some of the steps in the flowcharts of the figures may include a plurality of sub-steps or stages that are not necessarily performed at the same time, but may be performed at different times, the order of their execution not necessarily being sequential, but may be performed in turn or alternately with other steps or at least a portion of the other steps or stages.
The foregoing is only a partial embodiment of the present invention, and it should be noted that it will be apparent to those skilled in the art that modifications and adaptations can be made without departing from the principles of the present invention, and such modifications and adaptations should and are intended to be comprehended within the scope of the present invention.

Claims (14)

1. A method of processing a cross-chain transaction, comprising:
when a first resource locking event of a first resource triggered in a first blockchain is monitored by a cross-chain relay, determining a designated period based on event information of the first resource locking event;
Generating a corresponding processing request based on whether a second resource locking event of a second resource triggered in a second blockchain is monitored in the appointed time period, and respectively sending the processing request to the first blockchain and the second blockchain so that the first blockchain and the second blockchain respectively process the processing request;
the processing request is an asset transfer request or an asset rollback request, and the generating a corresponding processing request based on whether a second resource locking event for a second resource triggered in a second blockchain is monitored within the specified period of time includes:
if a second resource locking event for a second resource triggered in a second blockchain is monitored within the specified period of time, generating an asset transfer request;
and if a second resource locking event for the second resource triggered in the second blockchain is not monitored within the specified period of time, generating an asset rollback request.
2. The method of claim 1, wherein generating the asset transfer request comprises:
querying the first blockchain for the first resource locking event to cause the first blockchain to return first presence attestation information of a query result of the first resource locking event;
Querying the second blockchain for the second resource locking event to cause the second blockchain to return second presence attestation information of the query result of the second resource locking event;
a resource transfer request is generated based on the first presence attestation information and the second presence attestation information.
3. The method of claim 2, wherein if the processing request is an asset transfer request, sending the processing request to the first blockchain and the second blockchain, respectively, such that the first blockchain and the second blockchain process the processing request, respectively, comprises:
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 presence proving information and the second presence proving information carried in the asset transfer request, and transferring the first resource and the second resource when the first presence proving information and the second presence proving information pass the verification.
4. The method of claim 1, wherein the generating an asset rollback request comprises:
Querying the second blockchain for the second resource locking event to cause the second blockchain to return third presence attestation information of the query result of the second resource locking event;
a resource rollback request is generated based on the third presence attestation information.
5. The method of claim 4, wherein if the processing request is an asset rollback request, the sending the processing request to the first blockchain and the second blockchain, respectively, such that the first blockchain and the second blockchain 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 the third presence proving information carried in the asset rollback request, rolls back the first resource when the verification passes, verifies the third presence proving information carried in the asset rollback request, and rolls back the second resource when the verification passes.
6. The method of any of claims 1-5, wherein the determining a specified period based on time information of the first resource lock event comprises:
A specified period is determined based on a timeout timestamp included in event information of the first resource lock event.
7. A method of processing a cross-chain transaction, applied to a first node on a first blockchain, the method comprising:
when an asset locking request for a first resource is received, locking the first resource and triggering a first resource locking event;
when a processing request sent by a cross-chain relay is received, processing the processing request, wherein the processing request is generated by the cross-chain relay when the cross-chain relay monitors the first resource locking event based on whether a second resource locking event triggered in a second blockchain is monitored within a specified period of time, and the specified period of time is determined based on event information of the first resource locking event;
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 listens for the second resource lock event within the specified period of time, and the asset rollback request is generated when the cross-chain relay does not hear the second resource lock event within the specified period of time.
8. The method as recited in claim 7, further comprising:
when a query request of the cross-chain relay for the first resource locking event is received, determining a query result of the first resource locking event;
generating first presence proving information of the query result of the first resource locking event, and returning the first presence proving information to the cross-chain relay.
9. The method of claim 8, wherein processing the processing request if the processing request is an asset transfer request comprises:
verifying the first presence proving information and the second presence proving information carried in the asset transfer request, and transferring the first resource and the second resource when the first presence proving information and the second presence proving information are verified, wherein the second presence proving information is provided for the cross-chain relay by the second block chain when the cross-chain relay monitors the second resource locking event in the appointed period;
and if the processing request is an asset rollback request, processing the processing request, including:
And verifying the third presence proving information carried in the asset transfer request, and rolling back the first resource when the third presence proving information passes verification, wherein the third presence proving information is provided to the cross-chain relay by the second blockchain when the cross-chain relay does not monitor the second resource locking event within the appointed time period.
10. The method according to any of claims 7-9, wherein a timeout timestamp is included in the event information of the first resource lock event, the timeout timestamp being used to cause the cross-chain relay to determine a specified period of time.
11. A processing apparatus for a cross-chain transaction, comprising:
a designated period determining module, configured to determine a designated period based on event information of a first resource lock event triggered in a first blockchain when the cross-chain relay monitors the first resource lock event;
a processing request generation module, configured to generate a corresponding processing request based on whether a second resource locking event triggered in a second blockchain is detected in the specified period, and send the processing request to the first blockchain and the second blockchain respectively, so that the first blockchain and the second blockchain respectively process the processing request;
The processing request is an asset transfer request or an asset rollback request, and the processing request generation module is specifically configured to, when generating a corresponding processing request based on whether a second resource locking event for a second resource triggered in a second blockchain is monitored within the specified period of time:
if a second resource locking event for a second resource triggered in a second blockchain is monitored within the specified period of time, generating an asset transfer request;
and if a second resource locking event for the second resource triggered in the second blockchain is not monitored within the specified period of time, generating an asset rollback request.
12. A processing apparatus for a cross-chain transaction, comprising:
the resource locking module is used for locking the first resource and triggering a first resource locking event when an asset locking request for the first resource is received;
the transaction processing module is used for processing the processing request when the processing request sent by the cross-chain relay is received, wherein the processing request is generated by the cross-chain relay when the cross-chain relay monitors the first resource locking event based on whether a second resource locking event triggered in a second blockchain is monitored within a specified period of time, and the specified period of time is determined based on event information of the first resource locking event;
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 listens for the second resource lock event within the specified period of time, and the asset rollback request is generated when the cross-chain relay does not hear the second resource lock event within the specified period of time.
13. An electronic device comprising a processor and a memory;
the memory is used for storing operation instructions;
the processor is configured to execute the method of any one of claims 1-10 by invoking the operation instruction.
14. A computer readable storage medium, characterized in that the storage medium has stored thereon a computer program which, when executed by a processor, implements the method of any of claims 1-10.
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 CN112927075A (en) 2021-06-08
CN112927075B true 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)

Families Citing this family (1)

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

Citations (5)

* 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
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

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107301536B (en) * 2017-06-12 2019-07-12 腾讯科技(深圳)有限公司 Resource transfers method and device

Patent Citations (5)

* 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
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
BitXHub:基于侧链中继的异构区块链互操作平台;叶少杰;汪小益;徐才巢;孙建伶;;计算机科学(第06期);全文 *
Narges Shadab ; Farzin Houshmand ; Mohsen Lesani.Cross-chain Transactions.IEEE.2020,全文. *
区块链跨链技术分析;郭朝;郭帅印;张胜利;宋令阳;王晖;;物联网学报(第02期);全文 *

Also Published As

Publication number Publication date
CN112927075A (en) 2021-06-08

Similar Documents

Publication Publication Date Title
CN111461723B (en) Data processing system, method and device based on block chain
CN111163129B (en) Resource processing method and device based on cross-link network
CN109150943B (en) Information transmission method, device and system
US11423473B2 (en) Blockchain-based leasing
CN109981646B (en) Resource transfer method and device based on block chain and electronic equipment
CN102630315B (en) Method and system for processing data for preventing deadlock
JP7397986B2 (en) Blockchain cross-chain data access methods, devices, adapters and systems
CN110298755B (en) Block chain transaction method and device
CN110020854B (en) Data evidence storage method and system based on multiple block chain networks
KR20220038781A (en) Decentralized Blockchain Transaction System
CN112927075B (en) Processing method and device of cross-chain transaction, electronic equipment and readable storage medium
CN110505311A (en) A kind of across the chain exchange method of isomorphism block chain and system
CN114896639A (en) Data processing method and device, electronic equipment and storage medium
CN113377875B (en) Cross-chain data processing method and device, electronic equipment and readable storage medium
CN113645251B (en) Data transmission method and device suitable for cross-regional service
Eizinger et al. Open problems in cross-chain protocols
Dixon et al. Using temporal logics of knowledge in the formal verification of security protocols
CN110458541B (en) Object replacement method and device based on block chain
CN113221165A (en) User element authentication method and device based on block chain
CN112396427A (en) Cross-chain interchange operation method for general scenes
CN115567321B (en) Chain-crossing system and method based on built-in preplan contract
CN111143040A (en) Transaction processing method, device, system and storage medium
CN114238500A (en) Block chain transaction storage method and device, electronic equipment and readable storage medium
CN111339208A (en) Method and device for calling intelligent contract
CN111124631A (en) Task processing method and device based on block chain network

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