Cross-chain interaction method and device

By generating and executing consensus blockchain transactions in the destination blockchain network, the problem of inconsistent results in cross-chain interactions is solved, and unified results are achieved after each node processes the source blockchain network messages.

CN113923228BActive Publication Date: 2024-08-27ANT BLOCKCHAIN TECHNOLOGY (SHANGHAI) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202111406523.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-06-02
Publication Date
2024-08-27
Estimated Expiration
2041-06-02

AI Technical Summary

Technical Problem

In the process of cross-chain interaction between blockchain networks, how to ensure that each node in the destination blockchain network obtains consistent processing results after processing cross-chain messages sent by the source blockchain network is an urgent problem that needs to be solved.

Method used

Each destination node in the destination blockchain network obtains cross-chain messages in the source blockchain network, generates blockchain transactions and submits consensus, and executes the same blockchain transaction that passes the consensus to ensure that all nodes process The results are consistent.

Benefits of technology

It achieves the consistency of the results of each node during the cross-chain interaction process and ensures unified processing results after processing cross-chain messages sent by the source blockchain network.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113923228B
    Figure CN113923228B
Patent Text Reader

Abstract

One or more embodiments of this specification provide a cross-chain interaction method and device. The method includes: each destination node in the destination blockchain network respectively obtains a cross-chain message sent by at least one source node in the source blockchain network to the destination blockchain network; each destination node generates a blockchain transaction according to the cross-chain message obtained by itself, and submits the generated blockchain transaction to the destination blockchain network; each destination node executes the same blockchain transaction among multiple blockchain transactions that have passed consensus.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] One or more embodiments of this specification relate to the field of blockchain technology, and in particular, to a cross-chain interaction method and device. Background Art

[0002] Blockchain technology is built on top of a transmission network (e.g., a peer-to-peer network). Nodes in a blockchain network use a chain data structure to verify and store data, and a distributed node consensus algorithm to generate and update data. In some blockchain networks, some nodes sometimes need to implement small-scale transactions to prevent other nodes from obtaining these transactions and related data. Therefore, a blockchain subnet can be further established based on the blockchain mainnet.

[0003] However, there may be cross-chain interaction requirements between different blockchain networks, so that nodes in the source blockchain network can initiate interaction requests to the destination blockchain network, such as sending cross-chain messages. However, because different nodes in the destination blockchain network may receive multiple cross-chain messages initiated by different nodes in the source blockchain network, how to ensure that each node in the destination blockchain network obtains consistent processing results after processing the cross-chain messages sent by the source blockchain network is an urgent problem to be solved in the cross-chain interaction process. Summary of the invention

[0004] In view of this, one or more embodiments of the present specification provide a cross-chain interaction method and device.

[0005] To achieve the above objectives, one or more embodiments of this specification provide the following technical solutions:

[0006] According to a first aspect of one or more embodiments of this specification, a cross-chain interaction method is proposed, including:

[0007] Each destination node in the destination blockchain network respectively obtains a cross-chain message sent to the destination blockchain network by at least one source node in the source blockchain network;

[0008] Each destination node generates a blockchain transaction according to the cross-chain message obtained by itself, and submits the generated blockchain transaction to the destination blockchain network;

[0009] Each destination node executes the same blockchain transaction among multiple blockchain transactions that have passed consensus.

[0010] According to a second aspect of one or more embodiments of this specification, a cross-chain interaction device is proposed, including:

[0011] A message receiving unit enables each destination node in the destination blockchain network to respectively obtain a cross-chain message sent by at least one source node in the source blockchain network to the destination blockchain network;

[0012] The transaction consensus unit enables each destination node to generate a blockchain transaction according to the cross-chain message obtained by itself, and submit the generated blockchain transaction to the destination blockchain network respectively;

[0013] The transaction execution unit enables each destination node to respectively execute the same blockchain transaction among multiple blockchain transactions that have passed consensus.

[0014] According to a third aspect of one or more embodiments of this specification, an electronic device is provided, including:

[0015] processor;

[0016] a memory for storing processor-executable instructions;

[0017] The processor implements the method as described in any one of the first aspects by running the executable instructions.

[0018] According to a fourth aspect of one or more embodiments of the present specification, a computer-readable storage medium is provided, on which computer instructions are stored, and when the instructions are executed by a processor, the steps of the method described in any one of the first aspects are implemented.

[0019] Through the above embodiment, after each destination node in the destination blockchain network obtains the cross-chain message generated by the source node in the source blockchain network, it generates a blockchain transaction according to the cross-chain message it obtains and submits the consensus, and then each destination node executes the same blockchain transaction. Because the cross-chain messages obtained by each destination node are all from the source blockchain network, the blockchain transactions generated by each node according to the cross-chain messages it obtains can contain the same blockchain message, and then each node can obtain the same execution result after executing the same blockchain transaction through consensus, so that each destination node can obtain a consistent processing result after processing the cross-chain message sent by the source blockchain network. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] Figure 1 It is a schematic diagram of creating a smart contract provided by an exemplary embodiment.

[0021] Figure 2 This is a schematic diagram of calling a smart contract provided by an exemplary embodiment.

[0022] Figure 3 It is a schematic diagram of creating and calling a smart contract provided by an exemplary embodiment.

[0023] Figure 4 This is a schematic diagram of establishing a blockchain subnet based on a blockchain mainnet, provided by an exemplary embodiment.

[0024] Figure 5 It is a schematic diagram of a cross-chain interaction method provided by an exemplary embodiment.

[0025] Figure 6 It is a flowchart of a cross-chain interaction method provided by an exemplary embodiment.

[0026] Figure 7 It is a structural schematic diagram of a device provided by an exemplary embodiment.

[0027] Figure 8 It is a block diagram of a cross-chain interaction device provided by an exemplary embodiment. DETAILED DESCRIPTION

[0028] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with one or more embodiments of this specification. Instead, they are merely examples of devices and methods consistent with some aspects of one or more embodiments of this specification as detailed in the appended claims.

[0029] It should be noted that: in other embodiments, the steps of the corresponding method are not necessarily performed in the order shown and described in this specification. In some other embodiments, the steps included in the method may be more or less than those described in this specification. In addition, a single step described in this specification may be decomposed into multiple steps for description in other embodiments; and multiple steps described in this specification may be combined into a single step for description in other embodiments.

[0030] Blockchain is generally divided into three types: public blockchain, private blockchain and consortium blockchain. In addition, there are many types of combinations, such as private blockchain + consortium blockchain, consortium blockchain + public blockchain and other different combinations. Among them, the public chain has the highest degree of decentralization. Public chains are represented by Bitcoin and Ethereum. Participants who join the public chain can read data records on the chain, participate in transactions, and compete for the right to record new blocks. Moreover, each participant (i.e., node) can freely join and exit the network and perform related operations. On the contrary, the private chain has the write permission of the network controlled by a certain organization or institution, and the data reading permission is stipulated by the organization. In simple terms, the private chain can be a weakly centralized system with strictly limited and few participating nodes. This type of blockchain is more suitable for use within a specific organization. The consortium chain is a blockchain between the public chain and the private chain, which can achieve "partial decentralization". Each node in the consortium chain usually has a corresponding entity or organization; participants join the network through authorization and form a stakeholder alliance to jointly maintain the operation of the blockchain.

[0031] Whether it is a public chain, a private chain or a consortium chain, it may provide the function of smart contracts. Smart contracts on the blockchain are contracts that can be triggered and executed by transactions on the blockchain system. Smart contracts can be defined in the form of code.

[0032] Taking Ethereum as an example, supporting users to create and call some complex logic in the Ethereum network is the biggest challenge that distinguishes Ethereum from Bitcoin blockchain technology. The core of Ethereum as a programmable blockchain is the Ethereum Virtual Machine (EVM), and each Ethereum node can run EVM. EVM is a Turing-complete virtual machine, which means that various complex logics can be implemented through it. Users publish and call smart contracts in Ethereum on EVM. In fact, the virtual machine directly runs the virtual machine code (virtual machine bytecode, hereinafter referred to as "bytecode"). Smart contracts deployed on the blockchain can be in the form of bytecode.

[0033] For example Figure 1 As shown in the figure, after Bob sends a transaction containing information about creating a smart contract to the Ethereum network, the EVM of node 1 can execute this transaction and generate the corresponding contract instance. Figure 1The "0x6f8ae93..." in the transaction represents the address of this contract. The data field of the transaction can store bytecode, and the to field of the transaction is empty. After the nodes reach an agreement through the consensus mechanism, the contract is successfully created and can be called in the subsequent process. After the contract is created, a contract account corresponding to the smart contract appears on the blockchain and has a specific address. The contract code will be saved in the contract account. The behavior of the smart contract is controlled by the contract code. In other words, the smart contract generates a virtual account on the blockchain that contains the contract code and account storage.

[0034] like Figure 2 As shown in the figure, still taking Ethereum as an example, after Bob sends a transaction for calling a smart contract to the Ethereum network, the EVM of a certain node can execute this transaction and generate a corresponding contract instance. Figure 2 The from field of the transaction is the address of the account of the transaction initiator (i.e. Bob), the "0x6f8ae93..." in the to field represents the address of the smart contract being called, the value field is the value of ether in Ethereum, and the data field of the transaction stores the method and parameters of calling the smart contract. After calling the smart contract, the value of balance may change. Later, a client can use a blockchain node (such as Figure 2 Node 6) in the blockchain network to check the current value of balance. Smart contracts are executed independently on each node in the blockchain network in a prescribed manner, and all execution records and data are stored on the blockchain. Therefore, when the transaction is completed, the blockchain stores transaction credentials that cannot be tampered with or lost.

[0035] The schematic diagram of creating and calling smart contracts is as follows: Figure 3 To create a smart contract in Ethereum, you need to go through the process of writing the smart contract, compiling it into bytecode, and deploying it to the blockchain. To call a smart contract in Ethereum is to initiate a transaction pointing to the smart contract address. The smart contract code runs in a distributed manner in the virtual machines of each node in the Ethereum network.

[0036] It should be noted that in addition to being able to be created by users, smart contracts can also be set by the system in the genesis block. This type of contract is generally called a genesis contract. Generally, some blockchain network data structures, parameters, properties, and methods can be set in the genesis contract. In addition, accounts with system administrator privileges can create system-level contracts or modify system-level contracts (referred to as system contracts). In addition to the EVM in Ethereum, different blockchain networks may also use various virtual machines, which are not limited here.

[0037] After executing a transaction that calls a smart contract, a node in the blockchain network will generate a corresponding receipt to record information related to the execution of the smart contract. In this way, you can query the transaction receipt to obtain relevant information about the contract execution result. The contract execution result can be expressed as an event in the receipt. The message mechanism can realize message transmission through the event in the receipt to trigger the blockchain node to perform corresponding processing. The structure of the event can be, for example:

[0038] Event:

[0039] [topic][data]

[0040] [topic][data] ......

[0042] In the above example, the number of events can be one or more, wherein each event includes fields such as topic and data. The blockchain node can monitor the topic of the event, and when a predefined topic is monitored, perform a preset process, or read relevant content from the data field of the corresponding event, and perform a preset process based on the read content.

[0043] In the above event mechanism, it is equivalent to having a client with a monitoring function at the listening party (such as a user with a monitoring demand), such as running an SDK for implementing the monitoring function on the client, and the client monitors the events generated by the blockchain node, and the blockchain node only needs to generate receipts normally. In addition to the above event mechanism, the disclosure of transaction information can also be achieved in other ways. For example, the listening code can be embedded in the blockchain platform code running on the blockchain node, so that the listening code can monitor one or more data such as the transaction content of the blockchain transaction, the contract status of the smart contract, and the receipt generated by the contract, and send the monitored data to the predefined listening party. Since the listening code is deployed in the blockchain platform code, rather than at the client of the listening party, this implementation method based on the listening code is relatively more active than the event mechanism. Among them, the above listening code can be added to the blockchain platform code by the developers of the blockchain platform during the development process, or it can be embedded by the listening party based on its own needs, and this specification does not limit this.

[0044] One of the decentralized features that distinguishes blockchain technology from traditional technologies is that it records accounts on each node, or distributed accounting, rather than traditional centralized accounting. In order for a blockchain system to become a decentralized, honest and trustworthy system that is difficult to break, public, and cannot be tampered with, it is necessary to make distributed data records secure, clear, and irreversible in the shortest possible time. In different types of blockchain networks, in order to maintain the consistency of the ledgers in each node that records the ledger, a consensus algorithm is usually used to ensure that it is the consensus mechanism mentioned above. For example, a consensus mechanism of block granularity can be implemented between blockchain nodes. For example, after a node (such as a unique node) generates a block, if the generated block is recognized by other nodes, other nodes record the same block. For another example, a consensus mechanism of transaction granularity can be implemented between blockchain nodes. For example, after a node (such as a unique node) obtains a blockchain transaction, if the blockchain transaction is recognized by other nodes, each node that recognizes the blockchain transaction can add the blockchain transaction to the latest block maintained by itself, and ultimately ensure that each node generates the same latest block. The consensus mechanism is a mechanism for blockchain nodes to reach a consensus on block information (or block data) across the entire network, which can ensure that the latest block is accurately added to the blockchain. The current mainstream consensus mechanisms include: Proof of Work (POW), Proof of Stake (POS), Delegated Proof of Stake (DPOS), Practical Byzantine Fault Tolerance (PBFT) algorithm, HoneyBadgerBFT algorithm, etc.

[0045] Due to the decentralized nature of the blockchain network, all blockchain nodes in the blockchain network will maintain the same block data, which cannot meet the special needs of some nodes. Taking the alliance chain as an example, all alliance members (i.e., node members within the alliance) can form a blockchain network. All alliance members have corresponding blockchain nodes in the blockchain network, and can obtain all transactions and related data occurring on the blockchain network through the corresponding blockchain nodes. However, in some cases, some alliance members may want to complete some transactions with confidentiality requirements. These alliance members hope that these transactions can be stored on the blockchain or with the help of other advantages of blockchain technology, and can avoid other alliance members from viewing these transactions and related data. Although these alliance members can form a new blockchain network in addition, the establishment method is similar to the above-mentioned blockchain network containing all alliance members, but it takes a lot of resources to establish a new blockchain network from scratch, and both the establishment process of the blockchain network and the configuration process after it is established are very time-consuming. The needs between alliance members are often temporary or have a certain timeliness, so that the newly established blockchain network will soon lose its meaning of existence due to the disappearance of needs, thereby further increasing the chain construction cost of the above-mentioned blockchain network. The needs of alliance members often change, and the alliance members corresponding to each need are often different. Therefore, whenever the alliance members change, it may be necessary to establish a new blockchain network, resulting in a huge waste of resources and time.

