CN117196615A - Cross-blockchain transaction method, device, equipment and storage medium - Google Patents

Cross-blockchain transaction method, device, equipment and storage medium Download PDF

Info

Publication number
CN117196615A
CN117196615A CN202210598395.4A CN202210598395A CN117196615A CN 117196615 A CN117196615 A CN 117196615A CN 202210598395 A CN202210598395 A CN 202210598395A CN 117196615 A CN117196615 A CN 117196615A
Authority
CN
China
Prior art keywords
chain
cross
link
sub
transaction
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210598395.4A
Other languages
Chinese (zh)
Inventor
邵珠光
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen 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 Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN202210598395.4A priority Critical patent/CN117196615A/en
Publication of CN117196615A publication Critical patent/CN117196615A/en
Pending legal-status Critical Current

Links

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The application relates to the technical field of blockchains, and provides a transaction method, device and equipment for a cross-region blockchain and a storage medium. The method comprises the following steps: based on the cross-chain transaction instruction sent by the client, corresponding main chain transaction operations are respectively executed for each sub-chain, and corresponding main chain execution results are obtained; and generating a corresponding cross-link event based on each main chain execution result and a preset event generation template, respectively transmitting each sub-link transaction operation contained in the cross-link event to a corresponding sub-link so that each sub-link respectively executes the corresponding sub-link transaction operation, and notifying the client of the completion of the cross-link transaction when receiving the sub-link execution result returned by each sub-link. By normalizing the event content to support one-to-many, one-to-many and the like cross-chain scenes, the expandability of the scenes is improved, and the cross-chain events are generated by utilizing the events supported by most block chains, so that the safety and the universality of the cross-chain operation are improved.

Description

