Detailed Description
In the following description, for purposes of explanation and not limitation, specific details are set forth, such as particular system structures, techniques, etc. in order to provide a thorough understanding of the embodiments of the present application. It will be apparent, however, to one skilled in the art that the present application may be practiced in other embodiments that depart from these specific details. In other instances, detailed descriptions of well-known systems, devices, circuits, and methods are omitted so as not to obscure the description of the present application with unnecessary detail.
It will be understood that the terms "comprises" and/or "comprising," when used in this specification and the appended claims, 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 should also be understood that the term "and/or" as used in this specification and the appended claims refers to and includes any and all possible combinations of one or more of the associated listed items.
As used in this specification and the appended claims, the term "if" may be interpreted contextually as "when", "upon" or "in response to" determining "or" in response to detecting ". Similarly, the phrase "if it is determined" or "if a [ described condition or event ] is detected" may be interpreted contextually to mean "upon determining" or "in response to determining" or "upon detecting [ described condition or event ]" or "in response to detecting [ described condition or event ]".
Furthermore, in the description of the present application and the appended claims, the terms "first," "second," "third," and the like are used for distinguishing between descriptions and not necessarily for describing or implying relative importance.
Reference throughout this specification to "one embodiment" or "some embodiments," or the like, means that a particular feature, structure, or characteristic described in connection with the embodiment is included in one or more embodiments of the present application. Thus, appearances of the phrases "in one embodiment," "in some embodiments," "in other embodiments," or the like, in various places throughout this specification are not necessarily all referring to the same embodiment, but rather "one or more but not all embodiments" unless specifically stated otherwise. The terms "comprising," "including," "having," and variations thereof mean "including, but not limited to," unless expressly specified otherwise.
The embodiment of the present application provides a multi-node chain crossing method applied to a blockchain all-in-one machine, where the blockchain all-in-one machine may be a palm computer, a desktop computer, a notebook computer, an ultra-mobile personal computer (UMPC), a netbook, a cloud server, a Personal Digital Assistant (PDA), and other devices, and the specific type of the blockchain all-in-one machine is not limited in this embodiment of the present application.
It should be understood that, the sequence numbers of the steps in the foregoing embodiments do not imply an execution sequence, and the execution sequence of each process should be determined by its function and inherent logic, and should not constitute any limitation to the implementation process of the embodiments of the present application.
In order to explain the technical means of the present application, the following description will be given by way of specific examples.
Referring to fig. 1, which is a schematic flowchart of a chain crossing method applied to multiple nodes in a blockchain all-in-one machine according to an embodiment of the present disclosure, where the blockchain all-in-one machine includes N blockchain nodes, where a blockchain network currently accessed by each blockchain node in the N blockchain nodes is different, N is an integer greater than 1, and as shown in fig. 1, the chain crossing method may include the following steps:
step S101, the initiating chain node acquires a cross-chain transaction request.
Each block chain link point in the N block chain nodes monitors a currently accessed block chain network to find a cross-chain transaction request, the block chain link point monitored from the N block chain nodes to the cross-chain transaction request is used as an initiating chain node, namely the initiating chain node is one of the N block chain nodes, the currently accessed block chain network of the initiating chain link point is a source chain, and the cross-chain transaction request is initiated by one node of the source chain, namely the source node.
After initiating the cross-chain transaction request, the source node broadcasts the cross-chain transaction to all blockchain nodes of the source chain, so that the blockchain link points of the source chain in the blockchain all-in-one machine can monitor the cross-chain transaction request. The cross-chain transaction request comprises initiation chain information, destination chain information and transaction data, wherein the initiation chain information comprises an initiation chain Identity (ID), the destination chain information comprises a destination chain ID, and the transaction data comprises a transaction signature, a transaction structure and the like.
And when the initiating chain node of the block chain all-in-one machine acquires the cross-chain transaction request, the target chain is not the block chain network where the initiating chain node is located. The initiating chain and the destination chain may be homogeneous or heterogeneous blockchain networks, the homogeneous blockchain network may refer to that the initiating chain and the destination chain are both Fabric blockchains, Hyperchain blockchains or BCOS blockchains in a federation chain, and the heterogeneous blockchain network may refer to that the initiating chain is a Fabric blockchain and the destination chain is not a Fabric blockchain.
Optionally, after the initiating link node obtains the cross-link transaction request, the cross-link method further includes:
initiating a chain node to call a cross-chain intelligent contract to verify a cross-chain transaction request;
detecting whether a destination chain in the destination chain information is one of the block chain networks to which the N block chain link points are currently accessed specifically is:
and when the result of the cross-chain transaction request is verified to be passed, detecting whether the destination chain in the destination chain information is one of the block chain networks to which the N block chain link points are currently accessed.
The cross-chain intelligent contract is an intelligent contract file which is configured in advance and stored in the block chain node, and the cross-chain intelligent contract is used for verifying the transaction which passes through the cross-chain of the initiating chain node, including but not limited to verification of information such as initiating chain ID, destination chain ID, signature and the like. If the verification is not passed, the initiating chain node does not execute the cross-chain action.
Optionally, the initiating link node invoking the cross-link intelligent contract to verify the cross-link transaction request includes:
extracting an initiating chain ID in the initiating chain information, a target chain ID in the target chain information and a signature of transaction data;
detecting whether signatures of an initiating chain ID, a target chain ID and transaction data are all legal or not according to a cross-chain intelligent contract stored in an initiating chain node;
and if the initiating chain ID, the destination chain ID and the signature of the transaction data are legal, the verification is passed.
The initiating chain node extracts the initiating chain ID, the destination chain ID and the signature of the transaction data from the cross-chain transaction request, acquires a corresponding certificate from a source chain through a cross-chain intelligent contract, and is used for detecting the legality of the initiating chain ID, the destination chain ID and the signature of the transaction data, and when the initiating chain ID, the destination chain ID and the signature of the transaction data are legal, the verification is passed.
Step S102, detecting whether the destination chain in the destination chain information is one of the block chain networks to which the N block chain link points are currently accessed.
The cross-link transaction request is data interaction between an initiating link and a destination link, and the cross-link transaction is carried out in the blockchain all-in-one machine, wherein one blockchain node participating in the initiating link and one blockchain node participating in the destination link are two blockchain nodes in the blockchain all-in-one machine.
The method comprises the steps that N block chain link points are arranged in a block chain all-in-one machine, a block chain ID corresponding to a block chain network to which each block chain link point in the N block chain nodes is currently connected is recorded, whether a target chain is one of the block chain networks to which the N block chain link points are currently connected is detected, the target chain ID can be compared with the recorded block chain ID, if the target chain ID is one of the recorded block chain IDs, cross-chain transaction can be conducted in the block chain all-in-one machine, and if the target chain ID does not belong to one of the recorded block chain IDs, the cross-chain transaction cannot be conducted in the block chain all-in-one machine.
Step S103, if the target chain in the target chain information is detected to be one of the block chain networks to which the N block chain nodes are currently accessed, determining the target chain node, and establishing a chain crossing channel between the initiating chain node and the target chain node in a trusted execution computing environment.
If the target chain in the target chain information is detected to be one of the block chain networks to which the N block chain link points are currently accessed, the block chain link point of the target chain in the block chain all-in-one machine can be determined according to the target chain, and the block chain link point is the target chain node.
The Trusted Execution Environment (TEE) may be a secure area within a Central Processing Unit (CPU) of a blockchain all-in-one machine. The TEE runs in a separate environment and in parallel with the operating system. TEE requires that the blockchain kiosk be configured with corresponding software and hardware to enable the blockchain kiosk to provide a trusted execution environment.
In the TEE, communication between the initiating link node and the destination link node is established, so that the initiating link node can reliably send transaction data and the like to the destination link node.
Optionally, in the trusted execution computing environment, establishing a cross-link channel between the initiating link node and the destination link node includes:
establishing a cross-chain transaction with a unique identifier in the trusted execution computing environment according to the cross-chain transaction request;
and running a cross-chain transaction, and butting the data of the initiating chain node and the target chain node.
The inter-chain channel may refer to the operation of a transaction running in the TEE, that is, the operation of an inter-chain transaction, where the inter-chain transaction has atomicity, and one inter-chain transaction request corresponds to one inter-chain transaction with a unique identifier. The data of the initiating chain node and the target chain node can be butted by operating the cross-chain transaction, and the data structure of the cross-chain transaction is as follows:
Struct
{ slotID; a slot identification ID;
srcchaiin ID, initiating chain ID;
DstchainID, destination chain ID;
tx data, transaction data;
ExcResult, results of cross-chain execution;
sig, cross-chain request initiator signature;
}。
the slot identification ID is the unique identification of the cross-chain transaction, and the initiating chain ID, the destination chain ID, the transaction data, the cross-chain execution result and the cross-chain request initiator (source node) are signed as the interactive data in the cross-chain transaction.
Cross-chain service (CCS) is built in the block chain all-in-one machine, the CCS provides monitoring service and is responsible for collecting cross-chain service requests from the nodes of the block chain all-in-one machine, after the cross-chain transaction requests are verified by the initiating chain node, the CCS sends the cross-chain service requests to the CCS, and the CCS establishes a cross-chain channel based on TEE according to the cross-chain service requests.
And step S104, sending the transaction data to the destination chain node through the chain crossing channel.
After the data of the initiating chain link point and the target chain node are in butt joint, the information of transaction data and the like in the cross-chain transaction request can be sent to the target chain node, and after the target chain link point receives the information in the cross-chain transaction request, the transaction is executed, so that the cross-chain transaction is completed. The destination chain node can also feed back the execution result of the transaction to the initiating chain node through the cross-chain channel, and further informs the initiating chain.
The block chain all-in-one machine is provided with N block chain nodes, after a block chain link point acquires a cross chain transaction request, a target chain in the cross chain transaction request is detected to be one of block chain networks to which the N block chain link points are currently accessed, and then the target chain node of the target chain of the cross chain transaction request in the block chain all-in-one machine is determined, a cross chain channel between an initiating chain link point and the target chain node is established in a trusted execution computing environment, and cross chain interaction is carried out through the cross chain channel, so that cross chain transaction between the two block chain nodes in the block chain all-in-one machine is realized, data of the cross chain transaction in the trusted execution environment cannot be stolen, and the safety of the cross chain transaction is guaranteed.
Referring to fig. 2, it is a schematic flowchart of a chain crossing method applied to multiple nodes in a blockchain all-in-one machine according to a second embodiment of the present disclosure, where the chain crossing method may be used in a blockchain all-in-one machine, as shown in fig. 2, the chain crossing method may include the following steps:
step S201, the initiating link node acquires a cross-link transaction request.
Step S202, detecting whether the destination chain in the destination chain information is one of the block chain networks to which the N block chain link points are currently accessed.
Step S203, if it is detected that the destination chain in the destination chain information is one of the block chain networks to which the N block chain nodes are currently accessed, determining a destination chain node, and establishing a chain crossing channel between the initiating chain node and the destination chain node in the trusted execution computing environment.
The contents of steps S201 to S203 are the same as those of steps S101 to S103, and reference may be made to the description of steps S101 to S103, which is not repeated herein.
In step S204, the destination chain ID in the destination chain information is extracted.
The target chain information is data in the cross-chain transaction request, data analysis is carried out on the cross-chain transaction request, the target chain information is extracted, and then the target chain ID can be determined. The destination chain ID is unique identification information of the destination chain, and data corresponding to the destination chain can be determined by the destination chain ID.
And step S205, determining a transaction data interface of the destination chain according to the destination chain ID.
The blockchain all-in-one machine is provided with a transaction data interface corresponding to the destination chain, certainly, the blockchain all-in-one machine can also be provided with transaction data interfaces of other blockchain networks, and a specific transaction data interface can be selected through a blockchain ID.
The transaction data Interface may refer to an Application Programming Interface (API) set in the smart contract, and may be used to perform operations such as converting and packaging transaction data.
And step S206, converting the cross-chain transaction request into a destination chain transaction request according to the transaction data interface of the destination chain.
The conversion of the cross-chain transaction request into the destination chain transaction request may refer to conversion of a transaction in the cross-chain transaction request into a transaction structure that can be identified by a destination chain, and the destination chain transaction request may further retain content such as initiating chain information, destination chain information, a signature and the like in the cross-chain transaction request, that is, the destination chain transaction request is a transaction structure identified for the destination chain.
If a plurality of transaction data interfaces of the blockchain network are built in the blockchain all-in-one machine, the adaptation and docking difficulty of intelligent contracts during chain crossing of the nodes of the isomorphic blockchain network and the nodes of the heterogeneous blockchain network can be reduced, and the blockchain all-in-one machine has better adaptation. For example, the blockchain network may refer to a fabric blockchain, a hyperchain blockchain, an Etherum blockchain, and the like.
And step S207, transmitting the destination chain transaction request to the destination chain node through the chain crossing channel.
The destination chain transaction request is obtained by converting transaction data, and the specific process of sending data in step S207 is the same as that in step S104, and reference may be made to the description in step S104, which is not described herein again.
Optionally, after the destination chain transaction request is sent to the destination chain node through the chain crossing channel, the chain crossing method further includes:
after receiving the destination chain transaction request, the destination chain node calls a destination chain intelligent contract to verify the destination chain transaction request;
and if the verification is passed, the destination chain node executes corresponding operation based on the destination chain transaction request.
The target chain intelligent contract can be an intelligent contract running on a target chain, and the target chain intelligent contract can be obtained after the target chain link point is connected with the target chain.
The target chain transaction request is verified through the target chain intelligent contract, whether a transaction signature, an initiating chain ID and a target chain ID in the target chain transaction request are legal or not can be verified, the transaction is executed after the target chain transaction request is verified, and illegal transactions are avoided.
Optionally, after performing the corresponding operation based on the destination chain transaction request, the cross-chain method further includes:
the target link node acquires an execution result;
and the target link node feeds back an execution result to the initiating link node through the cross-link channel.
The step of executing the destination chain transaction request by the destination chain node may be to broadcast data in the destination chain transaction request to all intra-chain nodes of the destination chain, and after all intra-chain nodes receive the transaction data information sent by the all-in-one machine device, according to a consensus algorithm of the destination chain, after achieving consensus on the operation, confirm that the transaction data information is valid and write the transaction data information into the account book. The destination node of the destination chain finds that the destination node address of the transaction data information is matched with the address of the destination node through analyzing the data packet, then other specific contents of the data packet are continuously analyzed, corresponding transaction operation is completed, a transaction completion message is sent and broadcasted to the destination chain node, and the transaction completion message is fed back to the initiating chain node through the cross-chain channel.
The steps are operated in the blockchain all-in-one machine, and specifically, the steps include that a CCS, an initiating chain node and a target chain link point in the blockchain all-in-one machine are respectively and correspondingly executed, the CCS executes steps of cross-chain channel establishment, transmission and the like, the initiating chain node executes steps of monitoring cross-chain transaction requests, verification and the like, and the target chain node executes steps of acquiring, verifying transactions, feeding back transaction results and the like.
The transaction data interface of the built-in destination chain in the blockchain all-in-one machine is determined through analysis of destination chain information in the cross-chain transaction request, the transaction can be converted into a transaction structure which can be identified by the destination chain, cross-chain between two blockchain nodes is facilitated, in addition, the transaction data interface of the built-in multiple blockchain networks can reduce the adaptation butt joint difficulty of intelligent contracts when cross-chain is carried out on the nodes of the isomorphic blockchain networks and the nodes of the heterogeneous blockchain networks, and the blockchain all-in-one machine has better adaptability.
Corresponding to the chain crossing method applied to multiple nodes in a blockchain all-in-one machine of the above embodiments, fig. 3 shows a structural block diagram of a chain crossing device applied to multiple nodes in a blockchain all-in-one machine provided in the third embodiment of the present application, where the blockchain all-in-one machine includes N blockchain nodes, a blockchain network currently accessed by each blockchain node in the N blockchain nodes is different, N is an integer greater than 1, and for convenience of description, only the parts related to the embodiment of the present application are shown.
Referring to fig. 3, the chain spanning apparatus includes:
a cross-chain request obtaining module 31, configured to initiate a chain node to obtain a cross-chain transaction request, where the initiating chain node is one of the N block chain nodes, and the cross-chain transaction request includes initiating chain information, destination chain information, and transaction data;
a detecting module 32, configured to detect whether a destination chain in the destination chain information is one of the block chain networks to which the N block chain link points are currently accessed;
a channel establishing module 33, configured to determine a destination link node if it is detected that a destination link in the destination link information is one of the blockchain networks to which the N blockchain link points are currently accessed, and establish a cross-link channel between the initiating link node and the destination link node in a trusted execution computing environment;
and the transaction sending module 34 is used for sending the transaction data to the destination chain link point through the chain crossing channel.
Optionally, the chain spanning device further includes:
the initiating chain verification module is used for calling a cross-chain intelligent contract to verify the cross-chain transaction request by the initiating chain node after the initiating chain node acquires the cross-chain transaction request;
the detection module 32 is specifically configured to: and when the result of the cross-chain transaction request is verified to be passed, detecting whether the destination chain in the destination chain information is one of the block chain networks to which the N block chain link points are currently accessed.
Optionally, the origination chain verification module is specifically configured to:
acquiring an initiating chain ID in the initiating chain information, a target chain ID in the target chain information and a signature of transaction data;
detecting whether signatures of an initiating chain ID, a target chain ID and transaction data are all legal or not according to a cross-chain intelligent contract stored in an initiating chain node;
and if the initiating chain ID, the destination chain ID and the signature of the transaction data are legal, the verification is passed.
Optionally, the chain spanning device further includes:
the extraction module is used for extracting a destination chain ID in destination chain information after a chain-crossing channel between an initiating chain node and a destination chain node is established in a trusted execution computing environment;
the interface determining module is used for determining a transaction data interface of the destination chain according to the destination chain ID;
the conversion module is used for converting the cross-chain transaction request into a destination chain transaction request according to a transaction data interface of a destination chain, wherein the destination chain transaction request is a transaction structure identified aiming at the destination chain;
accordingly, the transaction sending module 34 is specifically configured to:
and transmitting the destination chain transaction request to the destination chain node through the chain crossing channel.
Optionally, the chain spanning device further includes:
the destination chain verification module is used for calling a destination chain intelligent contract to verify a destination chain transaction request after the destination chain node receives the destination chain transaction request after the destination chain transaction request is sent to the destination chain node through the cross-chain channel;
and the execution module is used for executing corresponding operation by the destination link node based on the destination link transaction request if the verification is passed.
Optionally, the chain spanning device further includes:
the execution result acquisition module is used for acquiring an execution result by the destination chain node after executing corresponding operation based on the destination chain transaction request;
and the feedback module is used for feeding back the execution result to the initiating link node by the destination link node through the cross link channel.
Optionally, the channel establishing module 33 includes:
the transaction establishing unit is used for establishing a cross-chain transaction with a unique identifier in the trusted execution computing environment according to the cross-chain transaction request;
and the transaction operation unit is used for operating the cross-chain transaction and butting the data of the initiating chain node and the target chain node.
It should be noted that, because the contents of information interaction, execution process, and the like between the modules are based on the same concept as that of the embodiment of the method of the present application, specific functions and technical effects thereof may be specifically referred to a part of the embodiment of the method, and details are not described here.
Fig. 4 is a schematic structural diagram of a block chain all-in-one machine according to a fourth embodiment of the present application. As shown in fig. 4, the blockchain integrator 4 of this embodiment includes: at least one processor 40 (only one shown in fig. 4), a memory 41, and a computer program 42 stored in the memory 41 and executable on the at least one processor 40, the processor 40 when executing the computer program 42 implementing the steps in any of the various cross-link method embodiments described above as applied to multiple nodes within a blockchain integrator.
The blockchain integrator may include, but is not limited to, a processor 40, a memory 41. Those skilled in the art will appreciate that fig. 4 is merely an example of a blockchain kiosk 4, and does not constitute a limitation on blockchain kiosk 4, and may include more or fewer components than shown, or some components in combination, or different components, such as input output devices, network access devices, etc.
The Processor 40 may be a CPU, and the Processor 40 may also be other general purpose processors, Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), Field-Programmable Gate arrays (FPGAs) or other Programmable logic devices, discrete Gate or transistor logic devices, discrete hardware components, etc. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The memory 41 may be an internal storage unit of the blockchain kiosk 4 in some embodiments, such as a hard disk or memory of the blockchain kiosk 4. Memory 41 may also be an external storage device of blockchain all-in-one 4 in other embodiments, such as a plug-in hard disk provided on blockchain all-in-one 4, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), and so forth. Further, the memory 41 may also include both an internal storage unit of the blockchain integrator 4 and an external storage device. The memory 41 is used for storing an operating system, an application program, a BootLoader (BootLoader), data, and other programs, such as program codes of a computer program. The memory 41 may also be used to temporarily store data that has been output or is to be output.
It will be apparent to those skilled in the art that, for convenience and brevity of description, only the above-mentioned division of the functional units and modules is illustrated, and in practical applications, the above-mentioned function distribution may be performed by different functional units and modules according to needs, that is, the internal structure of the apparatus is divided into different functional units or modules, so as to perform all or part of the functions described above. Each functional unit and module in the embodiments may be integrated in one processing unit, or each unit may exist alone physically, or two or more units are integrated in one unit, and the integrated unit may be implemented in a form of hardware, or in a form of software functional unit. In addition, specific names of the functional units and modules are only for convenience of distinguishing from each other, and are not used for limiting the protection scope of the present application. The specific working processes of the units and modules in the above-mentioned apparatus may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again. The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, all or part of the flow of the method of the embodiments described above can be implemented by a computer program, which can be stored in a computer readable storage medium and can implement the steps of the embodiments of the methods described above when the computer program is executed by a processor. Wherein the computer program comprises computer program code, which may be in the form of source code, object code, an executable file or some intermediate form, etc. The computer readable medium may include at least: any entity or device capable of carrying computer program code, recording medium, computer Memory, Read-Only Memory (ROM), Random Access Memory (RAM), electrical carrier wave signals, telecommunications signals, and software distribution media. Such as a usb-disk, a removable hard disk, a magnetic or optical disk, etc. In certain jurisdictions, computer-readable media may not be an electrical carrier signal or a telecommunications signal in accordance with legislative and patent practice.
When the computer program product runs on the blockchain all-in-one machine, the steps in the method embodiments can be realized when the blockchain all-in-one machine is executed.
In the above embodiments, the descriptions of the respective embodiments have respective emphasis, and reference may be made to the related descriptions of other embodiments for parts that are not described or illustrated in a certain embodiment.
Those of ordinary skill in the art will appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus/blockchain integrator and method may be implemented in other ways. For example, the above-described embodiments of the apparatus/blockchain integrator are merely illustrative, and for example, a module or a unit may be divided into only one logical function, and may be implemented in other ways, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
Units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
The above embodiments are only used to illustrate the technical solutions of the present application, and not to limit the same; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; such modifications and substitutions do not substantially depart from the spirit and scope of the embodiments of the present application and are intended to be included within the scope of the present application.