[0046] To this end, the established blockchain network can be used as the blockchain main network, and a blockchain subnet can be established on the basis of the blockchain main network. Then, in the above-mentioned alliance chain scenario, alliance members can establish the required blockchain subnet on the basis of the blockchain main network based on their own needs after participating in the blockchain main network. Since the blockchain subnet is established on the basis of the blockchain main network, the process of establishing the blockchain subnet greatly reduces the resources consumed and the time required compared to establishing a completely independent blockchain network, and is extremely flexible.

[0047] The process of quickly establishing a blockchain subnet based on the blockchain main network is as follows: each main network node in the blockchain main network obtains a transaction for establishing a blockchain subnet, and the transaction contains the configuration information of the blockchain subnet, and the configuration information includes the identity information of the node members. Then, each main network node in the blockchain main network executes the transaction respectively; wherein, when the first main network node belongs to the node member indicated by the configuration information, the node device deploying the first main network node generates a genesis block containing the configuration information based on the transaction and starts the first subnet node belonging to the blockchain subnet.

[0048] The transaction of establishing a blockchain subnet can be initiated by the administrator of the blockchain main network, that is, only the administrator is allowed to establish a blockchain subnet based on the blockchain main network, and avoid opening the establishment authority of the blockchain subnet to ordinary users to prevent security issues caused by this. In some cases, ordinary users of the blockchain main network can also be allowed to initiate the above-mentioned transaction of establishing a blockchain subnet to meet the networking needs of ordinary users, so that ordinary users can still quickly establish a blockchain subnet when it is inconvenient for administrators to initiate transactions.

[0049] by Figure 4 As shown in the example, the blockchain main network is subnet0, and the blockchain nodes contained in subnet0 are nodeA, nodeB, nodeC, nodeD, and nodeE. Assume that nodeA, nodeB, nodeC, and nodeD want to form a blockchain subnet: if nodeA is an administrator and only administrators are allowed to initiate transactions to form blockchain subnets, then nodeA can initiate the above-mentioned transaction to form a blockchain subnet to subnet0; if nodeE is an administrator and only administrators are allowed to initiate transactions to form blockchain subnets, then nodeA~nodeD need to make a request to nodeE so that nodeE initiates the above-mentioned transaction to form a blockchain subnet to subnet0; if nodeE is an administrator but ordinary users are allowed to initiate transactions to form blockchain subnets, then nodeA~nodeE can all initiate the above-mentioned transaction to form a blockchain subnet to subnet0. Of course, whether it is an administrator or an ordinary user, the blockchain node that initiates the transaction to form a blockchain subnet does not necessarily participate in the formed blockchain subnet. For example, although the blockchain subnet is ultimately formed by nodeA, nodeB, nodeC, and nodeD, nodeE can initiate the above-mentioned transaction to form a blockchain subnet to subnet0, and it is not necessarily nodeA~nodeD that initiate the transaction to form a blockchain subnet.

[0050] When a blockchain subnet is established on the basis of the blockchain mainnet, it is easy to understand that there will be a logical hierarchical relationship between the blockchain subnet and the blockchain mainnet. Figure 4 When the blockchain subnet subnet1 is built on subnet0 shown in the figure, it can be considered that subnet0 is in the first layer and subnet1 is in the second layer. Subnet0 is the parent network of subnet1, and subnet1 is the subnet of subnet0. And the blockchain subnet can also build a corresponding blockchain subnet. For example, Figure 4On the basis of subnet1, another blockchain subnet subnet3 is further established. At this time, it can be considered that subnet is in the third layer. Subnet1 is the parent network corresponding to subnet3, subnet3 is the subnet of subnet1, and subnet3 is the grandchild network of subnet0. Similarly, subnet3 can still establish a new blockchain subnet on its basis, so that each blockchain network forms this multi-level tree structure. In this specification, any blockchain network is managed by its corresponding parent network, that is, by the blockchain network that establishes any blockchain network. Therefore, in Figure 4 In this blockchain network tree system, which is composed of the blockchain main network as the root node (the root node has the lowest level) and each blockchain subnet as other nodes, the blockchain subnet represented by any node is managed by the blockchain network corresponding to its parent node. As a special case, when the blockchain main network is the underlying blockchain network, the blockchain main network is managed by the blockchain main network itself. The blockchain main network in this specification can be the underlying blockchain network. The underlying blockchain network refers to a blockchain subnet that is not established on the basis of other blockchain networks. Therefore, there is no other blockchain network other than the blockchain main network that can manage the blockchain main network, such as Figure 4 Subnet0 in the above can be considered as the main blockchain network of the underlying blockchain network type. Subnet0 manages subnet0 itself. Of course, the main blockchain network can also be a subnet of other blockchain networks. This manual does not impose any restrictions on this. The above blockchain network tree system realizes layer-by-layer management by managing the corresponding child nodes through the parent node, reducing the management pressure of the main blockchain network, while avoiding exposing the subnet information of the upper network to the lower network, thereby realizing the secret management of networks at all levels.

[0051] After the transaction for establishing the blockchain subnet is sent to the blockchain main network, the consensus nodes in the blockchain main network will reach a consensus, and after reaching a consensus, each main network node will execute the transaction to complete the establishment of the blockchain subnet. The consensus process depends on the consensus mechanism adopted, such as any of the consensus mechanisms described above, and this specification does not limit this.

[0052] By including configuration information in the transaction of forming a blockchain subnet, the configuration information can be used to configure the formed blockchain subnet so that the formed blockchain subnet meets the networking requirements. For example, by including the identity information of the node members in the configuration information, it is possible to specify which blockchain nodes are included in the formed blockchain subnet.

[0053] The identity information of the node member may include the public key of the node, or other information that can characterize the node identity, such as the node ID, which is not limited in this specification. Taking the public key as an example, each blockchain node has one or more corresponding public-private key pairs. The blockchain node holds the private key, while the public key is public and uniquely corresponds to the private key. Therefore, the identity of the corresponding blockchain node can be characterized by the public key. Therefore, for blockchain nodes that wish to be node members of a blockchain subnet, the public keys of these blockchain nodes can be added to the above-mentioned transaction for forming a blockchain subnet as the identity information of the above-mentioned node members.

[0054] The first main network node can be a blockchain node that is a node member indicated by the configuration information on the blockchain main network. When forming a blockchain subnet, the first main network node does not directly join the blockchain subnet and become its node member, but needs to be generated by the node device used to deploy the first main network node, and the first subnet node becomes a node member in the blockchain subnet. The first main network node and the first subnet node correspond to the same blockchain member, for example, in the alliance chain scenario, they correspond to the same alliance chain member, but the first main network node belongs to the blockchain main network and the first subnet node belongs to the blockchain subnet, so that the blockchain member can participate in the transactions of the blockchain main network and the blockchain subnet respectively; and, since the blockchain main network and the blockchain subnet belong to two independent blockchain networks, the blocks generated by the first main network node and the blocks generated by the first subnet node are respectively stored in different storages on the node devices (the storage used may be, for example, a database), thereby achieving mutual isolation between the storages used by the first main network node and the first subnet node respectively, and thus the data generated by the blockchain subnet will only be synchronized between the node members of the blockchain subnet, so that the blockchain members who only participate in the blockchain main network cannot obtain the data generated on the blockchain subnet, thereby achieving data isolation between the blockchain main network and the blockchain subnet, and meeting the transaction needs between some blockchain members (i.e., blockchain members participating in the blockchain subnet).

[0055] It can be seen that the first main network node and the first subnet node are logically divided blockchain nodes. From the perspective of physical devices, it is equivalent to the node devices that deploy the first main network node and the first subnet node participating in both the blockchain main network and the blockchain subnet. Since the blockchain main network and the blockchain subnet are independent of each other, the identity systems of the two blockchain networks are also independent of each other. Therefore, even if the first main network node and the first subnet node can use exactly the same public key, they should still be regarded as different blockchain nodes. For example, in Figure 4In the example, nodeA in subnet0 is equivalent to the first main network node, and the node device that deploys nodeA generates nodeA1 belonging to subnet1, which is equivalent to the first subnet node. It can be seen that since the identity systems are independent of each other, even if the public key used by the first subnet node is different from that of the first main network node, it does not affect the implementation of the solution in this specification.

[0056] Of course, the node members of the blockchain subnet are not necessarily only some of the node members of the blockchain main network. In some cases, the node members of the blockchain subnet can be completely consistent with the node members of the blockchain main network. At this time, all blockchain members can obtain data on the blockchain main network and the blockchain subnet, but the data generated by the blockchain main network and the blockchain subnet can still be isolated from each other. For example, one type of business can be implemented on the blockchain main network and another type of business can be implemented on the blockchain subnet, so that the business data generated by these two types of business can be isolated from each other.

[0057] In addition to the identity information of the node members mentioned above, the configuration information may also include at least one of the following: the network identifier of the blockchain subnet, the identity information of the administrator of the blockchain subnet, the attribute configuration for the blockchain platform code, etc., which is not limited in this specification. The network identifier is used to uniquely characterize the blockchain subnet, so the network identifier of the blockchain subnet should be different from the blockchain main network and other blockchain subnets established on the blockchain main network. The identity information of the administrator of the blockchain subnet can be, for example, the public key of the node member who is the administrator; wherein, the administrators of the blockchain main network and the blockchain subnet can be the same or different.

[0058] One of the advantages of forming a blockchain subnet through the blockchain mainnet is that since the first mainnet node has been deployed on the node device that generates the first subnet node, the blockchain platform code used by the first mainnet node can be reused on the first subnet node, eliminating the need for repeated deployment of the blockchain platform code, greatly improving the efficiency of forming the blockchain subnet. Then, if the configuration information does not contain the attribute configuration for the blockchain platform code, the first subnet node can reuse the attribute configuration used on the first mainnet node; if the configuration information contains the attribute configuration for the blockchain platform code, the first subnet node can use the attribute configuration, so that the attribute configuration used by the first subnet node is not limited to the attribute configuration of the first mainnet node and has nothing to do with the first mainnet node. The attribute configuration for the blockchain platform code may include at least one of the following: code version number, whether consensus is required, consensus algorithm type, block size, etc., and this manual does not limit this.

[0059] The transaction for forming a blockchain subnet includes a transaction for calling a contract. The transaction may specify the address of the smart contract being called, the calling method, and the parameters passed in. For example, the called contract may be the aforementioned genesis contract or system contract, the called method may be the method for forming a blockchain subnet, and the parameters passed in may include the aforementioned configuration information. In one embodiment, the transaction may include the following information:

[0060] from:Administrator

[0061] to:Subnet

[0062] method:AddSubnet(string)

[0063] string: genesis

[0064] Among them, the from field is the information of the initiator of the transaction, for example, Administrator indicates that the initiator is the administrator; the to field is the address of the called smart contract, for example, the smart contract can be a Subnet contract, then the to field is specifically the address of the Subnet contract; the method field is the calling method, for example, the method used to form a blockchain subnet in the Subnet contract can be AddSubnet(string), and string is the parameter in the AddSubnet() method. In the above example, the value of the parameter is represented by genesis, and the genesis is specifically the aforementioned configuration information.

[0065] Take the transaction in which nodes nodeA~nodeE on Subnet0 execute the AddSubnet() method in the Subnet contract as an example. After the transaction passes consensus, nodeA~nodeE respectively execute the AddSubnet() method and pass in the configuration information to obtain the corresponding execution results.

[0066] The execution result of the contract may include the configuration information. The execution result may be in the receipt mentioned above, which may include an event related to the execution of the AddSubnet() method, that is, a networking event. The topic of the networking event may include a predefined networking event identifier to distinguish it from other events. For example, in the event related to the execution of the AddSubnet() method, the content of the topic is the keyword subnet, and the keyword is different from the topic in the event generated by other methods. Then, nodeA~nodeE can determine that it has listened to the event related to the execution of the AddSubnet() method, that is, a networking event, by monitoring the topics contained in each event in the generated receipt when it monitors the topic containing the keyword subnet. For example, the event in the receipt is as follows:

[0067] Event:

[0068] [topic:other][data]

[0069] [topic:subnet][data] ......

[0071] Then, when nodeA~nodeE listens to the first event, since the content of the topic is other, it determines that the event is not related to the AddSubnet() method; and when nodeA~nodeE listens to the second event, since the content of the topic is subnet, it determines that the event is related to the AddSubnet() method, and then reads the data field corresponding to the event, which contains the above configuration information. Taking the configuration information including the public key of the node member of the blockchain subnet as an example, the content of the data field may include:

[0072] {subnet1;

[0073] nodeA's public key, nodeA's IP, nodeA's port number...;

[0074] nodeB's public key, nodeB's IP, nodeB's port number...;

[0075] Public key of nodeC, IP address of nodeC, port number of nodeC...;

[0076] nodeD's public key, nodeD's IP, nodeD's port number...;

[0077] }

[0078] Among them, subnet1 is the network identifier of the blockchain subnet you want to create. Each blockchain node in the blockchain main network can record the network identifiers of all blockchain subnets that have been created on the blockchain main network, or other information related to these blockchain subnets. This information can be maintained in the above-mentioned Subnet contract, and specifically can correspond to the value of one or more contract states contained in the Subnet contract. Then, nodeA~nodeE can determine whether the above-mentioned subnet1 already exists based on the network identifiers of all the blockchain subnets that have been created; if it does not exist, it means that subnet1 is a new blockchain subnet that needs to be created at present, and if it does exist, it means that subnet1 already exists.

[0079] In addition to using the network identifier of the new blockchain subnet you want to create, you can also use a predefined new network identifier, which indicates that the corresponding networking event is used to form a new blockchain subnet. For example, the above subnet1 can be replaced with newsubnet, which is a predefined new network identifier. When nodeA~nodeE recognizes that the data field contains newsubnet, it can be determined that the event containing newsubnet is a networking event and a new blockchain subnet needs to be created.