Cross-blockchain transaction method, device, equipment and storage medium
Technical Field
The application relates to the technical field of blockchains, and provides a transaction method, device and equipment for a cross-region blockchain and a storage medium.
Background
With the continuous development of science and technology, blockchains have formed blockchain networks with different characteristics and suitable for different application scenarios. In recent years, the demand for collaborative operation between different blockchains is becoming stronger, but the isolation and the sealing of blockchains become a technical bottleneck preventing the collaborative operation between blockchains from being applied to the ground. Therefore, in order to achieve blockchain interconnection, a cross-chain technique has been developed.
At present, two kinds of cross-link schemes are commonly used, one is a cross-link scheme based on a cross-link agent, and the other is a cross-link scheme based on event triggering.
However, there are several drawbacks to the two cross-chain schemes currently provided:
the method has the advantages that the cross-link operation is finished under the cross-link scheduling of the cross-link agent, the cross-link gateway and other third-party equipment, and once the third-party equipment is not trusted, the safety of the cross-link operation is affected.
And the second disadvantage is that when the amount of data to be processed increases and one sub-chain is difficult to meet the increasing data processing requirement, a plurality of sub-chains are required to be used for common processing, but the above-mentioned cross-chain scheme can only be applied to one-to-one cross-chain scenes of one main chain and one sub-chain, and can not be applied to one-to-many cross-chain scenes of one main chain and n sub-chains.
And thirdly, the cross-link scheme is customized and developed for different cross-link events, and once the business of the cross-link event changes, the cross-link scheme needs to be redeveloped, so that the universality of the cross-link scheme is poor.
Disclosure of Invention
The embodiment of the application provides a transaction method, device and equipment of a cross-region block chain and a storage medium, which are used for solving the problems of low safety, poor scene expandability and poor universality of cross-region block chain operation.
In a first aspect, an embodiment of the present application provides a transaction method for a cross-blockchain, where the method is applied to a main chain in a plurality of blockchains, and includes:
acquiring a cross-link transaction instruction sent by a client, wherein the cross-link transaction instruction is used for indicating: when realizing cross-chain transaction with a plurality of sub-chains, the main chain transaction operation executed by the main chain;
based on the cross-chain transaction instruction, corresponding main chain transaction operations are respectively executed for each sub-chain, and corresponding main chain execution results are obtained;
based on the obtained execution results of the main chains and a preset event generation template, generating corresponding cross-link events, wherein the cross-link events are at least used for indicating: when realizing cross-chain transaction with the main chain, each sub-chain executes sub-chain transaction operation;
and respectively sending all the sub-link transaction operations contained in the cross-link event to corresponding sub-links, so that all the sub-links respectively execute the received sub-link transaction operations, and notifying the client of the completion of the cross-link transaction when receiving the sub-link execution results returned by all the sub-links.
In a second aspect, an embodiment of the present application provides a transaction method for a cross-block chain, where the method is applied to a client, and includes:
starting a detection operation of a cross-chain completion event for a main chain in a plurality of blockchains;
generating a cross-chain transaction instruction, and sending the cross-chain transaction instruction to the main chain, so that the main chain executes corresponding main chain transaction operations for each sub-chain based on the received cross-chain transaction instruction, and a corresponding main chain execution result is obtained;
and determining that the cross-chain transaction is completed when the cross-chain completion event sent by the main chain is detected.
In a third aspect, an embodiment of the present application provides a transaction method for a cross-area block chain, where the method is applied to a main cross-link gateway among a plurality of cross-link gateways, and includes:
acquiring a cross-chain event sent by a main chain in a plurality of blockchains;
broadcasting each sub-link transaction operation contained in the cross-link event to a corresponding sub-link through a sub-cross-link gateway of each sub-link so that each sub-link respectively executes the received sub-link transaction operation;
generating a corresponding main chain submitting transaction based on a sub-chain executing result returned by each sub-chain, and sending the main chain submitting transaction to the main chain, so that the main chain executes the main chain submitting operation based on the sub-chain executing result returned by each sub-chain in the main chain submitting transaction, updates the cross-chain state information, obtains the main chain submitting result, and generates a corresponding cross-chain completing event when the state information updating is completed, and informs a client of the completion of the cross-chain transaction.
In a fourth aspect, embodiments of the present application further provide a transaction device for a cross-blockchain, the device being applied to a main chain of a plurality of blockchains, including:
the cross-link processing unit is used for acquiring a cross-link transaction instruction sent by the client, wherein the cross-link transaction instruction is used for indicating: when realizing cross-chain transaction with a plurality of sub-chains, the main chain transaction operation executed by the main chain;
based on the cross-chain transaction instruction, corresponding main chain transaction operations are respectively executed for each sub-chain, and corresponding main chain execution results are obtained;
the event generation unit is used for generating corresponding cross-link events based on the obtained main chain execution results and a preset event generation template, and the cross-link events are at least used for indicating: when realizing cross-chain transaction with the main chain, each sub-chain executes sub-chain transaction operation;
and respectively sending all the sub-link transaction operations contained in the cross-link event to corresponding sub-links, so that all the sub-links respectively execute the received sub-link transaction operations, and notifying the client of the completion of the cross-link transaction when receiving the sub-link execution results returned by all the sub-links.
Optionally, the event generating unit is configured to:
obtaining the event generation template, wherein the event generation template at least comprises: a first sub-template set for backbone commit operations based on backbone contract rules, and a second sub-template set for sub-link transaction operations based on sub-link contract rules;
Adding the main chain identification as a first operation parameter into the first sub-template to obtain configured main chain submitting operation; the method comprises the steps of,
based on the obtained execution results of the main chains, respectively determining second operation parameters of the sub-chains, and respectively adding each second operation parameter into the second sub-templates to obtain sub-chain transaction operations of the corresponding configured sub-chains;
and obtaining the cross-chain event based on the generated main chain submitting operation and the sub-chain transaction operation of each sub-chain.
Optionally, the event generating unit is configured to:
and sending the cross-link event to a main cross-link gateway in a plurality of cross-link gateways, so that the main cross-link gateway broadcasts all sub-link transaction operations contained in the cross-link event to corresponding sub-links through the sub-cross-link gateways of all sub-links.
Optionally, after obtaining the corresponding backbone execution result, the cross-chain processing unit is further configured to, before generating the corresponding cross-chain event:
and sending a main chain identifier and a cross-chain identifier of the cross-chain event to the client so that the client determines whether the cross-chain completion event sent by the main chain is detected or not based on the received main chain identifier and the cross-chain identifier.
Optionally, the cross-chain identification includes a cross-chain usage key value, the backbone identification, and a tile height of a tile generating the cross-chain event.
Optionally, the event generating unit is configured to:
when a main chain submitting transaction returned by a main chain crossing gateway is received, executing the main chain submitting operation based on a sub-chain executing result returned by each sub-chain in the main chain submitting transaction, and updating the cross-chain state information to obtain a main chain submitting result;
and when the state information updating is completed, generating a corresponding cross-link completion event, and notifying the client of the completion of the cross-link transaction.
In a fifth aspect, an embodiment of the present application further provides a transaction apparatus for a block-spanning chain, where the apparatus is applied to a client, and includes:
the event detection unit is used for starting detection operation of a cross-chain completion event aiming at main chains in the plurality of blockchains;
the cross-link processing unit is used for generating a cross-link transaction instruction and sending the cross-link transaction instruction to the main chain so that the main chain executes corresponding main chain transaction operation for each sub-chain based on the received cross-link transaction instruction to obtain a corresponding main chain execution result;
and determining that the cross-chain transaction is completed when the cross-chain completion event sent by the main chain is detected.
In a sixth aspect, an embodiment of the present application further provides a transaction apparatus for a cross-block chain, where the apparatus is applied to a main cross-chain gateway among a plurality of cross-chain gateways, and includes:
the event transmission unit is used for acquiring a cross-chain event sent by a main chain in a plurality of blockchains;
broadcasting each sub-link transaction operation contained in the cross-link event to a corresponding sub-link through a sub-cross-link gateway of each sub-link so that each sub-link respectively executes the received sub-link transaction operation;
the cross-link processing unit is used for generating corresponding main-link submitting transactions based on sub-link execution results returned by all sub-links, and sending the main-link submitting transactions to the main links, so that the main links execute the main-link submitting operation based on the sub-link execution results returned by all sub-links in the main-link submitting transactions, update the cross-link state information to obtain main-link submitting results, and generate corresponding cross-link completion events when the state information update is completed to inform a client of the completion of the cross-link transactions.
Optionally, after the backbone commit transaction is sent to the backbone, the cross-chain processing unit is further configured to:
acquiring a main chain submitting result sent by the main chain;
And broadcasting the two-stage information contained in the main chain submitting result to corresponding sub-chains through each sub-chain crossing gateway, so that each sub-chain executes submitting operation or rollback operation based on the received main chain submitting result.
In a seventh aspect, an embodiment of the present application further provides a computer device, including a processor and a memory, where the memory stores program code, where the program code, when executed by the processor, causes the processor to perform any one of the steps of the transaction method of the inter-block chain.
In an eighth aspect, embodiments of the present application also provide a computer readable storage medium comprising program code for causing a computer device to perform the steps of any one of the above-mentioned trans-block chain transaction methods when the program product is run on the computer device.
In a ninth aspect, embodiments of the present application also provide a computer program product for use in a cross-blockchain transaction, comprising computer instructions for execution by a processor of any of the above-described cross-blockchain transaction methods.
The application has the following beneficial effects:
the embodiment of the application provides a transaction method, a device, equipment and a storage medium of a cross-region block chain, wherein the method comprises the following steps: acquiring a cross-link transaction instruction sent by a client, wherein the cross-link transaction instruction is used for indicating: when realizing cross-chain transaction with a plurality of sub-chains, a main chain transaction operation executed by the main chain is executed; based on the cross-link transaction instruction, corresponding main chain transaction operations are respectively executed for each sub-link to obtain corresponding main chain execution results, and then a template is generated based on each obtained main chain execution result and a preset event to generate corresponding cross-link events, wherein the cross-link events are at least used for indicating: when realizing cross-chain transaction with the main chain, each sub-chain executes sub-chain transaction operation; and respectively sending all the sub-link transaction operations contained in the cross-link event to the corresponding sub-links, so that all the sub-links respectively execute the received sub-link transaction operations, and notifying the client of the completion of the cross-link transaction when receiving the sub-link execution results returned by all the sub-links.
By normalizing event content, the whole cross-link operation not only supports one-to-one cross-link scenes, but also supports multiple scenes such as one-to-many cross-link scenes, one-to-many-to-one cross-link scenes and the like, and the problem that the cross-link scenes are not supported in the current cross-link scheme is solved.
The whole cross-chain event is triggered by utilizing most events supported by the blockchain, so that an execution subject of cross-chain scheduling is converted into a main chain by a cross-chain agent, a cross-chain gateway and other third-party equipment, the risk of the third-party equipment being bad in the cross-chain scheduling process is reduced, a client is not required to be developed for the second time, and the development difficulty of the client is reduced.
Additional features and advantages of the application will be set forth in the description which follows, and in part will be obvious from the description, or may be learned by practice of the application. The objectives and other advantages of the application will be realized and attained by the structure particularly pointed out in the written description and claims thereof as well as the appended drawings.
Drawings
The accompanying drawings, which are included to provide a further understanding of the application and are incorporated in and constitute a part of this specification, illustrate embodiments of the application and together with the description serve to explain the application and do not constitute a limitation on the application. In the drawings:
FIG. 1A is a schematic diagram of an alternative architecture of a blockchain system in accordance with embodiments of the present application;
FIG. 1B is a schematic diagram of an alternative block structure according to an embodiment of the present application;
FIG. 2A is a flow chart of a transaction method applied to a block-crossing chain of a main chain according to an embodiment of the present application;
fig. 2B is a flowchart of a transaction method applied to a cross-block chain of a client according to an embodiment of the present application;
FIG. 2C is a rule diagram of a set of contract rules associated with a cross-link service provided by an embodiment of the present application;
fig. 2D is a schematic diagram of a one-to-one cross-chain scenario provided by an embodiment of the present application;
FIG. 2E is a schematic diagram of a one-to-many multi-span chain scenario provided by an embodiment of the present application;
FIG. 2F is a schematic diagram of a one-to-many-to-one cross-link scenario provided by an embodiment of the present application;
FIG. 2G is a flowchart illustrating a generation of a cross-chain event according to an embodiment of the present application;
FIG. 2H is a schematic diagram of an event generation template according to an embodiment of the present application;
FIG. 3A is a schematic diagram of a first process for implementing a cross-link transaction between a main chain and a plurality of sub-chains in a pair of multi-link scenario according to an embodiment of the present application;
FIG. 3B is a schematic diagram of a second flow for implementing a cross-link transaction between a main chain and a plurality of sub-chains in a pair of multi-cross-link scenario according to an embodiment of the present application;
FIG. 3C is a schematic diagram of a cross-link transaction between a main chain and multiple sub-chains in a pair of multi-cross-link scenario according to an embodiment of the present application;
fig. 3D is a schematic diagram of interaction between a verification node and a cross-link gateway according to an embodiment of the present application;
FIG. 4 is a schematic diagram of a transaction device applied to a block-crossing chain of a main chain according to an embodiment of the present application;
fig. 5 is a schematic structural diagram of a transaction device applied to a cross-block chain of a client according to an embodiment of the present application;
fig. 6 is a schematic structural diagram of a transaction device applied to a cross-block chain of a main cross-chain gateway according to an embodiment of the present application;
FIG. 7 is a schematic diagram of a computer device according to an embodiment of the present application;
FIG. 8 is a schematic diagram of a computing device according to an embodiment of the application.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the embodiments of the present application more apparent, the technical solutions of the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application, and it is apparent that the described embodiments are some embodiments of the technical solutions of the present application, but not all embodiments. All other embodiments, based on the embodiments described in the present document, which can be obtained by a person skilled in the art without any creative effort, are within the scope of protection of the technical solutions of the present application.
Some terms in the embodiments of the present application are explained below to facilitate understanding by those skilled in the art.
1. Blockchain (Blockchain):
blockchains are novel application modes of computer technologies such as distributed data storage, point-to-point transmission, consensus mechanisms, encryption algorithms, and the like.
Blockchains are essentially a de-centralized database, which is a string of blocks that are generated in association using cryptographic methods. The header of each chunk contains both the hash values of all transactions in that chunk and the hash values of all transactions in the previous chunk. Each block based on hash value series connection is a chain structure with strict sequence relation, once the data of a certain block is tampered, the hash value of the block recorded by the head of other blocks also changes, so that the other blocks can find the data tampering as soon as possible, and the tampered data in the block is discarded, therefore, the block chain has the characteristic of non-tampering.
2. Cross-chain technology: the blockchains are one kind of distributed ledgers, each blockchain is equivalent to an independent ledger, and then two different blockchains are equivalent to two independent and unassociated ledgers, so that the resource value cannot be transferred between the ledgers. To achieve the circulation of resource value, cross-chain technology has been developed.
Cross-chain technology, as the name implies, is a technology that enables data interaction between two or more blockchains. Early cross-chain technologies were dominated by asset transfer and current cross-chain technologies were dominated by cross-chain infrastructure.
3. Backbone in the cross-chain technology: generating a blockchain of a cross-chain event, and triggering the cross-chain event by the chain to perform cross-chain scheduling;
subchains in the cross-chain technique: refers to a blockchain that performs sub-chain operations defined in cross-chain events;
a main cross-chain gateway: and the application program is used for detecting the cross-chain event generated by the main chain and scheduling the whole cross-chain event.
4. Transaction: the term "transaction" in a blockchain does not refer solely to a transaction in a business context, but rather refers to an operation that needs to be submitted to be performed on the blockchain and the corresponding transaction results, but the present embodiments also follow this usage habit, given the terminology "transaction" is colloquially used in blockchain technology.
The following briefly describes the design concept of the embodiment of the present application:
with the continuous development of science and technology, blockchains have formed blockchain networks with different characteristics and suitable for different application scenarios. In recent years, the demand for collaborative operation between different blockchains is becoming stronger, but the isolation and the sealing of blockchains become a technical bottleneck preventing the collaborative operation between blockchains from being applied to the ground. Therefore, in order to achieve blockchain interconnection, a cross-chain technique has been developed.
At present, two kinds of cross-link schemes are commonly used, one is a cross-link scheme based on a cross-link agent, and the other is a cross-link scheme based on event triggering.
However, there are several drawbacks to the two cross-chain schemes currently provided:
firstly, the above-mentioned cross-link scheme is to complete the cross-link operation under the cross-link scheduling of the cross-link agent, the cross-link gateway and other third party devices, once the third party devices are not trusted, the authenticity and security of the cross-link operation will be affected.
And the second disadvantage is that when the amount of data to be processed increases and one sub-chain is difficult to meet the increasing data processing requirement, a plurality of sub-chains are required to be used for common processing, but the above-mentioned cross-chain scheme can only be applied to one-to-one cross-chain scenes of one main chain and one sub-chain, and can not be applied to one-to-many cross-chain scenes of one main chain and n sub-chains.
And thirdly, the cross-link scheme is customized and developed for different cross-link events, and once the business of the cross-link event changes, the cross-link scheme needs to be redeveloped, so that the universality of the cross-link scheme is poor.
In view of this, the embodiment of the application provides a transaction method of a cross-block chain. The method is applied to a main chain in a plurality of blockchains, and specifically comprises the following steps: acquiring a cross-link transaction instruction sent by a client, wherein the cross-link transaction instruction is used for indicating: when realizing cross-chain transaction with a plurality of sub-chains, a main chain transaction operation executed by the main chain is executed; based on the cross-link transaction instruction, corresponding main chain transaction operations are respectively executed for each sub-link to obtain corresponding main chain execution results, and then a template is generated based on each obtained main chain execution result and a preset event to generate corresponding cross-link events, wherein the cross-link events are at least used for indicating: when realizing cross-chain transaction with the main chain, each sub-chain executes sub-chain transaction operation; and respectively sending all the sub-link transaction operations contained in the cross-link event to the corresponding sub-links, so that all the sub-links respectively execute the received sub-link transaction operations, and notifying the client of the completion of the cross-link transaction when receiving the sub-link execution results returned by all the sub-links.
By normalizing event content, the whole cross-link operation not only supports one-to-one cross-link scenes, but also supports multiple scenes such as one-to-many cross-link scenes, one-to-many-to-one cross-link scenes and the like, and the problem that the cross-link scenes are not supported in the current cross-link scheme is solved.
The whole cross-chain event is triggered by utilizing most events supported by the blockchain, so that an execution subject of cross-chain scheduling is converted into a main chain by a cross-chain agent, a cross-chain gateway and other third-party equipment, the risk of the third-party equipment being bad in the cross-chain scheduling process is reduced, a client is not required to be developed for the second time, and the development difficulty of the client is reduced.
The preferred embodiments of the present application will be described below with reference to the accompanying drawings of the specification, it being understood that the preferred embodiments described herein are for illustration and explanation only, and not for limitation of the present application, and embodiments of the present application and features of the embodiments may be combined with each other without conflict.
The system according to the embodiment of the application can be a distributed system formed by connecting a client, a plurality of blockchain nodes (computer devices which access a network in any form, such as a server, a terminal and the like) through a wired network or a wireless network.
The distributed system 100 is applied to the blockchain technology field to obtain the blockchain system shown in fig. 1A. Referring To an alternative architecture of the blockchain system shown in fig. 1A, the blockchain system is composed of a client 300 and a plurality of blockchain nodes 200, and a Peer-To-Peer (P2P) network is formed between the blockchain nodes 200.
In a blockchain system, any computer device (e.g., server, terminal, etc.) may join a blockchain network, referred to as a blockchain node in the blockchain system. The blockchain node comprises a hardware layer, a middle layer, an operating system layer and an application layer.
The functionality of each blockchain node is specifically described below with respect to participating in the blockchain system shown in fig. 1A.
(1) The basic function that the block link points possess, the routing function, is used to support communication between the individual block link points.
(2) The block chain node also has an application function, the function is used for realizing specific service according to actual service requirements by the block chain node, recording data relevant to the realization function, generating corresponding record data, wherein the record data comprises a digital signature used for representing a task data source, the block chain node transmits the record data to other block chain nodes in the block chain system, and when the other block chain nodes successfully verify the record data source and the integrity, the record data is added into the temporary block.
For example, the blockchain node has an application function, so that the following services can be realized:
(2.1) wallet services, providing resource usage functions (e.g., initiating electronic money transactions, querying electronic money balances in electronic money addresses, etc.). The method comprises the steps of receiving a transaction record of a current transaction from a block chain node, and storing the transaction record data into a temporary block of the block chain after the transaction record is successfully verified by the block chain node.
(2.2) shared ledgers, which provide operations such as storing, querying and modifying account data. And after the transaction records are successfully verified by other block chain nodes, the record data is stored in a temporary block of the block chain as a response for acknowledging that the modified account data is valid data, and a confirmation message can be sent to the block chain node initiating the operation.
(2.3) Smart contracts are computer agreements that are intended to propagate, verify, or execute contracts in an informative manner. Smart contracts allow trusted transactions to be made without third parties, which transactions are traceable and irreversible. For example, the physical distribution status of the goods purchased by the buyer is queried, and after the buyer registers the goods, the electronic money of the buyer is transferred to the electronic account address of the merchant.
Of course, the smart contract is not limited to executing a contract for a transaction, and a contract that processes received information may also be executed.
(3) A blockchain includes a series of blocks that follow each other in a time sequence that is formed. The new block is not removed once it is added to the blockchain and records therein the record data submitted by the blockchain nodes in the blockchain system.
Referring to the block structure shown in fig. 1B, the header of each block includes both the hash values of all transactions in the block and the hash values of all transactions in the previous block, and the hash values are used to concatenate the blocks to form a blockchain having a chain structure with a strict sequence relationship. In addition, each block also contains a generation time stamp of the block.
It can be seen that the blockchain is essentially a de-centralized database, which is a string of blocks that are generated in association using cryptographic methods, each block of data containing information that is used to verify the validity of the information and to generate the next block.
The transaction method of the cross-blockchain provided by the embodiment of the application can be applied to the main chains in a plurality of blockchains. Next, referring to the flow chart shown in fig. 2A, a process of performing a cross-link transaction between the main chain and the multiple sub-chains will be specifically described.
S201: the main chain acquires a cross-link transaction instruction sent by the client, wherein the cross-link transaction instruction is used for indicating: backbone transaction operations performed by the backbone when implementing a cross-chain transaction with a plurality of sub-chains.
The transaction method of the cross-block chain provided by the embodiment of the application is carried out by taking the cross-chain event as a trigger condition and taking the main chain as an execution body of cross-chain scheduling. Therefore, for the client in the embodiment of the present application, there is no need to develop the client for the second time in order to adapt to the business logic of different cross-link transactions, and the core step is to start the detection operation of the cross-link completion event for the main chain before sending the cross-link transaction, so that the client can determine when the cross-link transaction is completed between the main chain and the multiple sub-chains.
The processing flow of the client for each cross-chain transaction is shown in fig. 2B:
s2011: the method comprises the steps that a client starts a detection operation for a cross-chain completion event of a main chain in a plurality of blockchains;
s2012: the client generates a cross-link transaction instruction based on a cross-link contract rule and sends the cross-link transaction instruction to the main chain, so that the main chain executes corresponding main chain transaction operation for each sub-chain based on the received cross-link transaction instruction, and a corresponding main chain execution result is obtained;
S2013: the client receives all main chain execution results returned by the main chain, wherein each main chain execution result is obtained by the main chain executing corresponding main chain transaction operation on all sub-chains based on a cross-chain transaction instruction;
s2014: the client judges whether a cross-link completion event sent by the main chain is detected, if so, the client determines that the cross-link transaction is completed; otherwise, continuing to detect the cross-chain completion event.
S202: based on the cross-chain transaction instruction, the main chain executes corresponding main chain transaction operation for each sub-chain respectively, and a corresponding main chain execution result is obtained.
Assuming that chain 1 is the main chain, chain 2 to chain n are sub-chains, when receiving a cross-chain transaction instruction { chain 1 goes out 10-element to chain 2, chain 1 goes out 15-element to chain 3, … …, chain 1 receives 100-element to which chain n goes in }, respectively executing a main chain transaction operation { chain 1 account goes out 10-element } for chain 2, a main chain transaction operation { chain 1 account goes out 15-element } for chain 3, … …, a main chain transaction operation { chain 1 account goes into 100-element } for chain n, and obtaining a corresponding main chain execution result.
After the main chain obtains each main chain execution result, a main chain identification (Identity, ID) and a cross-link identification of a cross-link event are sent to the client, so that the client determines whether the cross-link completion event sent by the main chain is detected based on the received main chain identification and the cross-link identification.
The cross-chain identification has uniqueness and is used for marking one cross-chain event. The cross-chain identification specifically comprises the following steps: the cross-chain uses key value, backbone identification, and block height of the block that generated the cross-chain event.
The key value used by the cross-chain is generated when the client generates a cross-chain transaction instruction, and is generally a value which is larger in value and not repeated. The block height refers to the number of blocks connected to the blockchain, and the verification node may determine, based on the block height, on which block of the backbone the cross-chain event was generated, and then perform the transaction verification operation based on all backbone transaction operations generated on that block.
S203: the main chain generates a template based on the obtained execution results of the main chains and a preset event, and generates a corresponding cross-chain event which is at least used for indicating: when implementing a cross-chain transaction with a backbone, each sub-chain performs a sub-chain transaction operation.
As shown in fig. 2C, the embodiment of the present application designs a set of contract rules related to the cross-link service, and by normalizing the event content, the whole cross-link transaction not only supports one-to-one cross-link scenarios, but also supports one-to-many cross-link scenarios, one-to-many-to-one cross-link scenarios, and the like, so as to solve the problem of the cross-link scenarios that are not supported in the current cross-link scheme.
As shown in fig. 2C, at least three types of contract rules are included, respectively: cross-link contract rules, sub-link contract rules, and main-link contract rules.
Wherein, 1) the cross-link contract rule is a contract rule directly called by the client, and comprises business logic of main chain transaction operation and business logic for generating the cross-link event. The business logic of the main chain transaction operation specifically comprises: and the main chain carries out normal service processing, saves the service state and returns a main chain identifier and a cross-chain identifier to the client.
Assuming chain 1 as the backbone, its account balance is 1000 yuan. When the chain 1 receives 100-element based on the cross-chain transaction instruction { the chain 1 receives the 100-element transferred from the chain n }, the chain 1 transfers 100-element to the account, stores the account balance as 1100-element, and returns the main chain identification and the cross-chain identification to the client.
Wherein, the normal business processing of the main chain corresponds to the operation of 'chain 1 transferring 100 yuan to own account', and the business state preservation corresponds to 'account balance preservation as 1100 yuan'.
2) The sub-link contract rules contain business logic for sub-link transaction operations for each sub-link. Each sub-chain transaction operation specifically includes: and carrying out normal service processing on the corresponding sub-chain, and returning the sub-chain execution result which needs to be submitted by the main chain.
3) The main chain contract rule comprises business logic of main chain submitting operation, and the main chain submitting operation is executed to generate a cross-chain completion event so as to inform a client of cross-chain transaction completion. The business logic of the main chain submitting operation specifically comprises: and updating the cross-link state information based on the sub-link execution result returned by each sub-link, and generating a cross-link completion event.
As shown in fig. 2D, the one-to-one cross-chain scenario includes one main chain and one sub-chain. The main chain is used for generating a cross-chain event and executing main chain submitting operation to inform the client of the completion of the cross-chain transaction; the sub-chain is used for executing sub-chain transaction operation in the cross-chain event and sending a corresponding sub-chain execution result to the main chain.
As shown in fig. 2E, a pair of multi-strand scenarios includes a main strand and a plurality of sub-strands. The main chain is used for generating a cross-chain event and executing main chain submitting operation to inform the client of the completion of the cross-chain transaction; each sub-chain is used for executing corresponding sub-chain transaction operation in the cross-chain event and sending corresponding sub-chain execution results to the main chain.
As shown in fig. 2F, the one-to-many-to-one cross-chain scenario includes a main chain, a plurality of sub-chains, and a blockchain. The main chain is used for generating a cross-link event, each sub-chain is used for executing corresponding sub-chain transaction operation in the cross-link event, a corresponding sub-chain execution result is sent to the main chain, and the other blockchain is used for executing main chain submitting operation to inform the client of the completion of the cross-link transaction. It should be noted that while another blockchain performs the backbone commit operation, it is not a backbone, and the backbone in this scenario can only be the blockchain that generated the cross-chain event.
The main chain generates a cross-chain event by utilizing events supported by most blockchains so as to achieve the purpose of cross-chain scheduling. Next, as shown in fig. 2G, the process of the backbone generating a cross-chain event is as follows.
S2031: the backbone obtains an event generating template comprising at least: a first sub-template set for backbone commit operations based on backbone contract rules, and a second sub-template set for sub-chain transaction operations based on sub-chain contract rules.
The backbone invokes the cross-link contract rules to obtain the event generation template as shown in FIG. 2H, each blockchain that will require implementation of the cross-link transaction, and how the business logic for implementing the cross-link transaction on each blockchain is written into the event generation template. Therefore, on one hand, the expandability of the cross-link is increased, and on the other hand, when the cross-link business changes, the business logic of the cross-link event is not required to be rewritten, only the contract rule related in the event generation template is updated, and the business development difficulty is reduced.
As shown in fig. 2H, the event generation template includes a cross-chain identification, a first sub-template set for backbone commit operations based on backbone contract rules, and a second sub-template set for sub-chain transaction operations based on sub-chain contract rules.
Wherein the first sub-template comprises: backbone identification, business logic for backbone commit operations specified in backbone contract rules, and other extensible data for backbone operations.
The second sub-module includes: each sub-chain performs an operation to be performed. The operations to be performed by a sub-chain specifically include: the sub-chain identification of the corresponding sub-chain, the business logic of the sub-chain transaction operations specified in the sub-chain contract rules, and other extensible data of the sub-chain operations.
S2032: adding the main chain identification as a first operation parameter into a first sub-template to obtain configured main chain submitting operation; and respectively determining second operation parameters of each sub-chain based on the obtained main chain execution results, and respectively adding each second operation parameter into a second sub-template to obtain the configured sub-chain transaction operation of the corresponding sub-chain.
The first sub-module includes: backbone identification, business logic for backbone commit operations specified in backbone contract rules, and other extensible data for backbone operations. And adding the main chain identification as a first operation parameter into a first sub-template to obtain configured main chain submitting operation.
The main chain and the transaction operation to be executed by each sub-chain are completely opposite, so that the inverse operation of the execution result of each main chain can be used as the second operation parameter of the corresponding sub-chain and added into the second sub-template to obtain the sub-chain transaction operation of the corresponding sub-chain after configuration.
For example, let chain 1 be the main chain and chain 2 be the sub-chain. When the cross-chain transaction instruction is { chain 1 to chain 2 transfer 10 yuan }, the backbone transaction operation performed by chain 1 is a 10 yuan transfer from its own account. Then the sub-chain transaction operation to be performed by chain 2 should be 10-element for its own account, so the second operating parameter of chain 2 is { chain 2-10-element for its own account }.
S2023: the backbone obtains a cross-chain event based on the generated backbone commit operation and the sub-chain transaction operation of each sub-chain.
S204: the main chain respectively sends all sub-chain transaction operations contained in the cross-chain event to corresponding sub-chains, so that all the sub-chains respectively execute the received sub-chain transaction operations, and when receiving sub-chain execution results returned by all the sub-chains, the main chain informs the client of the completion of the cross-chain transaction.
The main chain sends a cross-link event to a main cross-link gateway in the plurality of cross-link gateways, and the main cross-link gateway acquires the cross-link event when detecting the cross-link event. And broadcasting each sub-link transaction operation contained in the cross-link event to the corresponding sub-link by the main cross-link gateway through the sub-cross-link gateway of each sub-link so that each sub-link respectively executes the received sub-link transaction operation.
And then, the main cross-link gateway obtains a sub-link execution result returned by each sub-cross-link through each sub-cross-link gateway, generates a corresponding main chain submitting transaction based on each sub-link execution result, and sends the main chain submitting transaction to the main chain. Wherein each sub-chain execution result includes: the sub-link transaction operation of the corresponding sub-link, and execution status information indicating execution success or execution failure.
And finally, when the main chain receives a main chain submitting transaction returned by the main chain crossing gateway, based on a sub-chain executing result returned by each sub-chain in the main chain submitting transaction, executing main chain submitting operation, updating the crossing chain state information to obtain a main chain submitting result, generating a corresponding crossing chain completing event when the state information updating is completed, and notifying the client of the completion of the crossing chain transaction.
When the main chain determines that each sub-chain successfully executes corresponding sub-chain transaction operation based on each received execution result, the cross-chain state information is updated to be submitted successfully;
when the main chain determines that at least one sub-chain fails to execute the corresponding sub-chain transaction operation based on the received execution results, the cross-chain state information is updated to be failed in submission, and whether to roll back the previous operation is determined according to event content defined in the cross-chain contract rule.
The main chain crossing gateway acquires a main chain submitting result sent by a main chain, and then broadcasts two-stage information contained in the main chain submitting result to corresponding sub-chains through each sub-chain crossing gateway, so that each sub-chain executes submitting operation or rollback operation based on the received main chain submitting result. The two-stage message specifically comprises: a commit message indicating that the backbone commit was successful, and a rollback message indicating that the backbone commit failed.
In fact, whether the main cross-chain gateway is to execute the submitting operation of the two-stage message and whether each sub-chain is to execute the rollback operation are not determined by the cross-chain gateway, but depend on event content defined in the cross-chain related contract rule, so that the risk of the cross-chain gateway being wrought in the cross-chain scheduling process is reduced.
For example, for a cross-chain event where business logic is relatively simple, the commit operation of the two-phase message may not be set;
for another example, for the main chain, the execution result returned by each sub-chain is a reference information, and even if the cross-chain state information shows that the commit fails, each sub-chain is not necessarily required to execute the rollback operation.
For ease of understanding, referring to the flow diagrams shown in fig. 3A-3B and the logic diagram shown in fig. 3C, the method is applied in a one-to-many cross-chain scenario, and the complete process of implementing a cross-chain transaction is as follows.
S301: the client initiates a detection operation for a cross-chain completion event for a backbone in the plurality of blockchains.
S302: the client generates a cross-link transaction instruction based on the cross-link contract rule and sends the cross-link transaction instruction to the main chain.
S303: based on the cross-chain transaction instruction, the main chain executes corresponding main chain transaction operation for each sub-chain respectively, and a corresponding main chain execution result is obtained.
S304: the main chain sends a main chain identifier and a cross-chain identifier of a cross-chain event to the client so that the client can determine whether a main chain completion event sent by the main chain is detected or not based on the received main chain identifier and the cross-chain identifier.
S305: the main chain generates a corresponding cross-link event based on the obtained main chain execution results and a preset event generation template, and sends the cross-link event to a main cross-link gateway in a plurality of cross-link gateways.
S306: the main cross-link gateway invokes the verification node and endorses the received cross-link event.
In order to prevent the cross-link gateway from maliciously tampering the received contents such as the cross-link event, the transaction operation and the like, each cross-link gateway can call the verification node to endorse the received contents, which indicates that the contents provided by the cross-link gateway are correct.
As shown in fig. 3D, the cross-link gateway sends cross-link transaction information of the cross-link event to the verification node, where the cross-link transaction information at least includes: the cross-chain use key value, the block height of the block generating the cross-chain event, the sequence of the cross-chain event in the block and the information related to the contract rule.
The verification node adopts modes of simple payment verification (Simplified Payment Verification, SPV), synchronous node, trust endorsement and the like to verify the cross-chain transaction information, and obtains a verification result (indicating verification success or verification failure) and a result signature (referring to gateway identification of the cross-chain gateway).
In practice, whether the primary cross-link gateway is to adopt the validation results depends on the event content defined in the cross-link related contract rules. Therefore, even if the verification fails, the main cross-link gateway can still send the cross-link transaction information and each sub-link transaction operation to each sub-cross-link gateway.
S307: the main cross-link gateway obtains the sub-link transaction operation of each sub-link by analyzing the cross-link event, and broadcasts the sub-link transaction operation to the sub-cross-link gateway of each sub-link.
S308: and each sub-cross-link gateway invokes a verification node to verify the cross-link transaction information carried by the sub-link transaction operation.
Because the verification node has cached the verification result and the result signature of the cross-link transaction information, when the verification node receives endorsement requests for the cross-link transaction information sent by other cross-link gateways, the cross-link transaction information is not required to be endorsed any more, and the cross-link transaction information is rapidly verified by checking whether the result signatures of the cross-link transaction information are matched and consistent.
S309: each sub-cross-chain gateway sends sub-chain transaction operations into a corresponding sub-chain.
S310: each sub-chain executes the received sub-chain transaction operation respectively, and sends the sub-chain execution result to the corresponding sub-cross-chain gateway.
S311: each sub-cross-chain gateway invokes the verification node to endorse the sub-chain transaction operation.
S312: and each sub-spanning chain gateway gathers the sub-chain execution result into the main spanning chain gateway.
S313: and the main cross-chain gateway calls a verification node to verify the sub-chain transaction operation corresponding to each sub-chain execution result.
S314: the main cross-link gateway generates corresponding main chain submitting transactions based on the execution results of all the sub-links and sends the main chain submitting transactions to the main chain.
S315: based on each sub-chain execution result included in the main chain submitting transaction, the main chain submitting operation is executed, the cross-chain state information is updated, the main chain submitting result is obtained, and when the state information updating is completed, a corresponding cross-chain completion event is generated.
S316: and the client determines that the cross-chain transaction is completed when the cross-chain completion event is detected.
S317: the main cross-link gateway calls the verification node to endorse the main chain submitting result sent by the main chain.
S318: and broadcasting the main chain submitting result to each sub-chain gateway by the main chain gateway.
S319: and each sub-cross-chain gateway invokes a verification node to verify the received main chain submission result.
S320: and each sub-cross-chain gateway sends the main chain submitting result to the corresponding sub-chain.
S321: each sub-chain performs a commit operation or a rollback operation based on the received backbone commit result, respectively.
Based on the same inventive concept as the above-mentioned method embodiment, the embodiment of the present application also provides a transaction device for cross-block chains, which is applied to a main chain of a plurality of block chains. As shown in fig. 4, a transaction device 400 across blockchains may include:
the cross-link processing unit 401 is configured to obtain a cross-link transaction instruction sent by the client, where the cross-link transaction instruction is used to indicate: when realizing cross-chain transaction with a plurality of sub-chains, a main chain transaction operation executed by the main chain is executed;
based on the cross-chain transaction instruction, corresponding main chain transaction operations are respectively executed for each sub-chain, and corresponding main chain execution results are obtained;
the event generating unit 402 is configured to generate a corresponding cross-link event based on the obtained execution result of each main chain and a preset event generating template, where the cross-link event is at least used for indicating: when realizing cross-chain transaction with the main chain, each sub-chain executes sub-chain transaction operation;
and respectively sending all the sub-link transaction operations contained in the cross-link event to the corresponding sub-links, so that all the sub-links respectively execute the received sub-link transaction operations, and notifying the client of the completion of the cross-link transaction when receiving the sub-link execution results returned by all the sub-links.
Optionally, the event generating unit 402 is configured to:
obtaining an event generation template, wherein the event generation template at least comprises: a first sub-template set for backbone commit operations based on backbone contract rules, and a second sub-template set for sub-link transaction operations based on sub-link contract rules;
adding the main chain identification as a first operation parameter into a first sub-template to obtain configured main chain submitting operation; the method comprises the steps of,
based on the obtained execution results of the main chains, respectively determining second operation parameters of the sub-chains, and respectively adding each second operation parameter into a second sub-template to obtain the sub-chain transaction operation of the corresponding configured sub-chain;
based on the generated main chain submitting operation and sub-chain transaction operation of each sub-chain, a cross-chain event is obtained.
Optionally, the event generating unit 402 is configured to:
and sending the cross-link event to a main cross-link gateway in the plurality of cross-link gateways, so that the main cross-link gateway broadcasts each sub-link transaction operation contained in the cross-link event to the corresponding sub-link through the sub-cross-link gateway of each sub-link.
Optionally, after obtaining the corresponding backbone execution result, the cross-chain processing unit 401 is further configured to, before generating the corresponding cross-chain event:
And sending the main chain identification and the cross-chain identification of the cross-chain event to the client so that the client can determine whether the cross-chain completion event sent by the main chain is detected or not based on the received main chain identification and the cross-chain identification.
Optionally, the cross-chain identification includes cross-chain usage key values, backbone identifications, and tile heights of tiles that generated the cross-chain event.
Optionally, the event generating unit 402 is configured to:
when a main chain submitting transaction returned by a main chain crossing gateway is received, executing the main chain submitting operation based on a sub-chain executing result returned by each sub-chain in the main chain submitting transaction, and updating the cross-chain state information to obtain a main chain submitting result;
and when the state information updating is completed, generating a corresponding cross-link completion event, and notifying the client of the completion of the cross-link transaction.
Based on the same inventive concept as the above-mentioned method embodiment, the embodiment of the present application also provides a transaction device for a block-crossing chain, which is applied to a client. As shown in fig. 5, a transaction device 500 of a block-spanning chain may include:
an event detection unit 501 for starting a detection operation of a cross-chain completion event for a main chain in a plurality of blockchains;
the cross-link processing unit 502 is configured to generate a cross-link transaction instruction, and send the cross-link transaction instruction to the main chain, so that the main chain executes corresponding main chain transaction operations for each sub-chain based on the received cross-link transaction instruction, and obtains a corresponding main chain execution result;
Upon detecting a cross-link completion event sent by the backbone, determining that the cross-link transaction is complete.
Based on the same inventive concept as the above-mentioned method embodiment, the embodiment of the present application also provides a transaction device for a cross-block chain, where the device is applied to a main cross-chain gateway of a plurality of cross-chain gateways. As shown in fig. 6, a transaction device 600 of a block-spanning chain may include:
an event transmission unit 601, configured to obtain a cross-link event sent by a main chain in a plurality of blockchains;
broadcasting each sub-link transaction operation contained in the cross-link event to the corresponding sub-link through the sub-cross-link gateway of each sub-link so that each sub-link respectively executes the received sub-link transaction operation;
the cross-link processing unit 602 is configured to generate a corresponding main-link commit transaction based on a sub-link execution result returned by each sub-link, and send the main-link commit transaction to the main-link, so that the main-link executes main-link commit operation based on the sub-link execution result returned by each sub-link in the main-link commit transaction, updates cross-link state information, obtains a main-link commit result, and generates a corresponding cross-link completion event when the state information update is completed, to notify the client of completion of the cross-link transaction.
Optionally, after sending the backbone commit transaction to the backbone, the cross-chain processing unit 602 is further configured to:
Acquiring a main chain submitting result sent by a main chain;
and broadcasting the two-stage information contained in the main chain submitting result to the corresponding sub-chain through each sub-chain crossing gateway so that each sub-chain executes the submitting operation or rollback operation based on the received main chain submitting result.
For convenience of description, the above parts are described as being functionally divided into modules (or units) respectively. Of course, the functions of each module (or unit) may be implemented in the same piece or pieces of software or hardware when implementing the present application.
Having described the method and apparatus for cross-blockchain transactions of exemplary embodiments of the present application, next, a computer device according to another exemplary embodiment of the present application is described.
Those skilled in the art will appreciate that the various aspects of the application may be implemented as a system, method, or program product. Accordingly, aspects of the application may be embodied in the following forms, namely: an entirely hardware embodiment, an entirely software embodiment (including firmware, micro-code, etc.) or an embodiment combining hardware and software aspects may be referred to herein as a "circuit," module "or" system.
Based on the same inventive concept as the above-mentioned method embodiment, a computer device is further provided in the embodiment of the present application, and referring to fig. 7, a computer device 700 may include at least a processor 701 and a memory 702. The memory 702 stores program code that, when executed by the processor 701, causes the processor 701 to perform the steps of any of the above-described inter-block chain transaction methods.
In some possible implementations, a computing device according to the application may include at least one processor, and at least one memory. The memory stores therein program code that, when executed by the processor, causes the processor to perform the steps in the cross-blockchain transaction methods described above in this specification in accordance with various exemplary embodiments of the application. For example, the processor may perform the steps as shown in fig. 2A.
A computing device 800 according to such an embodiment of the application is described below with reference to fig. 8. The computing device 800 of fig. 8 is only one example and should not be taken as limiting the functionality and scope of use of embodiments of the present application.
As shown in fig. 8, computing device 800 is in the form of a general purpose computing device. Components of computing device 800 may include, but are not limited to: the at least one processing unit 801, the at least one memory unit 802, and a bus 803 connecting the different system components (including the memory unit 802 and the processing unit 801).
Bus 803 represents one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, a processor, and a local bus using any of a variety of bus architectures.
The storage unit 802 may include readable media in the form of volatile memory, such as Random Access Memory (RAM) 8021 and/or cache storage unit 8022, and may further include Read Only Memory (ROM) 8023.
The storage unit 802 may also include a program/utility 8025 having a set (at least one) of program modules 8024, such program modules 8024 including, but not limited to: an operating system, one or more application programs, other program modules, and program data, each or some combination of which may include an implementation of a network environment.
The computing device 800 may also communicate with one or more external devices 804 (e.g., keyboard, pointing device, etc.), one or more devices that enable a user to interact with the computing device 800, and/or any devices (e.g., routers, modems, etc.) that enable the computing device 800 to communicate with one or more other computing devices. Such communication may occur through an input/output (I/O) interface 805. Moreover, computing device 800 may also communicate with one or more networks such as a Local Area Network (LAN), a Wide Area Network (WAN) and/or a public network, such as the Internet, through network adapter 806. As shown, network adapter 806 communicates with other modules for computing device 800 over bus 803. It should be appreciated that although not shown, other hardware and/or software modules may be used in connection with computing device 800, including but not limited to: microcode, device drivers, redundant processors, external disk drive arrays, RAID systems, tape drives, data backup storage systems, and the like.
Based on the same inventive concept as the above-described method embodiments, aspects of the transaction method of a cross-blockchain provided by the present application may also be implemented in the form of a program product comprising program code for causing a computer device to perform the steps in the transaction method of a cross-blockchain according to the various exemplary embodiments of the present application described herein above, when the program product is run on a computer device, e.g. the computer device may perform the steps as shown in fig. 2A.
The program product may employ any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium can be, for example, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples (a non-exhaustive list) of the readable storage medium would include the following: an electrical connection having one or more wires, a portable disk, a hard disk, random Access Memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
While preferred embodiments of the present application have been described, additional variations and modifications in those embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. It is therefore intended that the following claims be interpreted as including the preferred embodiments and all such alterations and modifications as fall within the scope of the application.
It will be apparent to those skilled in the art that various modifications and variations can be made to the present application without departing from the spirit or scope of the application. Thus, it is intended that the present application also include such modifications and alterations insofar as they come within the scope of the appended claims or the equivalents thereof.