[0080] In addition to the network identifier subnet1, the above data field also contains the identity information of each node member and other content. The node device that deploys the first main network node can monitor the generated receipt, and when the networking event is monitored and the content of the networking event indicates that the first main network node belongs to the node member, the node device that deploys the first main network node obtains the configuration information or genesis block contained in the networking event. For example, when nodeA~nodeE determines that subnet1 is a blockchain subnet that needs to be newly established, it will further identify the identity information of the node members contained in the data field to determine its own processing method. For example, nodeA~nodeD will find that the data field contains its own public key, IP address, port number and other identity information. Assuming that nodeA~nodeD are deployed on node devices 1~4 respectively, taking nodeA and node device 1 as an example: nodeA will trigger node device 1, so that node device 1 obtains configuration information from the data field based on the above message mechanism and generates a genesis block containing the configuration information, and node device 1 will deploy nodeA1 locally, and nodeA1 will load the generated genesis block to become a subnet node of subnet1; similarly, nodeB will trigger node device 2 to generate nodeB1, nodeC will trigger node device 3 to generate nodeC1, and nodeD will trigger node device 4 to generate nodeD1. In addition, nodeE will find that the identity information contained in the data field does not match itself. Assuming that nodeE is deployed on node device 5, node device 5 will not generate a genesis block according to the configuration information in the data field, nor will it generate a node in subnet1.

[0081] As mentioned above, the first main network node and the first subnet node do not necessarily use the same identity information. Therefore, in the above embodiment, the data field may contain identity information pre-generated for nodeA1~nodeD1, and different from the identity information of nodeA~nodeD. Taking nodeA as an example, if nodeA finds the identity information of nodeA1 in the data field, nodeA will trigger node device 1 to generate a genesis block, deploy nodeA1, and nodeA1 will load the genesis block; the processing method of nodeB~nodeD is similar, which will not be repeated here.

[0082] In addition to configuration information, the execution result of the contract may include a genesis block. In other words, in addition to including configuration information in the data field, a genesis block containing configuration information can also be generated directly during the execution of the contract call, thereby including the genesis block in the data field. For the above-mentioned nodeA~nodeD, the corresponding node devices 1~4 can obtain the genesis block directly from the data field through the message mechanism without generating it themselves, which can improve the deployment efficiency of nodeA1~nodeD1.

[0083] In this specification, the transaction of forming a blockchain subnet may not be a transaction that calls a smart contract, so that a blockchain network that does not support smart contracts can also implement the technical solution of this specification, thereby quickly creating a blockchain subnet based on the blockchain main network. For example, a group of network transaction type identifiers can be pre-defined. When a transaction contains the network transaction type identifier, it indicates that the transaction is used to form a new blockchain subnet, that is, the transaction is a transaction for forming a blockchain subnet. The blockchain platform code can include relevant processing logic for forming a blockchain subnet, so that when the first main network node running the blockchain platform code executes a transaction, if it is found that the transaction contains the above-mentioned network transaction type identifier, and the first main network node belongs to the node member indicated by the configuration information in the transaction, it can trigger the node device that deploys the first main network node based on the above-mentioned processing logic to generate a genesis block containing the configuration information and start the first subnet node, and the first subnet node loads the genesis block to form a blockchain node in the blockchain subnet.

[0084] The node device starts a process and creates an instance in the process, and the instance runs the blockchain platform code, which is equivalent to deploying a blockchain node on the node device. For the first main network node, the node device creates a first instance in the above process, and the first instance runs the blockchain platform code. Similarly, for the first subnet node, the node device creates a second instance different from the first instance in the above process, and the second instance runs the blockchain platform code. When the first instance and the second instance are in the same process, since there is no cross-process interaction, the deployment difficulty of the first subnet node can be reduced and the deployment efficiency can be improved; of course, the second instance may also be in a different process on the node device from the first instance, and this specification does not limit this. In fact, each blockchain node deployed on any node device involved in the embodiments of this specification is a different blockchain instance running on any node device, and the blocks generated by each blockchain node deployed on any node device are respectively stored in different storage (such as a database) on any node device, and the storage used by each blockchain node deployed by any node device is isolated from each other.

[0085] Through the above method, a blockchain subnet can be created on the blockchain mainnet. Figure 4 For example, subnet0 originally includes nodeA~nodeE, and subnet1 can be formed on the basis of subnet0, which includes nodeA1~nodeD1, and nodeA and nodeA1, nodeB and nodeB1, nodeC and nodeC1, nodeD and nodeD1 are deployed on the same node device. Similarly, subnet2 or more blockchain subnets can be formed on subnet0, where subnet2 includes nodeA2, nodeB2, nodeC2 and nodeE2, and nodeA and nodeA1, nodeA2, nodeB and nodeB1, nodeB2, nodeC and nodeC1, nodeD and nodeD1, nodeE and nodeE2 are deployed on the same node device. In addition, subnet1, subnet2, etc. can be used as blockchain main networks, and blockchain subnets can be further established on this basis. For example, blockchain subnet subnet3 is established on the basis of subnet1. The process is similar to the establishment of subnet1 or subnet2, except that the blockchain main network is replaced with blockchain subnet subnet1. It will not be repeated here. Finally, subnet3 contains nodeA3, nodeB3 and nodeC3, so that nodeA and nodeA1, nodeA2, nodeA3, nodeB and nodeB1, nodeB2, nodeB3, nodeC and nodeC1, nodeC2, nodeC3 are deployed on the same node device respectively.

[0086] Whether between different blockchain main networks or between different blockchain subnets established in the above manner, there may be a need for cross-chain interaction. However, because there are usually multiple source blockchain nodes that send cross-chain messages (i.e., initiate cross-chain requests) and multiple destination blockchain nodes that respond to cross-chain messages, different destination nodes in the destination blockchain network may receive multiple cross-chain messages generated by different source nodes in the source blockchain subnet. Therefore, how to ensure that each node in the destination blockchain network obtains consistent processing results after processing the cross-chain messages sent by the source blockchain network is an urgent problem to be solved in the cross-chain interaction process.

[0087] To solve this problem, this specification proposes a cross-chain interaction method, after the destination nodes in the destination blockchain network respectively obtain the cross-chain messages sent by at least one source node in the source blockchain network, they respectively generate blockchain transactions according to the cross-chain messages obtained by themselves and submit consensus, and then each destination node executes the same blockchain transaction through consensus. Because the cross-chain messages obtained by each destination node are all from the source blockchain network, the blockchain transactions generated by each node according to the cross-chain messages obtained by itself can contain the same blockchain messages, and then each node can obtain the same execution results after executing the same blockchain transaction through consensus, that is, each destination node can obtain consistent processing results after processing the cross-chain messages sent by the source blockchain network.

[0088] First, combine the corresponding Figure 4 of Figure 5 Briefly describe the cross-chain interaction scheme in this manual. Figure 5 , Figure 5 This is a schematic diagram of a cross-chain interaction method provided by an exemplary embodiment. Figure 4 As shown in the figure, blockchain subnet1 and blockchain subnet2 are created based on the blockchain mainnet subnet0. Figure 5 The figure shows the process of subnet1 and subnet2 realizing cross-chain interaction based on subnet0.

[0089] like Figure 5 As shown in the figure, the node device to which any node in subnet1 and subnet2 belongs can be deployed with the corresponding database and virtual machine. Figure 5For example, nodeD1 in subnet1 is specifically a blockchain node instance (hereinafter referred to as a blockchain node) formed by the node device 4 running the pre-deployed blockchain platform code in the locally deployed virtual machine, and the relevant data of nodeD1 as a blockchain node during operation is stored in the database corresponding to nodeD1. Among them, the blockchain network to which the blockchain node deployed in the node device belongs can be a blockchain main network or a blockchain subnet established in the aforementioned manner. Of course, this solution can also be applied to an independent blockchain network (that is, the blockchain network is not established based on other blockchain networks, and there are no other blockchain networks established based on the blockchain network). In other words, the cross-chain interaction method described in this specification can be applied to any two blockchain networks, and this specification does not limit the relationship between the blockchain network and other blockchain networks. In addition, a blockchain consensus code can be deployed in the node device, and the node device can run the consensus code to form a consensus plug-in instance locally; and, a P2P plug-in code managed in the form of a plug-in can also be deployed in the node device, and the node device can run the P2P plug-in code to form a P2P plug-in instance locally, that is, a P2P plug-in. Blockchain business codes are also deployed in the node devices, and the node devices can run the blockchain business codes to form business instances locally. Among them, at least one business instance can be implemented in any node device, such as a storage instance for implementing data read / write functions, a computing instance for implementing computing functions such as privacy computing, an encryption instance for implementing data encryption functions, etc., which will not be repeated here.

[0090] In particular, when the cross-chain interaction method described in this specification is applied to two blockchain subnets managed by the blockchain main network, the node devices corresponding to the source node in the source blockchain network or the destination node in the destination blockchain network are deployed with the main network nodes in the blockchain main network. Figure 4 and Figure 5, the node device 4 to which nodeD1 in subnet1 belongs is also deployed with the main network node nodeD, and the node device 5 to which nodeE2 in subnet2 belongs is also deployed with the main network node nodeE. Since the P2P plug-in on the node device can be shared by each blockchain node on the node device, although there is no direct network connection link between subnet1 and subnet2, since nodeD deployed on node device 4 and nodeE deployed on node device 5 have already established a network connection based on the P2P plug-in in advance through the network connection link realized when forming subnet0, nodeD1 in subnet1 can call the P2P plug-in running locally on node device 4, and with the help of the network connection link realized when forming subnet0, establish a network connection with the P2P plug-in running on the node device (such as node device 5) to which each destination node (such as nodeE2) in subnet2 belongs, thereby further realizing network communication with the destination node, so that there is no need to establish a new network connection link between the source blockchain network and the destination blockchain network, but through the network connection link pre-established by the underlying blockchain main network, the network communication between the source node in the source blockchain network and the destination node in the destination blockchain network is realized.

[0091] In the process of implementing business functions, each node in subnet1 may need to use the data stored in each node in subnet2, so subnet1 can request subnet2 to obtain the data. In the process of obtaining data through the cross-chain interaction scheme described in this specification, the above subnet1 is the source blockchain network and subnet2 is the destination blockchain network. For example, subnet1 can send a cross-chain request to subnet2 in order to obtain the contract status of a specific field in a specific contract stored in the node database of subnet2. It can be understood that "subnet1 sends a cross-chain request to subnet2" means "the subnet node in subnet1 (i.e., the source node) sends a cross-chain request to the subnet node in subnet2 (i.e., the destination node)".

[0092] Specifically, when the cross-chain interaction method described in this specification is applied to two blockchain subnets under the management of the blockchain main network, any node in subnet1 can encapsulate the network identifier of the target blockchain network subnet2 in the cross-chain request, and broadcast the cross-chain request through the network connection link of subnet0 to the P2P plug-in running on each node device where the main network node is deployed by calling the P2P plug-in locally deployed on the node device and shared with the main network node in subnet0. In one embodiment, if nodeA1 in subnet1 sends a cross-chain request through the P2P plug-in on node device 1, then other node devices 2 to 5 deployed with main network nodes will all receive the cross-chain request. For example, after receiving the cross-chain request, the P2P plug-in on node device 5 will determine whether node device 5 is locally deployed with a blockchain node in the blockchain network corresponding to the network identifier based on the network identifier carried by the cross-chain request. Obviously, node device 5 is deployed with nodeE2 in subnet2. Therefore, the P2P plug-in on node device 5 will further forward the cross-chain request to nodeE2 based on the network identifier. After receiving the cross-chain request, the P2P plug-in on node device 4 will also forward it based on the network identifier it carries. However, since node device 4 does not locally deploy a blockchain node in subnet2, node device 4 will not retain the cross-chain request, but will further forward the cross-chain request to other node devices deployed with main network nodes. In addition, in addition to encapsulating the network identifier in the cross-chain request, any node in subnet1 can also encapsulate the identity information of any node in the target blockchain network in the cross-chain request, such as the node ID and the node public key. Therefore, in the process of calling the P2P plug-in to realize the cross-chain transmission of the cross-chain request, it is not necessary to send it to the node devices belonging to each main network node in the form of broadcast, but directly enables the P2P plug-in to send it to the node device specified by the identity information of each node carried in the cross-chain request in a point-to-point communication manner. For example, nodeD1 in subnet1 can encapsulate the identity information of nodeE2 in the cross-chain request and call the P2P plug-in running locally on node device 4, so that the P2P plug-in can send the cross-chain request in a unicast form to the node device 5 where nodeE2 in subnet2 and nodeE in subnet0 are deployed at the same time according to the identity information of nodeE2. After receiving the cross-chain request, the P2P plug-in on node device 5 can forward the cross-chain request to nodeE2 through the network identifier carried by the cross-chain request, or directly forward the cross-chain request to nodeE2 through the identity information of nodeE2 carried by the cross-chain request.

[0093] The above process describes the process of the source blockchain network sending a message request to the destination blockchain network through the network connection link established by the blockchain main network. Similarly, the destination blockchain network can also realize message transmission to the source blockchain network by calling the local P2P plug-in. For example, the cross-chain data corresponding to the block request sent by the above source blockchain network is returned to the source blockchain network. In this way, the two-way communication channel between the source blockchain network and the destination blockchain network is formed to realize the network communication between the source node in the source blockchain network and the destination node in the destination blockchain network.

[0094] A data acquisition request can be sent to the main network node in subnet0, and the main network node forwards the request to the corresponding subnet2, wherein the destination node in subnet2 can verify the received data acquisition request to ensure the legitimacy of the responded data acquisition request, and respond if the verification is successful. The process of the destination node responding to the above data acquisition request is to determine the data executed by the received data acquisition request (i.e., the data required by subnet1), and generate a cross-chain message based on the data and return it to subnet1 through the main network node in subnet0. Similarly, the source node in subnet1 can also verify the legitimacy of the received cross-chain message, and use the data contained in the cross-chain message to continue to implement related business functions if the verification is successful.

[0095] Figure 5 Just combine Figure 4 The following is an example of blockchain subnets subnet1 and subnet2. Figure 4 Each blockchain network in the cross-chain interaction can be realized, and this specification does not limit the relationship between the blockchain networks of cross-chain interaction. For example, between the above-mentioned blockchain main network subnet0 and blockchain subnet1, between the blockchain main network subnet0 and blockchain subnet3 (i.e., the grandchild network of subnet0), between blockchain subnet2 and subnet3, etc., cross-chain interaction can be realized, and the specific process will not be repeated.

[0096] Combine the following Figure 6 A detailed description of the cross-chain interaction scheme in this manual. Figure 6 , Figure 6 This is a schematic diagram of a cross-chain interaction method provided by an exemplary embodiment. Figure 6 As shown, the method is applied to a blockchain system including a source blockchain network and a destination blockchain network, and the method may include the following steps:

[0097] In step 602, each destination node in the destination blockchain network respectively obtains a cross-chain message sent to the destination blockchain network by at least one source node in the source blockchain network.

[0098] In this embodiment, at least one source node in the source blockchain network can send a cross-chain message to the destination blockchain network, so that each destination node in the destination blockchain network can verify the received cross-chain message, and then use the verified cross-chain message to generate a blockchain transaction and submit a consensus, and respectively execute the same blockchain transaction that has passed the consensus. It can be understood that each destination node in the destination blockchain network will respectively execute the above-mentioned response process for the cross-chain message, such as receiving the cross-chain message, verifying the cross-chain message, generating the blockchain transaction, and executing the blockchain transaction.

[0099] by Figure 4 The cross-chain interaction process between blockchain subnets subnet1 and subnet2 in the network structure shown is used as an example for explanation. At least one source node in subnet1 (source nodes nodeA1, nodeB1, nodeC1 and / or nodeD1) can send a cross-chain message to subnet2 through the blockchain main network subnet0 in the aforementioned unicast, multicast or broadcast manner. After each destination node in subnet2 (destination node nodeA2, nodeB2, nodeC2 and nodeE2) obtains the cross-chain message, it can respectively respond to the cross-chain message received by itself and perform corresponding verification and other processing. The following is a detailed description of the specific process of the destination node obtaining the message content contained in the received cross-chain message and verifying each cross-chain message in combination with multiple specific embodiments.

[0100] In one embodiment, in order to ensure the privacy of the cross-chain message sent and avoid leakage of the requested content, the source node can use digital envelope technology to encrypt the cross-chain message. For example, for the blockchain message to be transmitted (corresponding to the specific business that the source node needs to complete, such as being used to call a smart contract, the message content at this time may include relevant parameters, contract information of the called contract, function information in the called contract, etc.), the source node can use its own node private key to sign the blockchain message, and use a symmetric key to encrypt the blockchain message and its signature, and use the node public key of each destination node to encrypt the above symmetric key respectively, and add the blockchain message encrypted by the symmetric key and its signature, as well as each symmetric key encrypted by the node public key to the above cross-chain request; accordingly, each destination node that receives the cross-chain request can decrypt the above cross-chain request by the node public key of the source node, and decrypt the encrypted symmetric key obtained by decryption by its own node private key, and then decrypt the encrypted blockchain message by the symmetric key obtained by decryption, and use the node public key of the source node to verify the signature of the blockchain message, and perform subsequent processing on the blockchain message if the verification is passed, so as to return the corresponding cross-chain message to the source blockchain network. Among them, if the above cross-chain request is verified, it means that the received blockchain message is indeed sent by the corresponding source node and has not been tampered with. It can be seen that, on the one hand, using symmetric keys to encrypt message content with relatively large data volume, and using asymmetric keys to encrypt symmetric keys with relatively small data volume, not only helps to ensure faster encryption speed, but also enables the encrypted message content to achieve stricter data privacy. On the other hand, because the source node uses the node public key of each destination node in the destination blockchain network to encrypt the symmetric key, each destination node can use its own node private key to decrypt the symmetric key after receiving the cross-chain message, and then use the decrypted symmetric key to decrypt the message content, so as to achieve the effect of broadcasting the cross-chain message in the destination blockchain network.

[0101] by Figure 4For example, in the scenario where subnet1 sends a cross-chain message to subnet2, subnet1 is the source blockchain network and subnet2 is the destination blockchain network. Then, any subnet node nodeA1 in subnet1 can use the symmetric key to encrypt the message content, and then use the node public keys of each subnet node nodeA2, nodeB2, nodeC2 and nodeE2 in subnet2 to encrypt the symmetric key, and include the encrypted symmetric key and message content in the cross-chain message and send it to subnet2 through subnet0. After any subnet node (such as nodeA2) in subnet2 receives the cross-chain message, if it determines that its own node private key can decrypt the encrypted symmetric key in the cross-chain message, it determines that it is the legitimate recipient of the cross-chain message, and then can use the decrypted symmetric key to decrypt and obtain the above message content.

[0102] It is understandable that, using the digital envelope technology, the node public keys of multiple destination nodes can be used to encrypt symmetric keys at the same time, so any source node can use the public keys of all destination nodes in the destination blockchain network to encrypt blockchain messages and include them in cross-chain messages, and then each destination node can decrypt the blockchain message in the cross-chain message according to its own node private key, so as to achieve the cross-chain transmission effect of the source node broadcasting the cross-chain message to the destination node. Of course, in the case of adopting the above-mentioned digital envelope method, any source node can also only use the node public key of one (or more) destination nodes to encrypt the symmetric key in the cross-chain message, so as to achieve the cross-chain transmission effect of the source node unicasting (or multicasting) the cross-chain message to the destination node, and the specific process will not be repeated. In fact, this specification does not limit the above-mentioned cross-chain messages and the specific sending methods of cross-chain messages, such as not using digital envelopes and directly using node public keys to encrypt the message content in the cross-chain message, etc., which will not be repeated.

[0103] As mentioned above, each source node in the source blockchain network can send (i.e. broadcast) cross-chain messages to each destination node in the destination blockchain network; or, each source node can also send (i.e. unicast or multicast) cross-chain messages to any one (or multiple) destination nodes in the destination blockchain network, and each destination node synchronizes the cross-chain messages it receives to other destination blockchain networks in the destination blockchain network. It can be seen that whether the cross-chain message is sent by broadcasting; or the cross-chain message is sent by unicast or multicast and synchronized by the receiver in its own network, it can ensure that each destination node in the destination blockchain network receives the cross-chain message sent by at least one source node in the source blockchain network.

[0104] In one embodiment, the source blockchain network may be a blockchain subnet managed by a blockchain main network, which may maintain the node identity information of each source node in the active blockchain network. The above cross-chain message may include identity information for representing the node identity of the source node that sends the cross-chain message. At this time, each destination node that receives the cross-chain message may query the blockchain main network for the node identity information of the source node that sends the cross-chain message to verify the identity information, and respond to the cross-chain message if the verification passes.

[0105] by Figure 4 For example, the blockchain main network subnet0 can maintain the node identity information of each subnet node in the blockchain subnets subnet1 and subnet2. It is understandable that the cross-chain message sent by the source node nodeA1 received by the destination node nodeA2 may contain the identity information of nodeA1, so nodeA2 can determine that the source node corresponding to the request (i.e. the sender of the request) is nodeA1, so that nodeA2 can query the node identity information of nodeA1 from the blockchain main network subnet0, and determine whether nodeA1 is a legitimate source node based on the node identity information returned by subnet0. Among them, the node identity information stored in subnet0 may include the node's network address, port, node public key and / or node identifier, etc. Taking the node public key as an example, nodeA2 can send a query request containing the node public key of nodeA1 carried in the cross-chain message to the main network node nodeA in subnet0. At this time, nodeA can query whether there is a node public key of nodeA1 in the node public keys of the subnet nodes maintained locally (included in each blockchain subnet formed based on subnet0), and return the corresponding query result to nodeA2, so that nodeA2 can verify the node public key of nodeA1 according to the query result. If the node public key of nodeA1 is queried, the verification is passed, which means that nodeA1 is indeed the trusted sender of the cross-chain message received by nodeA2, so nodeA2 can further respond to the cross-chain message; otherwise, if the node public key of nodeA1 is not queried, the verification fails, which means that nodeA1 is not trustworthy, and nodeA2 can directly discard the cross-chain message sent by nodeA1. In addition, if the verification fails, nodeA2 can also record nodeA1 as an illegal source node, so that when receiving a cross-chain message from nodeA1 again in the future, the request can be directly discarded to avoid invalid processing and speed up the response. Of course, nodeA2 can also synchronize nodeA1's illegal records to other destination nodes in subnet2.

[0106] In the aforementioned embodiment where the source blockchain network is a blockchain subnet, the destination blockchain network can also be a blockchain subnet, and then the main network node in the blockchain main network and the subnet node in the blockchain subnet managed by the blockchain main network can be deployed on the same node device. The main network node and the subnet node on the node device can share the blockchain plug-in running on the node device. At this time, after receiving the cross-chain message, each destination node can query the node identity information of the source node through the blockchain plug-in, such as reading the identity information of the source node (i.e. the sender of the cross-chain message) corresponding to the cross-chain message maintained by the main network node through the blockchain plug-in shared with the main network node deployed on its own node device. Figure 4 For example, if the main network node nodeA and the subnet node nodeA2 are both deployed in the same node device (hereinafter referred to as node device A), the two can share the blockchain plug-in running on node device A. At this time, nodeA2 can query the node identity information of nodeA1 through the blockchain plug-in (of course, if the subnet node nodeA1 is also deployed in node device A, nodeA1 can also query the node identity information of nodeA2 through the blockchain plug-in). Among them, the above-mentioned blockchain plug-in can be a plug-in deployed in the blockchain main network for calling the subnet management contract. Any blockchain node can query the node identity information of the subnet node by sending a transaction to call the subnet management contract in subnet0 through the corresponding main network node (such as reading the subnet node information maintained by the subnet management contract). Of course, in order to ensure the query speed, the above-mentioned transaction can be a transaction that does not require consensus. Obviously, when network nodes belonging to different blockchain networks are deployed in the same node device, by sharing the blockchain plug-in of the node device among the nodes, efficient reuse of the blockchain plug-in can be achieved, and the number of blockchain plug-ins that need to be deployed in the node device can be effectively reduced, which helps to simplify the node device configuration and the deployment process of the blockchain node, and improve the deployment efficiency of the blockchain node and the management efficiency of the node device. In fact, different blockchain nodes deployed in the same node device can also share other functional plug-ins, such as the aforementioned P2P plug-in instance, consensus plug-in instance and / or business instance, etc., which will not be repeated here.

[0107] In the aforementioned embodiment where the source blockchain network is a blockchain subnet, a subnet management contract can be deployed on the above blockchain mainnet, and the subnet management contract is used to maintain the node identity information of the subnet nodes in each blockchain subnet established based on the blockchain mainnet; at this time, any destination node can read the node identity information of any source node maintained by the subnet management contract, such as after receiving a cross-chain message, it can read the identity information of the source node corresponding to the cross-chain message (i.e., the sender of the cross-chain message). Figure 4For example, because subnet1 to which subnet node nodeA1 belongs and subnet2 to which subnet node nodeA2 belongs are both established on the basis of subnet0, the subnet management contract deployed in subnet0 can be used to manage the node identity information of each subnet node in subnet1 and subnet2, and any destination node can also read the node identity information of any source node maintained by the subnet management contract, such as nodeA2 can read the node identity information of nodeA1. By maintaining the node identity information of subnet nodes by the subnet management contract deployed in the blockchain main network, efficient management of node identity information can be guaranteed. The subnet nodes in the blockchain subnet directly read the node identity information maintained by the subnet management contract, so that the process of obtaining node identity information does not require the consensus process of the main network nodes in the blockchain main network, which helps to improve the efficiency of obtaining node identity information.

[0108] In the aforementioned embodiment where the source blockchain network is a blockchain subnet, the identity information of any subnet node may include the node identifier declared by the subnet node and the subnet identifier of the blockchain subnet to which the subnet node belongs; at this time, each destination node may query the blockchain main network to see whether the node identifier and subnet identifier declared by the source node that sent the cross-chain message match. Figure 4 For example, the node identity information contained in the cross-chain message sent by subnet node nodeA1 to nodeA2 may include the node identifier of nodeA1 and the subnet identifier of subnet1. Therefore, after receiving the cross-chain message sent by nodeA1, nodeA2 can query subnet0 whether the node identifier and subnet identifier declared by nodeA1 match. For example, nodeA2 can query the main network node A whether all subnet identifiers maintained by it include the subnet identifier of subnet1, and further query whether all node identifiers corresponding to the subnet identifier of subnet1 include the node identifier of nodeA1 if they do include the node identifier of nodeA1: if the node identifier of node nodeA1 is included, it indicates that the node identifier and subnet identifier declared by nodeA1 match, and further indicates that the cross-chain message received by nodeA2 is indeed sent by nodeA1, so nodeA2 can further respond to the message; otherwise, if the node identifier of nodeA1 is not included, it indicates that the node identifier and subnet identifier declared by nodeA1 do not match, and further indicates that the cross-chain message received by nodeA2 may be a false request sent by other nodes, so the response to the message can be terminated, such as directly discarding the message. In this way, the node identity information of each subnet node maintained in the blockchain main network can be fully utilized to verify the cross-chain messages sent by the source node to ensure the legitimacy of the cross-chain messages actually processed by the destination node.

[0109] In the aforementioned embodiment where the source blockchain network is a blockchain subnet, the identity information of any subnet node may also include a signature generated by the subnet node based on its own node private key; therefore, each destination node may query the blockchain main network for the node public key of the source node that sent the cross-chain message, and use the node public key to verify the above signature. Figure 4 For example, subnet node nodeA1 can generate a signature for the message content (or the cross-chain message) contained in the cross-chain message based on its own node private key, and include the signature in the cross-chain message (or send it in association with the cross-chain message) to subnet node nodeA2, so that nodeA2 can query subnet0 for nodeA1's node identity information to verify the signature, such as verifying the above signature based on the node public key of nodeA1 queried from subnet0. Accordingly, if the signature verification is passed, the cross-chain message can be further responded to; and if the signature verification fails, the response to the cross-chain message can be terminated, such as directly discarding the cross-chain message or even recording nodeA1 as an illegal node.

[0110] In step 604, each destination node generates a blockchain transaction according to the cross-chain message obtained by itself, and submits the generated blockchain transaction to the destination blockchain network.

[0111] As mentioned above, because the multiple cross-chain messages received by any destination node are sent by the same source node, in the case where there are no malicious nodes in the source blockchain network and the destination blockchain network, the cross-chain messages received by each destination node should be sufficient. Therefore, in order to avoid the tampering or falsification of cross-chain messages by malicious nodes that may exist in the source blockchain network or the destination blockchain network, each destination node can perform a Byzantine fault tolerance check on the cross-chain messages it receives. For example, each destination node can perform a Byzantine fault tolerance check on the cross-chain messages it receives based on the number of cross-chain messages it receives and the total number of source nodes in the source blockchain network. Of course, only cross-chain messages that pass the above Byzantine fault tolerance check can be used by the corresponding destination node to generate blockchain transactions. It can be seen from the above implementation that any destination node may receive multiple cross-chain messages sent by multiple source nodes. Therefore, after receiving a cross-chain message, any destination node performs a Byzantine fault tolerance check on the cross-chain message it has obtained based on the number of cross-chain messages it has obtained and the total number of source nodes in the source blockchain network, and only generates blockchain messages based on cross-chain messages that have passed the check, thereby ensuring the reliability of the cross-chain messages used to generate blockchain messages, and further ensuring the reliability of the generated blockchain messages.