Claims (15)

1. A method of transacting a cross-blockchain, the method being applied to a backbone in a plurality of blockchains, comprising:
acquiring a cross-link transaction instruction sent by a client, wherein the cross-link transaction instruction is used for indicating: when realizing cross-chain transaction with a plurality of sub-chains, the main chain transaction operation executed by the main chain;
based on the cross-chain transaction instruction, corresponding main chain transaction operations are respectively executed for each sub-chain, and corresponding main chain execution results are obtained;
based on the obtained execution results of the main chains and a preset event generation template, generating corresponding cross-link events, wherein the cross-link events are at least used for indicating: when realizing cross-chain transaction with the main chain, each sub-chain executes sub-chain transaction operation;
And respectively sending all the sub-link transaction operations contained in the cross-link event to corresponding sub-links, so that all the sub-links respectively execute the received sub-link transaction operations, and notifying the client of the completion of the cross-link transaction when receiving the sub-link execution results returned by all the sub-links.
2. The method of claim 1, wherein generating the corresponding cross-link event based on the obtained backbone execution results and a preset event generation template comprises:
obtaining the event generation template, wherein the event generation template at least comprises: a first sub-template set for backbone commit operations based on backbone contract rules, and a second sub-template set for sub-link transaction operations based on sub-link contract rules;
adding the main chain identification as a first operation parameter into the first sub-template to obtain configured main chain submitting operation; the method comprises the steps of,
based on the obtained execution results of the main chains, respectively determining second operation parameters of the sub-chains, and respectively adding each second operation parameter into the second sub-templates to obtain sub-chain transaction operations of the corresponding configured sub-chains;
and obtaining the cross-chain event based on the generated main chain submitting operation and the sub-chain transaction operation of each sub-chain.
3. The method according to claim 1 or 2, wherein said sending each sub-chain transaction operation contained in said cross-chain event onto a corresponding sub-chain, respectively, comprises:
and sending the cross-link event to a main cross-link gateway in a plurality of cross-link gateways, so that the main cross-link gateway broadcasts all sub-link transaction operations contained in the cross-link event to corresponding sub-links through the sub-cross-link gateways of all sub-links.
4. The method of claim 1, after obtaining the corresponding backbone execution result, prior to generating the corresponding cross-chain event, further comprising:
and sending a main chain identifier and a cross-chain identifier of the cross-chain event to the client so that the client determines whether the cross-chain completion event sent by the main chain is detected or not based on the received main chain identifier and the cross-chain identifier.
5. The method of claim 4, wherein the cross-chain identification comprises a cross-chain usage key, the backbone identification, and a tile height of a tile generating the cross-chain event.
6. The method as claimed in claim 1 or 2, wherein said notifying the client of completion of the cross-link transaction upon receiving the result of the execution of the sub-link returned by each sub-link comprises:
When a main chain submitting transaction returned by a main chain crossing gateway is received, executing the main chain submitting operation based on a sub-chain executing result returned by each sub-chain in the main chain submitting transaction, and updating the cross-chain state information to obtain a main chain submitting result;
and when the state information updating is completed, generating a corresponding cross-link completion event, and notifying the client of the completion of the cross-link transaction.
7. A method of trading across a chain of blocks, the method being applied to a client and comprising:
starting a detection operation of a cross-chain completion event for a main chain in a plurality of blockchains;
generating a cross-chain transaction instruction, and sending the cross-chain transaction instruction to the main chain, so that the main chain executes corresponding main chain transaction operations for each sub-chain based on the received cross-chain transaction instruction, and a corresponding main chain execution result is obtained;
and determining that the cross-chain transaction is completed when the cross-chain completion event sent by the main chain is detected.
8. A method of trading a chain of blocks across a region, the method being applied to a primary chain-crossing gateway of a plurality of chain-crossing gateways, comprising:
acquiring a cross-chain event sent by a main chain in a plurality of blockchains;
broadcasting each sub-link transaction operation contained in the cross-link event to a corresponding sub-link through a sub-cross-link gateway of each sub-link so that each sub-link respectively executes the received sub-link transaction operation;
Generating a corresponding main chain submitting transaction based on a sub-chain executing result returned by each sub-chain, and sending the main chain submitting transaction to the main chain, so that the main chain executes the main chain submitting operation based on the sub-chain executing result returned by each sub-chain in the main chain submitting transaction, updates the cross-chain state information, obtains the main chain submitting result, and generates a corresponding cross-chain completing event when the state information updating is completed, and informs a client of the completion of the cross-chain transaction.
9. The method of claim 8, further comprising, after sending the backbone commit transaction to the backbone:
acquiring a main chain submitting result sent by the main chain;
and broadcasting the two-stage information contained in the main chain submitting result to corresponding sub-chains through each sub-chain crossing gateway, so that each sub-chain executes submitting operation or rollback operation based on the received main chain submitting result.
10. A transaction device for a cross-blockchain, the device being applied to a backbone in a plurality of blockchains, comprising:
the cross-link processing unit is used for acquiring a cross-link transaction instruction sent by the client, wherein the cross-link transaction instruction is used for indicating: when realizing cross-chain transaction with a plurality of sub-chains, the main chain transaction operation executed by the main chain;
Based on the cross-chain transaction instruction, corresponding main chain transaction operations are respectively executed for each sub-chain, and corresponding main chain execution results are obtained;
the event generation unit is used for generating corresponding cross-link events based on the obtained main chain execution results and a preset event generation template, and the cross-link events are at least used for indicating: when realizing cross-chain transaction with the main chain, each sub-chain executes sub-chain transaction operation;
and respectively sending all the sub-link transaction operations contained in the cross-link event to corresponding sub-links, so that all the sub-links respectively execute the received sub-link transaction operations, and notifying the client of the completion of the cross-link transaction when receiving the sub-link execution results returned by all the sub-links.
11. A transaction device across a chain of blocks, the device being applied to a client and comprising:
the event detection unit is used for starting detection operation of a cross-chain completion event aiming at main chains in the plurality of blockchains;
the cross-link processing unit is used for generating a cross-link transaction instruction and sending the cross-link transaction instruction to the main chain so that the main chain executes corresponding main chain transaction operation for each sub-chain based on the received cross-link transaction instruction to obtain a corresponding main chain execution result;
And determining that the cross-chain transaction is completed when the cross-chain completion event sent by the main chain is detected.
12. A transaction device for a chain of blocks across a region, the device being applied to a main chain-crossing gateway of a plurality of chain-crossing gateways, comprising:
the event transmission unit is used for acquiring a cross-chain event sent by a main chain in a plurality of blockchains;
broadcasting each sub-link transaction operation contained in the cross-link event to a corresponding sub-link through a sub-cross-link gateway of each sub-link so that each sub-link respectively executes the received sub-link transaction operation;
the cross-link processing unit is used for generating corresponding main-link submitting transactions based on sub-link execution results returned by all sub-links, and sending the main-link submitting transactions to the main links, so that the main links execute the main-link submitting operation based on the sub-link execution results returned by all sub-links in the main-link submitting transactions, update the cross-link state information to obtain main-link submitting results, and generate corresponding cross-link completion events when the state information update is completed to inform a client of the completion of the cross-link transactions.
13. A computer device comprising a processor and a memory, wherein the memory stores program code that, when executed by the processor, causes the processor to perform the steps of the method of any of claims 1 to 9.
14. A computer readable storage medium, characterized in that it comprises a program code for causing a computer device to perform the steps of the method according to any one of claims 1-9, when said program code is run on said computer device.
15. A computer program product for use in a cross-blockchain transaction, comprising computer instructions which, when executed by a processor, implement the steps of the method of any of claims 1 to 9.
CN202210598395.4A 2022-05-30 2022-05-30 Cross-blockchain transaction method, device, equipment and storage medium Pending CN117196615A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210598395.4A CN117196615A (en) 2022-05-30 2022-05-30 Cross-blockchain transaction method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210598395.4A CN117196615A (en) 2022-05-30 2022-05-30 Cross-blockchain transaction method, device, equipment and storage medium

Publications (1)

Publication Number Publication Date
CN117196615A true CN117196615A (en) 2023-12-08

Family

ID=88998402

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210598395.4A Pending CN117196615A (en) 2022-05-30 2022-05-30 Cross-blockchain transaction method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN117196615A (en)

Similar Documents

Publication Publication Date Title
CN110597925B (en) Cross-chain data processing method and device based on block chain
CN111901121B (en) Cross-blockchain authentication method and device and electronic equipment
CN108881187B (en) Cross-link data transmission method and device suitable for permission link scene
US20210150521A1 (en) Blockchain-based privacy transaction and blockchain-based privacy transaction application methods and apparatuses
CN110311790B (en) Method and device for sending authenticable message in cross-link mode
US20190172026A1 (en) Cross blockchain secure transactions
CN107317672A (en) A kind of light weight terminating machine block catenary system
EP3885956A1 (en) Transaction processing method and device
CN110163755B (en) Block chain-based data compression and query method and device and electronic equipment
CN112200569B (en) Digital seal using method and device based on block chain and electronic equipment
CN112613877B (en) Intelligent contract triggering method and device applied to block chain network and related equipment
CN111784128A (en) Asset information processing method and system based on block chain
WO2022206433A1 (en) Method and apparatus for pre-executing chaincode in fabric blockchain
CN114567643A (en) Cross-block-chain data transfer method, device and related equipment
CN113689216A (en) Cross-chain transaction processing method and device, equipment, storage medium and program product
CN110096511B (en) Data consistency verification method, device, equipment and medium based on private chain
WO2022206439A1 (en) Method and apparatus for providing cross-chain message
US20230259930A1 (en) Cross-chain transaction processing method and apparatus, electronic device, and storage medium
CN112950180A (en) Community certificate method and system based on alliance chain, electronic device and storage medium
CN112291321A (en) Service processing method, device and system
KR20210109767A (en) A method for providing asset backup services based on blockchain monitoring
CN117196615A (en) Cross-blockchain transaction method, device, equipment and storage medium
CN112163917A (en) Bill processing method, device, medium and electronic equipment based on block chain
CN117993911B (en) Block chain-based offline payment method, system and computer equipment
US20240104557A1 (en) Method for transmitting specific data whose data format is unknown at relay from first blockchain network to second blockchain network and relay using the same

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