[0112] Among them, in the case where the source blockchain network is a blockchain subnet managed by the blockchain main network, the blockchain main network can maintain the total number of source nodes in the active blockchain network, so each destination node can query the total number of nodes from the blockchain main network. For example, subnet node nodeA2 may receive cross-chain messages sent by one or more nodes in subnet nodes nodeA1, nodeB1, nodeC1 and nodeD1, so nodeA2 can query subnet0 for the total number of nodes of the source blockchain node in the source blockchain network, and then perform Byzantine fault tolerance verification on the received cross-chain message according to the total number of nodes and the number of messages of the cross-chain message received by itself. At this time, the subnet information of the blockchain subnet maintained by the blockchain main network can be fully utilized, which helps to improve the interaction efficiency. In addition, in the scenarios of the blockchain main network and blockchain subnet mentioned in the above embodiments, any blockchain node can save the information locally after querying the information of other blockchain subnets from the blockchain main network to avoid repeated queries in the subsequent processing process, and further improve the interaction efficiency. Of course, in order to ensure the timeliness of the above information, the effective duration can also be set for the locally stored information to query and update the above information in time.

[0113] In addition, in the case where there are no malicious nodes in the source blockchain network and the destination blockchain network, the multiple cross-chain messages obtained by any destination node should contain the same message content. Therefore, each destination node can perform content verification on the blockchain that has passed the aforementioned process, that is, compare whether each blockchain transaction contains the same message content. Furthermore, each destination node can perform the above-mentioned Byzantine fault tolerance verification on the cross-chain messages containing the same message content. For example, each destination node can perform Byzantine fault tolerance verification on the cross-chain messages it has obtained based on the number of cross-chain messages containing the same message content it has obtained and the total number of source nodes in the source blockchain network. Among them, only cross-chain messages that have passed the above-mentioned Byzantine fault tolerance verification and contain the same message content will be used to generate blockchain transactions.

[0114] Combine the following Figure 4 The scenario shown is based on the example of nodeA2 using the PBFT fault-tolerant algorithm. Figure 4It can be seen that subnet1, which is the source blockchain network, contains four subnet nodes, namely nodeA1, nodeB1, nodeC1 and nodeD1 (the total number of nodes is 3f+1=4, i.e., f=1). Therefore, if nodeA2 receives legal cross-chain messages sent by at least f+1 (i.e., 2) source nodes containing the same message content, it can be determined that these cross-chain messages pass the Byzantine fault tolerance check. Of course, in the practice of the scheme, the total number of nodes and the number of received cross-chain messages can also be other values, and this specification does not limit this. Among them, only cross-chain messages that pass the above verification (containing the same message content) will be used to generate blockchain transactions. Through the above Byzantine fault tolerance check, it can be ensured that the cross-chain messages used by each destination node in subnet2 to generate blockchain transactions are all generated by legal source nodes in subnet1, which effectively reduces the possibility of malicious nodes (i.e., Byzantine nodes) doing evil to blockchain transactions.

[0115] After any destination node in the destination blockchain network generates a blockchain transaction, it can submit the blockchain transaction to the destination blockchain network to participate in the consensus, that is, broadcast the blockchain transaction to other nodes in the destination blockchain network so that each destination node in the destination blockchain network can reach a consensus on the blockchain transaction. The cross-chain message received by the destination node may contain data to be processed, such as data for updating local data, data for participating in local calculations, etc. Correspondingly, the blockchain transaction generated by the destination node based on the cross-chain message obtained by itself may also contain the data. However, the destination node that generates or forwards any blockchain transaction may be a malicious node. Therefore, after any node receives any blockchain transaction submitted by other destination nodes, it can verify the transaction based on the data to be processed or its hash contained in the transaction.

[0116] As an exemplary embodiment, each destination node in the destination blockchain network can directly verify the blockchain transaction according to the pending data contained in the blockchain transaction. For example, each destination node can use the pending data carried in the cross-chain message received by itself (i.e., the message content contained in the cross-chain message) as the first pending data (as mentioned above, the cross-chain message received by the same destination node or the cross-chain message through fault-tolerant verification carries the same pending data), and the pending data extracted from the blockchain message submitted by other destination nodes (i.e., the blockchain message to be verified) as the second pending data. Then, by comparing whether the above-mentioned first pending data and the second pending data are the same, the verification of the above-mentioned blockchain transaction submitted by other destination nodes can be realized: if the first pending data and the second pending data are the same, it can be determined that the blockchain transaction has passed the verification; otherwise, if the first pending data and the second pending data are not the same, it is determined that the blockchain transaction has not passed the verification.

[0117] Alternatively, as another exemplary embodiment, in order to improve the verification efficiency of blockchain transactions generated by other destination nodes, the blockchain transaction generated by any destination node may also include a hash of the data to be processed, so that each destination node can use the hash as the second hash, and use the hash of the data to be processed contained in the cross-chain message received by itself (the hash can be included in the cross-chain message or calculated by the target node based on the data to be processed contained in the cross-chain message) as the first hash. Then, by comparing whether the above-mentioned first hash and the second hash are the same, the verification of the above-mentioned blockchain transactions submitted by other destination nodes can be achieved: if the first hash and the second hash are the same, it can be determined that the blockchain transaction has passed the verification; otherwise, if the first hash and the second hash are different, it can be determined that the blockchain transaction has not passed the verification. Usually, the amount of data to be processed is much larger than the amount of hash data, so the verification efficiency can be effectively improved by comparing hashes.

[0118] It is understandable that, for each cross-chain message obtained by any destination node, only the cross-chain message that passes the aforementioned signature verification and / or Byzantine fault tolerance verification and contains the same message content will be used by the destination node to generate blockchain transactions. Among them, for any generated blockchain transaction, each destination node can use the aforementioned proof of work, proof of equity, delegated equity proof, practical Byzantine fault tolerance algorithm, HoneyBadgerBFT algorithm, etc. to reach consensus, and the specific process will not be repeated.

[0119] In addition, it should be noted that, in the process of processing the same business event (such as executing the same smart contract), each source node in the source blockchain network generates a cross-chain message containing the same message content and sends it to the destination blockchain network; accordingly, each destination node in the destination blockchain network generates a blockchain transaction according to the cross-chain message obtained by itself after verification. It can be seen that the above cross-chain message and blockchain transaction should maintain a corresponding relationship. In fact, the source blockchain network can simultaneously process multiple business events and generate and send different cross-chain messages containing multiple message contents, and the destination blockchain network can simultaneously participate in processing cross-chain messages containing multiple message contents. Therefore, in order to avoid confusion between different cross-chain messages or blockchain transactions, the source node can carry a unique identifier when generating a cross-chain message, and the blockchain transaction generated by the destination node according to the cross-chain message also includes the same identifier as the cross-chain message (that is, the unique identifier of the cross-chain message is used as the unique identifier of the blockchain transaction generated according to the cross-chain message), thereby ensuring that the cross-chain message and the blockchain transaction generated according to the cross-chain message contain the same unique identifier, so as to achieve effective distinction between different cross-chain messages and different blockchain transactions. Obviously, the cross-chain messages and blockchain transactions described in the foregoing embodiments of this specification are cross-chain messages and blockchain transactions that contain the same unique identifier.

[0120] Step 606: Each destination node executes the same blockchain transaction among the multiple blockchain transactions that have passed consensus.

[0121] Because each destination node in the destination blockchain network generates a blockchain transaction based on the verified cross-chain message obtained by itself, there may be multiple blockchain transactions corresponding to the cross-chain message in the destination blockchain network that have passed consensus. However, in order to ensure the consistency of the blockchain transaction execution results, each destination node is required to execute the same blockchain transaction that has passed consensus, so as to achieve the same business effect. In order to ensure that each destination node in the destination blockchain network executes the same blockchain transaction that has passed consensus, each destination node can execute the first blockchain transaction that has passed consensus in the destination blockchain network. Alternatively, the first blockchain transaction generated in the blockchain transaction that has passed consensus can also be executed separately. For example, each destination node can ensure that the executed blockchain transaction is the first blockchain transaction generated based on the timestamp carried by the blockchain transaction. After executing the above blockchain transaction, any destination node can terminate the processing process for other blockchain transactions. For example, if any blockchain transaction carries a request identifier, the destination node may not execute the new blockchain transaction (i.e., not execute the contract code related to the specific business) when receiving a new blockchain transaction that carries the same request identifier as the executed blockchain transaction. Of course, the destination node may also receive multiple blockchain transactions with the same request identifier in a short period of time, and verify, execute, and process each transaction in the order in which the transactions are received. Therefore, the processing progress of each blockchain transaction may be different. After executing the first blockchain transaction, the destination node can immediately terminate the execution process for other blockchain transactions to ensure that only the first blockchain transaction is successfully executed, thereby maintaining consistent transaction execution results with other destination nodes and reducing computing power loss caused by invalid processing.

[0122] As mentioned above, because the source blockchain network may participate in the processing of multiple cross-chain requests at the same time (such as each source node generates multiple cross-chain messages in a short period of time), the destination blockchain network may respond to multiple cross-chain messages and process multiple blockchain transactions at the same time (such as receiving the second cross-chain message before the response process for the first cross-chain message is completed), in order to avoid confusion between different cross-chain messages or different blockchain transactions, the association between cross-chain messages and blockchain transactions can be achieved through request identifiers, that is, the request identifier is used as the aforementioned unique identifier. For example, in the case where the cross-chain message is generated by the source node executing a smart contract, the source node can use the contract identifier of the smart contract (such as the contract address, contract number, contract name, etc.) as the request identifier of the cross-chain message; or, in the case where the above cross-chain message is generated by the source node executing a certain contract task defined in the smart contract, the source node can use the task identifier of the contract task as the request identifier of the cross-chain message, and then, the blockchain transaction generated by the destination node according to the received cross-chain message also includes the request identifier of the request, thereby ensuring that the cross-chain messages sent by each source node and the blockchain transactions generated by each destination node contain the request identifier. That is, the request identifier is used to associate the cross-chain messages sent by each source node for the same smart contract (or contract task), and the request identifier is used to associate the blockchain transactions generated by each destination node in response to the cross-chain messages corresponding to the request identifier, thereby realizing the association of all cross-chain messages and all blockchain transactions corresponding to the same smart contract (or contract task), which helps to effectively distinguish between different cross-chain messages or different blockchain transactions.

[0123] Because any destination node in the destination blockchain network may simultaneously participate in the processing of multiple cross-chain messages containing different request identifiers, in order to avoid repeated execution of blockchain transactions containing the same request identifier, the destination blockchain network can maintain a request identifier set, which is used to record the request identifiers carried in the blockchain transactions that have been executed in the destination blockchain network at the current moment. Thus, any destination node can execute a blockchain transaction among multiple blockchain transactions that have passed consensus in the following manner: after determining that a blockchain transaction has passed consensus, the destination node can extract the target request identifier contained in the message, and then query the target request identifier in the locally maintained request identifier set, and execute the blockchain transaction if the query result shows that the target request identifier is not recorded in the request identifier set. It can be understood that if the above request identifier set contains the target request identifier, it means that several blockchain transactions corresponding to the target request identifier (generated by several destination nodes respectively) have not been executed, so the destination node only needs to execute the blockchain transaction to achieve the response to the cross-chain message. Of course, after any destination node completes the execution of the above blockchain transaction, the target request identifier can be added to the above request identifier set to ensure that other blockchain transactions corresponding to the target request identifier will not be repeatedly executed.

[0124] In one embodiment, the message content may include data to be processed, and the cross-chain message may be created by the destination node calling a smart contract deployed on the destination blockchain network; accordingly, the destination node may call the smart contract task callback method in response to the cross-chain message to return the data to be processed to the smart contract. In accordance with the aforementioned embodiment of automatic login to the user account, it is assumed that the destination node executes a smart contract for implementing user account login, but the destination node does not save the user account and login password locally, so that the destination node can generate a cross-chain message for obtaining the user account and login password, and then after the source node in the source blockchain network returns the cross-chain message in response to the request, the destination node can realize automatic login to the user account according to the user account and login password contained in the cross-chain message. At this time, the user account and login password are the data to be processed, and the destination node returns the user account and login password to the smart contract for implementing business functions.

[0125] Furthermore, because the request identifier set records the request identifiers included in the executed blockchain transaction, in order to avoid invalid responses to the obtained cross-chain messages and invalid consensus on the obtained blockchain transactions, any target node can query whether the request identifier included in the cross-chain message or the blockchain transaction is recorded in the request identifier set after obtaining any cross-chain message or any blockchain transaction. Furthermore, if it is determined that the request identifier included in any cross-chain message is recorded in the request identifier set, the response process for the cross-chain message can be terminated; or, if it is determined that the request identifier included in any blockchain transaction is recorded in the request identifier set, the consensus process for the blockchain transaction can be terminated.

[0126] In one embodiment, the same smart contract may be deployed in the source blockchain network and the destination blockchain network, the cross-chain message may contain the data to be processed, and the cross-chain message may be created by the source node calling the smart contract deployed in the source blockchain network; accordingly, the source node may call the smart contract task callback method in response to the cross-chain message to return the data to be processed to the locally deployed smart contract. For example, the smart contract may be used to update local data with the data to be processed, or may also use the data to be processed obtained through the callback method to implement other business functions, such as participating in privacy computing.

[0127] Through the above embodiments, after each destination node in the destination blockchain network obtains the cross-chain message generated by the source node in the source blockchain network, it generates a blockchain transaction according to the cross-chain message obtained by itself and submits the consensus, and then each destination node executes the same blockchain transaction. Because the cross-chain messages obtained by each destination node are from the source blockchain network, the blockchain transactions generated by each node according to the cross-chain message obtained by itself can contain the same blockchain message, and then each node can obtain the same execution result after executing the same blockchain transaction through consensus, that is, each destination node can obtain a consistent processing result after processing the cross-chain message sent by the source blockchain network.

[0128] So far, a complete introduction to the processing process of the destination node in the destination blockchain network responding to the cross-chain message sent by the source blockchain network has been completed. In fact, each destination node can also respond to the cross-chain message and return a response message to the source blockchain network (that is, the destination blockchain network regards the cross-chain message sent by the source blockchain network as the cross-chain request initiated by it), or return a response message to the source blockchain network after executing the blockchain transaction. The response information contained in the above response message can be the response result of the destination node to the cross-chain message or the execution result of the blockchain transaction, and then the source node can perform corresponding operations according to the response information. The following describes the acquisition, verification and subsequent processing of the response message by the source node.

[0129] In one embodiment, to ensure the privacy of the response message sent and avoid leakage of the response information, any destination node can use digital envelope technology to encrypt the response message to be transmitted. The specific transmission method can be found in the description of the above embodiment, which will not be repeated here.

[0130] The destination node in the destination blockchain network can send (i.e. broadcast) a response message to each source node in the source blockchain network, or each destination node can also send (i.e. unicast or multicast) a response message to any one (or more) source nodes in the source blockchain network, and each source node synchronizes the response message received by itself to other source blockchain nodes in the source blockchain network. It can be seen that whether the response message is sent by broadcasting, or by unicast or multicasting and synchronized by the receiver in its own network, it can ensure that each source node in the source blockchain network receives a response message sent by at least one destination node in the destination blockchain network. In addition to using the broadcast method described in the aforementioned embodiment (the digital envelope uses the node public key of each subnet node in the source blockchain network to encrypt the symmetric key), any destination node can also determine the sender of the cross-chain message based on the cross-chain message it receives, and then only return the corresponding response message to the sender. For example, after receiving the cross-chain message sent by the source node nodeA1 in subnet1 via unicast, the destination node nodeA2 in subnet2 can only return the corresponding response message to nodeA1, and nodeA1 will synchronize it to other source nodes such as nodeB1, nodeC1 and nodeD1 in the source blockchain network after receiving the response message. Obviously, the above two methods can ensure that each source node in the source blockchain network receives the response message returned by each destination node in the destination blockchain network.

[0131] In one embodiment, the destination blockchain network may be a blockchain subnet managed by a blockchain main network, which maintains node identity information of each destination node in the destination blockchain network. The above-mentioned response message includes identity verification information for characterizing the node identity of the destination node that returns the response message. Accordingly, each source node may query the blockchain main network for the node identity information of the destination node included in the returned response message to verify the identity verification information, and generate a blockchain transaction based on the verified response message.

[0132] Still Figure 4For example, after receiving the response message returned by nodeA2, nodeA1 can also query the node identity information of nodeA2 to A in subnet0 according to the identity information of nodeA2 carried in the response message, so as to verify the identity information of nodeA2. If the verification is passed, it shows that nodeA2 is indeed the trusted sender of the response message received by nodeA1, so that nodeA1 can further carry out subsequent processing according to the response message received, such as generating blockchain transactions (specific generation process can be seen in the following embodiments, and will not be repeated here). Otherwise, if the verification is not passed, it shows that nodeA2 is untrustworthy, and now nodeA1 can directly discard the response message. Of course, in the case of verification not passing, nodeA1 can also record nodeA2 as an illegal destination node, so that in the case of receiving the response message returned by nodeA2 again in the future, the information can be directly discarded to avoid invalid processing and speed up the response speed. Of course, when sending cross-chain messages in unicast mode, if nodeA1 records nodeA2 as an illegal destination node, nodeA1 can refuse to send cross-chain messages to nodeA2, and can even synchronize nodeA2’s illegal records to other source nodes in subnet1.

[0133] In the aforementioned embodiment where the destination blockchain network is a blockchain subnet, when the main network node in the blockchain main network and the subnet node in the blockchain subnet managed by the blockchain main network are deployed on the same node device, the main network node and the subnet node on the node device can share the blockchain plug-in running on the node device. At this time, the source node can query the node identity information of the destination node through the blockchain plug-in, such as reading the node identity information of the destination node maintained by the main network node through the blockchain plug-in shared with the main network node deployed on the node device to which it belongs. For the specific reading method, please refer to the relevant records of the aforementioned embodiment. Obviously, in the case where network nodes belonging to different blockchain networks are deployed in the same node device, the blockchain plug-in of the node device shared by each node can realize efficient reuse of the blockchain plug-in, and effectively reduce the number of blockchain plug-ins that need to be deployed in the node device, which helps to simplify the node device configuration and the deployment process of the blockchain node, and improve the deployment efficiency of the blockchain node and the management efficiency of the node device. In fact, different blockchain nodes deployed in the same node device can also share other functional plug-ins, such as the aforementioned P2P plug-in instance, consensus plug-in instance and / or business instance, etc., which will not be repeated.

[0134] In the aforementioned embodiment where the destination blockchain network is a blockchain subnet, a subnet management contract can be deployed on the blockchain main network. The subnet management contract is used to maintain the node identity information of the subnet nodes in each blockchain subnet established based on the blockchain main network; at this time, the source node can read the node identity information of the destination node maintained by the subnet management contract. Figure 4 For example, because subnet1 to which subnet node nodeA1 belongs and subnet2 to which subnet node nodeA2 belongs are both established on the basis of subnet0, the subnet management contract deployed in subnet0 can be used to manage the node identity information of each subnet node in subnet1 and subnet2, and then nodeA1 can read the node identity information of nodeA2 maintained by the subnet management contract. By maintaining the node identity information of the subnet nodes by the subnet management contract deployed in the blockchain main network, efficient management of the node identity information can be guaranteed. The source node directly reads the node identity information of the destination node maintained by the subnet management contract, so that the process of obtaining the node identity information does not require the consensus of the main network nodes in the blockchain main network, which helps to improve the efficiency of obtaining the node identity information.

[0135] In the aforementioned embodiment where the destination blockchain network is a blockchain subnet, the identity verification information of any subnet node may include the node identifier declared by the subnet node and the subnet identifier of the blockchain subnet to which the subnet node belongs; at this time, the source node may query the blockchain main network whether the node identifier and subnet identifier declared by the destination node match. Figure 4 For example, after receiving the response message returned by nodeA2, nodeA1 can query subnet0 whether the node identifier and subnet identifier declared by nodeA2 match, and then perform corresponding processing according to the query result, such as generating a blockchain transaction according to the received response message if the two match; or terminating and directly discarding the response message if the two do not match, etc., which will not be repeated. In this way, the node identity information of each subnet node maintained in the blockchain main network can be fully utilized to verify the response message sent by the subnet node to ensure the legitimacy of the subsequently processed message.

[0136] In the aforementioned embodiment where the destination blockchain network is a blockchain subnet, the identity information of any subnet node may also include a signature generated by the subnet node based on its own node private key; at this time, querying the blockchain main network for the node identity information of the destination node to verify the identity information carried in the response message may include: the source node receiving the response message may query the blockchain main network for the node public key of the destination node that sent the response message, and use the node public key to verify the signature of the destination node contained in the above response message. Figure 4For example, after receiving the response message and the corresponding destination node signature returned by nodeA2, nodeA1 can request subnet0 to obtain the node public key of nodeA2 and verify the signature, and then perform corresponding processing according to the verification result: if the verification is successful, subsequent processing can be performed according to the response message, such as generating a blockchain transaction, etc.; and if the verification fails, the response to the response message can be terminated, such as directly discarding the response message or even recording nodeA2 as an illegal node. Of course, if nodeA2 is recorded as an illegal node, nodeA1 can not send the cross-chain message to nodeA2 after generating a cross-chain message again (such as not using the node public key of nodeA2 to encrypt the symmetric key in the aforementioned digital envelope), so as to avoid invalid transmission.

[0137] As mentioned above, because the multiple response messages received by any source node are generated by the destination node in response to the cross-chain message sent by the source node, in the case where there are no illegal nodes in the source blockchain network and the destination blockchain network, the multiple response messages received by any source node should contain the same response information. Therefore, for the multiple response messages received by any source node, the source node can compare the response information contained in each response message and verify the response message containing the same response information. Alternatively, the source node can also use a variety of fault-tolerant algorithms such as the PBFT algorithm and the HoneyBadgerBFT algorithm to verify multiple response messages containing the same response information, and the specific process will not be repeated. Of course, in the practice of the scheme, the total number of nodes and the number of messages received by the cross-chain message can also be other values, and this specification does not limit this. Among them, the response message (containing the same message content) that passes the above verification will be used for subsequent processing, such as being used to generate blockchain transactions.

[0138] As mentioned above, each destination node in the destination blockchain network will return a response message containing the same request identifier to the source blockchain network so that each source node can obtain the response message respectively. Because each destination node generates a response message based on a cross-chain message containing the same message content, or generates a response message after executing a blockchain transaction containing the same message content, each response message received by each source node contains the same response information, and each destination node needs to respond to any response message respectively.

[0139] Take the process of responding to a response message including generating and executing a blockchain transaction according to the response message (obviously, the blockchain transaction generated by the source node is different from the blockchain transaction generated by the source node described in the aforementioned embodiment) as an example for explanation. In order to ensure the reliability of the blockchain transactions executed by each source node, the response message returned by the destination node can be processed in a variety of ways. One way is "decentralized verification and separate proposal", that is, each source node performs a Byzantine fault tolerance check on each response message received by itself, and generates a blockchain transaction based on the verified response message; the other way is "decentralized verification and centralized proposal", that is, each source node verifies any response message received and adds the source node signature generated by itself, and then any source node generates a blockchain transaction based on the response message when it determines that the number of source node signatures of any response message can pass the Byzantine fault tolerance check. The two methods are explained below:

[0140] (1) Decentralized verification and proposal

[0141] First of all, it should be noted that the multiple response messages obtained by any source node mentioned in this embodiment all contain the same request identifier. In this embodiment, after obtaining any response message, the source node can first verify whether the response message is legal, and then determine the number of response messages that are verified to be legal and contain the same response information, and when the number of messages and the total number of nodes of the destination nodes in the destination blockchain network enable the response message to pass the Byzantine fault tolerance check, use this part of the response message that passes the Byzantine fault tolerance check to generate a blockchain transaction and submit it to the source blockchain network for consensus.

[0142] In one embodiment, D1 can first verify whether each response message it obtains is legal. For example, for any response message, if the response message contains the signature of the destination node that generated the response message (i.e., the generator of the response message), the source node can obtain the node public key of the destination node and use the node public key to verify the signature: if the signature verification passes, it indicates that the response message is legal; otherwise, it indicates that the response message is illegal, and the response message can be directly discarded. Among them, in the case where the destination blockchain network is a blockchain subnet managed by the blockchain main network, the blockchain main network can maintain the IP address, port, node public key, node identification and other information of the subnet nodes of each blockchain subnet created based on the blockchain main network. Therefore, the source node can query the node public key of the destination node from the blockchain main network. The specific process can be found in the records of the aforementioned embodiment, which will not be repeated here. Alternatively, when the response message contains the subnet identifier of the destination blockchain network and the node identifier of the destination node, the source node can also query the blockchain main network whether the node identifier exists under the subnet identifier: if it exists, it indicates that the response message and the destination node are legal; otherwise, it indicates that the response message or the destination node is illegal, and the response message can be directly discarded.

[0143] As mentioned above, under normal circumstances where there are no malicious nodes in the source blockchain network and the destination blockchain network, all response messages containing the same request identifier should contain the same response information, so any source node can compare whether the response information contained in multiple legitimate response messages it obtains is the same. Obviously, if the response information contained in multiple legitimate response messages is the same, it indicates that the response information in each response message has not been tampered with; otherwise, it indicates that the response message that is different from the response information in other response messages (usually the majority of others) may have been tampered with, and the response message can be directly discarded at this time.

[0144] When all the above checks are passed, the source node can further perform a Byzantine fault-tolerant check on the legal response message containing the same response information. For example, the legal response message containing the same response information obtained by itself can be fault-tolerantly checked according to the number of cross-chain messages obtained by itself and the total number of nodes of the destination nodes in the destination blockchain network. Among them, in the case where the destination blockchain network is a blockchain subnet managed by the blockchain main network, the above blockchain main network can maintain the total number of nodes of the destination nodes in the destination blockchain network, so the above source node can query the blockchain main network for the total number of nodes of the destination nodes in the destination blockchain network. At this time, the subnet information of the blockchain subnet maintained by the blockchain main network can be fully utilized, which helps to improve the interaction efficiency. In addition, after the source node queries the relevant information of the destination node from the blockchain main network, it can save it locally to avoid repeated queries in the subsequent processing process, and further improve the interaction efficiency. Of course, in order to ensure the timeliness of the above relevant information, the effective duration can also be set for the relevant information stored locally to update the relevant information in time.

[0145] Still Figure 4 Take the example to illustrate the above process. Assuming that the source node nodeA1 receives the response messages returned by the destination nodes nodeA2, nodeB2, nodeC2 and nodeE2, nodeA1 can verify each response message according to the destination node signature and other information carried by each response message to determine whether each response message is legal; secondly, it can further compare whether the response information contained in each legal response message is the same to find out the legal response message containing the same response information; then, the legal response message containing the same response information can be verified by Byzantine fault tolerance based on the number of legal response messages and the total number of nodes of the destination blockchain network queried from the main network node. Among them, because the destination blockchain network includes destination nodes nodeA2, nodeB2, nodeC2 and nodeE2, the total number of nodes is 3f+1=4 (ie f=1), so the critical number f+1=2-indicates that if nodeA1 receives 2 legal response messages containing the same response information, then these 2 legal response messages pass the Byzantine fault tolerance verification.

[0146] If the above Byzantine fault tolerance verification is passed, the source node can use the verified response message to generate a blockchain transaction. For example, let's assume that the number of nodes with the above legal response message containing the same response information is 3. Since these three response messages contain the same response information, the source node can generate a blockchain transaction containing the response information and submit the blockchain transaction to the destination blockchain network for consensus. It can be seen that only response messages that pass the Byzantine fault tolerance verification (containing the same data to be processed) will be used to generate blockchain transactions.

[0147] Obviously, the blockchain transactions generated by any of the above source nodes need to be broadcast to other source nodes, and the blockchain transactions generated by other source nodes will also be broadcast to the source node. Any source node can use the response information or the hash of the response information to verify the blockchain transactions generated by other source nodes it receives.

[0148] For example, any source node can compare the first response information contained in the response message obtained by itself with the second response information contained in the blockchain transaction received by itself, and verify the blockchain transaction: if the first response information is the same as the second response information, it can be determined that the above-mentioned blockchain transaction has passed the verification; otherwise, if the first response information is different from the second response information, it is determined that the above-mentioned blockchain transaction has not passed the verification. Alternatively, in order to improve the verification efficiency of blockchain transactions generated by other source nodes, the blockchain transaction generated by any source node can also carry the hash of the response information, so that the source node can use the hash as the second hash, and use the hash of the response information carried in the response message received by itself as the first hash. Then, by comparing whether the above-mentioned first hash and the second hash are the same, the verification of the above-mentioned blockchain transaction broadcasted by other source nodes can be realized: if the first hash and the second hash are the same, it can be determined that the above-mentioned blockchain transaction has passed the verification; otherwise, if the first hash and the second hash are different, it is determined that the above-mentioned blockchain transaction has not passed the verification. Usually, the amount of data in the response information is much larger than the amount of data in the hash, so the verification efficiency can be effectively improved by comparing the hash.

[0149] It can be seen that if the process of generating blockchain transactions and initiating consensus is regarded as a "proposal" process for response messages, then in this embodiment, each source node in the source blockchain network verifies the response message it obtains (i.e., decentralized verification), and each source node that passes the verification uses the verified response message to generate blockchain transactions and initiate consensus (i.e., decentralized proposal). Obviously, this method can have as many source nodes as possible initiate blockchain transactions corresponding to the same request identifier, fully ensuring that each source node can execute blockchain transactions, thereby completing the response closed loop to the cross-chain message sent by itself (i.e., the cross-chain request initiated by itself).

[0150] (2) Decentralized verification and centralized proposal

[0151] First of all, it should be noted that the multiple response messages obtained by any source node mentioned in this embodiment all contain the same request identifier. After obtaining the response messages returned by each destination node, any source node can verify the response message obtained by itself, and construct a reconstruction message including the message content of the response message and the signature of the source node generated by itself according to the response message obtained by itself if the verification is passed (obviously, the reconstruction message in this scheme is different from the reconstruction message generated by the destination node according to the cross-chain message in the aforementioned embodiment), and then broadcast the reconstruction message to other source nodes in the source blockchain network. It can be understood that each source node in the source blockchain network will perform the above operations respectively, so that any source node can verify the reconstruction message after receiving any reconstruction message broadcast by other source nodes, and add the signature of the source node generated by itself to the reconstruction message if the verification is passed, and continue to broadcast the reconstruction message to other source nodes in the source blockchain network. Until any source node determines that the received reconstruction message passes the Byzantine fault tolerance check based on the number of signatures of the source nodes contained in the received reconstruction message and the total number of source nodes contained in the source blockchain network, the source node generates a blockchain transaction based on the received reconstruction message and submits it to the source blockchain network for consensus.

[0152] The reconstruction message includes the response information included in the response message used to construct the reconstruction message and the source node signature generated by the source node that constructs the reconstruction message (i.e., the builder of the reconstruction message). It can be understood that for any reconstruction message, the above-mentioned processing of "receiving reconstruction messages broadcast by other nodes - adding the source node signature generated by itself after verifying the reconstruction message - continuing to broadcast the reconstruction message after adding the source node signature generated by itself" can be performed in sequence by multiple source nodes in the source blockchain network; and when any source node finds that any reconstruction message it receives already contains the source node signature generated by itself, it means that it has already performed the above-mentioned processing on the reconstruction message, and thus the reconstruction message can be directly discarded.

[0153] Among them, the verification process of any source node for any reconstruction message may include the verification process of the source node signature contained in the reconstruction message; of course, if the reconstruction message also includes the destination node signature of the response message corresponding to the response information in the reconstruction message, then the verification process of any reconstruction message may also include the verification process of the destination node signature, which are explained separately below.

[0154] In one embodiment, each source node in the source blockchain network can use the node public key of other source nodes to verify the reconstruction message it receives. For example, each source node can verify the source node signature contained in the received reconstruction message using the node public key of other source nodes maintained by itself. Figure 4 For example, it can be understood that any source node in the source blockchain network locally maintains the node public key of other source nodes, and accordingly, each other source node locally also maintains the node public key of the source node. For example, after nodeA1 adds the source node signature generated by its own node public key to the reconstruction message and broadcasts it, the other source nodes (nodeB1, nodeC1 and nodeD1) that receive the reconstruction message can use the node public key of nodeA1 maintained locally to verify (i.e., verify the signature) the source node signature added by nodeA1 contained in the reconstruction message. Similarly, if nodeB1 verifies the reconstruction message, it can add the source node signature generated by its own node public key to the reconstruction message. If it determines that the current number of signatures cannot pass the Byzantine fault tolerance check, it will continue to broadcast. After receiving the reconstruction message, nodeC1 and nodeD1 can verify the source node signatures added by nodeA1 and nodeB1 respectively according to the node public keys of nodeA1 and nodeB1 maintained locally. If the verification passes, it will add the source node signature generated by itself, and further determine whether the current reconstruction message can pass the Byzantine fault tolerance check: if it passes, it can generate a blockchain transaction based on the reconstruction message; otherwise, if it does not pass, it can continue to broadcast the reconstruction message. Of course, after the above nodeA1 receives the reconstruction message broadcast by nodeB1, it can determine that it contains the source node signature added by itself, so it can directly discard the reconstruction message.

[0155] In another embodiment, the above-mentioned destination blockchain network can be a blockchain subnet managed by the blockchain main network, and the blockchain main network can maintain the node public key of each destination node in the destination blockchain network. In addition to the above-mentioned response information and source node signature, the above-mentioned reconstruction message also includes the destination node signature carried in each response message received by the source node that constructs the reconstruction message (that is, the destination node signature carried by each response message corresponding to the response information contained in the reconstruction message). Therefore, each source node can further verify the reconstruction message received by itself. For example, each source node can query the blockchain main network for the node public key of the destination node indicated by the reconstruction message received by itself, and verify the destination node signature contained in the reconstruction message received by itself through the queried node public key. The specific acquisition method and verification method of the node public key can refer to the detailed record of the aforementioned embodiment, which will not be repeated here. In this embodiment, after receiving the reconstruction message, the source node not only verifies the source node signature added by the source node contained in the reconstruction message, but also verifies the destination node signature contained in the reconstruction message through the node public key of the corresponding destination node obtained from the blockchain main network, thereby achieving double verification of the reconstruction message, further ensuring the reliability of the reconstruction message used to generate blockchain transactions, and avoiding inconsistent transaction execution results that may be caused by illegal nodes within the source blockchain network reconstructing response information or even forging signatures.

[0156] It can be seen that every time a reconstruction message is broadcasted in the source blockchain network, a new source node signature will be added. Therefore, each source node that receives the reconstruction message can perform a Byzantine fault-tolerance check on the reconstruction message. For example, the reconstruction message can be checked by the number of signatures of the source nodes contained in the received reconstruction message and the total number of source nodes contained in the source blockchain network. If any source node passes the verification of any reconstruction message, it can generate a blockchain transaction based on the reconstruction message and submit it to the source blockchain network for consensus. Figure 4For example, the source node nodeC1 can first determine the total number of nodes (3f+1) in its subnet1, and then verify the reconstruction message after receiving any reconstruction message broadcast by other source nodes, and add the source node signature generated by itself to the reconstruction message after verification, and then determine whether the number of signatures of the source node signatures contained in the current reconstruction message meets (is not less than) the first critical value f+1 corresponding to the above-mentioned total number of nodes, and generate a blockchain transaction based on the reconstruction message if it meets (that is, the reconstruction message has been recognized by f+1 destination nodes). Alternatively, to further speed up the processing speed, the source node nodeC1 can also determine the number of signatures of the source node signatures contained in the reconstruction message after receiving any reconstruction message broadcast by other source nodes, and determine whether the number of signatures meets (is not less than) the second critical value f corresponding to the above-mentioned total number of nodes. If it meets, the source node can generate a blockchain transaction based on the reconstruction message if the reconstruction message is verified (at this time, the number of source nodes that have verified the reconstruction message meets f+1). In this manner, when nodeC1 determines that the reconstructed message meets the preset conditions, it is not necessary to add the source node signature generated by itself to the reconstructed message, which helps to further speed up the processing.

[0157] Among them, in the case where the destination blockchain network is a blockchain subnet managed by the blockchain main network, the blockchain main network can maintain the total number of nodes of the destination nodes in the destination blockchain network, so each source node can query the total number of nodes of the destination nodes in the destination blockchain network from the blockchain main network, and perform the above-mentioned Byzantine fault tolerance verification based on the total number of nodes. In addition, in the embodiments of the blockchain main network and blockchain subnet mentioned in this specification, after the blockchain subnet queries the blockchain main network for the corresponding information, the information can be saved locally to avoid repeated queries in subsequent processing and further improve the interaction efficiency. Of course, in order to ensure the timeliness of the above information, the effective time can also be set for the locally stored information to update the above information in time. It is understandable that only the reconstruction message that is verified by Byzantine fault tolerance by a source node in the source blockchain network will be used to generate blockchain transactions.

[0158] So far, the two ways of processing the response message returned by the destination node have been introduced. Among them, for any generated blockchain transaction, proof of work, proof of equity, delegated proof of equity, practical Byzantine fault tolerance algorithm, HoneyBadgerBFT algorithm, etc. can be used for consensus, and the specific process will not be repeated.

[0159] Because each source node generates a blockchain transaction based on the response message it obtains, or constructs a reconstruction message based on the verified response message it obtains, and generates a blockchain transaction based on the reconstruction message when the reconstruction message passes the Byzantine fault tolerance check, there may be multiple blockchain transactions corresponding to the above cross-chain request in the source blockchain network that have passed consensus. However, in order to ensure the consistency of the blockchain transaction execution results, each source node is required to execute the same blockchain transaction that has passed consensus, so as to achieve the same business effect. In order to ensure that each source node in the source blockchain network executes the same blockchain transaction that has passed consensus, each source node can execute the first blockchain transaction that has passed consensus in the source blockchain network. Alternatively, the first blockchain transaction generated first in the blockchain transaction that has passed consensus can also be executed. For example, each source node can ensure that the executed blockchain transaction is the first blockchain transaction generated based on the timestamp carried by the blockchain transaction. After executing the above blockchain transaction, any source node can terminate the processing process for other blockchain transactions. For example, if any blockchain transaction carries a request identifier, then the source node may not execute the new blockchain transaction (i.e., not execute the contract code related to the specific business) when receiving a new blockchain transaction carrying the same request identifier as the executed blockchain transaction. Of course, the source node may also receive multiple blockchain transactions carrying the same request identifier in a short period of time, and verify and execute each transaction in the order in which each transaction is received. Therefore, the processing progress of each blockchain transaction may be different. After executing the first blockchain transaction, the source node can immediately terminate the execution process for other blockchain transactions to ensure that only the first blockchain transaction is successfully executed, thereby maintaining consistent transaction execution results with other source nodes and reducing computing power loss caused by invalid processing.

[0160] As mentioned above, the blockchain transaction generated by the source node in response to the response message may include the request identifier carried by the response message, thereby realizing the mutual association between the cross-chain message, the response message and the blockchain transaction. The source blockchain network can maintain a request identifier set (obviously, the request identifier set maintained by the source node is not the same as the request identifier set maintained by the destination node described in the above embodiment), which is used to record the request identifier carried in the cross-chain message that has not been responded to in the source blockchain network at the current moment (i.e., the cross-chain message whose corresponding blockchain transaction has not been executed). Thus, after any source node determines that a blockchain transaction has passed consensus, it can extract the target request identifier contained in the message, and query the target request identifier in the locally maintained request identifier set, and execute the blockchain transaction if the query result shows that the target request identifier is recorded in the request identifier set. It can be understood that if the above request identifier set contains the target request identifier, it means that the several blockchain transactions corresponding to the target request identifier (generated by several source nodes respectively) have not been executed, so the source node only needs to execute the blockchain transaction to achieve the response to the cross-chain message. Of course, after any source node completes the execution of the above blockchain transaction, the target request identifier can be deleted from the request identifier set to ensure that other blockchain transactions corresponding to the target request identifier will not be repeatedly executed.

[0161] In one embodiment, the cross-chain message can be created by the source node calling the smart contract deployed on the source blockchain network; accordingly, the source node can call the smart contract task callback method in response to the above response message to return the response information to the above smart contract. Furthermore, because the request identifier set records the request identifier contained in the blockchain transaction that has not yet been executed, in order to avoid invalid responses to the obtained cross-chain messages and invalid processing of the obtained reconstruction messages, any target node can query whether the request identifier contained in the cross-chain message or the reconstruction message is recorded in the request identifier set after obtaining any cross-chain message or any reconstruction message. Furthermore, if it is determined that the request identifier contained in any response message is not recorded in the request identifier set, the response process for the response message can be terminated; or, if it is determined that the request identifier contained in any reconstruction message is not recorded in the request identifier set, the processing process for the reconstruction message can be terminated.

[0162] Through the above embodiments, on the one hand, multiple source nodes verify and sign the response message (or reconstruction message) multiple times, which ensures that the response message (or reconstruction message) used to generate the blockchain transaction is recognized by enough source nodes. On the other hand, each source node executes the same blockchain transaction respectively, which effectively ensures the consistency of the response results of each source node to the cross-chain message generated by itself.

[0163] Figure 7This is a schematic diagram of a device structure provided by an exemplary embodiment. Figure 7 At the hardware level, the device includes a processor 702, an internal bus 704, a network interface 706, a memory 708, and a non-volatile memory 710, and may also include hardware required for other services. One or more embodiments of this specification may be implemented based on software, such as the processor 702 reading the corresponding computer program from the non-volatile memory 710 into the memory 708 and then running it. Of course, in addition to the software implementation, one or more embodiments of this specification do not exclude other implementations, such as logic devices or a combination of software and hardware, etc., that is, the execution subject of the following processing flow is not limited to each logic unit, but can also be hardware or logic devices.

[0164] Figure 8 This is a block diagram of a cross-chain interaction device provided by an exemplary embodiment. Please refer to Figure 8 , the device can be applied to Figure 7 The cross-chain interaction device may include:

[0165] The message receiving unit 801 enables each destination node in the destination blockchain network to respectively obtain a cross-chain message sent by at least one source node in the source blockchain network to the destination blockchain network;

[0166] The transaction consensus unit 802 enables each destination node to generate a blockchain transaction according to the cross-chain message obtained by itself, and submit the generated blockchain transaction to the destination blockchain network respectively;

[0167] The transaction execution unit 803 enables each destination node to respectively execute the same blockchain transaction among the multiple blockchain transactions that have passed consensus.

[0168] Optionally, also include:

[0169] The message encryption unit 804 enables the source node to use its own node private key to sign the blockchain message to be transmitted, use the symmetric key to encrypt the message content to be transmitted and the signature of the blockchain message, use the node public key of each destination node to encrypt the symmetric key respectively, and add the encrypted signature, the encrypted message content and the encrypted symmetric keys to the cross-chain message;

[0170] The message decryption unit 805 enables each destination node to decrypt the symmetric key encrypted by its own node public key in the cross-chain message through its own node private key, decrypt the encrypted message content and the signature through the decrypted symmetric key, and obtain the message content for generating the blockchain transaction when the signature is verified through the node public key of the source node.

[0171] Optionally, the source blockchain network is a blockchain subnet managed by a blockchain main network, the blockchain main network maintains node identity information of each source node in the source blockchain network, and the cross-chain message includes identity certification information for representing the node identity of the source node sending the cross-chain message; the device also includes:

[0172] The destination node verification unit 806 enables each destination node to query the blockchain main network for the node identity information of the source node that sends the cross-chain message to verify the identity information, and respond to the cross-chain message if the verification passes.

[0173] Optionally, the destination blockchain network is a blockchain subnet managed by a blockchain main network. When the main network node in the blockchain main network and the subnet node in the blockchain subnet managed by the blockchain main network are deployed on the same node device, the main network node and the subnet node on the node device share the blockchain plug-in running on the node device; the destination node verification unit 806 is also used to:

[0174] Each destination node reads the node identity information of the source node that sends the cross-chain message maintained by the main network node through the blockchain plug-in shared with the main network node deployed on its own node device.

[0175] Optionally, a subnet management contract is deployed on the blockchain main network, and the subnet management contract is used to maintain the node identity information of the subnet nodes in each blockchain subnet established based on the blockchain main network; the destination node verification unit 806 is also used to:

[0176] Enable each destination node to read the node identity information of the source node that sends the cross-chain message maintained by the subnet management contract.

[0177] Optionally, the identity authentication information of any source node includes the node identifier declared by any source node and the subnet identifier of the blockchain subnet to which any source node belongs; the destination node verification unit 806 is further used to:

[0178] Each destination node queries the blockchain main network to see whether the node identifier and subnet identifier declared by the source node that sends the cross-chain message match.

[0179] Optionally, the identity authentication information of any source node includes a signature generated by any source node based on its own node private key; the destination node verification unit 806 is further used to:

[0180] Each destination node queries the blockchain main network for the node public key of the source node that sends the cross-chain message, and uses the node public key to verify the signature.

[0181] Optionally, also include:

[0182] The message verification unit 807 enables each destination node to perform Byzantine fault tolerance verification on the cross-chain message obtained by itself according to the number of cross-chain messages obtained by itself and the total number of source nodes in the source blockchain network, and generate the blockchain transaction according to the cross-chain message that passes the verification.

[0183] Optionally, the source blockchain network is a blockchain subnet managed by a blockchain main network, the blockchain main network maintains the total number of source nodes in the source blockchain network, and the device further includes:

[0184] The total amount query unit 808 enables each destination node to query the total amount of the node from the blockchain main network respectively.

[0185] Optionally, the message verification unit 807 is further used to:

[0186] Each destination node performs a Byzantine fault tolerance check on the cross-chain message it obtains according to the number of cross-chain messages containing the same message content obtained by itself and the total number of source nodes in the source blockchain network.

[0187] Optionally, the blockchain transaction includes data to be processed, and the device further includes:

[0188] The transaction verification unit 809 enables each destination node to verify the blockchain transactions submitted by other source nodes according to the first data to be processed contained in the cross-chain message obtained by itself and the second data to be processed contained in the blockchain transactions submitted by other destination nodes, or according to the first hash calculated by itself according to the first data to be processed contained in the cross-chain message obtained and the second hash of the second data to be processed contained in the blockchain transactions submitted by other source nodes, and reach consensus on the blockchain transactions that have passed the verification.

[0189] Optionally, the destination blockchain network maintains a request identifier set, and a cross-chain message received by any destination node and a blockchain transaction generated according to the received cross-chain message contain the same request identifier.

[0190] The transaction execution unit 803 is further used to: enable any destination node to execute the blockchain transaction when it is determined that the target request identifier included in the blockchain transaction is not recorded in the request identifier set;

[0191] The device also includes an identifier adding unit 810, which enables any destination node to add the target request identifier to the request identifier set after successfully executing the blockchain transaction.

[0192] Optionally, the device further comprises:

[0193] The response termination unit 811 enables each destination node to terminate the response process for any cross-chain message when it is determined that the request identifier set records the request identifier included in any cross-chain message.

[0194] Optionally, the same smart contract is deployed in the source blockchain network and the destination blockchain network, the message content of the cross-chain message includes data to be processed, and the device further includes:

[0195] The contract calling unit 812 enables the source node to call the locally deployed smart contract to create the cross-chain message;

[0196] The contract callback unit 813 enables the destination node to call the smart contract task callback method in response to the cross-chain message to return the data to be processed to the locally deployed smart contract.

[0197] Optionally, the smart contract deployed locally at the destination node is used to update local data using the data to be processed.

[0198] Optionally, the blockchain transaction executed by each source node is:

[0199] The first blockchain transaction to pass consensus; or,

[0200] The first blockchain transaction generated among the blockchain transactions that pass consensus.

[0201] The systems, devices, modules or units described in the above embodiments may be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer, which may be in the form of a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email transceiver, a game console, a tablet computer, a wearable device or a combination of any of these devices.

[0202] In a typical configuration, a computer includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.

[0203] The memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.

[0204] Computer-readable media include permanent and non-permanent, removable and non-removable media that can be used to store information by any method or technology. Information can be computer-readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassettes, disk storage, quantum memory, graphene-based storage media or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer-readable media does not include temporary computer-readable media (transitory media), such as modulated data signals and carrier waves.

[0205] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.

[0206] The above is a description of a specific embodiment of the specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0207] The terms used in one or more embodiments of this specification are only for the purpose of describing specific embodiments, and are not intended to limit one or more embodiments of this specification. The singular forms of "a", "said" and "the" used in one or more embodiments of this specification and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used herein refers to and includes any or all possible combinations of one or more associated listed items.

[0208] It should be understood that although the terms first, second, third, etc. may be used to describe various information in one or more embodiments of this specification, these information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of one or more embodiments of this specification, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information. Depending on the context, the word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".

[0209] The above description is merely a preferred embodiment of one or more embodiments of the present specification and is not intended to limit one or more embodiments of the present specification. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of one or more embodiments of the present specification shall be included in the scope of protection of one or more embodiments of the present specification.

Claims

1. A cross-chain interaction method, comprising: Each destination node in the destination blockchain network respectively obtains a cross-chain message sent to the destination blockchain network by at least one source node in the source blockchain network; The source blockchain network and the destination blockchain network are different blockchain networks and a network connection link is established between the two. The source blockchain network is a blockchain subnet created based on the blockchain main network and managed by the blockchain main network. Any main network node in the blockchain main network and the corresponding subnet node in any blockchain subnet managed by the blockchain main network are deployed on the same node device; Each destination node generates a blockchain transaction according to the cross-chain message obtained by itself, and submits the generated blockchain transaction to the destination blockchain network; Each destination node respectively executes the same blockchain transaction among multiple blockchain transactions that have passed consensus in the destination blockchain network.

2. The method according to claim 1, further comprising: The source node uses its own node private key to sign the blockchain message to be transmitted, uses a symmetric key to encrypt the message content to be transmitted and the signature of the blockchain message, uses the node public key of each destination node to encrypt the symmetric key respectively, and adds the encrypted signature, the encrypted message content and the encrypted symmetric keys to the cross-chain message; Each destination node decrypts the symmetric key encrypted by its own node public key in the cross-chain message using its own node private key, decrypts the encrypted message content and the signature using the symmetric key obtained by decryption, and obtains the message content for generating the blockchain transaction when the signature is verified by the node public key of the source node.

3. According to the method of claim 1, the blockchain main network maintains the node identity information of each source node in the source blockchain network, and the cross-chain message includes the identity certification information for representing the node identity of the source node sending the cross-chain message; the method further comprises: Each destination node queries the blockchain main network for the node identity information of the source node that sends the cross-chain message to verify the identity information, and responds to the cross-chain message if the verification passes.

4. According to the method of claim 3, the destination blockchain network is a blockchain subnet managed by the blockchain main network, and the main network node and subnet node on any node device share the blockchain plug-in running on the node device; each destination node respectively queries the blockchain main network for the node identity information of the source node that sends the cross-chain message, including: Each destination node reads the node identity information of the source node that sends the cross-chain message maintained by the main network node through the blockchain plug-in shared with the main network node deployed on its own node device.

5. According to the method of claim 4, the blockchain plug-in includes a P2P plug-in, the network connection link includes a link established between main network nodes deployed in different node devices through the corresponding P2P plug-in, and the source node in any node device sends the cross-chain message to the destination node in another node device, including: The source node in any node device sends the cross-chain message to the destination node in the other node device through the network connection link between the any node device and the other node device.

6. According to the method of claim 1, a subnet management contract is deployed on the blockchain main network, and the subnet management contract is used to maintain the node identity information of the subnet nodes in each blockchain subnet established based on the blockchain main network; each destination node queries the blockchain main network for the node identity information of the source node that sends the cross-chain message, including: Each destination node reads the node identity information of the source node that sends the cross-chain message maintained by the subnet management contract.

7. According to the method of claim 1, the identity information of any source node includes the node identifier declared by any source node and the subnet identifier of the blockchain subnet to which any source node belongs; each destination node queries the blockchain main network for the node identity information of the source node that sends the cross-chain message, including: Each destination node queries the blockchain main network to see whether the node identifier and subnet identifier declared by the source node that sends the cross-chain message match.

8. According to the method of claim 1, the identity information of any source node includes a signature generated by any source node based on its own node private key; each destination node respectively queries the blockchain main network for the node identity information of the source node that sends the cross-chain message to verify the identity information, including: Each destination node queries the blockchain main network for the node public key of the source node that sends the cross-chain message, and uses the node public key to verify the signature.

9. The method according to claim 1, further comprising: Each destination node performs a Byzantine fault tolerance check on the cross-chain message it obtains according to the number of cross-chain messages it obtains and the total number of source nodes in the source blockchain network, and generates the blockchain transaction based on the cross-chain message that passes the check.

10. The method according to claim 9, wherein the source blockchain network is a blockchain subnet managed by a blockchain main network, and the blockchain main network maintains the total number of source nodes in the source blockchain network, and the method further comprises: Each destination node queries the total number of nodes from the blockchain main network respectively.

11. According to the method of claim 9, each destination node performs a Byzantine fault tolerance check on the cross-chain message obtained by itself according to the number of cross-chain messages obtained by itself and the total number of source nodes in the source blockchain network, including: Each destination node performs a Byzantine fault tolerance check on the cross-chain message it obtains based on the number of cross-chain messages containing the same message content it obtains and the total number of source nodes in the source blockchain network.

12. The method according to claim 1, wherein the blockchain transaction contains data to be processed, and the method further comprises: Each destination node verifies the blockchain transactions submitted by other source nodes based on the first data to be processed contained in the cross-chain message obtained by itself and the second data to be processed contained in the blockchain transactions submitted by other destination nodes, or based on the first hash calculated by itself according to the first data to be processed contained in the cross-chain message obtained and the second hash of the second data to be processed contained in the blockchain transactions submitted by other source nodes, and reaches consensus on the blockchain transactions that have passed the verification.

13. According to the method of claim 1, the destination blockchain network maintains a request identifier set, and the cross-chain message received by any destination node and the blockchain transaction generated according to the received cross-chain message contain the same request identifier, Any destination node executes the blockchain transaction, including: Any destination node executes the blockchain transaction when determining that the target request identifier included in the blockchain transaction is not recorded in the request identifier set; The method also includes: after any destination node successfully executes the blockchain transaction, adding the target request identifier to the request identifier set.

14. The method according to claim 13, further comprising: When each destination node determines that the request identifier included in any cross-chain message is recorded in the request identifier set, it terminates the response process for any cross-chain message.

15. According to the method of claim 1, the same smart contract is deployed in the source blockchain network and the target blockchain network, and the message content of the cross-chain message includes data to be processed, and the method further includes: The source node calls the locally deployed smart contract to create the cross-chain message; The destination node calls the smart contract task callback method in response to the cross-chain message to return the data to be processed to the locally deployed smart contract.

16. According to the method of claim 15, the smart contract locally deployed at the destination node is used to update local data using the data to be processed.

17. According to the method of claim 1, the blockchain transaction executed by each source node is: The first blockchain transaction to pass consensus; or, The first blockchain transaction generated among the blockchain transactions that pass consensus.

18. According to the method of claim 1, the target blockchain network is a blockchain subnet managed by the blockchain main network, and the method further comprises: Each destination node returns a response message to at least one source node in the source blockchain network, and the response message includes the execution result of the blockchain transaction.

19. According to the method of claim 18, the blockchain main network maintains the node identity information of each destination node in the destination blockchain network, and the response message includes identity certification information for representing the node identity of the destination node sending the response message; the method further comprises: Each source node queries the blockchain main network for the node identity information of the destination node that sends the response message to verify the identity information, and processes the response message if the verification passes.

20. According to the method of claim 19, the main network node and the sub-network node on any node device share the blockchain plug-in running on the node device; each source node respectively queries the blockchain main network for the node identity information of the destination node that sends the response message, including: Each source node reads the node identity information of the destination node that sends the response message, which is maintained by the main network node, through the blockchain plug-in shared with the main network node deployed on its own node device.

21. According to the method of claim 18, a subnet management contract is deployed on the blockchain main network, and the subnet management contract is used to maintain the node identity information of the subnet nodes in each blockchain subnet established based on the blockchain main network; each source node queries the blockchain main network for the node identity information of the destination node that sends the response message, including: Each source node reads the node identity information of the destination node that sends the response message maintained by the subnet management contract.

22. A cross-chain interaction device, comprising: A message receiving unit enables each destination node in the destination blockchain network to respectively obtain a cross-chain message sent by at least one source node in the source blockchain network to the destination blockchain network; The source blockchain network and the destination blockchain network are different blockchain networks and a network connection link is established between the two. The source blockchain network is a blockchain subnet created based on the blockchain main network and managed by the blockchain main network. Any main network node in the blockchain main network and the corresponding subnet node in any blockchain subnet managed by the blockchain main network are deployed on the same node device; The transaction consensus unit enables each destination node to generate a blockchain transaction according to the cross-chain message obtained by itself, and submit the generated blockchain transaction to the destination blockchain network respectively; The transaction execution unit enables each destination node to respectively execute the same blockchain transaction among multiple blockchain transactions that have passed consensus in the destination blockchain network.

23. An electronic device, characterized in that: include: processor; a memory for storing processor-executable instructions; The processor implements the method according to any one of claims 1 to 21 by running the executable instructions.

24. A computer-readable storage medium having computer instructions stored thereon, characterized in that: When the instruction is executed by a processor, the steps of the method according to any one of claims 1 to 21 are implemented.