WO2023050966A1 - Blockchain data verification - Google Patents

Blockchain data verification Download PDF

Info

Publication number
WO2023050966A1
WO2023050966A1 PCT/CN2022/104372 CN2022104372W WO2023050966A1 WO 2023050966 A1 WO2023050966 A1 WO 2023050966A1 CN 2022104372 W CN2022104372 W CN 2022104372W WO 2023050966 A1 WO2023050966 A1 WO 2023050966A1
Authority
WO
WIPO (PCT)
Prior art keywords
subnet
data
main network
blockchain
verification
Prior art date
Application number
PCT/CN2022/104372
Other languages
French (fr)
Chinese (zh)
Inventor
卓海振
Original Assignee
支付宝(杭州)信息技术有限公司
蚂蚁区块链科技(上海)有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 支付宝(杭州)信息技术有限公司, 蚂蚁区块链科技(上海)有限公司 filed Critical 支付宝(杭州)信息技术有限公司
Publication of WO2023050966A1 publication Critical patent/WO2023050966A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/62Protecting access to data via a platform, e.g. using keys or access control rules
    • G06F21/6218Protecting access to data via a platform, e.g. using keys or access control rules to a system of files or objects, e.g. local or distributed file system or database

Definitions

  • One or more embodiments of this specification relate to the technical field of blockchain, and in particular to a method, device, electronic device, and storage medium for verifying blockchain data.
  • Blockchain technology is built on top of transmission networks such as peer-to-peer networks. Nodes in the blockchain network use chained data structures to verify and store data, and use distributed node consensus algorithms to generate and update data.
  • blockchain subnets will be established on the basis of the blockchain main network, so that each blockchain subnet is independent and isolated from each other, so there is data sharing between each other. Verify requirements.
  • Traditional cross-chain technology can meet the data verification requirements between different blockchain subnets, but the process is usually cumbersome and time-consuming, and ignores the trust that the blockchain main network can serve as data verification between different blockchain subnets Base.
  • one or more embodiments of this specification provide a method, device, electronic device and storage medium for verifying blockchain data.
  • a method for verifying blockchain data is proposed, which is applied to network and the block chain system of the block chain main network, wherein the node device where the subnet node in the block chain subnet is located is deployed with the main network node in the block chain main network, and the block chain
  • the block chain subnet includes at least a first block chain subnet and a second block chain subnet, and the main network nodes in the block chain main network maintain data verification conditions corresponding to the second block chain subnet;
  • the method includes: The first block chain subnet initiates a data verification transaction to the block chain main network, and the data verification transaction is used to verify whether the target data exists on the second block chain subnet;
  • the network node executes the data verification transaction to generate a candidate verification result under the condition that any subnet node in the second block chain subnet is deployed on the node device where any main network node is located, and the Candidate verification
  • another method for verifying blockchain data is proposed, which is applied to the main network nodes in the blockchain main network.
  • the node device where the subnetwork nodes in the block chain subnet are located is deployed with the main network nodes in the block chain main network, and the block chain subnet is at least Including the first block chain subnet and the second block chain subnet, the main network node in the block chain main network maintains the data verification conditions corresponding to the second block chain subnet;
  • the method includes: receiving the first zone The data verification transaction initiated by the block chain subnet to the block chain main network, the data verification transaction is used to verify whether the target data exists on the second block chain subnet; Generate a candidate verification result when any subnet node in the second blockchain subnet is deployed on the network, and broadcast the candidate verification result to other main network nodes in the blockchain main network, wherein the The candidate verification result is used to indicate whether the target data exists on any subnetwork node; determine
  • a device for verifying blockchain data is proposed, which is applied to the main network nodes in the blockchain main network, and the blockchain main network and block
  • the node device where the subnet node in the block chain subnet is located is deployed with the main network node in the block chain main network
  • the block chain subnet includes at least The first block chain subnet and the second block chain subnet
  • the main network node in the block chain main network maintains the data verification conditions corresponding to the second block chain subnet
  • the device includes: a transaction receiving module, used To receive the data verification transaction initiated by the first block chain subnet to the block chain main network, the data verification transaction is used to verify whether the target data exists on the second block chain subnet;
  • the transaction execution module is used to execute the Data verification transaction, to generate a candidate verification result when any subnet node in the second block chain subnet is deployed on the node device where it is located, and broadcast the candidate verification result to the block chain master Other main network
  • a blockchain system including a blockchain subnet and a blockchain main network, wherein the subnet nodes in the blockchain subnet are located
  • the main network nodes in the block chain main network are deployed on the node device, and the block chain subnet includes at least the first block chain subnet and the second block chain subnet, and the block chain main network
  • the main network node maintains the data verification conditions corresponding to the second block chain subnet;
  • the system includes: the first block chain subnet, used to initiate a data verification transaction to the block chain main network, and the data verification transaction is used for Whether there is target data on the second block chain sub-net for verification; block chain main network, any main network node in the block chain main network executes the data verification transaction, so that any main network node in the block chain Generate a candidate verification result when any subnet node in the second block chain subnet is deployed on the node device, and broadcast the candidate verification result to other main network nodes in the block chain main network,
  • the subnet nodes in the blockchain subnet are located
  • an electronic device including: a processor; a memory for storing processor-executable instructions; wherein, the processor executes the executable instructions to implement the above verification area The steps of the method of blockchain data.
  • a computer-readable storage medium on which executable instructions are stored; wherein, when the instructions are executed by a processor, the steps of the above-mentioned method for verifying blockchain data are implemented.
  • Fig. 1 is a schematic diagram of a blockchain system including a blockchain main network and a blockchain subnet provided by an exemplary embodiment.
  • Fig. 2 is a flowchart of a method for verifying blockchain data provided by an exemplary embodiment.
  • Fig. 3 is a flow chart of another method for verifying blockchain data provided by an exemplary embodiment.
  • Fig. 4 is a schematic structural diagram of a device provided by an exemplary embodiment.
  • Fig. 5 is a block diagram of a device for verifying blockchain data provided by an exemplary embodiment.
  • Fig. 6 is an architecture diagram of a system for verifying blockchain data provided by an exemplary embodiment.
  • the steps of the corresponding methods are not necessarily performed in the order shown and described in this specification.
  • the method may include more or less steps than those described in this specification.
  • a single step described in this specification may be decomposed into multiple steps for description in other embodiments; multiple steps described in this specification may also be combined into a single step in other embodiments describe.
  • all blockchain nodes in the blockchain network will maintain the same block data, which cannot meet the special needs of some nodes.
  • all consortium members that is, node members in the consortium
  • all consortium members can form a blockchain network, and all consortium members have corresponding blockchain nodes in the blockchain network, and can pass the corresponding zone Block chain nodes obtain all transactions and related data that occur on the block chain network.
  • there may be some alliance members who want to complete some transactions with privacy requirements. These alliance members hope that these transactions can be stored on the blockchain or take advantage of other advantages of blockchain technology, and can avoid other transactions. affiliate members see these transactions and related data.
  • the establishment method is similar to the above-mentioned blockchain network that includes all alliance members, but building a new blockchain network from scratch requires a lot of resources, and regardless of The establishment process of the blockchain network or the configuration process after completion is very time-consuming.
  • the needs among alliance members are often temporary or have a certain timeliness, so that the newly built blockchain network will soon lose the meaning of existence due to the disappearance of demand, thus 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 demand are often different. Therefore, whenever the alliance members change, it may be necessary to form a new blockchain network, resulting in resource and time constraints. A lot of waste.
  • the established blockchain network can be used as the blockchain main network, and a blockchain subnet can be formed on the basis of the blockchain main network.
  • the consortium members can build the required blockchain subnet based on their own needs while already participating in the blockchain main network. Since the blockchain subnet is established on the basis of the blockchain main network, the construction process of the blockchain subnet is compared to the completely independent establishment of a blockchain network, the resources consumed and the time required, etc. Both are greatly reduced, and the flexibility is extremely high.
  • each blockchain node in the blockchain main network obtains a transaction for establishing a blockchain subnet, and the transaction includes the configuration information of the blockchain subnet , the configuration information includes the identity information of the node members participating in the formation of the block chain subnet, each block chain node in the block chain main network respectively executes the transaction to disclose the configuration information, when the When the configuration information includes the identity information of the node members corresponding to the first block chain node, the node device deploying the first block chain node starts the first block belonging to the block chain subnet based on the genesis block containing the configuration information.
  • Two blockchain nodes Two blockchain nodes.
  • 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 on the basis of the blockchain main network, and avoid opening the establishment authority of the blockchain subnet to Normal users to prevent security issues caused by this.
  • 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 initiate transactions when the administrator is inconvenient. It is possible to quickly form a blockchain subnet.
  • Fig. 1 is a schematic diagram of a block chain system including a block chain main network and a block chain subnet provided by an exemplary embodiment.
  • the block chain main network is subnet0, and the subnet0 includes
  • the blockchain nodes are nodeA, nodeB, nodeC, nodeD, nodeE, etc.
  • nodeA, nodeB, nodeC and nodeD want to form a blockchain subnet: if nodeA is an administrator and only allows the administrator to initiate a transaction to form a blockchain subnet, then nodeA can initiate the above-mentioned transaction to form a blockchain subnet to subnet0; If nodeE is an administrator and only allows the administrator to initiate the transaction of establishing a blockchain subnet, then nodeA ⁇ nodeD needs to make a request to nodeE, so that nodeE initiates the above transaction of establishing a blockchain subnet to subnet0; if nodeE is an administrator but allows Ordinary users initiate a transaction to establish a blockchain subnet, then nodeA ⁇ nodeE can initiate the above transaction to subnet0 to establish a blockchain subnet.
  • the blockchain node that initiates the transaction to form a blockchain subnet does not necessarily participate in the established blockchain subnet.
  • nodeE can initiate the above-mentioned transaction of establishing a blockchain subnet to subnet0, and not necessarily nodeA ⁇ nodeD initiate the transaction of establishing a blockchain subnet.
  • the blockchain main network in this specification can be the underlying blockchain network, that is, the blockchain main network is not a blockchain subnet formed on the basis of other blockchain networks, such as the subnet0 can be regarded as the blockchain mainnet belonging to the underlying blockchain network type.
  • the blockchain main network in this specification can also be a subnet of other blockchain networks.
  • subnet1 is the blockchain main network corresponding to the blockchain subnet, and this does not affect that subnet1 also belongs to the blockchain subnet created on subnet0. It can be seen that the blockchain main network and the blockchain subnet are actually relative concepts. The same blockchain network can be the blockchain main network in some cases and the blockchain subnet in other cases.
  • the consensus nodes in the blockchain main network will conduct a consensus, and after the consensus is passed, each main network node will execute the transaction to complete the block The formation of the chain subnet.
  • the consensus process depends on the consensus mechanism adopted, such as any consensus mechanism mentioned above, and this description does not limit it.
  • the configuration information can be used to configure the established blockchain subnet so that the established blockchain subnet meets the networking requirements. For example, by including the identity information of node members in the configuration information, it is possible to specify which blockchain nodes are included in the established blockchain subnet.
  • the identity information of the node members may include the public key of the node, or other information that can represent the identity of the node such as the node ID, which is not limited in this specification.
  • each blockchain node has one or more sets of corresponding public-private key pairs.
  • the blockchain node holds the private key and the public key is public and uniquely corresponds to the private key. Therefore, it can be passed
  • the public key is used to represent the identity of the corresponding blockchain node. Therefore, for blockchain nodes that want to be node members of the blockchain subnet, the public keys of these blockchain nodes can be added to the above-mentioned transaction of forming the blockchain subnet as the identity information of the above-mentioned node members.
  • the above-mentioned public-private key pair can be used in the process of signature verification.
  • nodeA1 in subnet1 uses its own private key to sign the message, and then broadcasts the signed message in subnet1, while nodeB1, nodeC1 and nodeD1 can use the public key of nodeA1 Signature verification is performed on the received message to confirm that the message received by itself is indeed from nodeA1 and has not been tampered with.
  • the first main network node may be a blockchain node on the blockchain main network that is a node member indicated by the configuration information.
  • the first subnet node needs to be generated by the node device used to deploy the first main network node , and the first subnetwork node becomes a node member in the blockchain subnetwork.
  • 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
  • the node belongs to the blockchain subnet, so that the blockchain members 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 network, so that 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 device (the storage used can be a database, for example), realizing the first
  • the storage used by the main network node and the first subnet node is isolated from each other, so the data generated by the blockchain subnet will only be synchronized among the node members of the blockchain subnet, so that only those who participate in the blockchain main
  • the blockchain members of the network cannot obtain the data generated on the blockchain subnet, which realizes the data isolation between the blockchain main network and the blockchain subnet, and satisfies the requirements
  • the first main network node and the first subnet node are logically divided blockchain nodes, and from the perspective of physical equipment, it is equivalent to deploying the first main network node and the first subnet node
  • the node devices participate in the blockchain main network and the blockchain subnet at the same time. 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, so even if the first main network node and the first subnet node can use exactly the same public key, the two should still be considered as different blockchain nodes. For example, in FIG.
  • nodeA in subnet0 is equivalent to the first main network node, and the node device deploying the nodeA generates nodeA1 belonging to subnet1, and the nodeA1 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 will not affect the implementation of the scheme in this specification.
  • the node members of the blockchain subnet are not necessarily only part of the node members of the blockchain main network.
  • the node members of the blockchain subnet can be completely consistent with the node members of the blockchain main network.
  • all blockchain members can obtain the 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.
  • the two types of The business data generated by the business are isolated from each other.
  • 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 The attribute configuration of the code, etc., is not limited in this specification.
  • the network identifier is used to uniquely represent the blockchain subnet, so the network identifier of the blockchain subnet should be distinguished from the blockchain main network and other blockchain subnets formed 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; the administrators of the blockchain main network and the blockchain subnet can be the same or different.
  • One of the advantages of building a blockchain subnet through the blockchain mainnet is that since the first mainnet node has already been deployed on the node device that generates the first subnetwork node, the area used by the first mainnet node can be The block chain platform code is reused on the first subnet node, which eliminates the repeated deployment of the block chain platform code and greatly improves the efficiency of the block chain subnet.
  • the first subnet node can reuse the attribute configuration adopted on the first main network node; if the configuration information includes the attribute configuration for the blockchain platform code attribute configuration, the first subnetwork node can adopt the attribute configuration, so that the attribute configuration adopted by the first subnetwork node is not limited to the attribute configuration of the first main network node, and has nothing to do with the first main network node.
  • the attribute configuration for the blockchain platform code can include at least one of the following: code version number, whether consensus is required, consensus algorithm type, block size, etc., which are not limited in this specification.
  • Transactions that form blockchain subnets include transactions that call contracts.
  • the transaction can specify the address of the called smart contract, the method called and the parameters passed in.
  • the invoked contract can be the aforementioned genesis contract or system contract
  • the invoked method can be a method for building a blockchain subnet
  • the incoming parameters can include the above-mentioned configuration information.
  • the transaction may contain the following information:
  • the from field is the information of the initiator of the transaction.
  • Administrator indicates that the initiator is an administrator; the to field is the address of the called smart contract.
  • the smart contract can be a Subnet contract, and the to field is specifically the Subnet The address of the contract; the method field is the calling method.
  • the method used to build a blockchain subnet in the Subnet contract can be AddSubnet(string), and string is the parameter in the AddSubnet() method.
  • genesis is used to represent the The value of the parameter, the genesis is specifically the aforementioned configuration information.
  • nodeA ⁇ nodeE Take nodes nodeA ⁇ nodeE on Subnet0 executing a transaction calling the AddSubnet() method in the Subnet contract as an example. After the transaction passes the consensus, nodeA ⁇ nodeE respectively execute the AddSubnet() method and pass in the configuration information to obtain the corresponding execution results.
  • the execution result of the contract may include the configuration information, and the execution result may be included in the above-mentioned receipt, which may include an event related to the execution of the AddSubnet() method, that is, a networking event.
  • the topic of networking events can contain predefined networking event identifiers to distinguish them from other events.
  • the content of the topic is the keyword subnet, and this keyword is different from the topic in the event generated by other methods.
  • nodeA ⁇ nodeE can determine to monitor the event related to the execution of the AddSubnet() method, that is, the networking event, when the topic containing the keyword subnet is monitored.
  • the event in the receipt is as follows:
  • the content of the data field may include, for example:
  • 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, such information can be maintained in In the above-mentioned Subnet contract, it may specifically correspond to the values of one or more contract states included in the Subnet contract.
  • nodeA ⁇ nodeE can determine whether the above-mentioned subnet1 already exists according to the recorded network identifiers of all 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 currently, and if it exists, it means subnet1 already exists.
  • a predefined new network identifier which indicates that the corresponding networking event is used to form a new blockchain subnet.
  • the above subnet1 can be replaced with newsubnet, which is a predefined new network identifier.
  • nodeA ⁇ nodeE recognizes that the data field contains newsubnet, they can determine that the event containing this newsubnet is a networking event, and a new one needs to be created.
  • Blockchain subnet When nodeA ⁇ nodeE recognizes that the data field contains newsubnet, they can determine that the event containing this newsubnet is a networking event, and a new one needs to be created.
  • the above data field also includes identity information of each node member and so on.
  • the node device deploying 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 deployment second A node device of a main network node obtains the configuration information or the genesis block included in the networking event.
  • the first blockchain node can monitor the generated receipt, and when the networking event is monitored and the content of the networking event indicates that the first blockchain node belongs to the node member, trigger the deployment of the first blockchain node.
  • a node device of a blockchain node acquires the configuration information or the genesis block included in the networking event.
  • node devices can listen for receipts directly. Assuming that nodeA ⁇ nodeE are respectively deployed on node devices 1 ⁇ 5, and node devices 1 ⁇ 5 can monitor the receipts generated by nodeA ⁇ nodeE respectively, then when it is detected that subnet1 is a blockchain subnet that needs to be newly established, node device 1 ⁇ 5 will further identify the identity information of the node members contained in the data field to determine its own processing method.
  • nodeA and node device 1 Take nodeA and node device 1 as an example: if node device 1 finds that the data field contains identity information such as nodeA's public key, IP address, and port number, then node device 1 obtains configuration information from the data field based on the above message mechanism , generate a genesis block containing the configuration information, and node device 1 will deploy nodeA1 locally, and then nodeA1 will load the generated genesis block, thus becoming a subnet node of subnet1; similarly, node device 2 can generate nodeB1, node Device 3 can generate nodeC1, and node device 4 can generate nodeD1. And, node device 5 will find that the identity information contained in the data field does not match itself, then the node device 5 will not generate a genesis block according to the configuration information in the data field, nor will it generate a blockchain node in subnet1.
  • identity information such as nodeA's public key, IP address, and port number
  • the blockchain nodes in the blockchain main network can monitor receipts and trigger node devices to perform related processing according to the monitoring results.
  • nodeA ⁇ nodeE will further identify the identity information of the node members contained in the data field in order to determine their own processing methods when they determine that subnet1 is a blockchain subnet that needs to be newly established.
  • nodeA ⁇ nodeD will find that the data field contains their own identity information such as their public key, IP address, and port number. Assume that nodeA ⁇ nodeD are deployed on node devices 1 ⁇ 4 respectively.
  • 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, Thus, it becomes a subnet node in 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.
  • 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, then the node device 5 will not generate a genesis block based on the configuration information in the data field, nor will it generate subnet1 nodes in .
  • the data field may contain identity information generated in advance for nodeA1-nodeD1, which is different from the identity information of nodeA-nodeD.
  • nodeA and node device 1 as an example: if node device 1 finds the identity information of nodeA1 in the data field, it can generate a genesis block, deploy nodeA1, and nodeA1 loads the genesis block; or, if nodeA is in the data field If the identity information of nodeA1 is found in , then nodeA will trigger node device 1 to generate a genesis block, deploy nodeA1, and nodeA1 will load the genesis block.
  • the processing methods of other blockchain nodes or node devices are similar and will not be repeated here.
  • the execution result of the contract can include the genesis block.
  • the corresponding node devices 1-4 can directly obtain the genesis block from the data field through the message mechanism without generating it by themselves, which can improve the deployment efficiency of nodeA1-nodeD1.
  • the transaction of establishing 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, so that on the basis of the blockchain main network Quickly create a blockchain subnet.
  • a group of network transaction type identifiers can be pre-defined, and when the 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 to form a blockchain subnet.
  • the blockchain platform code can contain relevant processing logic for component blockchain subnets, so that when the first main network node running the blockchain platform code executes a transaction, if it finds that the transaction contains the above-mentioned networking transaction type identification, and the first main network node belongs to the node member indicated by the configuration information in the transaction, based on the above processing logic, the node device deploying the first main network node can be triggered to generate a genesis block containing the configuration information and start the first A subnetwork node, the first subnetwork node loads the genesis block to form a blockchain node in the blockchain subnetwork.
  • the node device implements the deployment of a blockchain node on the node device by creating an instance of running the blockchain platform code in the process.
  • the node device creates the first instance in the above process, and the first instance runs the blockchain platform code to form.
  • 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 to form.
  • the node device can first create the first instance in the process to form the first blockchain node in the blockchain main network; In the above process, a second instance is created, which is different from the above-mentioned first instance, and the second instance forms a second blockchain node in the blockchain subnet.
  • the second instance may also be in separate nodes from the first instance
  • this specification does not limit this; for example, the node device can create the first instance in the first process to form the first blockchain node in the blockchain main network; and when the node When the node member corresponding to the device wants to participate in the establishment of a blockchain subnet, it can start a second process different from the first process, and create a second instance in the second process, which is different from the first instance above. Furthermore, the second instance forms a second blockchain node in the blockchain subnet.
  • 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 each blockchain node deployed on any node device
  • the blocks generated by the nodes are respectively stored in different storages (such as databases) on any node device, and the storages used by each blockchain node deployed by any node device are isolated from each other.
  • a blockchain subnet can be created on the blockchain mainnet.
  • subnet0 originally included nodeA ⁇ nodeE
  • subnet1 can be built on the basis of subnet0.
  • This subnet1 includes nodeA1 ⁇ nodeD1, and nodeA and nodeA1, nodeB and nodeB1, nodeC and nodeC1, nodeD and nodeD1 are respectively deployed in on the same node device.
  • subnet2 or more blockchain subnets can also be established 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 respectively deployed on the same node device.
  • subnet1, subnet2, etc. can be used as the new blockchain main network, and a blockchain subnet can be further formed on this basis. The process is similar to the formation of subnet1 or subnet2, and will not be repeated here.
  • the different blockchain subnets established on the blockchain mainnet through the above methods are independent and isolated from each other. Received by nodeA2, nodeB2, nodeC2 and nodeE2 in subnet2. Therefore, different blockchain subnets logically belong to different blockchain networks.
  • the credible cross-chain interaction between different blockchain networks needs to be completed through cross-chain protocols, such as side chain technology, witness mechanism or relay technology, etc., but the traditional cross-chain technology adopts The implementation of cross-chain protocols is usually cumbersome and time-consuming.
  • this specification proposes a method for verifying blockchain data, which is applied to a blockchain system including a blockchain subnet and a blockchain main network, wherein the subnet nodes in the blockchain subnet are The main network node in the block chain main network is deployed on the node device at the location, and the block chain subnet includes at least a first block chain subnet and a second block chain subnet, and in the block chain main network
  • the main network node maintains the data verification conditions corresponding to the second blockchain subnet, which allows the first blockchain subnet to verify the existence of blockchain data from the second blockchain subnet , through the correlation between the blockchain main network and each blockchain subnet on the network architecture at the node device level, the blockchain main network can be used as a trust medium between different blockchain subnets to achieve simpler data verification protocol.
  • Fig. 2 is a flowchart of a method for verifying blockchain data provided by an exemplary embodiment.
  • the method is applied to a block chain system including a block chain subnet and a block chain main network, wherein the node device where the subnet node in the block chain subnet is located is deployed with the block chain in the block chain main network
  • the main network nodes of the blockchain subnet include at least the first blockchain subnet and the second blockchain subnet, and the main network nodes in the blockchain main network maintain data corresponding to the second blockchain subnet Verifying the conditions, the method includes the following steps.
  • Step 202 the first blockchain subnet initiates a data verification transaction to the blockchain main network, and the data verification transaction is used to verify whether the target data exists on the second blockchain subnet.
  • the first blockchain subnet involved in the embodiment of this specification is the demander of the data verification service, which has the requirement to verify the target data.
  • the first blockchain subnet has acquired the target data, but it is not clear whether the target data really comes from the second blockchain subnet, or, although the first blockchain subnet has not acquired the target data, it still hopes to Verify that the target data corresponding to a certain data description information exists in the second blockchain subnet truthfully as the blockchain data of the second blockchain subnet, then the first blockchain subnet can pass to the blockchain
  • the main network initiates a data verification transaction to verify whether the target data exists on the second blockchain subnet.
  • a blockchain system including a blockchain subnet and a blockchain main network, such as the blockchain system composed of subnet0, subnet1 and subnet2 shown in Figure 1, where subnet0 is Blockchain main network, while subnet1 and subnet2 are blockchain subnets.
  • node devices 1, 2, 3 and 4 where the subnet nodes nodeA1, nodeB1, nodeC1 and nodeD1 are located in subnet1 are respectively deployed with subnet0 nodeA, nodeB, nodeC and nodeD
  • the node devices 1, 2, 3 and 5 where the subnet nodes nodeA2, nodeB2, nodeC2 and nodeE2 in subnet2 are located are respectively deployed with nodeA, nodeB, nodeC and nodeE in subnet0. Therefore, there must be a main network node deployed on the node device where the subnet node is deployed.
  • the main network nodes in the blockchain main network maintain data verification conditions corresponding to the second blockchain subnet, for example, each main network node nodeA-nodeE in subnet0 maintains data verification conditions corresponding to subnet2, of course , each main network node nodeA ⁇ nodeE also maintains data verification conditions corresponding to subnet1.
  • the data verification conditions maintained on the blockchain main network can be created or changed by sending transactions to the blockchain main network.
  • a subnetwork creation transaction for creating a new blockchain subnet may be initiated to the blockchain mainnet, and the blockchain mainnet responds to the subnetwork creation transaction for creating a new blockchain subnetwork so that the zone
  • the main network node in the block chain main network obtains and maintains the data verification conditions corresponding to the new blockchain subnet after executing the subnet creation transaction, and the subnet creation transaction contains the data corresponding to the new blockchain subnet Verify conditions.
  • the above-mentioned subnet creation transaction for creating a new blockchain subnet is the aforementioned transaction for establishing a blockchain subnet.
  • the data verification conditions of the new blockchain subnet can be carried in the subnet creation transaction, so that the blockchain main network can maintain the data verification conditions corresponding to the new blockchain subnet as soon as the new blockchain subnet is created, for example
  • the data verification condition is stored in the contract state corresponding to the new blockchain subnet in the aforementioned Subnet contract (system contract).
  • a condition change transaction for updating the data verification conditions corresponding to the second blockchain subnet may also be initiated to the main network of the blockchain, and a transaction for updating the data verification conditions corresponding to the second blockchain subnet may be initiated to the main network of the blockchain.
  • the condition change transaction of the data verification condition corresponding to the second block chain subnet so that the main network node in the block chain main network will update the data verification condition maintained by itself to the new one after executing the condition change transaction.
  • Data verification conditions, the condition modification transaction includes the new data verification conditions corresponding to the second block chain subnet.
  • the second blockchain subnet changes due to factors such as the total number of nodes and the consensus algorithm, it is necessary to immediately adjust the data verification conditions corresponding to the blockchain subnet to ensure blockchain data verification. Therefore, by initiating a condition change transaction to the blockchain main network to update the data verification conditions corresponding to the second blockchain subnet, the second block maintained in the blockchain main network The data verification conditions corresponding to the chain subnet are adjusted in a timely manner.
  • the condition change transaction will update the smart contract used to record the second blockchain subnet.
  • the network corresponds to the contract status of the data verification conditions, and finally updates the world status of the blockchain main network.
  • any subnet node in the first blockchain subnet can initiate a data verification transaction to the node device where it is located, so as to forward the data verification transaction to the blockchain main network. Since the main network node is deployed on the node device where the subnetwork node is located, the node device can verify the network identification field in the transaction by identifying the data initiated by the subnetwork node in the first blockchain subnetwork (for example, the zone The network identifier subnet0 of the block chain main network, so as to know that the transaction needs to be routed to the block chain main network instead of the first block chain subnet or other block chain networks.
  • the transaction routing module in the node device (such as the consensus module ) will pass the data verification transaction to the local main network node.
  • the transaction routing module can also broadcast the transaction to other main network nodes in the blockchain main network through the pre-established consensus link in the blockchain main network. network nodes, so that the first blockchain subnet can initiate a data verification transaction to the blockchain main network.
  • the main network nodes in the blockchain main network and the subnet nodes in the blockchain subnet are deployed on the same node device, multiple blockchain nodes deployed on the same node device They share the same consensus module with each other, which makes it possible to send transactions from the first blockchain subnet to the blockchain mainnet.
  • the target data includes one of the following: transaction data, status data, and receipt data.
  • transaction data, status data and receipt data are logically organized into corresponding tree structures to facilitate subsequent data verification.
  • the tree structure formed by transaction data may be called a transaction tree
  • the tree structure formed by state data may be called a state tree
  • the tree structure formed by receipt data may be called a receipt tree.
  • Step 204 any main network node in the blockchain main network executes the data verification transaction, so that any one of the second blockchain subnets is deployed on the node device where any main network node is located.
  • a candidate verification result is generated, and the candidate verification result is broadcast to other main network nodes in the blockchain main network, wherein the candidate verification result is used to indicate that any subnet Whether the target data exists on the node.
  • each main network node in the blockchain main network will receive and execute the data verification transaction, for example, when the data verification transaction includes calling the In the case of the transaction of the data verification smart contract deployed on the blockchain main network, each main network node will respectively call the locally maintained data verification smart contract to execute the contract logic as in step 204 when executing the data verification transaction.
  • the data verification transaction involved in this specification includes the data description information of the target data and the network identification of the second blockchain subnet.
  • the network identifier is used to indicate any main network node: determine the subnetwork node corresponding to the network identifier deployed on the node device where it is located as any subnetwork node; the data description The information is used to instruct the any main network node to: determine the data matching the data description information on the any sub-network node as the target data.
  • the data description information may include transaction hash, account ID, contract address, parameter name and so on.
  • any main network node when any main network node executes a data verification transaction, it will first determine that the data verification transaction is used for the second blockchain subnet according to the network identifier of the second blockchain subnet carried in the data verification transaction. network data, so that any main network node will check whether any subnetwork node in the second blockchain subnetwork is deployed on the node device where it is located, and when it is determined that any subnetwork node is deployed.
  • candidate verification results are generated, and the generated candidate verification results are broadcast to other main network nodes in the blockchain main network through the consensus module.
  • any mainnetwork node when it is determined that any of the subnetwork nodes is deployed, any mainnetwork node will further verify the data description information of the target data carried in the transaction according to the data.
  • the candidate verification result generated at this time will contain indication information indicating that the target data exists on any subnet node; similarly, if any main network node does not match the If the target data is to prove that the target data corresponding to the data description information does not exist in any of the subnetwork nodes, the candidate verification result generated at this time will contain a An indication of the target data.
  • any of the above-mentioned main network nodes can access the local database corresponding to any sub-network node is that in the embodiment of this specification, the main network node and zone in the blockchain main network are deployed on the same node device. Therefore, although the blockchain main network and the second blockchain subnet logically belong to different blockchain networks, the corresponding main network nodes and subnet nodes are deployed in the same On the node device, this makes it possible to completely realize unauthorized management at the node device level, that is, the main network node can have the right to access other sub
  • the database corresponding to the network nodes creates a cross-chain interaction channel based on node equipment.
  • any main network node generates a candidate verification result when it is determined that any subnet node is deployed on the node device where it is located, and that any subnet node maintains the target data , and broadcast the candidate verification result to other main network nodes in the blockchain main network, but no subnet node is deployed on the node device where it is determined, or although any subnet node is deployed If the target data is not maintained by any sub-network node but the target data is not maintained by any sub-network node, no candidate verification result is generated.
  • the existence of a candidate verification result can be used to indicate that the target data exists on any subnetwork node.
  • any main network node determines that no subnet node in the second blockchain subnet is deployed on the node device where it is located, it does not generate the candidate verification result, Or generate candidate verification results containing preset invalid data and broadcast to other main network nodes in the blockchain main network.
  • the main network node where the node device is not deployed with any subnet node in the second blockchain subnet it is obviously unable to make a decision on whether the target data exists in the second blockchain subnet. Effective judgment, so such main network nodes do not need to generate candidate verification results, but collect candidate verification results broadcast by other main network nodes as the basis for judgment.
  • main network nodes can also generate candidate verification results containing invalid data And broadcast, for example, the candidate verification result generated and broadcast contains "unknown" to indicate that the main network node corresponding to the candidate verification result cannot effectively judge whether the target data exists in the second blockchain subnet, so there is no Reference value, so when other main network nodes receive candidate verification results containing "unknown", they will discard it and not count it into all candidate verification results received, thus preventing those main network nodes that cannot make valid judgments from The selection of the final target verification result forms interference, and can be used to determine that each main network node has indeed received the verification transaction and made a response, so as to rule out the situation that the main network node does not respond normally. In other words, if you do not receive candidate verification results (even if unknown) returned by each main network node, it indicates that there may be network problems or downtime.
  • the data verification smart contract can maintain the membership information (such as node public key) of each blockchain subnet managed by the blockchain main network, for example, the contract account corresponding to the data verification smart contract can be maintained , as the contract status under the contract account.
  • any of the above-mentioned main network nodes can verify the contract account corresponding to the smart contract by reading data to obtain the node public key set of each node member in the second blockchain subnet, so that any of the main network nodes can
  • the maintained node public key is compared, if the node public key of any main network node is included in the node public key set corresponding to the second blockchain subnet, it means that any main network node belongs to the second block
  • the node member of the chain subnet that is, any subnet node in the second blockchain subnet is deployed on the node device where any main network node is located; if the node public key of any main network node is not included in
  • the set of node public keys corresponding to the second blockchain subnet indicates that any of the main network nodes does not belong to the node members of the second blockchain subnet, that is, the node device where any of the main network nodes is located does not deploy Any subnetwork node in the second blockchain subnetwork.
  • the membership information of each blockchain subnet managed by the blockchain mainnet is not maintained by the data verification smart contract, but is maintained as a contract state by the subnetwork deployed on the blockchain mainnet.
  • the data verification smart contract can read the identity of each node member in the second blockchain subnet from the contract account of the subnet management smart contract in response to the call of any main network node The information is used to determine whether any of the above-mentioned subnetwork nodes is deployed on the node device where any mainnetwork node is located.
  • any main network node has previously judged whether any subnet node is deployed on the node device where it is located, and maintains the judgment result in any main network node. Therefore, when any When a main network node needs to check whether any subnet node in the second blockchain subnet is deployed on the node device where it is located, it only needs to read the judgment result maintained in advance to judge the node device where it is located. Whether any subnetwork nodes are deployed on it.
  • Step 206 said any main network node determines a target verification result that satisfies the data verification condition from all obtained candidate verification results, so that the first blockchain subnetwork can determine the target verification result according to the target verification result Whether the data exists in the second blockchain subnet.
  • each main network node in the blockchain main network needs to perform data verification transactions, and broadcast candidate verification when the subnet node in the second blockchain network is deployed in the node device where it is located.
  • the same mainnet node may receive multiple candidate verification results broadcast from other mainnet nodes.
  • the candidate verification results generated by itself are also counted in its Among all candidate verification results obtained.
  • all candidate verification results obtained are from other main network nodes.
  • each main network node in the blockchain main network will theoretically receive the same number of candidate verification results with the same content (that is, all candidate verification results) after completing the candidate verification result broadcast stage. to form a candidate set.
  • a candidate verification result with the same content from the candidate set obtained by itself. Therefore, according to the data verification conditions for the second blockchain subnet, each main network node selects candidate verification results with the same content from their respective candidate sets as the above-mentioned target verification results.
  • the data verification conditions may include at least one of the following: among all the candidate verification results, the candidate verification results with the same content exceed the first preset number, and all the candidate verification results Candidate verification results with the same content and exceeding the first preset number are used as target verification results.
  • the candidate verification results with the same content among all the candidate verification results are from the preset main network node, and the candidate verification results with the same content and originating from the preset main network node among all the candidate verification results are taken as the target verification results.
  • the data verification conditions include at least two of the above, in order to prevent the existence of multiple candidate verification results with different content that all meet the data verification conditions, resulting in inconsistent target verification results selected by each main network node, it is necessary to ensure that the final selection is The target verification result of can satisfy all data verification conditions at the same time.
  • this manual only lists the above three data verification conditions, in fact, the data verification conditions can be expanded arbitrarily to meet the actual needs of users or specific verification scenarios. For example, in the broadcast stage of candidate verification results, if any main network The node generates a candidate verification result when it is determined that any of the subnet nodes is deployed on the node device where it is located, and broadcasts the candidate verification result to other main network nodes in the blockchain main network.
  • the candidate verification condition can be set to at least one of the following: the candidate verification results among all the candidate verification results exceed the first preset number; Candidate verification results among all candidate verification results are from preset main network nodes; among all candidate verification results, candidate verification results from subnet nodes in the second blockchain subnet exceed a second preset number.
  • a time limit condition is added, for example, the candidate verification condition is set as: the candidate verification results among all the candidate verification results determined within a preset time period exceed the first preset number, etc., and this specification does not make any restrictions on this .
  • the identity verification mechanism may be implemented by way of electronic signature/signature verification.
  • subnet0 is the blockchain main network
  • subnet1 is the first blockchain subnet
  • subnet2 is the second blockchain subnet
  • nodeA as the main network node
  • nodeB will generate a candidate verification result result_A
  • nodeC will also receive results from nodeB, nodeC and nodeE respectively (these main network nodes are located on the node devices where the second blockchain subnet is deployed).
  • the result_B, result_C and result_E broadcasted by the subnet nodes in .
  • nodeA it can only ensure that the result_A generated by itself is legal, but it cannot confirm the legitimacy of other candidate verification results received from other main network nodes.
  • the any main network node is required to sign the candidate verification result and then broadcast it to the main network other than the any main network node in the blockchain main network. network nodes, so as to ensure that any candidate verification result received by any main network node from other main network nodes contains a corresponding electronic signature.
  • nodeA when nodeA receives result_B, result_C and result_E, it will also Electronic signatures sign_B, sign_C and sign_E corresponding to result_B, result_C and result_E are received, wherein sign_B, sign_C and sign_E are respectively obtained by signing result_B, result_C and result_E by nodeB, nodeC and nodeE through their respective node private keys. Therefore, nodeA can verify sign_B, sign_C and sign_E respectively according to the node public keys of nodeB, nodeC and nodeE maintained locally. If the electronic signature verification is successful, it proves that the candidate verification result corresponding to the electronic signature is indeed from its own The declared main network node has legitimacy.
  • any main network node can first verify the signature of the candidate verification results received from other main network nodes through the above-mentioned identity verification mechanism, and use the successful candidate verification results as all candidate verification results , so that all candidate verification results include: self-generated candidate verification results and candidate verification results received from other main network nodes and successfully verified, so as to ensure that all candidate verification results in the candidate set for selecting target verification results The legitimacy of the results to ultimately ensure the credibility of the selected target verification results.
  • some means can also be used to prevent malicious or faulty main network nodes from repeatedly broadcasting multiple identical or Different candidate validation results. Since the repeatedly sent candidate verification results still meet the legality based on the above-mentioned signature and signature verification technology, they will not be screened out by the identity verification mechanism, but it will obviously destroy the composition of all candidate verification results in the candidate set, and may Ultimately, the verification result of the determined target is not credible. Therefore, it is necessary to establish a deduplication mechanism to prevent untrustworthiness caused by replay failures.
  • the candidate verification results from the main network node can be directly removed from the candidate set , or select one of the at least two candidate verification results as the only valid candidate verification result and keep it in the candidate set, and the others are eliminated.
  • the candidate verification result includes a candidate receipt; the method further includes: any main network node setting the target verification result as a transaction receipt corresponding to the data verification transaction.
  • the aforementioned candidate verification result is the candidate receipt
  • the aforementioned selected target verification result is the transaction receipt corresponding to the data verification transaction.
  • the transaction receipt corresponding to the data verification transaction can also be sent to the first blockchain subnet of the same node device through the event monitoring mechanism. Obtained by the subnetwork nodes in .
  • the first block chain subnetwork can obtain the transaction receipt through the following way: the subnetwork nodes in the first block chain subnetwork monitor the transaction receipt generated by the main network node deployed on the node device where it is located. Since each main network node will select a transaction receipt with the same content after executing the data verification transaction, and the node equipment of each subnet node in the first blockchain subnet is also equipped with a main network node, so for Each subnet node in the first block chain subnet can obtain the transaction receipt by monitoring the main network node on the node device where it is located, so that the first block chain subnet obtains the transaction receipt.
  • the main network nodes in the blockchain main network are mainly divided into the following two stages in the process of executing data verification transactions: the first stage occurs when each main network node just receives the data verification transaction When each main network node decides whether to generate candidate verification results and broadcast the candidate verification results, this stage is called the voting stage; the second stage occurs when each main network node receives candidate verification results from other main network nodes Finally, based on the data verification conditions corresponding to the maintained second blockchain network, a candidate verification result that satisfies the data verification conditions is determined from all the candidate verification results obtained by itself as the target verification result, and it is transparently transmitted to the second block chain network. A blockchain subnetwork, this process is called the consensus phase.
  • the data verification transaction includes a transaction calling the data verification smart contract deployed on the main network of the block chain; the execution of the data verification transaction by any of the main network nodes includes: calling the data verification smart contract A smart contract is used to generate the candidate verification result and determine the target verification result.
  • the data verification smart contract deployed on any main network node responds to the contract logic executed by the data verification exchange, including judging whether the node device where it is located is deployed with any subnet node in the second blockchain network, From the local database corresponding to any of the subnetwork nodes, the logic of checking whether the target data exists beyond authority, generating and broadcasting candidate verification results, and at the same time, the contract logic also includes determining a satisfactory data from all the obtained candidate verification results
  • the target verification result of the verification condition that is, the contract logic involved in the data verification smart contract in the embodiment of this specification includes the necessary processes of both the voting stage and the consensus stage.
  • the data verification transaction includes a transaction calling the data verification smart contract deployed on the main network of the block chain; the execution of the data verification transaction by any main network node includes: calling the said data verification smart contract to generate said candidate verification results; said any main network node determines a target verification result that satisfies said data verification conditions from all obtained candidate verification results, including: The consensus module deployed on the main network node determines the target verification result.
  • the contract logic executed by the data verification smart contract in response to the data verification transaction only includes judging whether the node device where it is located is deployed with any sub-network node in the second blockchain network, from any In the local database corresponding to the subnet node, the logic of checking whether the target data exists beyond authority, generating and broadcasting the candidate verification result is the necessary process of the voting stage, and after that, the necessary process of the consensus stage carried out by any main network node is It is completed by the consensus module of the node device where any main network node itself is located.
  • the consensus module must maintain the data verification conditions corresponding to the second blockchain subnet, and in the embodiment of this specification, The data verification condition is maintained by the data verification smart contract; and/or, the data verification condition is maintained by other smart contracts. Therefore, the consensus module needs to access the local database corresponding to the main network node to read the data verification conditions corresponding to the second blockchain subnet from the data verification smart contract or other smart contracts.
  • the other smart contracts mentioned above include The aforementioned Subnet contract not only records the data verification conditions corresponding to the second blockchain subnet, but also records the data verification conditions corresponding to all other blockchain subnets under the management of the blockchain main network.
  • the first blockchain subnet can verify whether the target data exists on the second blockchain subnet by checking the content contained in the target verification result.
  • the any main network node determines that the target data exists on the any sub-network node, it generates the candidate verification result containing the target data; the any main network node
  • the network node determines that the target data does not exist in the subnet node in the second blockchain subnet deployed on the node device where any main network node is located, generate the candidate that does not contain the target data.
  • the subnet node in the first block chain subnetwork determines that the target data exists in the second block chain subnetwork under the condition that the target data is included in the target verification result; the first block If the target data is not included in the target receipt, the sub-network nodes in the chain subnet determine that the target data does not exist in the second block chain subnet.
  • subnet0 is the blockchain main network
  • subnet1 is the first blockchain subnet and subnet2 is the second blockchain subnet
  • nodeA1 in subnet1 Holds a transaction hash, and wants to verify whether the transaction data corresponding to the transaction hash (the target data in this embodiment is the transaction data) is maintained in subnet2, so nodeA1 submits a request to the node device 1 where it is located
  • the consensus module sends out data verification transactions, and carries the network identifier of subnet0 in the data verification transaction to indicate the destination blockchain network to which the transaction is sent, and at the same time carries the network identifier of subnet2 to indicate the target blockchain used to verify the target data Network, and the transaction hash that carries the data description information to indicate the target data that needs to be verified.
  • the consensus module in node device 1 determines that the transaction is sent to subnet2 according to the network identifier of subnet0 in the data verification transaction, and then broadcasts the data verification transaction to each main network node in subnet0 according to the consensus link in subnet0, including nodeA located locally on node device 1, and nodeB-nodeE located on node devices 2-5. After any main network node receives the data verification transaction, based on the network identifier of subent2 carried in the data verification transaction, it first judges whether the node device 1 where it is located has deployed a subnet node belonging to subnet2.
  • the main network node nodeA belonging to the subnet node nodeA2 in subnet2 is deployed on the node device where it is located, it will further obtain the blockchain account book of subnet2 in the database corresponding to nodeA2, and verify the transaction hash carried in the transaction according to the data. Hope to check whether the transaction corresponding to the transaction hash exists in the blockchain ledger.
  • nodeA will take out the transaction and write it into the generated candidate verification result result_A, and broadcast result_A to other main network nodes;
  • nodeB assuming that there is no transaction corresponding to the transaction hash in the database corresponding to nodeB2 deployed on node device 2 where nodeB is located, the candidate verification result result_B generated by nodeB will carry empty or invalid data, and result_B Broadcast to other main network nodes; for nodeD, since the node device 4 where nodeD is located is not deployed with subnet nodes belonging to subnet2, nodeD may not generate candidate verification results, and the operations of other main network nodes are similar. I won’t go into details here. Therefore, when all main network nodes complete the generation and broadcast of candidate verification results, the voting phase ends and enters the consensus phase.
  • any main network node will obtain the same candidate verification results to form the same candidate set.
  • nodeA will receive candidate verification results result_B, result_C and result_E from nodeB, nodeC and nodeE respectively, plus The result_A generated by itself constitutes a candidate set including result_A, result_B, result_C, and result_E.
  • other main network nodes such as nodeB ⁇ nodeE will also obtain the same candidate set including result_A, result_B, result_C, and result_E.
  • any main network node will determine the target verification result from the candidate set according to the data verification conditions corresponding to the second blockchain subnet maintained by itself.
  • nodeA ⁇ nodeE will perform the operation of the above consensus stage to determine the target verification result of the same content, although the specific determination results may appear that nodeA ⁇ C determine result_A as the target verification result, nodeD ⁇ E determine result_C as the target verification result, etc.
  • nodeA will reveal the target verification result containing transaction data on node device 1, so that the subnet1 that is also deployed on node device 1
  • Subnet node nodeA1 obtains the target verification result
  • nodeA1 determines that the transaction corresponding to the transaction hash it holds does exist in subnet2 when checking that the target verification result contains the transaction data corresponding to the transaction hash, and finally Satisfy the verification requirements of nodeA1 as the demander of the data verification service for the corresponding data, and at the same time, nodeA1 also obtains the transaction data corresponding to the transaction hash held by it.
  • main network nodes will also perform similar operations to reveal the target verification results on their respective node devices, so that each subnet node in subnet1 can obtain the target verification results and verify the results according to the target If the transaction data is contained in , it is determined that the transaction data does exist in subnet2.
  • the data verification transaction sent by the first block chain subnet includes the target data; any of the main network nodes compares the data on any of the subnet nodes with the target data Compare, and generate the candidate verification result containing the comparison result; meanwhile, the subnetwork nodes in the first block chain subnet determine that the comparison result contained in the target verification result is consistent with the comparison Next, it is determined that the target data exists in the second block chain subnet; when the subnet node in the first block chain subnet determines that the comparison result contained in the target verification result is inconsistent with the comparison, It is determined that the target data does not exist in the second blockchain subnet.
  • subnet0 is the blockchain main network
  • subnet1 is the first blockchain subnet and subnet2 is the second blockchain subnet
  • nodeA1 in subnet1 holds a contract state and the data corresponding to the contract state ID and the contract address of the contract where the contract state is located, and wants to verify whether the contract state held by it (the target data in this embodiment is the contract state) is maintained in subnet2, so nodeA1 sends the node device 1 where it is located
  • the consensus module in the data verification transaction sends out the data verification transaction, and carries the network identification of subnet0 in the data verification transaction to indicate the destination blockchain network to which the transaction is sent, and carries the network identification of subnet2 to indicate the target block used to verify the target data Chain network, and carry the contract address and data identifier as data description information to indicate the target data that needs to be verified.
  • the consensus module in node device 1 determines that the transaction is sent to subnet2 according to the network identifier of subnet0 in the data verification transaction, and then broadcasts the data verification transaction to each main network node in subnet0 according to the consensus link in subnet0, including nodeA located locally on node device 1, and nodeB-nodeE located on node devices 2-5. After any main network node receives the data verification transaction, based on the network identifier of subent2 carried in the data verification transaction, it first judges whether the node device 1 where it is located has deployed a subnet node belonging to subnet2.
  • the main network node nodeA belonging to the subnet node nodeA2 in subnet2 is deployed on the node device where it is located, it will further obtain the contract storage space corresponding to the contract address carried in the data verification transaction from the database corresponding to nodeA2, and according to the data
  • the data identifier carried in the verification transaction is checked in the contract storage space to see if the contract state corresponding to the data identifier exists, and if the contract state exists, it is taken out and compared with the contract state carried in the data verification transaction, assuming If the comparison result is consistent, then nodeA writes the result of the consistent comparison into the generated candidate verification result result_A, and broadcasts result_A to other main network nodes; for nodeB, it is assumed that nodeB is located in node device 2
  • the contract status corresponding to the data identifier can be searched in the database corresponding to nodeB2 deployed on the network, but the contract status retrieved from the database is inconsistent with the contract status carried in the data verification transaction, then the candidate verification result result_
  • any main network node will obtain the same candidate verification results to form the same candidate set.
  • nodeA will receive candidate verification results result_B, result_C and result_E from nodeB, nodeC and nodeE respectively, plus The result_A generated by itself forms a candidate set including result_A, result_B, result_C, and result_E.
  • other main network nodes such as nodeB ⁇ nodeE will also obtain the same candidate set including result_A, result_B, result_C, and result_E.
  • any main network node will determine the target verification result from the candidate set according to the data verification condition corresponding to the second blockchain subnet maintained by itself, assuming that the data verification condition is "the source of the candidate verification result with the same content in all candidate verification results nodeA and nodeB", so any main network node needs to compare and check the content of all candidate verification results in the candidate set, assuming that the contents of result_A, result_C and result_E are all consistent comparison results (like " yes"), and result_B contains inconsistent comparison results (such as "no"), then according to the above data verification conditions, it is obvious that the contents of result_A and result_B from nodeA and nodeB are different, so in the candidate set There is no candidate verification result that satisfies the above data verification conditions, so the target verification result cannot be determined.
  • the candidate verification result with the comparison result that is inconsistent can be used as the target verification result, that is, result_B is determined as the target Verification result; or, it is also possible to be indeterminate and not reveal the target verification result.
  • subnet1 will consider that the contract state does not exist in subnet2 because of the waiting timeout.
  • NodeA ⁇ nodeE will perform the operation of the above consensus stage to determine the target verification result of the same content, or they will not be sure of the target verification result.
  • any main network node will reveal the confirmed target verification result result_B, for example, nodeA will send the target verification result containing transaction data to the node device 1, so that the subnet node nodeA1 belonging to subnet1 that is also deployed on node device 1 obtains the target verification result, and nodeA1 confirms that the target verification result contains an inconsistent comparison result.
  • the contract status held by itself does not exist in subnet2, so as to finally meet the verification requirements of nodeA1 as the demander of the data verification service for the corresponding data.
  • the target verification result is revealed on the device, but since the target verification result does not carry the contract status as the target data, in the case that other main network nodes do not hold the contract status themselves, the subnet nodes in subnet1 except nodeA It will be impossible to know what target data does not exist in subnet2 through the "no" in the target verification result, which has the effect of privacy protection.
  • Fig. 3 is a flowchart of a method for verifying blockchain data provided by an exemplary embodiment.
  • the method is applied to the main network nodes in the blockchain main network.
  • the subnet nodes in the blockchain subnet are located
  • the main network nodes in the blockchain main network are deployed on the node device, and the blockchain subnet includes at least the first blockchain subnet and the second blockchain subnet, and the main network nodes in the blockchain main network
  • the network node maintains data verification conditions corresponding to the second block chain subnet;
  • the method includes: step 302, receiving a data verification transaction initiated by the first block chain subnet to the block chain main network, and the data verification transaction is used for Verify whether the target data exists on the second block chain subnet; step 304, execute the data verification transaction, so that when any subnet node in the second block chain subnet is deployed on the node device where it is located Generate candidate verification results, and broadcast the candidate verification results to other main network nodes in the blockchain main network, wherein the candidate verification results
  • the data verification conditions include at least one of the following: the candidate verification results with the same content among all the candidate verification results exceed the first preset number; the candidate verification results with the same content among all the candidate verification results Originated from a preset main network node; the content of all candidate verification results is the same and the candidate verification results originating from subnet nodes in the second blockchain subnet exceed a second preset number.
  • the candidate verification result includes a candidate receipt; the method further includes: setting the target verification result as a transaction receipt corresponding to the data verification transaction.
  • the first block chain subnet obtains the transaction receipt through the following method: the subnet nodes in the first block chain subnet listen to the transaction receipt generated by the main network node deployed on the node device where it is located.
  • the data verification transaction includes the data description information of the target data and the network identifier of the second blockchain subnet; wherein, the network identifier is used to instruct the main network node to: put itself on the node device
  • the deployed sub-network node corresponding to the network identifier is determined as the any sub-network node; the data description information is used to instruct the main network node: match any sub-network node with the data
  • Data describing information is determined as the target data.
  • the broadcasting of the candidate verification results to other main network nodes in the blockchain main network includes: broadcasting the candidate verification results to the blockchain main network after signing A main network node other than any main network node; wherein, all candidate verification results include: candidate verification results generated by itself and candidate verification results received from other main network nodes and successfully verified.
  • the generating the candidate verification result includes: when it is determined that the target data exists on the any subnetwork node, generating the candidate verification result containing the target data, so that the first A subnetwork node in a block chain subnet determines that the target data exists in a second block chain subnet when the target verification result includes the target data.
  • the data verification transaction includes the target data; the generation of the candidate verification results includes: comparing the data on any subnetwork node with the target data, and generating a comparison The candidate verification result of the result, so that the subnet node in the first block chain subnet determines the target data when the comparison result contained in the target verification result is determined to be consistent.
  • the second blockchain subnet Exists on the second blockchain subnet.
  • it also includes: responding to and executing a subnet creation transaction for creating a new blockchain subnet, obtaining and maintaining the data verification conditions corresponding to the new blockchain subnet, and the subnet creation transaction includes the new zone The data verification conditions corresponding to the block chain subnet.
  • it also includes: responding to and executing a condition change transaction for updating the data verification conditions corresponding to the second blockchain subnet, updating the data verification conditions maintained by itself to new data verification conditions, the The condition modification transaction includes the new data verification condition corresponding to the second blockchain subnet.
  • the data verification transaction includes the transaction of calling the data verification smart contract deployed on the main network of the block chain; the execution of the data verification transaction includes: calling the data verification smart contract to generate the The candidate verification result is determined and the target verification result is determined.
  • the data verification transaction includes the transaction of calling the data verification smart contract deployed on the main network of the block chain; the execution of the data verification transaction includes: calling the data verification smart contract to generate the The candidate verification result; the determining a target verification result that satisfies the data verification condition from all the obtained candidate verification results includes: determining the target verification result through a locally deployed consensus module.
  • the data verification condition is maintained by the data verification smart contract; and/or, the data verification condition is maintained by other smart contracts.
  • the target data includes one of the following: transaction data, status data, and receipt data.
  • Fig. 4 is a schematic structural diagram of a device provided by an exemplary embodiment.
  • the device includes a processor 402 , an internal bus 404 , a network interface 406 , a memory 408 and a non-volatile memory 410 , and of course may include hardware required by other services.
  • One or more embodiments of this specification may be implemented based on software, for example, the processor 402 reads a corresponding computer program from the non-volatile memory 410 into the memory 408 and executes it.
  • 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 to say, the execution subject of the following processing flow is not limited to each A logic unit, which can also be a hardware or logic device.
  • Figure 5 is a block diagram of a device for verifying blockchain data provided in this specification according to an exemplary embodiment, and the device can be applied to the device shown in Figure 4 to realize the Technical solutions.
  • the device is applied to the main network nodes in the blockchain main network.
  • the subnet nodes in the blockchain subnet are located
  • the main network nodes in the blockchain main network are deployed on the node device, and the blockchain subnet includes at least the first blockchain subnet and the second blockchain subnet, and the main network nodes in the blockchain main network
  • the network node maintains the data verification conditions corresponding to the second block chain subnet;
  • the device includes: a transaction receiving module 501, which is used to receive the data verification transaction initiated by the first block chain subnet to the block chain main network, and the data The verification transaction is used to verify whether the target data exists on the second block chain subnet;
  • the transaction execution module 502 is used to execute the data verification transaction to deploy the second block chain subnet on the node device where it is located.
  • a candidate verification result is generated, and the candidate verification result is broadcast to other main network nodes in the blockchain main network, wherein the candidate verification result is used to indicate that any Whether the target data exists on the subnetwork node; the condition verification module 503 is used to determine a target verification result that satisfies the data verification condition from all the obtained candidate verification results, so that the first block chain subnet can use The target verification result determines whether the target data exists in the second block chain subnetwork.
  • the data verification conditions include at least one of the following: the candidate verification results with the same content among all the candidate verification results exceed the first preset number; the candidate verification results with the same content among all the candidate verification results Originated from a preset main network node; the content of all candidate verification results is the same and the candidate verification results originating from subnet nodes in the second blockchain subnet exceed a second preset number.
  • the candidate verification result includes a candidate receipt; the device further includes: a receipt setting module 504, configured to set the target verification result as a transaction receipt corresponding to the data verification transaction.
  • the first block chain subnet obtains the transaction receipt through the following method: the subnet nodes in the first block chain subnet listen to the transaction receipt generated by the main network node deployed on the node device where it is located.
  • the data verification transaction includes the data description information of the target data and the network identifier of the second blockchain subnet; wherein, the network identifier is used to instruct the main network node to: put itself on the node device
  • the deployed sub-network node corresponding to the network identifier is determined as the any sub-network node; the data description information is used to instruct the main network node: match any sub-network node with the data
  • Data describing information is determined as the target data.
  • the transaction execution module 502 is specifically configured to: broadcast the candidate verification result to the main network nodes in the blockchain main network except any main network node after signing; wherein, All the candidate verification results include: candidate verification results generated by itself and candidate verification results received from other main network nodes and successfully verified.
  • the transaction execution module 502 is specifically configured to: generate the candidate verification result containing the target data when it is determined that the target data exists on any of the subnetwork nodes, so that the first A subnetwork node in a block chain subnet determines that the target data exists in a second block chain subnet when the target verification result includes the target data.
  • the data verification transaction includes the target data; the transaction execution module 502 is specifically configured to: compare the data on any subnetwork node with the target data, and generate an inclusion ratio The candidate verification result of the result, so that the subnet node in the first block chain subnet determines the target data when the comparison result contained in the target verification result is determined to be consistent.
  • the second blockchain subnet Exists on the second blockchain subnet.
  • a subnet creation transaction execution module 505 which is used to respond to and execute a subnet creation transaction for creating a new blockchain subnet, acquire and maintain the data verification conditions corresponding to the new blockchain subnet, and
  • the subnet creation transaction includes the data verification conditions corresponding to the new blockchain subnet.
  • condition change transaction execution module 506 which is used to respond to and execute a condition change transaction for updating the data verification conditions corresponding to the second blockchain subnet, and convert the data verification conditions maintained by itself to The new data verification condition is updated, and the condition modification transaction includes the new data verification condition corresponding to the second block chain subnet.
  • the data verification transaction includes the transaction of calling the data verification smart contract deployed on the main network of the block chain; the transaction execution module 502 is specifically used to: call the data verification smart contract to generate the Candidate verification results and determine the target verification result.
  • the data verification transaction includes the transaction of calling the data verification smart contract deployed on the main network of the block chain; the transaction execution module 502 is specifically used to: call the data verification smart contract to generate the a candidate verification result; and, through a locally deployed consensus module, determine the target verification result.
  • the data verification condition is maintained by the data verification smart contract; and/or, the data verification condition is maintained by other smart contracts.
  • the target data includes one of the following: transaction data, status data, and receipt data.
  • this specification also provides a device, the device includes a processor; a memory for storing processor-executable instructions; wherein, the processor is configured to implement the implementation verification area provided by all the above method embodiments The steps of the method of blockchain data.
  • this specification also provides a computer-readable storage medium on which executable instructions are stored; wherein, when the instructions are executed by the processor, the methods for verifying blockchain data provided by all the above method embodiments are implemented. A step of.
  • Figure 6 is an architecture diagram of a system for verifying blockchain data provided by this specification according to an exemplary embodiment. It can be intuitively shown from the figure that the first blockchain subnet 610 Any deployed subnetwork node is in the same node device as a certain mainnet node in the blockchain mainnet 600 .
  • the block chain system includes a block chain subnet and a block chain main network 600, wherein, the node device where the subnet node in the block chain subnet is located is deployed with the block chain main network 600.
  • the block chain subnet includes at least a first block chain subnet 610 and a second block chain subnet
  • the main network nodes in the block chain main network 600 maintain data corresponding to the second block chain subnet Verification conditions
  • the system includes: a first block chain subnet 610, which is used to initiate a data verification transaction to the block chain main network 600, and the data verification transaction is used to verify whether there is target data on the second block chain subnet Block chain main network 600, any main network node in the block chain main network 600 executes the data verification transaction, so that the second block is deployed on the node device where any main network node is located
  • a candidate verification result is generated, and the candidate verification result is broadcast to other main network nodes in the blockchain main network 600, wherein the candidate verification result is used for Indicate whether the target data exists on any of the subnet nodes; any of the main network nodes determines a target verification result that satisfies the data verification conditions from all obtained candidate verification results,
  • the data verification conditions include at least one of the following: the candidate verification results with the same content among all the candidate verification results exceed the first preset number; the candidate verification results with the same content among all the candidate verification results Originated from a preset main network node; the content of all candidate verification results is the same and the candidate verification results originating from subnet nodes in the second blockchain subnet exceed a second preset number.
  • the candidate verification results include candidate receipts; the block chain main network 600 is also used to: enable any of the main network nodes to set the target verification result as the transaction corresponding to the data verification transaction Receipt.
  • the first block chain subnet 610 obtains the transaction receipt through the following method: make the subnet nodes in the first block chain subnet 610 listen to the transaction receipt generated by the main network node deployed on the node device where it is located. transaction receipt.
  • the data verification transaction includes the data description information of the target data and the network identification of the second blockchain subnet; wherein, the network identification is used to indicate that any main network node: The subnetwork node deployed on the device corresponding to the network identifier is determined as any subnetwork node; the data description information is used to indicate any main network node: match any subnetwork node The data based on the data description information is determined as the target data.
  • the blockchain main network 600 is specifically used to: enable any of the main network nodes to sign the candidate verification result and broadcast it to the blockchain main network 600 A main network node other than the main network node; wherein, all the candidate verification results include: candidate verification results generated by itself and candidate verification results received from other main network nodes and successfully verified.
  • the block chain main network 600 is specifically used to: make any of the main network nodes determine that the target data exists on any of the sub-network nodes, generate a block containing the target data the candidate verification result; the first blockchain subnetwork 610 is also used to: make the subnetwork nodes in the first blockchain subnetwork 610 determine that the target data is included in the target verification result The target data exists in the second blockchain subnet.
  • the data verification transaction includes the target data;
  • the block chain main network 600 is specifically used to: enable the any main network node to combine the data on the any sub-network node with the The target data is compared, and the candidate verification result containing the comparison result is generated;
  • the first block chain subnetwork 610 is also used to: make the subnetwork nodes in the first block chain subnetwork 610 determine the target If the comparison result included in the verification result is consistent, it is determined that the target data exists in the second blockchain subnetwork.
  • the block chain main network 600 is also used to: respond to the subnet creation transaction for creating a new block chain subnet, so that the main network nodes in the block chain main network 600 execute the Obtain and maintain the data verification conditions corresponding to the new blockchain subnet after the subnet creation transaction, and the subnet creation transaction includes the data verification conditions corresponding to the new blockchain subnet.
  • the block chain main network 600 is also used for: changing the transaction in response to the conditions for updating the data verification conditions corresponding to the second block chain subnet, so that the block chain main network 600 After executing the condition change transaction, the main network node in the node updates the data verification condition maintained by itself to the new data verification condition, and the condition change transaction includes the new data verification corresponding to the second blockchain subnet. condition.
  • the data verification transaction includes the transaction of invoking the data verification smart contract deployed on the block chain main network 600; the block chain main network 600 is specifically used to: enable any main network node to call the The data verification smart contract is used to generate the candidate verification result and determine the target verification result.
  • the data verification transaction includes the transaction of invoking the data verification smart contract deployed on the block chain main network 600; the block chain main network 600 is specifically used to: enable any main network node to call the The data verification smart contract is used to generate the candidate verification result; and the target verification result is determined through the consensus module deployed on any main network node.
  • the data verification condition is maintained by the data verification smart contract; and/or, the data verification condition is maintained by other smart contracts.
  • the target data includes one of the following: transaction data, status data, and receipt data.
  • the device embodiments described above are only illustrative, and the modules described as separate components may or may not be physically separated, and the components shown as modules may or may not be physical modules, that is, they may be located in One place, or it can be distributed to multiple network modules. Part or all of the modules can be selected according to actual needs to achieve the purpose of the solution in this specification. It can be understood and implemented by those skilled in the art without creative effort.
  • a typical implementing device is a computer.
  • the computer may be, for example, 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 device, a game console, a tablet computer, a wearable device, or Combinations of any of these devices.
  • the embodiments of the present invention may be provided as methods, systems, or computer program products. Accordingly, the present invention can take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) having computer-usable program code embodied therein.
  • computer-usable storage media including but not limited to disk storage, CD-ROM, optical storage, etc.
  • program modules include routines, programs, objects, components, data structures, etc. that perform particular tasks or implement particular abstract data types.
  • the present description may also be practiced in distributed computing environments where tasks are performed by remote processing devices that are linked through a communications network.
  • program modules may be located in both local and remote computer storage media including storage devices.
  • These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing apparatus to operate in a specific manner, such that the instructions stored in the computer-readable memory produce an article of manufacture comprising instruction means, the instructions
  • the device realizes the function specified in one or more procedures of the flowchart and/or one or more blocks of the block diagram.
  • a computer includes one or more processors (CPUs), input/output interfaces, network interfaces and memory.
  • Memory may include non-permanent storage in computer-readable media, in the form of random access memory (RAM) and/or nonvolatile memory such as read-only memory (ROM) or flash RAM. Memory is an example of computer readable media.
  • RAM random access memory
  • ROM read-only memory
  • flash RAM flash random access memory
  • Computer-readable media including both permanent and non-permanent, removable and non-removable media, can be implemented by any method or technology for storage of information.
  • Information may be computer readable instructions, data structures, modules of a program, 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 computing devices.
  • computer-readable media excludes transitory computer-readable media, such as modulated data signals and carrier waves.
  • first, second, third, etc. may be used in one or more embodiments of the present specification to describe various information, the information should not be limited to these terms. These terms are only used to distinguish information of the same type from one another. For example, without departing from the scope of one or more embodiments of this specification, first information may also be called second information, and similarly, second information may also be called first information. Depending on the context, the word “if” as used herein may be interpreted as “at” or "when” or "in response to a determination.”

Abstract

Provided in the present description are a blockchain data verification method and apparatus, and an electronic device and a storage medium. The method is applied to a blockchain system that includes a blockchain subnet and a blockchain main net. The method comprises: a first blockchain subnet initiating a data verification transaction to a blockchain main net, wherein the data verification transaction is used for verifying whether target data is present on a second blockchain subnet; any one main net node in the blockchain main net executing the data verification transaction, so as to generate a candidate verification result when any one subnet node in the second blockchain subnet is deployed on a node device in which the main net node is located, and broadcasting the candidate verification result to other main net nodes in the blockchain main net; and any one main net node determining, from among all acquired candidate verification results, a target verification result that meets a data verification condition, such that the first blockchain subnet determines, according to the target verification result, whether the target data is present on the second blockchain subnet.

Description

验证区块链数据Verify blockchain data 技术领域technical field
本说明书一个或多个实施例涉及区块链技术领域,尤其涉及一种验证区块链数据的方法、装置、电子设备和存储介质。One or more embodiments of this specification relate to the technical field of blockchain, and in particular to a method, device, electronic device, and storage medium for verifying blockchain data.
背景技术Background technique
区块链技术构建在传输网络(例如点对点网络)之上。区块链网络中的节点利用链式数据结构来验证与存储数据,并采用分布式节点共识算法来生成和更新数据。在相关技术中,基于区块链数据的私密需求,会在区块链主网的基础上组建区块链子网,使得各个区块链子网之间相互独立、彼此隔离,因此相互之间具有数据验证需求。基于传统的跨链技术能够满足不同区块链子网之间数据验证需求,但通常流程繁琐且耗时较长,并且忽略了区块链主网能够作为不同区块链子网间进行数据验证的信任基础。Blockchain technology is built on top of transmission networks such as peer-to-peer networks. Nodes in the blockchain network use chained data structures to verify and store data, and use distributed node consensus algorithms to generate and update data. In related technologies, based on the privacy requirements of blockchain data, blockchain subnets will be established on the basis of the blockchain main network, so that each blockchain subnet is independent and isolated from each other, so there is data sharing between each other. Verify requirements. Traditional cross-chain technology can meet the data verification requirements between different blockchain subnets, but the process is usually cumbersome and time-consuming, and ignores the trust that the blockchain main network can serve as data verification between different blockchain subnets Base.
发明内容Contents of the invention
有鉴于此,本说明书一个或多个实施例提供一种验证区块链数据的方法、装置、电子设备和存储介质。In view of this, one or more embodiments of this specification provide a method, device, electronic device and storage medium for verifying blockchain data.
为实现上述目的,本说明书一个或多个实施例提供技术方案如下:根据本说明书一个或多个实施例的第一方面,提出了一种验证区块链数据的方法,应用于包含区块链子网和区块链主网的区块链系统,其中,所述区块链子网中的子网节点所处的节点设备上部署有所述区块链主网中的主网节点,所述区块链子网至少包括第一区块链子网和第二区块链子网,所述区块链主网中的主网节点维护有第二区块链子网对应的数据验证条件;所述方法包括:第一区块链子网向区块链主网发起数据验证交易,所述数据验证交易用于对第二区块链子网上是否存在目标数据进行验证;所述区块链主网中的任一主网节点执行所述数据验证交易,以在所述任一主网节点所处节点设备上部署有第二区块链子网中的任一子网节点的情况下生成候选验证结果,并将所述候选验证结果广播至所述区块链主网中的其他主网节点,其中,所述候选验证结果用于表明所述任一子网节点上是否存在所述目标数据;所述任一主网节点从获取到的所有候选验证结果中确定一个满足所述数据验证条件的目标验证结果,以由第一区块链子网根据所述目标验证结果确定所述目标数据是否存在于第二区块链子网。In order to achieve the above purpose, one or more embodiments of this specification provide the following technical solutions: According to the first aspect of one or more embodiments of this specification, a method for verifying blockchain data is proposed, which is applied to network and the block chain system of the block chain main network, wherein the node device where the subnet node in the block chain subnet is located is deployed with the main network node in the block chain main network, and the block chain The block chain subnet includes at least a first block chain subnet and a second block chain subnet, and the main network nodes in the block chain main network maintain data verification conditions corresponding to the second block chain subnet; the method includes: The first block chain subnet initiates a data verification transaction to the block chain main network, and the data verification transaction is used to verify whether the target data exists on the second block chain subnet; The network node executes the data verification transaction to generate a candidate verification result under the condition that any subnet node in the second block chain subnet is deployed on the node device where any main network node is located, and the Candidate verification results are broadcast to other main network nodes in the blockchain main network, wherein the candidate verification results are used to indicate whether the target data exists on any of the subnet nodes; The node determines a target verification result that satisfies the data verification condition from all the obtained candidate verification results, so that the first blockchain subnet can determine whether the target data exists in the second blockchain subnet according to the target verification result. net.
根据本说明书一个或多个实施例的第二方面,提出了另一种验证区块链数据的方法,应用于区块链主网中的主网节点,在所述区块链主网与区块链子网构成的区块链系统中,所述区块链子网中的子网节点所处的节点设备上部署有所述区块链主网中的主网节点,所述区块链子网至少包括第一区块链子网和第二区块链子网,所述区块链主网中的主网节点维护有第二区块链子网对应的数据验证条件;所述方法包括:接收第一区块链子网向区块链主网发起的数据验证交易,所述数据验证交易用于对第二区块链子网上是否存在目标数据进行验证;执行所述数据验证交易,以在自身所处节点设备上部署有第二区块链子网中的任一子网节点的情况下生成候选验证结果,并将所述候选验证结果广播至所述区块链主网中的其他主网节点,其中,所述候选验证结果用于表明所述任一子网节点上是否存在所述目标数据;从获取到的所有候选验证结果中确定一个满足所述数据验证条件的目标验证结果,以由第一区块链子网根据所述目标验证结果确定所述目标数据是否存在于第二区块链子网。According to the second aspect of one or more embodiments of this specification, another method for verifying blockchain data is proposed, which is applied to the main network nodes in the blockchain main network. In a block chain system composed of block chain subnets, the node device where the subnetwork nodes in the block chain subnet are located is deployed with the main network nodes in the block chain main network, and the block chain subnet is at least Including the first block chain subnet and the second block chain subnet, the main network node in the block chain main network maintains the data verification conditions corresponding to the second block chain subnet; the method includes: receiving the first zone The data verification transaction initiated by the block chain subnet to the block chain main network, the data verification transaction is used to verify whether the target data exists on the second block chain subnet; Generate a candidate verification result when any subnet node in the second blockchain subnet is deployed on the network, and broadcast the candidate verification result to other main network nodes in the blockchain main network, wherein the The candidate verification result is used to indicate whether the target data exists on any subnetwork node; determine a target verification result that satisfies the data verification condition from all the obtained candidate verification results, so as to be used by the first block The chain subnet determines whether the target data exists in the second blockchain subnet according to the target verification result.
根据本说明书一个或多个实施例的第三方面,提出了一种验证区块链数据的装置,应用于区块链主网中的主网节点,在所述区块链主网与区块链子网构成的区块链系统中,所述区块链子网中的子网节点所处的节点设备上部署有所述区块链主网中的主网节点,所述区块链子网至少包括第一区块链子网和第二区块链子网,所述区块链主网中的主网节点维护有第二区块链子网对应的数据验证条件;所述装置包括:交易接收模块,用于接收第一区块链子网向区块链主网发起的数据验证交易,所述数据验证交易用于对第二区块链子网上是否存在目标数据进行验证;交易执行模块,用于执行所述数据验证交易,以在自身所处节点设备上部署有第二区块链子网中的任一子网节点的情况下生成候选验证结果,并将所述候选验证结果广播至所述区块链主网中的其他主网节点,其中,所 述候选验证结果用于表明所述任一子网节点上是否存在所述目标数据;条件验证模块,用于从获取到的所有候选验证结果中确定一个满足所述数据验证条件的目标验证结果,以由第一区块链子网根据所述目标验证结果确定所述目标数据是否存在于第二区块链子网。According to the third aspect of one or more embodiments of this specification, a device for verifying blockchain data is proposed, which is applied to the main network nodes in the blockchain main network, and the blockchain main network and block In the block chain system composed of the chain subnet, the node device where the subnet node in the block chain subnet is located is deployed with the main network node in the block chain main network, and the block chain subnet includes at least The first block chain subnet and the second block chain subnet, the main network node in the block chain main network maintains the data verification conditions corresponding to the second block chain subnet; the device includes: a transaction receiving module, used To receive the data verification transaction initiated by the first block chain subnet to the block chain main network, the data verification transaction is used to verify whether the target data exists on the second block chain subnet; the transaction execution module is used to execute the Data verification transaction, to generate a candidate verification result when any subnet node in the second block chain subnet is deployed on the node device where it is located, and broadcast the candidate verification result to the block chain master Other main network nodes in the network, wherein, the candidate verification result is used to indicate whether the target data exists on any subnet node; the condition verification module is used to determine one of the obtained candidate verification results A target verification result that satisfies the data verification condition, so that the first block chain subnet can determine whether the target data exists in the second block chain subnet according to the target verification result.
根据本说明书一个或多个实施例的第四方面,提出了一种区块链系统,包含区块链子网和区块链主网,其中,所述区块链子网中的子网节点所处的节点设备上部署有所述区块链主网中的主网节点,所述区块链子网至少包括第一区块链子网和第二区块链子网,所述区块链主网中的主网节点维护有第二区块链子网对应的数据验证条件;所述系统包括:第一区块链子网,用于向区块链主网发起数据验证交易,所述数据验证交易用于对第二区块链子网上是否存在目标数据进行验证;区块链主网,所述区块链主网中的任一主网节点执行所述数据验证交易,以在所述任一主网节点所处节点设备上部署有第二区块链子网中的任一子网节点的情况下生成候选验证结果,并将所述候选验证结果广播至所述区块链主网中的其他主网节点,其中,所述候选验证结果用于表明所述任一子网节点上是否存在所述目标数据;所述任一主网节点从获取到的所有候选验证结果中确定一个满足所述数据验证条件的目标验证结果,以由第一区块链子网根据所述目标验证结果确定所述目标数据是否存在于第二区块链子网。According to a fourth aspect of one or more embodiments of this specification, a blockchain system is proposed, including a blockchain subnet and a blockchain main network, wherein the subnet nodes in the blockchain subnet are located The main network nodes in the block chain main network are deployed on the node device, and the block chain subnet includes at least the first block chain subnet and the second block chain subnet, and the block chain main network The main network node maintains the data verification conditions corresponding to the second block chain subnet; the system includes: the first block chain subnet, used to initiate a data verification transaction to the block chain main network, and the data verification transaction is used for Whether there is target data on the second block chain sub-net for verification; block chain main network, any main network node in the block chain main network executes the data verification transaction, so that any main network node in the block chain Generate a candidate verification result when any subnet node in the second block chain subnet is deployed on the node device, and broadcast the candidate verification result to other main network nodes in the block chain main network, Wherein, the candidate verification result is used to indicate whether the target data exists on any of the subnetwork nodes; the any main network node determines a data verification result that satisfies the data verification condition from all obtained candidate verification results. A target verification result, so that the first block chain subnet can determine whether the target data exists in the second block chain subnet according to the target verification result.
根据本说明书实施例的第五方面,提供一种电子设备,包括:处理器;用于存储处理器可执行指令的存储器;其中,所述处理器通过运行所述可执行指令以实现上述验证区块链数据的方法的步骤。According to a fifth aspect of the embodiments of this specification, there is provided an electronic device, including: a processor; a memory for storing processor-executable instructions; wherein, the processor executes the executable instructions to implement the above verification area The steps of the method of blockchain data.
根据本说明书实施例的第六方面,提供一种计算机可读存储介质,其上储存有可执行指令;其中,该指令被处理器执行时,实现上述验证区块链数据的方法的步骤。According to a sixth aspect of the embodiments of the present specification, there is provided a computer-readable storage medium on which executable instructions are stored; wherein, when the instructions are executed by a processor, the steps of the above-mentioned method for verifying blockchain data are implemented.
应当理解的是,以上的一般描述和后文的细节描述仅是示例性和解释性的,并不能限制本说明书。It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the specification.
附图说明Description of drawings
图1是一示例性实施例提供的一种包含区块链主网和区块链子网的区块链系统的示意图。Fig. 1 is a schematic diagram of a blockchain system including a blockchain main network and a blockchain subnet provided by an exemplary embodiment.
图2是一示例性实施例提供的一种验证区块链数据的方法的流程图。Fig. 2 is a flowchart of a method for verifying blockchain data provided by an exemplary embodiment.
图3是一示例性实施例提供的另一种验证区块链数据的方法的流程图。Fig. 3 is a flow chart of another method for verifying blockchain data provided by an exemplary embodiment.
图4是一示例性实施例提供的一种设备的结构示意图。Fig. 4 is a schematic structural diagram of a device provided by an exemplary embodiment.
图5是一示例性实施例提供的一种验证区块链数据的装置的框图。Fig. 5 is a block diagram of a device for verifying blockchain data provided by an exemplary embodiment.
图6是一示例性实施例提供的一种验证区块链数据的系统的架构图。Fig. 6 is an architecture diagram of a system for verifying blockchain data provided by an exemplary embodiment.
具体实施方式Detailed ways
这里将详细地对示例性实施例进行说明,其示例表示在附图中。下面的描述涉及附图时,除非另有表示,不同附图中的相同数字表示相同或相似的要素。以下示例性实施例中所描述的实施方式并不代表与本说明书一个或多个实施例相一致的所有实施方式。相反,它们仅是与如所附权利要求书中所详述的、本说明书一个或多个实施例的一些方面相一致的装置和方法的例子。Reference will now be made in detail to the exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, the same numerals in different drawings refer to the same or similar elements unless otherwise indicated. Implementations described in the following exemplary embodiments do not represent all implementations consistent with one or more embodiments of this specification. Rather, they are merely examples of apparatuses and methods consistent with aspects of one or more embodiments of the present specification as recited in the appended claims.
需要说明的是:在其他实施例中并不一定按照本说明书示出和描述的顺序来执行相应方法的步骤。在一些其他实施例中,其方法所包括的步骤可以比本说明书所描述的更多或更少。此外,本说明书中所描述的单个步骤,在其他实施例中可能被分解为多个步骤进行描述;而本说明书中所描述的多个步骤,在其他实施例中也可能被合并为单个步骤进行描述。It should be noted that in other embodiments, the steps of the corresponding methods are not necessarily performed in the order shown and described in this specification. In some other embodiments, the method may include more or less steps 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; multiple steps described in this specification may also be combined into a single step in other embodiments describe.
由于区块链网络的去中心化特性,使得区块链网络中的所有区块链节点均会维护相同的区块数据,无法满足部分节点的特殊需求。以联盟链为例,所有联盟成员(即联盟内的节点成员)可以组成一区块链网络,所有联盟成员在该区块链网络中分别存在对应的区块链节点,并可以通过对应的区块链节点获得该区块链网络上发生的所有交易和相关数据。但在一些情况下,可能存在部分联盟成员希望完成一些具有私密需求的交易,这些联盟成员既希望这些交易能够在区块链上存证或借助于区块链技术的其他优势,又 能够避免其他联盟成员查看到这些交易和相关数据。虽然这些联盟成员可以额外组建一新的区块链网络,其建立方式与上述包含所有联盟成员的区块链网络类似,但是从头开始建立一条新的区块链网络需要消耗大量的资源,且无论是该区块链网络的建立过程或是建成后的配置过程都非常耗时。联盟成员之间的需求往往是临时的或者具有一定的时效性,使得新建的区块链网络很快就会由于需求消失而失去存在的意义,从而进一步增加了上述区块链网络的建链成本。而联盟成员之间的需求经常会变化,而每一需求所对应的联盟成员也往往不同,因而每当联盟成员发生变化时就可能需要组建一新的区块链网络,从而造成资源和时间的大量浪费。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 consortium chain as an example, all consortium members (that is, node members in the consortium) can form a blockchain network, and all consortium members have corresponding blockchain nodes in the blockchain network, and can pass the corresponding zone Block chain nodes obtain all transactions and related data that occur on the block chain network. However, in some cases, there may be some alliance members who want to complete some transactions with privacy requirements. These alliance members hope that these transactions can be stored on the blockchain or take advantage of other advantages of blockchain technology, and can avoid other transactions. Affiliate members see these transactions and related data. Although these alliance members can additionally form a new blockchain network, the establishment method is similar to the above-mentioned blockchain network that includes all alliance members, but building a new blockchain network from scratch requires a lot of resources, and regardless of The establishment process of the blockchain network or the configuration process after completion is very time-consuming. The needs among alliance members are often temporary or have a certain timeliness, so that the newly built blockchain network will soon lose the meaning of existence due to the disappearance of demand, thus further increasing the chain construction cost of the above-mentioned blockchain network . However, the needs of alliance members often change, and the alliance members corresponding to each demand are often different. Therefore, whenever the alliance members change, it may be necessary to form a new blockchain network, resulting in resource and time constraints. A lot of waste.
为此,可以将已组建的区块链网络作为区块链主网,并在该区块链主网的基础上组建区块链子网。那么,在诸如上述的联盟链场景下,联盟成员可以在已经参与区块链主网的情况下,基于自身需求而在区块链主网的基础上组建所需的区块链子网。由于区块链子网是在区块链主网的基础上所建立,使得区块链子网的组建过程相比于完全独立地组建一条区块链网络,所消耗的资源和所需的耗时等都极大地降低,灵活性极高。To this end, the established blockchain network can be used as the blockchain main network, and a blockchain subnet can be formed on the basis of the blockchain main network. Then, in the consortium chain scenario such as the one mentioned above, the consortium members can build the required blockchain subnet based on their own needs while already participating in the blockchain main network. Since the blockchain subnet is established on the basis of the blockchain main network, the construction process of the blockchain subnet is compared to the completely independent establishment of a blockchain network, the resources consumed and the time required, etc. Both are greatly reduced, and the flexibility is extremely high.
基于区块链主网快捷组建区块链子网的过程如下:区块链主网中的各区块链节点分别获取组建区块链子网的交易,所述交易包含所述区块链子网的配置信息,所述配置信息包括参与组建所述区块链子网的节点成员的身份信息,所述区块链主网中的各区块链节点分别执行所述交易以透出所述配置信息,当所述配置信息包含第一区块链节点对应的节点成员的身份信息时,部署第一区块链节点的节点设备基于所述包含所述配置信息的创世块启动属于所述区块链子网的第二区块链节点。The process of quickly establishing a blockchain subnet based on the blockchain main network is as follows: each blockchain node in the blockchain main network obtains a transaction for establishing a blockchain subnet, and the transaction includes the configuration information of the blockchain subnet , the configuration information includes the identity information of the node members participating in the formation of the block chain subnet, each block chain node in the block chain main network respectively executes the transaction to disclose the configuration information, when the When the configuration information includes the identity information of the node members corresponding to the first block chain node, the node device deploying the first block chain node starts the first block belonging to the block chain subnet based on the genesis block containing the configuration information. Two blockchain nodes.
组建区块链子网的交易可由区块链主网的管理员发起,即仅允许管理员在区块链主网的基础上组建区块链子网,而避免将区块链子网的组建权限开放给普通用户,以防止由此导致的安全性问题。在一些情况下,也可以允许区块链主网的普通用户发起上述组建区块链子网的交易,以满足普通用户的组网需求,使得普通用户能够在管理员不便于发起交易的情况下依然能够快捷地组建区块链子网。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 on the basis of the blockchain main network, and avoid opening the establishment authority of the blockchain subnet to Normal 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 initiate transactions when the administrator is inconvenient. It is possible to quickly form a blockchain subnet.
图1是一示例性实施例提供的一种包含区块链主网和区块链子网的区块链系统的示意图,以图1所示为例,区块链主网为subnet0,该subnet0包含的区块链节点为nodeA、nodeB、nodeC、nodeD和nodeE等。假定nodeA、nodeB、nodeC和nodeD希望组建一区块链子网:如果nodeA为管理员且仅允许管理员发起组建区块链子网的交易,那么可由nodeA向subnet0发起上述组建区块链子网的交易;如果nodeE为管理员且仅允许管理员发起组建区块链子网的交易,那么nodeA~nodeD需要向nodeE进行请求,使得nodeE向subnet0发起上述组建区块链子网的交易;如果nodeE为管理员但允许普通用户发起组建区块链子网的交易,那么nodeA~nodeE均可以向subnet0发起上述组建区块链子网的交易。当然,不论是管理员或者普通用户,发起组建区块链子网的交易的区块链节点并不一定参与所组建的区块链子网,比如虽然最终由nodeA、nodeB、nodeC和nodeD组建区块链子网,但可由nodeE向subnet0发起上述组建区块链子网的交易,而并不一定由nodeA~nodeD来发起该组建区块链子网的交易。Fig. 1 is a schematic diagram of a block chain system including a block chain main network and a block chain subnet provided by an exemplary embodiment. Taking the example shown in Fig. 1, the block chain main network is subnet0, and the subnet0 includes The blockchain nodes are nodeA, nodeB, nodeC, nodeD, nodeE, etc. Assume that nodeA, nodeB, nodeC and nodeD want to form a blockchain subnet: if nodeA is an administrator and only allows the administrator to initiate a transaction to form a blockchain subnet, then nodeA can initiate the above-mentioned transaction to form a blockchain subnet to subnet0; If nodeE is an administrator and only allows the administrator to initiate the transaction of establishing a blockchain subnet, then nodeA~nodeD needs to make a request to nodeE, so that nodeE initiates the above transaction of establishing a blockchain subnet to subnet0; if nodeE is an administrator but allows Ordinary users initiate a transaction to establish a blockchain subnet, then nodeA~nodeE can initiate the above transaction to subnet0 to establish a blockchain subnet. 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 established blockchain subnet. network, but nodeE can initiate the above-mentioned transaction of establishing a blockchain subnet to subnet0, and not necessarily nodeA~nodeD initiate the transaction of establishing a blockchain subnet.
在区块链主网的基础上组建区块链子网时,容易理解的是,会使得该区块链子网与区块链主网之间存在逻辑上的层次关系。比如在图1所示的subnet0上组建区块链子网subnet1时,可以认为subnet0处于第一层、subnet1处于第二层。一种情况下,本说明书中的区块链主网可以为底层区块链网络,即区块链主网并非在其他区块链网络的基础上组建的区块链子网,比如图1中的subnet0可以认为属于底层区块链网络类型的区块链主网。另一种情况下,本说明书中的区块链主网也可以为其他区块链网络的子网,比如可以在图1中subnet1的基础上进一步组建另一区块链子网,此时可以认为subnet1为该区块链子网对应的区块链主网,而这并不影响该subnet1同时属于subnet0上创建的区块链子网。可见,区块链主网与区块链子网实际上是相对概念,同一区块链网络在一些情况下可以为区块链主网、另一些情况下可以为区块链子网。When a blockchain subnet is established on the basis of the blockchain main network, it is easy to understand that there will be a logical hierarchical relationship between the blockchain subnet and the blockchain main network. For example, when a blockchain subnet subnet1 is established on subnet0 shown in Figure 1, it can be considered that subnet0 is at the first layer and subnet1 is at the second layer. In one case, the blockchain main network in this specification can be the underlying blockchain network, that is, the blockchain main network is not a blockchain subnet formed on the basis of other blockchain networks, such as the subnet0 can be regarded as the blockchain mainnet belonging to the underlying blockchain network type. In another case, the blockchain main network in this specification can also be a subnet of other blockchain networks. For example, another blockchain subnet can be further established on the basis of subnet1 in Figure 1. At this time, it can be considered subnet1 is the blockchain main network corresponding to the blockchain subnet, and this does not affect that subnet1 also belongs to the blockchain subnet created on subnet0. It can be seen that the blockchain main network and the blockchain subnet are actually relative concepts. The same blockchain network can be the blockchain main network in some cases and the blockchain subnet in other cases.
上述组建区块链子网的交易在被发送至区块链主网后,由区块链主网内的共识节点进行共识,并在通过共识后由各主网节点执行该交易,以完成区块链子网的组建。共识过程取决于所采用的共识机制,譬如上文所述的任一共识机制,本说明书并不对此进行 限制。After the above-mentioned transaction for establishing a blockchain subnet is sent to the blockchain main network, the consensus nodes in the blockchain main network will conduct a consensus, and after the consensus is passed, each main network node will execute the transaction to complete the block The formation of the chain subnet. The consensus process depends on the consensus mechanism adopted, such as any consensus mechanism mentioned above, and this description does not limit it.
通过在上述组建区块链子网的交易中包含配置信息,该配置信息可以用于对所组建的区块链子网进行配置,使得组建的区块链子网符合组网需求。例如,通过在配置信息中包含节点成员的身份信息,可以指定组建的区块链子网包含哪些区块链节点。By including the configuration information in the above-mentioned transaction of establishing the blockchain subnet, the configuration information can be used to configure the established blockchain subnet so that the established blockchain subnet meets the networking requirements. For example, by including the identity information of node members in the configuration information, it is possible to specify which blockchain nodes are included in the established blockchain subnet.
节点成员的身份信息可以包括节点的公钥,或者采用节点ID等其他能够表征节点身份的信息,本说明书并不对此进行限制。以公钥为例,每个区块链节点都存在对应的一组或多组公私钥对,由区块链节点持有私钥而公钥被公开且唯一对应于该私钥,因而可以通过公钥来表征相应区块链节点的身份。因此,对于希望作为区块链子网的节点成员的区块链节点,可以将这些区块链节点的公钥添加至上述组建区块链子网的交易中,以作为上述节点成员的身份信息。上述的公私钥对可以用于签名验证的过程。例如,在采用有签名的共识算法中,譬如subnet1上述的nodeA1采用自身维护的私钥对消息进行签名后,将经过签名的消息在subnet1中广播,而nodeB1、nodeC1和nodeD1可以用nodeA1的公钥对收到的消息进行签名验证,以确认自身收到的消息确实来自nodeA1且没有经过篡改。The identity information of the node members may include the public key of the node, or other information that can represent the identity of the node 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 sets of corresponding public-private key pairs. The blockchain node holds the private key and the public key is public and uniquely corresponds to the private key. Therefore, it can be passed The public key is used to represent the identity of the corresponding blockchain node. Therefore, for blockchain nodes that want to be node members of the blockchain subnet, the public keys of these blockchain nodes can be added to the above-mentioned transaction of forming the blockchain subnet as the identity information of the above-mentioned node members. The above-mentioned public-private key pair can be used in the process of signature verification. For example, in a consensus algorithm with a signature, for example, nodeA1 in subnet1 uses its own private key to sign the message, and then broadcasts the signed message in subnet1, while nodeB1, nodeC1 and nodeD1 can use the public key of nodeA1 Signature verification is performed on the received message to confirm that the message received by itself is indeed from nodeA1 and has not been tampered with.
第一主网节点可以为区块链主网上属于配置信息所指示的节点成员的区块链节点。在组建区块链子网时,并非由第一主网节点直接参与组建区块链子网、成为其节点成员,而是需要由用于部署该第一主网节点的节点设备生成第一子网节点,并由第一子网节点成为区块链子网中的节点成员。第一主网节点和第一子网节点对应于同一个区块链成员,比如在联盟链场景下对应于同一联盟链成员,但第一主网节点属于区块链主网、第一子网节点属于区块链子网,使得该区块链成员可以分别参与到区块链主网和区块链子网的交易中;并且,由于区块链主网和区块链子网属于相互独立的两个区块链网络,使得第一主网节点生成的区块与第一子网节点生成的区块分别存入所述节点设备上的不同存储(采用的存储譬如可以为数据库),实现了第一主网节点与第一子网节点分别使用的存储之间的相互隔离,因而区块链子网所产生的数据仅会在区块链子网的节点成员之间同步,使得仅参与了区块链主网的区块链成员无法获得区块链子网上产生的数据,实现了区块链主网与区块链子网之间的数据隔离,满足了部分区块链成员(即参与区块链子网的区块链成员)之间的交易需求。The first main network node may be a blockchain node on the blockchain main network that is a node member indicated by the configuration information. When building a blockchain subnet, instead of the first main network node directly participating in the establishment of the blockchain subnet and becoming its node member, the first subnet node needs to be generated by the node device used to deploy the first main network node , and the first subnetwork node becomes a node member in the blockchain subnetwork. 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 The node belongs to the blockchain subnet, so that the blockchain members 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 network, so that 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 device (the storage used can be a database, for example), realizing the first The storage used by the main network node and the first subnet node is isolated from each other, so the data generated by the blockchain subnet will only be synchronized among the node members of the blockchain subnet, so that only those who participate in the blockchain main The blockchain members of the network cannot obtain the data generated on the blockchain subnet, which realizes the data isolation between the blockchain main network and the blockchain subnet, and satisfies the requirements of some blockchain members (that is, the districts participating in the blockchain subnet). Transaction requirements between blockchain members).
可见,第一主网节点和第一子网节点是在逻辑上划分出来的区块链节点,而从物理设备的角度来说,相当于上述部署了第一主网节点和第一子网节点的节点设备同时参与了区块链主网和区块链子网。由于区块链主网与区块链子网之间相互独立,使得这两个区块链网络的身份体系也相互独立,因而即便第一主网节点和第一子网节点可以采用完全相同的公钥,仍然应当将两者视为不同的区块链节点。譬如在图1中,subnet0中的nodeA相当于第一主网节点,而部署该nodeA的节点设备生成了属于subnet1的nodeA1,该nodeA1相当于第一子网节点。可见,由于身份体系相互独立,所以即便第一子网节点所采用的公钥区别于第一主网节点,也不影响本说明书方案的实施。It can be seen that the first main network node and the first subnet node are logically divided blockchain nodes, and from the perspective of physical equipment, it is equivalent to deploying the first main network node and the first subnet node The node devices participate in the blockchain main network and the blockchain subnet at the same time. 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, so even if the first main network node and the first subnet node can use exactly the same public key, the two should still be considered as different blockchain nodes. For example, in FIG. 1 , nodeA in subnet0 is equivalent to the first main network node, and the node device deploying the nodeA generates nodeA1 belonging to subnet1, and the nodeA1 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 will not affect the implementation of the scheme in this specification.
当然,区块链子网的节点成员并不一定只是区块链主网的部分节点成员。在一些情况下,区块链子网的节点成员可以与区块链主网的节点成员完全一致,此时所有的区块链成员都可以获得区块链主网和区块链子网上的数据,但是区块链主网与区块链子网所产生的数据依然可以相互隔离,比如可以通过在区块链主网上实现一类业务、在区块链子网上实现另一类业务,从而可以使得这两类业务分别产生的业务数据之间相互隔离。Of course, the node members of the blockchain subnet are not necessarily only part 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 the 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, by implementing one type of business on the blockchain main network and another type of business on the blockchain subnet, the two types of The business data generated by the business are isolated from each other.
除了上述的节点成员的身份信息之外,配置信息还可以包括下述至少之一:所述区块链子网的网络标识、所述区块链子网的管理员的身份信息、针对区块链平台代码的属性配置等,本说明书并不对此进行限制。网络标识用于唯一表征该区块链子网,因而该区块链子网的网络标识应当区别于区块链主网和该区块链主网上组建的其他区块链子网。区块链子网的管理员的身份信息,譬如可以为作为管理员的节点成员的公钥;其中,区块链主网与区块链子网的管理员可以相同,也可以不同。In addition to the above-mentioned identity information of node members, 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 The attribute configuration of the code, etc., is not limited in this specification. The network identifier is used to uniquely represent the blockchain subnet, so the network identifier of the blockchain subnet should be distinguished from the blockchain main network and other blockchain subnets formed 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; the administrators of the blockchain main network and the blockchain subnet can be the same or different.
通过区块链主网来组建区块链子网的优势之一,就是由于生成第一子网节点的节点设备上已经部署了第一主网节点,因而可以将第一主网节点所使用的区块链平台代码复用在第一子网节点上,免去了区块链平台代码的重复部署,极大地提高了区块链子网的 组建效率。那么,如果配置信息中未包含针对区块链平台代码的属性配置,第一子网节点可以复用第一主网节点上采用的属性配置;如果配置信息中包含了针对区块链平台代码的属性配置,第一子网节点可以采用该属性配置,使得第一子网节点所采用的属性配置不受限于第一主网节点的属性配置、与第一主网节点无关。针对区块链平台代码的属性配置可以包括下述至少之一:代码版本号、是否需要共识、共识算法类型、区块大小等,本说明书并不对此进行限制。One of the advantages of building a blockchain subnet through the blockchain mainnet is that since the first mainnet node has already been deployed on the node device that generates the first subnetwork node, the area used by the first mainnet node can be The block chain platform code is reused on the first subnet node, which eliminates the repeated deployment of the block chain platform code and greatly improves the efficiency of the block chain subnet. Then, if the configuration information does not include the attribute configuration for the blockchain platform code, the first subnet node can reuse the attribute configuration adopted on the first main network node; if the configuration information includes the attribute configuration for the blockchain platform code attribute configuration, the first subnetwork node can adopt the attribute configuration, so that the attribute configuration adopted by the first subnetwork node is not limited to the attribute configuration of the first main network node, and has nothing to do with the first main network node. The attribute configuration for the blockchain platform code can include at least one of the following: code version number, whether consensus is required, consensus algorithm type, block size, etc., which are not limited in this specification.
组建区块链子网的交易包括调用合约的交易。该交易中可以指明被调用的智能合约的地址、调用的方法和传入的参数。例如,调用的合约可以为前述的创世合约或系统合约,调用的方法可以为组建区块链子网的方法,传入的参数可以包括上述的配置信息。在一实施例中,该交易可以包含如下信息:Transactions that form blockchain subnets include transactions that call contracts. The transaction can specify the address of the called smart contract, the method called and the parameters passed in. For example, the invoked contract can be the aforementioned genesis contract or system contract, the invoked method can be a method for building a blockchain subnet, and the incoming parameters can include the above-mentioned configuration information. In one embodiment, the transaction may contain the following information:
from:Administratorfrom: Administrator
to:Subnetto: Subnet
method:AddSubnet(string)method: AddSubnet(string)
string:genesisstring: genesis
其中,from字段为该交易的发起方的信息,譬如Administrator表明该发起方为管理员;to字段为被调用的智能合约的地址,譬如该智能合约可以为Subnet合约,则to字段具体为该Subnet合约的地址;method字段为调用的方法,譬如在Subnet合约中用于组建区块链子网的方法可以为AddSubnet(string),而string为AddSubnet()方法中的参数,上述示例中通过genesis表征该参数的取值,该genesis具体为前述的配置信息。Among them, the from field is the information of the initiator of the transaction. For example, Administrator indicates that the initiator is an administrator; the to field is the address of the called smart contract. For example, the smart contract can be a Subnet contract, and the to field is specifically the Subnet The address of the contract; the method field is the calling method. For example, the method used to build a blockchain subnet in the Subnet contract can be AddSubnet(string), and string is the parameter in the AddSubnet() method. In the above example, genesis is used to represent the The value of the parameter, the genesis is specifically the aforementioned configuration information.
以Subnet0上的节点nodeA~nodeE执行调用Subnet合约中AddSubnet()方法的交易为例。在交易通过共识后,nodeA~nodeE分别执行AddSubnet()方法并传入配置信息,得到相应的执行结果。Take nodes nodeA~nodeE on Subnet0 executing a transaction calling the AddSubnet() method in the Subnet contract as an example. After the transaction passes the consensus, nodeA~nodeE respectively execute the AddSubnet() method and pass in the configuration information to obtain the corresponding execution results.
合约的执行结果可以包括所述配置信息,该执行结果可以处于前文所述的收据中,该收据中可以包含与执行AddSubnet()方法相关的event,即组网事件。组网事件的topic可以包含预定义的组网事件标识,以区别于其他的事件。譬如在与执行AddSubnet()方法相关的event中,topic的内容为关键词subnet,且该关键词区别于其他方法所产生event中的topic。那么,nodeA~nodeE通过监听生成的收据中各个event所含的topic,可以在监听到包含关键词subnet的topic的情况下,确定监听到与执行AddSubnet()方法相关的event,即组网事件。例如,收据中的event如下:The execution result of the contract may include the configuration information, and the execution result may be included in the above-mentioned receipt, which may include an event related to the execution of the AddSubnet() method, that is, a networking event. The topic of networking events can contain predefined networking event identifiers to distinguish them 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 this keyword is different from the topic in the event generated by other methods. Then, by monitoring the topics contained in each event in the generated receipt, nodeA~nodeE can determine to monitor the event related to the execution of the AddSubnet() method, that is, the networking event, when the topic containing the keyword subnet is monitored. For example, the event in the receipt is as follows:
Event:Event:
[topic:other][data][topic:other][data]
[topic:subnet][data][topic:subnet][data]
...... …
那么,nodeA~nodeE在监听到第1条event时,由于所含topic的内容为other,确定该event与AddSubnet()方法无关;以及,nodeA~nodeE在监听到第2条event时,由于所含topic的内容为subnet,确定该event与AddSubnet()方法相关,并进而读取该event对应的data字段,该data字段包含上述的配置信息。以配置信息包括区块链子网的节点成员的公钥为例,data字段的内容例如可以包括:Then, when nodeA~nodeE listens to the first event, because the content of the included topic is other, it is determined that the event has nothing to do with the AddSubnet() method; and, when nodeA~nodeE listens to the second event, because the content of the included The content of the topic is subnet, determine that the event is related to the AddSubnet() method, and then read 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, for example:
{subnet1;{subnet1;
nodeA的公钥,nodeA的IP、nodeA的端口号…;The public key of nodeA, the IP of nodeA, the port number of nodeA...;
nodeB的公钥,nodeB的IP、nodeB的端口号…;public key of nodeB, IP of nodeB, port number of nodeB...;
nodeC的公钥,nodeC的IP、nodeC的端口号…;The public key of nodeC, the IP of nodeC, the port number of nodeC...;
nodeD的公钥,nodeD的IP、nodeD的端口号…;The public key of nodeD, the IP of nodeD, the port number of nodeD...;
}}
其中,subnet1为希望创建的区块链子网的网络标识。区块链主网中的各个区块链节点可以记录该区块链主网上已创建的所有区块链子网的网络标识,或者与这些区块链子网相关的其他信息,这些信息譬如可以维护在上述的Subnet合约中,具体可以对应于该Subnet合约所含的一个或多个合约状态的取值。那么,nodeA~nodeE可以根据记录的已创建的所有区块链子网的网络标识,确定上述的subnet1是否已经存在;如果不存在, 说明subnet1是当前需要创建的新区块链子网,如果存在则说明subnet1已经存在。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, such information can be maintained in In the above-mentioned Subnet contract, it may specifically correspond to the values of one or more contract states included in the Subnet contract. Then, nodeA~nodeE can determine whether the above-mentioned subnet1 already exists according to the recorded network identifiers of all 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 currently, and if it exists, it means subnet1 already exists.
除了采用希望创建的新的区块链子网的网络标识之外,还可以采用预定义的新建网络标识,该新建网络标识表明相应的组网事件用于组建新的区块链子网。例如,可以将上述的subnet1替换为newsubnet,该newsubnet为预定义的新建网络标识,nodeA~nodeE在识别到data字段包含newsubnet时,即可确定包含该newsubnet的event为组网事件,需要创建新的区块链子网。In addition to adopting 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, they can determine that the event containing this newsubnet is a networking event, and a new one needs to be created. Blockchain subnet.
除了网络标识subnet1之外,上述data字段中还包含各个节点成员的身份信息等内容。部署第一主网节点的节点设备可以监听生成的收据,并在监听到所述组网事件且所述组网事件的内容表明第一主网节点属于所述节点成员的情况下,由部署第一主网节点的节点设备获取所述组网事件包含的配置信息或创世块。或者,第一区块链节点可以监听生成的收据,并在监听到所述组网事件且所述组网事件的内容表明第一区块链节点属于所述节点成员的情况下,触发部署第一区块链节点的节点设备获取所述组网事件包含的所述配置信息或所述创世块。In addition to the network identifier subnet1, the above data field also includes identity information of each node member and so on. The node device deploying 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 deployment second A node device of a main network node obtains the configuration information or the genesis block included in the networking event. Alternatively, the first blockchain node can monitor the generated receipt, and when the networking event is monitored and the content of the networking event indicates that the first blockchain node belongs to the node member, trigger the deployment of the first blockchain node. A node device of a blockchain node acquires the configuration information or the genesis block included in the networking event.
如前所述,节点设备可以直接监听收据。假定nodeA~nodeE分别部署在节点设备1~5上,节点设备1~5可以监听nodeA~nodeE分别生成的收据,那么在监听到subnet1是需要新组建的区块链子网的情况下,节点设备1~5会进一步识别data字段中包含的节点成员的身份信息,以确定自身的处理方式。以nodeA和节点设备1为例:如果节点设备1发现data字段包含nodeA的公钥、IP地址和端口号等身份信息,那么节点设备1在基于上述的消息机制从data字段获得配置信息的情况下,生成包含该配置信息的创世块,且节点设备1会在本地部署nodeA1,进而由nodeA1加载生成的创世块,从而成为subnet1的子网节点;类似地,节点设备2可以生成nodeB1、节点设备3可以生成nodeC1、节点设备4可以生成nodeD1。以及,节点设备5会发现data字段包含的身份信息与自身均不匹配,则该节点设备5不会根据data字段中的配置信息生成创世块,也不会生成subnet1中的区块链节点。As mentioned earlier, node devices can listen for receipts directly. Assuming that nodeA~nodeE are respectively deployed on node devices 1~5, and node devices 1~5 can monitor the receipts generated by nodeA~nodeE respectively, then when it is detected that subnet1 is a blockchain subnet that needs to be newly established, node device 1 ~5 will further identify the identity information of the node members contained in the data field to determine its own processing method. Take nodeA and node device 1 as an example: if node device 1 finds that the data field contains identity information such as nodeA's public key, IP address, and port number, then node device 1 obtains configuration information from the data field based on the above message mechanism , generate a genesis block containing the configuration information, and node device 1 will deploy nodeA1 locally, and then nodeA1 will load the generated genesis block, thus becoming a subnet node of subnet1; similarly, node device 2 can generate nodeB1, node Device 3 can generate nodeC1, and node device 4 can generate nodeD1. And, node device 5 will find that the identity information contained in the data field does not match itself, then the node device 5 will not generate a genesis block according to the configuration information in the data field, nor will it generate a blockchain node in subnet1.
如前所述,区块链主网中的区块链节点可以监听收据,并根据监听结果触发节点设备执行相关处理。例如,nodeA~nodeE在确定subnet1是需要新组建的区块链子网的情况下,会进一步识别data字段中包含的节点成员的身份信息,以确定自身的处理方式。比如,nodeA~nodeD会发现在data字段包含自身的公钥、IP地址和端口号等身份信息,假定nodeA~nodeD分别部署在节点设备1~4上,以nodeA和节点设备1为例:nodeA会触发节点设备1,使得节点设备1基于上述的消息机制从data字段获得配置信息并生成包含该配置信息的创世块,且节点设备1会在本地部署nodeA1,该nodeA1加载生成的创世块,从而成为subnet1中的1个子网节点;类似地,nodeB会触发节点设备2生成nodeB1、nodeC会触发节点设备3生成nodeC1、nodeD会触发节点设备4生成nodeD1。以及,nodeE会发现data字段包含的身份信息与自身均不匹配,假定nodeE部署在节点设备5上,那么该节点设备5不会根据data字段中的配置信息生成创世块,也不会生成subnet1中的节点。As mentioned above, the blockchain nodes in the blockchain main network can monitor receipts and trigger node devices to perform related processing according to the monitoring results. For example, nodeA~nodeE will further identify the identity information of the node members contained in the data field in order to determine their own processing methods when they determine that subnet1 is a blockchain subnet that needs to be newly established. For example, nodeA~nodeD will find that the data field contains their own identity information such as their public key, IP address, and port number. Assume 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, Thus, it becomes a subnet node in 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. And, 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, then the node device 5 will not generate a genesis block based on the configuration information in the data field, nor will it generate subnet1 nodes in .
如前所述,第一主网节点与第一子网节点并不一定采用相同的身份信息。因此,在上述实施例中,data字段中可以包含预先为nodeA1~nodeD1生成的身份信息,且区别于nodeA~nodeD的身份信息。仍以nodeA和节点设备1为例:节点设备1如果在data字段中发现了nodeA1的身份信息,可以生成创世块、部署nodeA1,并由nodeA1加载该创世块;或者,nodeA如果在data字段中发现了nodeA1的身份信息,那么nodeA会触发节点设备1生成创世块、部署nodeA1,并由nodeA1加载该创世块。其他区块链节点或节点设备的处理方式类似,此处不再一一赘述。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 generated in advance for nodeA1-nodeD1, which is different from the identity information of nodeA-nodeD. Still take nodeA and node device 1 as an example: if node device 1 finds the identity information of nodeA1 in the data field, it can generate a genesis block, deploy nodeA1, and nodeA1 loads the genesis block; or, if nodeA is in the data field If the identity information of nodeA1 is found in , then nodeA will trigger node device 1 to generate a genesis block, deploy nodeA1, and nodeA1 will load the genesis block. The processing methods of other blockchain nodes or node devices are similar and will not be repeated here.
除了配置信息之外,合约的执行结果可以包括创世块。换言之,除了可以在data字段中包含配置信息,还可以直接在执行合约调用的过程中生成包含配置信息的创世块,从而将创世块包含于data字段中,那么对于上述的nodeA~nodeD而言,相应的节点设备1~4可以通过消息机制直接从data字段获得创世块,而无需自行生成,可以提升对nodeA1~nodeD1的部署效率。In addition to configuration information, the execution result of the contract can include the genesis block. In other words, in addition to including configuration information in the data field, you can also directly generate a genesis block containing configuration information in the process of executing the contract call, so that the genesis block is included in the data field, then for the above nodeA ~ nodeD and In other words, the corresponding node devices 1-4 can directly obtain the genesis block from the data field through the message mechanism without generating it by themselves, which can improve the deployment efficiency of nodeA1-nodeD1.
在本说明书中,组建区块链子网的交易可以并非是调用智能合约的交易,使得不支 持智能合约的区块链网络也可以实现本说明书的技术方案,从而在区块链主网的基础上快捷地创建出区块链子网。例如,可以预先定义一组网交易类型标识,当交易包含该组网交易类型标识时,就表明该交易用于组建新的区块链子网,即该交易为组建区块链子网的交易。区块链平台代码可以包含相关的用于组件区块链子网的处理逻辑,使得运行该区块链平台代码的第一主网节点在执行交易时,如果发现该交易中包含上述的组网交易类型标识,且第一主网节点属于该交易中的配置信息所指示的节点成员,可以基于上述处理逻辑来触发部署第一主网节点的节点设备生成包含该配置信息的创世块并启动第一子网节点,由第一子网节点加载该创世块,以形成为区块链子网中的区块链节点。In this specification, the transaction of establishing 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, so that on the basis of the blockchain main network Quickly create a blockchain subnet. For example, a group of network transaction type identifiers can be pre-defined, and when the 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 to form a blockchain subnet. The blockchain platform code can contain relevant processing logic for component blockchain subnets, so that when the first main network node running the blockchain platform code executes a transaction, if it finds that the transaction contains the above-mentioned networking transaction type identification, and the first main network node belongs to the node member indicated by the configuration information in the transaction, based on the above processing logic, the node device deploying the first main network node can be triggered to generate a genesis block containing the configuration information and start the first A subnetwork node, the first subnetwork node loads the genesis block to form a blockchain node in the blockchain subnetwork.
节点设备通过在该进程中创建一个运行区块链平台代码的实例,实现在该节点设备上部署一区块链节点。对于第一主网节点而言,由节点设备在上述进程中创建第一实例,并由该第一实例运行区块链平台代码而形成。类似地,对于第一子网节点而言,由节点设备在上述进程中创建区别于第一实例的第二实例,并由该第二实例运行区块链平台代码而形成。例如,节点设备可以首先在进程中创建第一实例,以形成区块链主网中的第一区块链节点;而当该节点设备对应的节点成员希望参与组建区块链子网时,可以在上述进程中创建第二实例,该第二实例区别于上述的第一实例,并由该第二实例形成区块链子网中的第二区块链节点。当第一实例与第二实例位于同一进程时,由于不涉及跨进程交互,可以降低对第一子网节点的部署难度、提高部署效率;当然,第二实例也可能与第一实例分别处于节点设备上的不同进程中,本说明书并不对此进行限制;例如,节点设备可以在第一进程中创建第一实例,以形成区块链主网中的第一区块链节点;而当该节点设备对应的节点成员希望参与组建区块链子网时,可以启动区别于第一进程的第二进程,并在该第二进程中创建第二实例,该第二实例区别于上述的第一实例,进而由该第二实例形成区块链子网中的第二区块链节点。事实上,本说明书实施例中涉及的任一节点设备上部署的各区块链节点均为运行在所述任一节点设备上的不同的区块链实例,任一节点设备上部署的各区块链节点生成的区块分别存入所述任一节点设备上的不同存储(例如数据库),且任一节点设备部署的各区块链节点分别使用的存储之间相互隔离。The node device implements the deployment of a blockchain node on the node device by creating an instance of running the blockchain platform code in the process. For the first main network node, the node device creates the first instance in the above process, and the first instance runs the blockchain platform code to form. Similarly, for the first subnetwork 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 to form. For example, the node device can first create the first instance in the process to form the first blockchain node in the blockchain main network; In the above process, a second instance is created, which is different from the above-mentioned first instance, and the second instance forms a second blockchain node in the blockchain subnet. When the first instance and the second instance are in the same process, because no cross-process interaction is involved, the difficulty of deploying the first subnet node can be reduced and the deployment efficiency can be improved; of course, the second instance may also be in separate nodes from the first instance In different processes on the device, this specification does not limit this; for example, the node device can create the first instance in the first process to form the first blockchain node in the blockchain main network; and when the node When the node member corresponding to the device wants to participate in the establishment of a blockchain subnet, it can start a second process different from the first process, and create a second instance in the second process, which is different from the first instance above. Furthermore, the second instance forms a second blockchain node in the blockchain subnet. 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 each blockchain node deployed on any node device The blocks generated by the nodes are respectively stored in different storages (such as databases) on any node device, and the storages used by each blockchain node deployed by any node device are isolated from each other.
通过上述方式,可以在区块链主网上创建出区块链子网。以图1为例,subnet0原本包含nodeA~nodeE,而在subnet0的基础上可以组建出subnet1,该subnet1包含nodeA1~nodeD1,且nodeA与nodeA1、nodeB与nodeB1、nodeC与nodeC1、nodeD与nodeD1分别部署在同一节点设备上。类似地,还可以在subnet0上组建出subnet2或更多的区块链子网,其中subnet2包含nodeA2、nodeB2、nodeC2和nodeE2,且nodeA与nodeA1、nodeA2,nodeB与nodeB1、nodeB2,nodeC与nodeC1,nodeD与nodeD1,nodeE与nodeE2分别部署在同一节点设备上。以及,可以将subnet1、subnet2等作为新的区块链主网,并在此基础上进一步组建出区块链子网,其过程与subnet1或subnet2的组建相似,此处不再赘述。Through the above method, a blockchain subnet can be created on the blockchain mainnet. Taking Figure 1 as an example, subnet0 originally included nodeA~nodeE, and subnet1 can be built on the basis of subnet0. This subnet1 includes nodeA1~nodeD1, and nodeA and nodeA1, nodeB and nodeB1, nodeC and nodeC1, nodeD and nodeD1 are respectively deployed in on the same node device. Similarly, subnet2 or more blockchain subnets can also be established 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 respectively deployed on the same node device. And, subnet1, subnet2, etc. can be used as the new blockchain main network, and a blockchain subnet can be further formed on this basis. The process is similar to the formation of subnet1 or subnet2, and will not be repeated here.
如前所述,通过上述方式在区块链主网上组建的不同区块链子网之间彼此独立,相互隔离,例如在subnet1上共识的交易就仅会最终被nodeA1~nodeD1所接收,而不会被subnet2中的nodeA2、nodeB2、nodeC2和nodeE2所接收。因此,不同区块链子网在逻辑上就属于不同的区块链网络。在相关技术中,不同区块链网络之间实现可信的跨链交互需要通过跨链协议来完成,例如侧链技术、见证人机制或中继技术等,但传统的跨链技术所采用的跨链协议通常在具体实现时流程繁琐且耗时较长,并且,传统的跨链协议并没有考虑到区块链子网之间的跨链场景与传统跨链场景的差异,忽略了区块链主网能够作为不同区块链子网间进行数据验证的信任基础,这使得不同区块链子网之间需要通过传统的跨链协议才能够实现彼此区块链数据的可信验证。As mentioned above, the different blockchain subnets established on the blockchain mainnet through the above methods are independent and isolated from each other. Received by nodeA2, nodeB2, nodeC2 and nodeE2 in subnet2. Therefore, different blockchain subnets logically belong to different blockchain networks. In related technologies, the credible cross-chain interaction between different blockchain networks needs to be completed through cross-chain protocols, such as side chain technology, witness mechanism or relay technology, etc., but the traditional cross-chain technology adopts The implementation of cross-chain protocols is usually cumbersome and time-consuming. Moreover, traditional cross-chain protocols do not take into account the differences between cross-chain scenarios between blockchain subnets and traditional cross-chain scenarios, and ignore the blockchain The main network can serve as the basis of trust for data verification between different blockchain subnets, which requires traditional cross-chain protocols between different blockchain subnets to achieve trusted verification of each other's blockchain data.
为此,本说明书提出了一种验证区块链数据的方法,应用于包含区块链子网和区块链主网的区块链系统,其中,所述区块链子网中的子网节点所处的节点设备上部署有所述区块链主网中的主网节点,所述区块链子网至少包括第一区块链子网和第二区块链子网,所述区块链主网中的主网节点维护有第二区块链子网对应的数据验证条件,可使在第一区块链子网在需要对来源于第二区块链子网的区块链数据进行存在性验证的情况 下,能通过区块链主网与各区块链子网在节点设备层面的网络架构上的关联性,利用区块链主网作为不同区块链子网之间的信任媒介以实现更为简单的数据验证协议。For this reason, this specification proposes a method for verifying blockchain data, which is applied to a blockchain system including a blockchain subnet and a blockchain main network, wherein the subnet nodes in the blockchain subnet are The main network node in the block chain main network is deployed on the node device at the location, and the block chain subnet includes at least a first block chain subnet and a second block chain subnet, and in the block chain main network The main network node maintains the data verification conditions corresponding to the second blockchain subnet, which allows the first blockchain subnet to verify the existence of blockchain data from the second blockchain subnet , through the correlation between the blockchain main network and each blockchain subnet on the network architecture at the node device level, the blockchain main network can be used as a trust medium between different blockchain subnets to achieve simpler data verification protocol.
图2是一示例性实施例提供的一种验证区块链数据的方法的流程图。该方法应用于包含区块链子网和区块链主网的区块链系统,其中,所述区块链子网中的子网节点所处的节点设备上部署有所述区块链主网中的主网节点,所述区块链子网至少包括第一区块链子网和第二区块链子网,所述区块链主网中的主网节点维护有第二区块链子网对应的数据验证条件,所述方法包括如下步骤。Fig. 2 is a flowchart of a method for verifying blockchain data provided by an exemplary embodiment. The method is applied to a block chain system including a block chain subnet and a block chain main network, wherein the node device where the subnet node in the block chain subnet is located is deployed with the block chain in the block chain main network The main network nodes of the blockchain subnet include at least the first blockchain subnet and the second blockchain subnet, and the main network nodes in the blockchain main network maintain data corresponding to the second blockchain subnet Verifying the conditions, the method includes the following steps.
步骤202,第一区块链子网向区块链主网发起数据验证交易,所述数据验证交易用于对第二区块链子网上是否存在目标数据进行验证。 Step 202, the first blockchain subnet initiates a data verification transaction to the blockchain main network, and the data verification transaction is used to verify whether the target data exists on the second blockchain subnet.
本说明书实施例中所涉及的第一区块链子网作为数据验证服务的需求方,其具有对目标数据进行验证的需求。例如,第一区块链子网已经获取了目标数据,但并不清楚该目标数据是否真的来源于第二区块链子网,或者,第一区块链子网虽然没有获取目标数据,但仍然希望验证某数据描述信息所对应的目标数据是否如实地作为第二区块链子网的区块链数据存在于第二区块链子网之中,那么第一区块链子网都可以通过向区块链主网发起数据验证交易以用于验证第二区块链子网上是否存在目标数据。The first blockchain subnet involved in the embodiment of this specification is the demander of the data verification service, which has the requirement to verify the target data. For example, the first blockchain subnet has acquired the target data, but it is not clear whether the target data really comes from the second blockchain subnet, or, although the first blockchain subnet has not acquired the target data, it still hopes to Verify that the target data corresponding to a certain data description information exists in the second blockchain subnet truthfully as the blockchain data of the second blockchain subnet, then the first blockchain subnet can pass to the blockchain The main network initiates a data verification transaction to verify whether the target data exists on the second blockchain subnet.
在本说明书实施例中,涉及到包含区块链子网和区块链主网的区块链系统,例如图1所示的由subnet0、subnet1和subnet2所构成的区块链系统,其中,subnet0为区块链主网,而subnet1和subnet2为区块链子网。假设subnet1为第一区块链子网而subnet2为第二区块链子网,subnet1中的子网节点nodeA1、nodeB1、nodeC1和nodeD1所处的节点设备1、2、3和4上分别部署有subnet0中的nodeA、nodeB、nodeC和nodeD,以及,subnet2中的子网节点nodeA2、nodeB2、nodeC2和nodeE2所处的节点设备1、2、3和5分别部署有subnet0中nodeA、nodeB、nodeC和nodeE。因此,部署有子网节点的节点设备上必然部署有主网节点。所述区块链主网中的主网节点维护有第二区块链子网对应的数据验证条件,例如subnet0中的各个主网节点nodeA~nodeE就分别维护有对应于subnet2的数据验证条件,当然,各个主网节点nodeA~nodeE也分别维护有对应于subnet1的数据验证条件。In the embodiment of this specification, it involves a blockchain system including a blockchain subnet and a blockchain main network, such as the blockchain system composed of subnet0, subnet1 and subnet2 shown in Figure 1, where subnet0 is Blockchain main network, while subnet1 and subnet2 are blockchain subnets. Assuming that subnet1 is the first blockchain subnet and subnet2 is the second blockchain subnet, node devices 1, 2, 3 and 4 where the subnet nodes nodeA1, nodeB1, nodeC1 and nodeD1 are located in subnet1 are respectively deployed with subnet0 nodeA, nodeB, nodeC and nodeD, and the node devices 1, 2, 3 and 5 where the subnet nodes nodeA2, nodeB2, nodeC2 and nodeE2 in subnet2 are located are respectively deployed with nodeA, nodeB, nodeC and nodeE in subnet0. Therefore, there must be a main network node deployed on the node device where the subnet node is deployed. The main network nodes in the blockchain main network maintain data verification conditions corresponding to the second blockchain subnet, for example, each main network node nodeA-nodeE in subnet0 maintains data verification conditions corresponding to subnet2, of course , each main network node nodeA~nodeE also maintains data verification conditions corresponding to subnet1.
在本说明书实施例中,可以通过向区块链主网发出交易的方式来对维护在区块链主网的数据验证条件进行创建或更改。例如,可以向区块链主网发起用于创建新区块链子网的子网创建交易,所述区块链主网响应于用于创建新区块链子网的子网创建交易,以使所述区块链主网中的主网节点在执行所述子网创建交易后获取并维护所述新区块链子网对应的数据验证条件,所述子网创建交易中包含所述新区块链子网对应的数据验证条件。在本说明书实施例中,上述创建新区块链子网的子网创建交易即前述用于组建区块链子网的交易,由于区块链主网需要维护有各个区块链子网的数据验证条件,因此可以通过在子网创建交易中携带新区块链子网的数据验证条件,以使区块链主网在新区块链子网创建的第一时间就能够维护有新区块链子网对应的数据验证条件,例如该数据验证条件就存储在前述的Subnet合约(系统合约)中对应于新区块链子网的合约状态中。In the embodiment of this specification, the data verification conditions maintained on the blockchain main network can be created or changed by sending transactions to the blockchain main network. For example, a subnetwork creation transaction for creating a new blockchain subnet may be initiated to the blockchain mainnet, and the blockchain mainnet responds to the subnetwork creation transaction for creating a new blockchain subnetwork so that the zone The main network node in the block chain main network obtains and maintains the data verification conditions corresponding to the new blockchain subnet after executing the subnet creation transaction, and the subnet creation transaction contains the data corresponding to the new blockchain subnet Verify conditions. In the embodiment of this specification, the above-mentioned subnet creation transaction for creating a new blockchain subnet is the aforementioned transaction for establishing a blockchain subnet. Since the blockchain main network needs to maintain the data verification conditions of each blockchain subnet, therefore The data verification conditions of the new blockchain subnet can be carried in the subnet creation transaction, so that the blockchain main network can maintain the data verification conditions corresponding to the new blockchain subnet as soon as the new blockchain subnet is created, for example The data verification condition is stored in the contract state corresponding to the new blockchain subnet in the aforementioned Subnet contract (system contract).
又例如,还可以向区块链主网发起用于更新所述第二区块链子网对应的数据验证条件的条件更改交易,通过向所述区块链主网响应于用于更新所述第二区块链子网对应的数据验证条件的条件更改交易,以使所述区块链主网中的主网节点在执行所述条件更改交易后,将自身维护的所述数据验证条件更新为新数据验证条件,所述条件更改交易中包含第二区块链子网对应的所述新数据验证条件。在本说明书实施例中,当第二区块链子网由于节点总数、共识算法等因素发生变化时,需要即时对该区块链子网对应的数据验证条件进行相应的调整才能确保区块链数据验证的可信度,因此可以通过向区块链主网发起用于更新所述第二区块链子网对应的数据验证条件的条件更改交易,从而对区块链主网中维护的第二区块链子网对应的数据验证条件进行及时地调整,当数据验证条件被维护在区块链主网部署的智能合约中时,该条件更改交易将会更新该智能合约中用于记录第二区块链子网对应数据验证条件的合约状态,并最终更新区块链主网的世界状态。当然,也可以向区块链主网发起用于更新其他区块链子网对应的数据验证条件的条件更改交易,本说明书对此并不做任何限制。For another example, a condition change transaction for updating the data verification conditions corresponding to the second blockchain subnet may also be initiated to the main network of the blockchain, and a transaction for updating the data verification conditions corresponding to the second blockchain subnet may be initiated to the main network of the blockchain. The condition change transaction of the data verification condition corresponding to the second block chain subnet, so that the main network node in the block chain main network will update the data verification condition maintained by itself to the new one after executing the condition change transaction. Data verification conditions, the condition modification transaction includes the new data verification conditions corresponding to the second block chain subnet. In the embodiment of this specification, when the second blockchain subnet changes due to factors such as the total number of nodes and the consensus algorithm, it is necessary to immediately adjust the data verification conditions corresponding to the blockchain subnet to ensure blockchain data verification. Therefore, by initiating a condition change transaction to the blockchain main network to update the data verification conditions corresponding to the second blockchain subnet, the second block maintained in the blockchain main network The data verification conditions corresponding to the chain subnet are adjusted in a timely manner. When the data verification conditions are maintained in the smart contract deployed on the blockchain main network, the condition change transaction will update the smart contract used to record the second blockchain subnet. The network corresponds to the contract status of the data verification conditions, and finally updates the world status of the blockchain main network. Of course, it is also possible to initiate a condition change transaction to the blockchain main network to update the data verification conditions corresponding to other blockchain subnets, and this specification does not impose any restrictions on this.
在本说明书实施例中,可以通过第一区块链子网中的任一子网节点向自身所处的节点设备发起数据验证交易,以将该数据验证交易转发至区块链主网。由于子网节点所处的节点设备上部署有主网节点,因此该节点设备可以通过识别由第一区块链子网中的子网节点所发起的数据验证交易中的网络标识字段(例如为区块链主网的网络标识subnet0),从而获知该交易需要路由至区块链主网而非第一区块链子网或其他区块链网络,此时节点设备中的交易路由模块(譬如共识模块)将会把该数据验证交易传入本地的主网节点,同时,交易路由模块还可以将该交易通过区块链主网中预先建立的共识链路广播至区块链主网中的其他主网节点,以实现第一区块链子网向区块链主网发起数据验证交易。在本说明书实施例中,由于同一节点设备上会同时部署有区块链主网中的主网节点和区块链子网中的子网节点,而同一节点设备上部署的多个区块链节点又彼此共用同一个共识模块,这使得从第一区块链子网向区块链主网发出交易成为可能。In the embodiment of this specification, any subnet node in the first blockchain subnet can initiate a data verification transaction to the node device where it is located, so as to forward the data verification transaction to the blockchain main network. Since the main network node is deployed on the node device where the subnetwork node is located, the node device can verify the network identification field in the transaction by identifying the data initiated by the subnetwork node in the first blockchain subnetwork (for example, the zone The network identifier subnet0 of the block chain main network, so as to know that the transaction needs to be routed to the block chain main network instead of the first block chain subnet or other block chain networks. At this time, the transaction routing module in the node device (such as the consensus module ) will pass the data verification transaction to the local main network node. At the same time, the transaction routing module can also broadcast the transaction to other main network nodes in the blockchain main network through the pre-established consensus link in the blockchain main network. network nodes, so that the first blockchain subnet can initiate a data verification transaction to the blockchain main network. In the embodiment of this specification, since the main network nodes in the blockchain main network and the subnet nodes in the blockchain subnet are deployed on the same node device, multiple blockchain nodes deployed on the same node device They share the same consensus module with each other, which makes it possible to send transactions from the first blockchain subnet to the blockchain mainnet.
在本说明书实施例中,所述目标数据包括下述之一:交易数据、状态数据、收据数据。其中,交易数据、状态数据和收据数据在逻辑上都组织成相应的树状结构,以便于后续的数据验证。交易数据所形成的树状结构可以称为交易树,状态数据所形成的树状结构可以称为状态树,收据数据所形成的树状结构可以称为收据树。In the embodiment of this specification, the target data includes one of the following: transaction data, status data, and receipt data. Among them, transaction data, status data and receipt data are logically organized into corresponding tree structures to facilitate subsequent data verification. The tree structure formed by transaction data may be called a transaction tree, the tree structure formed by state data may be called a state tree, and the tree structure formed by receipt data may be called a receipt tree.
步骤204,所述区块链主网中的任一主网节点执行所述数据验证交易,以在所述任一主网节点所处节点设备上部署有第二区块链子网中的任一子网节点的情况下生成候选验证结果,并将所述候选验证结果广播至所述区块链主网中的其他主网节点,其中,所述候选验证结果用于表明所述任一子网节点上是否存在所述目标数据。 Step 204, any main network node in the blockchain main network executes the data verification transaction, so that any one of the second blockchain subnets is deployed on the node device where any main network node is located. In the case of a subnet node, a candidate verification result is generated, and the candidate verification result is broadcast to other main network nodes in the blockchain main network, wherein the candidate verification result is used to indicate that any subnet Whether the target data exists on the node.
第一区块链子网在区块链主网中发起数据验证交易后,区块链主网中的各主网节点会接收并执行该数据验证交易,例如,在所述数据验证交易包括调用所述区块链主网上部署的数据验证智能合约的交易的情况下,各主网节点在执行所述数据验证交易时,会分别调用本地维护的数据验证智能合约以执行如步骤204的合约逻辑。After the first blockchain subnet initiates a data verification transaction in the blockchain main network, each main network node in the blockchain main network will receive and execute the data verification transaction, for example, when the data verification transaction includes calling the In the case of the transaction of the data verification smart contract deployed on the blockchain main network, each main network node will respectively call the locally maintained data verification smart contract to execute the contract logic as in step 204 when executing the data verification transaction.
本说明书所涉及的数据验证交易包括目标数据的数据描述信息以及第二区块链子网的网络标识。其中,所述网络标识用于指示所述任一主网节点:将自身所处节点设备上部署的对应于所述网络标识的子网节点确定为所述任一子网节点;所述数据描述信息用于指示所述任一主网节点:将所述任一子网节点上匹配于所述数据描述信息的数据确定为所述目标数据。其中,所述数据描述信息可以包括交易哈希、账户ID、合约地址、参数名称等等。在本实施例中,任一主网节点在执行数据验证交易时,首先会根据数据验证交易中携带的第二区块链子网的网络标识,确定该数据验证交易用于针对第二区块链子网的数据进行验证,从而所述任一主网节点会检查自身所处的节点设备上是否部署有第二区块链子网中的任一子网节点,并在确定部署有所述任一子网节点的情况下生成候选验证结果,以及,将生成的候选验证结果通过共识模块广播至区块链主网中的其他主网节点。具体而言,在确定部署有所述任一子网节点的情况下,任一主网节点会进一步根据数据验证交易中携带的目标数据的数据描述信息,在所述任一子网节点对应的本地数据库中匹配是否存在该数据描述信息所对应的目标数据,如果成功匹配到该目标数据,则证明所述数据描述信息对应的目标数据的确存在于自身所处节点设备部署的第二区块链子网对应的子网节点中,此时生成的候选验证结果中将包含用于表明所述任一子网节点上存在该目标数据的指示信息;同理,如果任一主网节点并未匹配到该目标数据,则证明所述数据描述信息对应的目标数据不存在于所述任一子网节点,此时生成的候选验证结果中将包含用于表明所述任一子网节点上不存在该目标数据的指示信息。上述任一主网节点之所以能够访问到任一子网节点对应的本地数据库,其根本原因在于本说明书实施例中,同一节点设备上同时部署有区块链主网中的主网节点和区块链子网中的子网节点的,因此,区块链主网与第二区块链子网虽然在逻辑上属于不同的区块链网络,但分别对应的主网节点和子网节点却部署在同一节点设备上,这使得在节点设备层面完全可以实现越权管理,即主网节点在满足某种条件下(例如在调用数据验证智能合约的过程中)能够有权访问自身所处节点设备中其他子网节点对应的数据库,从而创设了一种基于节点设备的跨链交互渠道。The data verification transaction involved in this specification includes the data description information of the target data and the network identification of the second blockchain subnet. Wherein, the network identifier is used to indicate any main network node: determine the subnetwork node corresponding to the network identifier deployed on the node device where it is located as any subnetwork node; the data description The information is used to instruct the any main network node to: determine the data matching the data description information on the any sub-network node as the target data. Wherein, the data description information may include transaction hash, account ID, contract address, parameter name and so on. In this embodiment, when any main network node executes a data verification transaction, it will first determine that the data verification transaction is used for the second blockchain subnet according to the network identifier of the second blockchain subnet carried in the data verification transaction. network data, so that any main network node will check whether any subnetwork node in the second blockchain subnetwork is deployed on the node device where it is located, and when it is determined that any subnetwork node is deployed In the case of network nodes, candidate verification results are generated, and the generated candidate verification results are broadcast to other main network nodes in the blockchain main network through the consensus module. Specifically, when it is determined that any of the subnetwork nodes is deployed, any mainnetwork node will further verify the data description information of the target data carried in the transaction according to the data. Match whether the target data corresponding to the data description information exists in the local database. If the target data is successfully matched, it proves that the target data corresponding to the data description information does exist in the second blockchain sub-chain deployed by the node device where it is located. In the subnet node corresponding to the network, the candidate verification result generated at this time will contain indication information indicating that the target data exists on any subnet node; similarly, if any main network node does not match the If the target data is to prove that the target data corresponding to the data description information does not exist in any of the subnetwork nodes, the candidate verification result generated at this time will contain a An indication of the target data. The fundamental reason why any of the above-mentioned main network nodes can access the local database corresponding to any sub-network node is that in the embodiment of this specification, the main network node and zone in the blockchain main network are deployed on the same node device. Therefore, although the blockchain main network and the second blockchain subnet logically belong to different blockchain networks, the corresponding main network nodes and subnet nodes are deployed in the same On the node device, this makes it possible to completely realize unauthorized management at the node device level, that is, the main network node can have the right to access other sub The database corresponding to the network nodes creates a cross-chain interaction channel based on node equipment.
在一实施例中,任一主网节点在确定自身所处节点设备上部署有所述任一子网节点、 且所述任一子网节点维护有所述目标数据的情况下生成候选验证结果,并将该候选验证结果广播至区块链主网中的其他主网节点,而在确定自身所处节点设备上未部署有所述任一子网节点、或者虽然部署有所述任一子网节点但所述任一子网节点未维护有所述目标数据的情况下不生成候选验证结果。在本说明书实施例中,候选验证结果的存在即可用于表明所述任一子网节点上存在所述目标数据。In an embodiment, any main network node generates a candidate verification result when it is determined that any subnet node is deployed on the node device where it is located, and that any subnet node maintains the target data , and broadcast the candidate verification result to other main network nodes in the blockchain main network, but no subnet node is deployed on the node device where it is determined, or although any subnet node is deployed If the target data is not maintained by any sub-network node but the target data is not maintained by any sub-network node, no candidate verification result is generated. In this embodiment of the specification, the existence of a candidate verification result can be used to indicate that the target data exists on any subnetwork node.
在本说明书实施例中,所述任一主网节点在确定自身所处节点设备上未部署有第二区块链子网中的任一子网节点的情况下,不生成所述候选验证结果,或者生成包含预设无效数据的候选验证结果并广播至所述区块链主网中的其他主网节点。在本说明书实施例中,对于自身所处节点设备未部署有第二区块链子网中任一子网节点的主网节点,其显然无法对目标数据是否存在于第二区块链子网做出有效的判断,因此这样的主网节点无需生成候选验证结果,而是通过收集其他主网节点广播的候选验证结果作为判断依据,当然,这样的主网节点也可以生成包含无效数据的候选验证结果并广播,例如生成并广播的候选验证结果中包含“unknown”,以用于表明该候选验证结果对应的主网节点无法对目标数据是否存在于第二区块链子网进行有效判断,因此也没有参考价值,于是其他主网节点在接收到包含“unknown”的候选验证结果时,将其舍去不计入接收到的所有候选验证结果,因此可以防止那些无法做出有效判断的主网节点对最终目标验证结果的选取形成干扰,同时可以用于确定各主网节点确实接收到验证交易并且做出了响应,以排除存在主网节点未正常响应的情况。或者说,如果没有收到各主网节点返回的候选验证结果(即便包含unknown),则表明可能存在网络问题或宕机的情况。In the embodiment of this specification, if any main network node determines that no subnet node in the second blockchain subnet is deployed on the node device where it is located, it does not generate the candidate verification result, Or generate candidate verification results containing preset invalid data and broadcast to other main network nodes in the blockchain main network. In the embodiment of this specification, for the main network node where the node device is not deployed with any subnet node in the second blockchain subnet, it is obviously unable to make a decision on whether the target data exists in the second blockchain subnet. Effective judgment, so such main network nodes do not need to generate candidate verification results, but collect candidate verification results broadcast by other main network nodes as the basis for judgment. Of course, such main network nodes can also generate candidate verification results containing invalid data And broadcast, for example, the candidate verification result generated and broadcast contains "unknown" to indicate that the main network node corresponding to the candidate verification result cannot effectively judge whether the target data exists in the second blockchain subnet, so there is no Reference value, so when other main network nodes receive candidate verification results containing "unknown", they will discard it and not count it into all candidate verification results received, thus preventing those main network nodes that cannot make valid judgments from The selection of the final target verification result forms interference, and can be used to determine that each main network node has indeed received the verification transaction and made a response, so as to rule out the situation that the main network node does not respond normally. In other words, if you do not receive candidate verification results (even if unknown) returned by each main network node, it indicates that there may be network problems or downtime.
上述任一主网节点可以通过多种方式检查自身所处的节点设备上是否部署有第二区块链子网中的任一子网节点。在一实施例中,数据验证智能合约可以维护有区块链主网所管理的各区块链子网的成员身份信息(例如节点公钥),比如可以维护在该数据验证智能合约所对应的合约账户中,以作为该合约账户下的合约状态。因此,上述的任一主网节点可以通过读取数据验证智能合约所对应的合约账户,以获取第二区块链子网中各节点成员的节点公钥集合,从而将所述任一主网节点维护的节点公钥进行比对,如果所述任一主网节点的节点公钥包含于第二区块链子网对应的节点公钥集合,则说明所述任一主网节点属于第二区块链子网的节点成员,即所述任一主网节点所处节点设备上部署有第二区块链子网中的任一子网节点;如果所述任一主网节点的节点公钥未包含于第二区块链子网对应的节点公钥集合,则说明所述任一主网节点不属于第二区块链子网的节点成员,即所述任一主网节点所处节点设备上未部署有第二区块链子网中的任一子网节点。在另一实施例中,区块链主网所管理的各区块链子网的成员身份信息并非由数据验证智能合约所维护,而是作为合约状态被维护于区块链主网上部署的子网管理智能合约所对应的合约账户中。因此,在执行数据验证交易的过程中,数据验证智能合约响应于任一主网节点的调用,可以从子网管理智能合约的合约账户中读取第二区块链子网中各节点成员的身份信息,以用于判断该任一主网节点所处的节点设备上是否部署有上述的任一子网节点。在又一实施例中,任一主网节点预先已经判断过自身所处的节点设备上是否部署有任一子网节点,并将判断结果维护在该任一主网节点中,因此,当任一主网节点需要检查自身所处的节点设备上是否部署有第二区块链子网中的任一子网节点时,只需要读取自身预先维护的判断结果即可判断自身所处的节点设备上是否部署有任一子网节点。Any of the above-mentioned main network nodes can check whether any subnetwork node in the second blockchain subnetwork is deployed on the node device where it is located in a variety of ways. In one embodiment, the data verification smart contract can maintain the membership information (such as node public key) of each blockchain subnet managed by the blockchain main network, for example, the contract account corresponding to the data verification smart contract can be maintained , as the contract status under the contract account. Therefore, any of the above-mentioned main network nodes can verify the contract account corresponding to the smart contract by reading data to obtain the node public key set of each node member in the second blockchain subnet, so that any of the main network nodes can The maintained node public key is compared, if the node public key of any main network node is included in the node public key set corresponding to the second blockchain subnet, it means that any main network node belongs to the second block The node member of the chain subnet, that is, any subnet node in the second blockchain subnet is deployed on the node device where any main network node is located; if the node public key of any main network node is not included in The set of node public keys corresponding to the second blockchain subnet indicates that any of the main network nodes does not belong to the node members of the second blockchain subnet, that is, the node device where any of the main network nodes is located does not deploy Any subnetwork node in the second blockchain subnetwork. In another embodiment, the membership information of each blockchain subnet managed by the blockchain mainnet is not maintained by the data verification smart contract, but is maintained as a contract state by the subnetwork deployed on the blockchain mainnet. In the contract account corresponding to the smart contract. Therefore, in the process of executing data verification transactions, the data verification smart contract can read the identity of each node member in the second blockchain subnet from the contract account of the subnet management smart contract in response to the call of any main network node The information is used to determine whether any of the above-mentioned subnetwork nodes is deployed on the node device where any mainnetwork node is located. In yet another embodiment, any main network node has previously judged whether any subnet node is deployed on the node device where it is located, and maintains the judgment result in any main network node. Therefore, when any When a main network node needs to check whether any subnet node in the second blockchain subnet is deployed on the node device where it is located, it only needs to read the judgment result maintained in advance to judge the node device where it is located. Whether any subnetwork nodes are deployed on it.
步骤206,所述任一主网节点从获取到的所有候选验证结果中确定一个满足所述数据验证条件的目标验证结果,以由第一区块链子网根据所述目标验证结果确定所述目标数据是否存在于第二区块链子网。 Step 206, said any main network node determines a target verification result that satisfies the data verification condition from all obtained candidate verification results, so that the first blockchain subnetwork can determine the target verification result according to the target verification result Whether the data exists in the second blockchain subnet.
如前所述,区块链主网中的各主网节点均需要执行数据验证交易,并在自身所处节点设备中部署有第二区块链网络中的子网节点的情况下广播候选验证结果,因此同一个主网节点可能接收到来自其他主网节点广播的多个候选验证结果。其中,对于自身所处节点设备部署有第二区块链网络中子网节点的主网节点,除了会接收到其他主网节点的候选验证结果,其自身生成的候选验证结果也算作在其所获取的所有候选验证结果之中。而对于所处节点设备未部署有第二区块链网络中子网节点的主网节点,由于其自身未生 成对应的候选验证结果,因此其所获取的所有候选验证结果均为从其他主网节点所接收到的候选验证结果。As mentioned above, each main network node in the blockchain main network needs to perform data verification transactions, and broadcast candidate verification when the subnet node in the second blockchain network is deployed in the node device where it is located. As a result, the same mainnet node may receive multiple candidate verification results broadcast from other mainnet nodes. Among them, for the main network node where the node device is deployed with the subnet node in the second blockchain network, in addition to receiving the candidate verification results of other main network nodes, the candidate verification results generated by itself are also counted in its Among all candidate verification results obtained. For the main network nodes whose node devices are not deployed with subnet nodes in the second blockchain network, since they do not generate corresponding candidate verification results, all candidate verification results obtained are from other main network nodes. Candidate verification results received by the node.
在本说明书实施例中,区块链主网中的各主网节点在完成候选验证结果广播阶段后,理论上将收到相同数量和相同内容的候选验证结果(即所述所有候选验证结果)以构成一个候选集合。为了使得每个主网节点均能从自己获得的候选集合中选取内容相同的候选验证结果,需要遵循统一的选取规则,也即前述的被维护在区块链主网中各主网节点的数据验证条件。因此,各主网节点均按照针对第二区块链子网的数据验证条件,分别从各自的候选集合中选取出内容相同的候选验证结果,以作为上述的目标验证结果。In the embodiment of this specification, each main network node in the blockchain main network will theoretically receive the same number of candidate verification results with the same content (that is, all candidate verification results) after completing the candidate verification result broadcast stage. to form a candidate set. In order for each main network node to select a candidate verification result with the same content from the candidate set obtained by itself, it is necessary to follow a unified selection rule, that is, the aforementioned data of each main network node maintained in the blockchain main network Verify conditions. Therefore, according to the data verification conditions for the second blockchain subnet, each main network node selects candidate verification results with the same content from their respective candidate sets as the above-mentioned target verification results.
为了保证选取出内容相同的目标验证结果,数据验证条件可以包括下述至少之一:所述所有候选验证结果中内容相同的候选验证结果超过第一预设数量,将所述所有候选验证结果中内容相同且超过第一预设数量的候选验证结果作为目标验证结果。所述所有候选验证结果中内容相同的候选验证结果来源于预设主网节点,将所述所有候选验证结果中内容相同且来源于预设主网节点的候选验证结果作为目标验证结果。所述所有候选验证结果中内容相同且来源于第二区块链子网中子网节点的候选验证结果超过第二预设数量,将所有候选验证结果中内容相同、来源于第二区块链子网中的子网节点且超过第二预设数量的候选验证结果作为目标验证结果。In order to ensure that the target verification results with the same content are selected, the data verification conditions may include at least one of the following: among all the candidate verification results, the candidate verification results with the same content exceed the first preset number, and all the candidate verification results Candidate verification results with the same content and exceeding the first preset number are used as target verification results. The candidate verification results with the same content among all the candidate verification results are from the preset main network node, and the candidate verification results with the same content and originating from the preset main network node among all the candidate verification results are taken as the target verification results. All candidate verification results with the same content and originating from subnetwork nodes in the second blockchain subnet exceed the second preset number, and all candidate verification results with the same content and originating from the second blockchain subnetwork Candidate verification results of the subnetwork nodes in and exceeding the second preset number are used as target verification results.
需要指出的是,当数据验证条件包括上述至少两条时,为了防止存在多个内容不同的候选验证结果均满足数据验证条件从而导致各主网节点选取的目标验证结果不一致,需要保证最终选取得到的目标验证结果能够同时满足所有数据验证条件。以及,虽然本说明书在仅罗列了上述三条数据验证条件,但实际上可以任意扩展数据验证条件以满足用户的实际需求或者具体的验证场景,例如,在候选验证结果广播阶段,如果任一主网节点在确定自身所处节点设备上部署有所述任一子网节点的情况下生成候选验证结果,并将该候选验证结果广播至区块链主网中的其他主网节点,而在确定自身所处节点设备上未部署有所述任一子网节点的情况下不生成候选验证结果,由于这种情况下只要生成有候选验证结果即可说明所述任一子网节点上存在所述目标数据,因此可以认为所有候选验证结果的内容一定是相同的,此时完全可以将候选验证条件设置为下述至少之一:所述所有候选验证结果中的候选验证结果超过第一预设数量;所述所有候选验证结果中的候选验证结果来源于预设主网节点;所述所有候选验证结果中来源于第二区块链子网中子网节点的候选验证结果超过第二预设数量。又或者,加入时间限制条件,例如,将候选验证条件设置为:在预设时间段内确定的所有候选验证结果中的候选验证结果超过第一预设数量等,本说明书对此并不作任何限制。It should be pointed out that when the data verification conditions include at least two of the above, in order to prevent the existence of multiple candidate verification results with different content that all meet the data verification conditions, resulting in inconsistent target verification results selected by each main network node, it is necessary to ensure that the final selection is The target verification result of can satisfy all data verification conditions at the same time. And, although this manual only lists the above three data verification conditions, in fact, the data verification conditions can be expanded arbitrarily to meet the actual needs of users or specific verification scenarios. For example, in the broadcast stage of candidate verification results, if any main network The node generates a candidate verification result when it is determined that any of the subnet nodes is deployed on the node device where it is located, and broadcasts the candidate verification result to other main network nodes in the blockchain main network. If no subnetwork node is deployed on the node device, no candidate verification result is generated, because in this case, as long as a candidate verification result is generated, it means that the target exists on any subnetwork node Therefore, it can be considered that the content of all candidate verification results must be the same, and at this time, the candidate verification condition can be set to at least one of the following: the candidate verification results among all the candidate verification results exceed the first preset number; Candidate verification results among all candidate verification results are from preset main network nodes; among all candidate verification results, candidate verification results from subnet nodes in the second blockchain subnet exceed a second preset number. Alternatively, a time limit condition is added, for example, the candidate verification condition is set as: the candidate verification results among all the candidate verification results determined within a preset time period exceed the first preset number, etc., and this specification does not make any restrictions on this .
在本说明书实施例中,为了保证任一主网节点在基于数据验证条件确定目标验证结果的可信度,需要确保任一主网节点从其他主网节点处接收到候选验证结果的确来源于区块链主网中的主网节点,因此有必要引入身份验核机制以确保接收的候选验证结果的合法性(来自区块链主网中的主网节点)。在一实施例中,可以通过电子签名/验签的方式来实现身份核验机制。以图1为例,假设subnet0为区块链主网,subnet1为第一区块链子网而subnet2为第二区块链子网,根据前述的候选验证结果生成和广播的逻辑,在候选验证结果广播阶段完成后,作为主网节点的nodeA其自身会生成一个候选验证结果result_A,并且还会分别接收到来自nodeB、nodeC和nodeE(这些主网节点所处节点设备上部署有第二区块链子网中的子网节点)广播的result_B、result_C和result_E。显然对于nodeA而言,其只能确保自身生成的result_A是合法的,但对于从其他主网节点接收到的其他候选验证结果则无法确认其合法性。基于此,可以在候选验证结果广播阶段,要求所述任一主网节点将所述候选验证结果进行签名后再广播至所述区块链主网中除所述任一主网节点以外的主网节点,从而可以保证任一主网节点接收到的来自其他主网节点的任一候选验证结果均包含有一个对应的电子签名,例如nodeA在接收到result_B、result_C和result_E的同时,还会分别接收到对应于result_B、result_C和result_E的电子签名sign_B、sign_C和sign_E,其中,sign_B、sign_C和sign_E分别是nodeB、nodeC和nodeE通过各自的节点私钥对result_B、result_C和result_E进行签名得到的。因此,nodeA可以根据本地维护的nodeB、nodeC和nodeE的节点公钥分别对sign_B、sign_C 和sign_E进行验签,如果电子签名验签成功,则证明该电子签名对应的候选验证结果的确来源于其所声明的主网节点,具有合法性。这样一来,任一主网节点就可以通过上述身份核验机制首先对接收到的来自其他主网节点的候选验证结果进行验签,并将验签成功的候选验证结果作为所述所有候选验证结果,以使所述所有候选验证结果包括:自身生成的候选验证结果以及从其他的主网节点接收到且验签成功的候选验证结果,从而确保用于选取目标验证结果的候选集合中所有候选验证结果的合法性,以最终保证选取目标验证结果的可信度。In the embodiment of this specification, in order to ensure the credibility of any main network node in determining the target verification result based on data verification conditions, it is necessary to ensure that the candidate verification results received by any main network node from other main network nodes are indeed from the zone Therefore, it is necessary to introduce an identity verification mechanism to ensure the legitimacy of the received candidate verification results (from the main network nodes in the blockchain main network). In an embodiment, the identity verification mechanism may be implemented by way of electronic signature/signature verification. Taking Figure 1 as an example, assuming that subnet0 is the blockchain main network, subnet1 is the first blockchain subnet and subnet2 is the second blockchain subnet, according to the aforementioned logic of generating and broadcasting candidate verification results, broadcast the candidate verification results After the stage is completed, nodeA, as the main network node, will generate a candidate verification result result_A, and will also receive results from nodeB, nodeC and nodeE respectively (these main network nodes are located on the node devices where the second blockchain subnet is deployed). The result_B, result_C and result_E broadcasted by the subnet nodes in . Obviously, for nodeA, it can only ensure that the result_A generated by itself is legal, but it cannot confirm the legitimacy of other candidate verification results received from other main network nodes. Based on this, in the candidate verification result broadcast stage, the any main network node is required to sign the candidate verification result and then broadcast it to the main network other than the any main network node in the blockchain main network. network nodes, so as to ensure that any candidate verification result received by any main network node from other main network nodes contains a corresponding electronic signature. For example, when nodeA receives result_B, result_C and result_E, it will also Electronic signatures sign_B, sign_C and sign_E corresponding to result_B, result_C and result_E are received, wherein sign_B, sign_C and sign_E are respectively obtained by signing result_B, result_C and result_E by nodeB, nodeC and nodeE through their respective node private keys. Therefore, nodeA can verify sign_B, sign_C and sign_E respectively according to the node public keys of nodeB, nodeC and nodeE maintained locally. If the electronic signature verification is successful, it proves that the candidate verification result corresponding to the electronic signature is indeed from its own The declared main network node has legitimacy. In this way, any main network node can first verify the signature of the candidate verification results received from other main network nodes through the above-mentioned identity verification mechanism, and use the successful candidate verification results as all candidate verification results , so that all candidate verification results include: self-generated candidate verification results and candidate verification results received from other main network nodes and successfully verified, so as to ensure that all candidate verification results in the candidate set for selecting target verification results The legitimacy of the results to ultimately ensure the credibility of the selected target verification results.
在本说明书实施例中,除了通过身份验核机制保证候选集合中的所有候选验证结果均来源于主网节点之外,还可以通过一些手段来防止恶意或故障主网节点重复广播多条相同或不同的候选验证结果。由于重复发送的候选验证结果在基于上述的签名及验签技术下依然满足合法性,而不会被身份验核机制所筛除,但显然会破坏候选集合中所有候选验证结果的构成,并可能最终使得确定的目标验证结果不可信。因此,有必要建立一种去重机制,以防止重放故障导致的失信问题。例如,在nodeA完成上述身份核验机制并确定合法的候选集合后,还需要进一步对候选集合中来自同一主网节点的候选验证结果进行统计(利用同一节点公钥验签成功的次数),如发现候选集合中包含来源于同一主网节点的至少两个候选验证结果,则证明该主网节点发来重放故障,此时可以直接将来自该主网节点的候选验证结果从候选集合中予以剔除,或者所述至少两个候选验证结果中选取其中一个作为唯一有效的候选验证结果保留在候选集合中,其他的予以剔除。这样一来,通过上述身份核验机制以及去重机制所最终确定得到的候选集合中的所有候选验证结果将同时具有合法性和来源独占性(指对于某一候选验证结果,候选集合中除了该候选验证结果以外的其他候选验证结果均不来源于该候选验证结果来源的主网节点),从而避免因恶意或故障主网节点多次广播候选验证结果而导致最终确定的目标验证结果不可信的问题。In the embodiment of this specification, in addition to ensuring that all candidate verification results in the candidate set come from the main network node through the identity verification mechanism, some means can also be used to prevent malicious or faulty main network nodes from repeatedly broadcasting multiple identical or Different candidate validation results. Since the repeatedly sent candidate verification results still meet the legality based on the above-mentioned signature and signature verification technology, they will not be screened out by the identity verification mechanism, but it will obviously destroy the composition of all candidate verification results in the candidate set, and may Ultimately, the verification result of the determined target is not credible. Therefore, it is necessary to establish a deduplication mechanism to prevent untrustworthiness caused by replay failures. For example, after nodeA completes the above identity verification mechanism and determines the legal candidate set, it is necessary to further count the candidate verification results from the same main network node in the candidate set (the number of successful signature verifications using the same node public key), if found If the candidate set contains at least two candidate verification results from the same main network node, it proves that the main network node sent a replay failure. At this time, the candidate verification results from the main network node can be directly removed from the candidate set , or select one of the at least two candidate verification results as the only valid candidate verification result and keep it in the candidate set, and the others are eliminated. In this way, all candidate verification results in the candidate set finally determined through the above-mentioned identity verification mechanism and de-duplication mechanism will have both legality and source exclusivity (referring to a candidate verification result, the candidate set except the candidate Candidate verification results other than the verification result do not originate from the main network node from which the candidate verification result originates), so as to avoid the problem that the final target verification result is not credible due to multiple broadcasts of candidate verification results by malicious or faulty main network nodes .
在一实施例中,所述候选验证结果包括候选收据;所述方法还包括:所述任一主网节点将所述目标验证结果设置为所述数据验证交易对应的交易收据。在本说明书实施例中,前述的候选验证结果即为候选收据,前述所选取的目标验证结果即为所述数据验证交易对应的交易收据。正如前述组建区块链子网的交易在执行后生成的收据可以通过消息机制实现消息传递,所述数据验证交易对应的交易收据也可以通过事件监听机制被处于同一节点设备的第一区块链子网中的子网节点所获取。因此,第一区块链子网可以通过以下途径获得所述交易收据:第一区块链子网中的子网节点监听自身所处节点设备上部署的主网节点生成的所述交易收据。由于每个主网节点在执行数据验证交易后均会选取内容相同的交易收据,并且第一区块链子网中的各子网节点自身所处的节点设备也均部署有主网节点,因此对于第一区块链子网中的每个子网节点,均可以通过监听自身所处节点设备上的主网节点以获取所述交易收据,从而使得第一区块链子网获取该交易收据。In an embodiment, the candidate verification result includes a candidate receipt; the method further includes: any main network node setting the target verification result as a transaction receipt corresponding to the data verification transaction. In the embodiment of this specification, the aforementioned candidate verification result is the candidate receipt, and the aforementioned selected target verification result is the transaction receipt corresponding to the data verification transaction. Just as the receipt generated after the execution of the aforementioned transactions that form the blockchain subnet can be passed through the message mechanism, the transaction receipt corresponding to the data verification transaction can also be sent to the first blockchain subnet of the same node device through the event monitoring mechanism. Obtained by the subnetwork nodes in . Therefore, the first block chain subnetwork can obtain the transaction receipt through the following way: the subnetwork nodes in the first block chain subnetwork monitor the transaction receipt generated by the main network node deployed on the node device where it is located. Since each main network node will select a transaction receipt with the same content after executing the data verification transaction, and the node equipment of each subnet node in the first blockchain subnet is also equipped with a main network node, so for Each subnet node in the first block chain subnet can obtain the transaction receipt by monitoring the main network node on the node device where it is located, so that the first block chain subnet obtains the transaction receipt.
在本说明书实施例中,区块链主网中的主网节点在执行数据验证交易的过程中,主要分为以下两个阶段:第一阶段发生于各主网节点在刚接收到数据验证交易时,各主网节点分别决定是否生成候选验证结果以及对候选验证结果进行广播,这个阶段被称为投票阶段;第二阶段发生于各主网节点在接收到来自其他主网节点的候选验证结果后,基于维护的第二区块链网络对应的数据验证条件,从自身获取的所有候选验证结果中确定出一个满足数据验证条件的候选验证结果作为目标验证结果,并将其透出传递至第一区块链子网,这一过程被称为共识阶段。在一实施例中,所述数据验证交易包括调用所述区块链主网上部署的数据验证智能合约的交易;所述任一主网节点执行所述数据验证交易,包括:调用所述数据验证智能合约,以生成所述候选验证结果并确定出所述目标验证结果。因此,任一主网节点上部署的数据验证智能合约响应于数据验证交易所执行的合约逻辑,既包含判断自身所处节点设备是否部署有第二区块链网络中的任一子网节点、从所述任一子网节点对应的本地数据库中越权检查是否存在目标数据、生成并广播候选验证结果的逻辑,同时,该合约逻辑中也包括从获取的所有候选验证结果中确定得到一个满足数据验证条件的目标验证结果,即本说明书实施例中数据验证智能合约所涉及的 合约逻辑同时包含投票阶段和共识阶段的必要流程。或者,在另一实施例中,所述数据验证交易包括调用所述区块链主网上部署的数据验证智能合约的交易;所述任一主网节点执行所述数据验证交易,包括:调用所述数据验证智能合约,以生成所述候选验证结果;所述任一主网节点从获取到的所有候选验证结果中确定一个满足所述数据验证条件的目标验证结果,包括:通过所述任一主网节点上部署的共识模块,确定出所述目标验证结果。在本实施例中,数据验证智能合约响应于数据验证交易所执行的合约逻辑仅包含判断自身所处节点设备是否部署有第二区块链网络中的任一子网节点、从所述任一子网节点对应的本地数据库中越权检查是否存在目标数据、生成并广播候选验证结果的逻辑,即投票阶段的必要流程,而在这之后,任一主网节点所进行的共识阶段的必要流程则是通过所述任一主网节点自身所处节点设备的共识模块所完成的,因此,该共识模块必然需要维护有第二区块链子网对应的数据验证条件,而在本说明书实施例中,所述数据验证条件由所述数据验证智能合约所维护;和/或,所述数据验证条件由其他智能合约所维护。因此,共识模块需要通过访问主网节点对应的本地数据库,以从数据验证智能合约或其他智能合约中读取第二区块链子网对应的数据验证条件,需要指出的是,上述其他智能合约包括前述的Subnet合约,该合约中不仅记录有第二区块链子网对应的数据验证条件,还记录有区块链主网管理下的其他所有区块链子网对应的数据验证条件。In the embodiment of this specification, the main network nodes in the blockchain main network are mainly divided into the following two stages in the process of executing data verification transactions: the first stage occurs when each main network node just receives the data verification transaction When each main network node decides whether to generate candidate verification results and broadcast the candidate verification results, this stage is called the voting stage; the second stage occurs when each main network node receives candidate verification results from other main network nodes Finally, based on the data verification conditions corresponding to the maintained second blockchain network, a candidate verification result that satisfies the data verification conditions is determined from all the candidate verification results obtained by itself as the target verification result, and it is transparently transmitted to the second block chain network. A blockchain subnetwork, this process is called the consensus phase. In one embodiment, the data verification transaction includes a transaction calling the data verification smart contract deployed on the main network of the block chain; the execution of the data verification transaction by any of the main network nodes includes: calling the data verification smart contract A smart contract is used to generate the candidate verification result and determine the target verification result. Therefore, the data verification smart contract deployed on any main network node responds to the contract logic executed by the data verification exchange, including judging whether the node device where it is located is deployed with any subnet node in the second blockchain network, From the local database corresponding to any of the subnetwork nodes, the logic of checking whether the target data exists beyond authority, generating and broadcasting candidate verification results, and at the same time, the contract logic also includes determining a satisfactory data from all the obtained candidate verification results The target verification result of the verification condition, that is, the contract logic involved in the data verification smart contract in the embodiment of this specification includes the necessary processes of both the voting stage and the consensus stage. Or, in another embodiment, the data verification transaction includes a transaction calling the data verification smart contract deployed on the main network of the block chain; the execution of the data verification transaction by any main network node includes: calling the said data verification smart contract to generate said candidate verification results; said any main network node determines a target verification result that satisfies said data verification conditions from all obtained candidate verification results, including: The consensus module deployed on the main network node determines the target verification result. In this embodiment, the contract logic executed by the data verification smart contract in response to the data verification transaction only includes judging whether the node device where it is located is deployed with any sub-network node in the second blockchain network, from any In the local database corresponding to the subnet node, the logic of checking whether the target data exists beyond authority, generating and broadcasting the candidate verification result is the necessary process of the voting stage, and after that, the necessary process of the consensus stage carried out by any main network node is It is completed by the consensus module of the node device where any main network node itself is located. Therefore, the consensus module must maintain the data verification conditions corresponding to the second blockchain subnet, and in the embodiment of this specification, The data verification condition is maintained by the data verification smart contract; and/or, the data verification condition is maintained by other smart contracts. Therefore, the consensus module needs to access the local database corresponding to the main network node to read the data verification conditions corresponding to the second blockchain subnet from the data verification smart contract or other smart contracts. It should be pointed out that the other smart contracts mentioned above include The aforementioned Subnet contract not only records the data verification conditions corresponding to the second blockchain subnet, but also records the data verification conditions corresponding to all other blockchain subnets under the management of the blockchain main network.
在本说明书实施例中,第一区块链子网可以通过检查目标验证结果中包含的内容来验证第二区块链子网上是否存在目标数据。在一实施例中,所述任一主网节点在确定所述任一子网节点上存在所述目标数据的情况下,生成包含所述目标数据的所述候选验证结果;所述任一主网节点在确定所述任一主网节点所处节点设备上部署的第二区块链子网中的子网节点不存在所述目标数据的情况下,生成未包含所述目标数据的所述候选验证结果;同时,第一区块链子网中的子网节点在所述目标验证结果中包含所述目标数据的情况下,确定所述目标数据存在于第二区块链子网;第一区块链子网中的子网节点在所述目标收据中未包含所述目标数据的情况下,确定所述目标数据未存在于第二区块链子网。以下通过一个例子来对本说明书实施例进行详细说明,以图1为例,假设subnet0为区块链主网,subnet1为第一区块链子网而subnet2为第二区块链子网,subnet1中的nodeA1持有一个交易哈希,并且希望验证该交易哈希所对应的交易数据(本实施例中目标数据即为该交易数据)是否被维护在subnet2中,于是nodeA1向其所处的节点设备1中的共识模块发出数据验证交易,并在数据验证交易中携带subnet0的网络标识以指示该交易发往的目的区块链网络,同时携带subnet2的网络标识以指示用于验证目标数据的目标区块链网络,以及携带作为数据描述信息的交易哈希以指示所需验证的目标数据。节点设备1中的共识模块根据该数据验证交易中subnet0的网络标识确定该交易是发往subnet2的,于是根据subnet0中的共识链路将该数据验证交易广播至subnet0中的各个主网节点,包括位于节点设备1本地的nodeA,以及位于节点设备2-5的nodeB-nodeE。任一主网节点在接收到该数据验证交易后,基于数据验证交易中携带的subent2的网络标识,首先判断自身所处的节点设备1是否部署有属于subnet2的子网节点。例如,对于自身所处节点设备部署有属于subnet2中子网节点nodeA2的主网节点nodeA,其会进一步在nodeA2对应的数据库中获取subnet2的区块链账本,并根据数据验证交易中携带的交易哈希在该区块链账本中查询该交易哈希对应的交易是否存在,假如存在则nodeA将取出该交易并将其写入生成的候选验证结果result_A,以及将result_A广播至其他的主网节点;对于nodeB而言,假设nodeB所处节点设备2上部署的nodeB2对应的数据库中不存在该交易哈希对应的交易,那么nodeB所生成的候选验证结果result_B将携带空数据或无效数据,并将result_B广播至其他的主网节点;而对于nodeD而言,由于nodeD所处的节点设备4并未部署有属于subnet2中的子网节点,nodeD可以不生成候选验证结果,其他主网节点的操作类似,这里不再赘述,由此,当所有主网节点完成候选验证结果的生成和广播后,投票阶段结束并进入共识阶段。In the embodiment of this specification, the first blockchain subnet can verify whether the target data exists on the second blockchain subnet by checking the content contained in the target verification result. In an embodiment, when the any main network node determines that the target data exists on the any sub-network node, it generates the candidate verification result containing the target data; the any main network node When the network node determines that the target data does not exist in the subnet node in the second blockchain subnet deployed on the node device where any main network node is located, generate the candidate that does not contain the target data. verification result; at the same time, the subnet node in the first block chain subnetwork determines that the target data exists in the second block chain subnetwork under the condition that the target data is included in the target verification result; the first block If the target data is not included in the target receipt, the sub-network nodes in the chain subnet determine that the target data does not exist in the second block chain subnet. The following uses an example to describe the embodiment of this specification in detail. Taking Figure 1 as an example, assume that subnet0 is the blockchain main network, subnet1 is the first blockchain subnet and subnet2 is the second blockchain subnet, and nodeA1 in subnet1 Holds a transaction hash, and wants to verify whether the transaction data corresponding to the transaction hash (the target data in this embodiment is the transaction data) is maintained in subnet2, so nodeA1 submits a request to the node device 1 where it is located The consensus module sends out data verification transactions, and carries the network identifier of subnet0 in the data verification transaction to indicate the destination blockchain network to which the transaction is sent, and at the same time carries the network identifier of subnet2 to indicate the target blockchain used to verify the target data Network, and the transaction hash that carries the data description information to indicate the target data that needs to be verified. The consensus module in node device 1 determines that the transaction is sent to subnet2 according to the network identifier of subnet0 in the data verification transaction, and then broadcasts the data verification transaction to each main network node in subnet0 according to the consensus link in subnet0, including nodeA located locally on node device 1, and nodeB-nodeE located on node devices 2-5. After any main network node receives the data verification transaction, based on the network identifier of subent2 carried in the data verification transaction, it first judges whether the node device 1 where it is located has deployed a subnet node belonging to subnet2. For example, if the main network node nodeA belonging to the subnet node nodeA2 in subnet2 is deployed on the node device where it is located, it will further obtain the blockchain account book of subnet2 in the database corresponding to nodeA2, and verify the transaction hash carried in the transaction according to the data. Hope to check whether the transaction corresponding to the transaction hash exists in the blockchain ledger. If it exists, nodeA will take out the transaction and write it into the generated candidate verification result result_A, and broadcast result_A to other main network nodes; For nodeB, assuming that there is no transaction corresponding to the transaction hash in the database corresponding to nodeB2 deployed on node device 2 where nodeB is located, the candidate verification result result_B generated by nodeB will carry empty or invalid data, and result_B Broadcast to other main network nodes; for nodeD, since the node device 4 where nodeD is located is not deployed with subnet nodes belonging to subnet2, nodeD may not generate candidate verification results, and the operations of other main network nodes are similar. I won’t go into details here. Therefore, when all main network nodes complete the generation and broadcast of candidate verification results, the voting phase ends and enters the consensus phase.
投票阶段结束后,任一主网节点均会获得相同的候选验证结果从而构成相同的候选集合,例如,nodeA会分别接收到来自nodeB、nodeC和nodeE的候选验证结果result_B、result_C和result_E,加上自身生成的result_A构成一个包含result_A、result_B、result_C 和result_E的候选集合,同理,其他的主网节点例如nodeB~nodeE也将分别获得包含result_A、result_B、result_C和result_E的相同的候选集合。然后,任一主网节点会根据自身维护的第二区块链子网对应的数据验证条件从候选集合中确定目标验证结果,假设数据验证条件为“所有候选验证结果中内容相同的候选验证结果的数量超过2”,因此任一主网节点需要对候选集合中的所有候选验证结果的内容进行比对排查,假设result_A、result_C和result_E的内容均为某一相同的交易数据,而result_B中包含有空数据,那么根据上述数据验证条件,显然result_A、result_C和result_E的内容相同且数量超过了2,因此可以将其中任意一个候选验证结果确定为目标验证结果。nodeA~nodeE均会执行上述共识阶段的操作,确定出相同内容的目标验证结果,虽然具体的确定结果中可能会出现nodeA~C确定result_A为目标验证结果、nodeD~E确定result_C为目标验证结果等类似的情况,但由于result_A、result_C和result_E的内容相同,只是来源不同(来源信息未体现在候选验证结果中),因此并不会影响各个主网节点最终将确定得到内容相同的目标验证结果这一根本目标。然后,任一主网节点均会透出确定得到的目标验证结果,例如nodeA会将包含交易数据的目标验证结果在节点设备1上透出,以使同样部署在节点设备1上的属于subnet1的子网节点nodeA1获取该目标验证结果,以及,nodeA1在检查目标验证结果中包含交易哈希对应的交易数据的情况下,确定自身持有的交易哈希对应的交易的确存在于subnet2中,从而最终满足nodeA1作为数据验证服务的需求方对相应数据的验证需求,同时nodeA1还获取到了其所持有的交易哈希所对应的交易数据。同理,其他的主网节点也会进行类似的操作以在各自所处的节点设备上透出目标验证结果,从而使得subnet1中的各个子网节点均能够获取目标验证结果并根据该目标验证结果中包含交易数据的情况,确定所述交易数据的确存在于subnet2。After the voting phase ends, any main network node will obtain the same candidate verification results to form the same candidate set. For example, nodeA will receive candidate verification results result_B, result_C and result_E from nodeB, nodeC and nodeE respectively, plus The result_A generated by itself constitutes a candidate set including result_A, result_B, result_C, and result_E. Similarly, other main network nodes such as nodeB~nodeE will also obtain the same candidate set including result_A, result_B, result_C, and result_E. Then, any main network node will determine the target verification result from the candidate set according to the data verification conditions corresponding to the second blockchain subnet maintained by itself. The number exceeds 2", so any main network node needs to compare and check the contents of all candidate verification results in the candidate set. Assume that the contents of result_A, result_C and result_E are the same transaction data, and result_B contains empty data, then according to the above data verification conditions, it is obvious that result_A, result_C and result_E have the same content and the number exceeds 2, so any one of the candidate verification results can be determined as the target verification result. nodeA~nodeE will perform the operation of the above consensus stage to determine the target verification result of the same content, although the specific determination results may appear that nodeA~C determine result_A as the target verification result, nodeD~E determine result_C as the target verification result, etc. Similar situation, but because the content of result_A, result_C and result_E is the same, but the source is different (the source information is not reflected in the candidate verification result), it will not affect each main network node will finally determine the target verification result with the same content. a fundamental goal. Then, any main network node will reveal the confirmed target verification result. For example, nodeA will reveal the target verification result containing transaction data on node device 1, so that the subnet1 that is also deployed on node device 1 Subnet node nodeA1 obtains the target verification result, and nodeA1 determines that the transaction corresponding to the transaction hash it holds does exist in subnet2 when checking that the target verification result contains the transaction data corresponding to the transaction hash, and finally Satisfy the verification requirements of nodeA1 as the demander of the data verification service for the corresponding data, and at the same time, nodeA1 also obtains the transaction data corresponding to the transaction hash held by it. In the same way, other main network nodes will also perform similar operations to reveal the target verification results on their respective node devices, so that each subnet node in subnet1 can obtain the target verification results and verify the results according to the target If the transaction data is contained in , it is determined that the transaction data does exist in subnet2.
在另一实施例中,第一区块链子网发出的所述数据验证交易包括所述目标数据;所述任一主网节点将所述任一子网节点上的数据与所述目标数据进行比对,并生成包含比对结果的所述候选验证结果;同时,第一区块链子网中的子网节点在确定所述目标验证结果中包含的所述比对结果为比对一致的情况下,确定所述目标数据存在于第二区块链子网;第一区块链子网中的子网节点在确定所述目标验证结果中包含的所述比对结果为比对不一致的情况下,确定所述目标数据未存在于第二区块链子网。仍以图1为例,假设subnet0为区块链主网,subnet1为第一区块链子网而subnet2为第二区块链子网,subnet1中的nodeA1持有一个合约状态、该合约状态对应的数据标识以及该合约状态所在合约的合约地址,并且希望验证其持有的合约状态(本实施例中目标数据即为该合约状态)是否被维护在subnet2中,于是nodeA1向其所处的节点设备1中的共识模块发出数据验证交易,并在数据验证交易中携带subnet0的网络标识以指示该交易发往的目的区块链网络,同时携带subnet2的网络标识以指示用于验证目标数据的目标区块链网络,以及携带作为数据描述信息的合约地址和数据标识以指示所需验证的目标数据。节点设备1中的共识模块根据该数据验证交易中subnet0的网络标识确定该交易是发往subnet2的,于是根据subnet0中的共识链路将该数据验证交易广播至subnet0中的各个主网节点,包括位于节点设备1本地的nodeA,以及位于节点设备2-5的nodeB-nodeE。任一主网节点在接收到该数据验证交易后,基于数据验证交易中携带的subent2的网络标识,首先判断自身所处的节点设备1是否部署有属于subnet2的子网节点。例如,对于自身所处节点设备部署有属于subnet2中子网节点nodeA2的主网节点nodeA,其会进一步在nodeA2对应的数据库中获取数据验证交易中携带的合约地址对应的合约存储空间,并根据数据验证交易中携带的数据标识在该合约存储空间中查询该数据标识对应的合约状态是否存在,并在该合约状态存在的情况下将其取出与数据验证交易中携带的合约状态进行比对,假设比对结果为比对一致,则nodeA将比对一致的比对结果写入生成的候选验证结果result_A,以及将result_A广播至其他的主网节点;对于nodeB而言,假设nodeB所处节点设备2上部署的nodeB2对应的数据库中能够搜索取得数据标识对应的合约状态,但从数据库中取出的合约状态与数据验证交易中携带的合约状态比对不一致,那么nodeB所生成的候选验证结果result_B将被写入比对不一致的比对结果,并将result_B广播至其他的主网节点;而对于nodeD而言,由于nodeD所处的节点设备4并 未部署有属于subnet2中的子网节点,nodeD可以不生成候选验证结果,其他主网节点的操作类似,这里不再赘述,由此,当所有主网节点完成候选验证结果的生成和广播后,投票阶段结束并进入共识阶段。In another embodiment, the data verification transaction sent by the first block chain subnet includes the target data; any of the main network nodes compares the data on any of the subnet nodes with the target data Compare, and generate the candidate verification result containing the comparison result; meanwhile, the subnetwork nodes in the first block chain subnet determine that the comparison result contained in the target verification result is consistent with the comparison Next, it is determined that the target data exists in the second block chain subnet; when the subnet node in the first block chain subnet determines that the comparison result contained in the target verification result is inconsistent with the comparison, It is determined that the target data does not exist in the second blockchain subnet. Still taking Figure 1 as an example, assuming that subnet0 is the blockchain main network, subnet1 is the first blockchain subnet and subnet2 is the second blockchain subnet, nodeA1 in subnet1 holds a contract state and the data corresponding to the contract state ID and the contract address of the contract where the contract state is located, and wants to verify whether the contract state held by it (the target data in this embodiment is the contract state) is maintained in subnet2, so nodeA1 sends the node device 1 where it is located The consensus module in the data verification transaction sends out the data verification transaction, and carries the network identification of subnet0 in the data verification transaction to indicate the destination blockchain network to which the transaction is sent, and carries the network identification of subnet2 to indicate the target block used to verify the target data Chain network, and carry the contract address and data identifier as data description information to indicate the target data that needs to be verified. The consensus module in node device 1 determines that the transaction is sent to subnet2 according to the network identifier of subnet0 in the data verification transaction, and then broadcasts the data verification transaction to each main network node in subnet0 according to the consensus link in subnet0, including nodeA located locally on node device 1, and nodeB-nodeE located on node devices 2-5. After any main network node receives the data verification transaction, based on the network identifier of subent2 carried in the data verification transaction, it first judges whether the node device 1 where it is located has deployed a subnet node belonging to subnet2. For example, if the main network node nodeA belonging to the subnet node nodeA2 in subnet2 is deployed on the node device where it is located, it will further obtain the contract storage space corresponding to the contract address carried in the data verification transaction from the database corresponding to nodeA2, and according to the data The data identifier carried in the verification transaction is checked in the contract storage space to see if the contract state corresponding to the data identifier exists, and if the contract state exists, it is taken out and compared with the contract state carried in the data verification transaction, assuming If the comparison result is consistent, then nodeA writes the result of the consistent comparison into the generated candidate verification result result_A, and broadcasts result_A to other main network nodes; for nodeB, it is assumed that nodeB is located in node device 2 The contract status corresponding to the data identifier can be searched in the database corresponding to nodeB2 deployed on the network, but the contract status retrieved from the database is inconsistent with the contract status carried in the data verification transaction, then the candidate verification result result_B generated by nodeB will be Write the comparison results that are inconsistent, and broadcast result_B to other main network nodes; for nodeD, since the node device 4 where nodeD is located is not deployed with subnet nodes belonging to subnet2, nodeD can not To generate candidate verification results, the operations of other main network nodes are similar and will not be repeated here. Therefore, when all main network nodes complete the generation and broadcast of candidate verification results, the voting phase ends and enters the consensus phase.
投票阶段结束后,任一主网节点均会获得相同的候选验证结果从而构成相同的候选集合,例如,nodeA会分别接收到来自nodeB、nodeC和nodeE的候选验证结果result_B、result_C和result_E,加上自身生成的result_A构成一个包含result_A、result_B、result_C和result_E的候选集合,同理,其他的主网节点例如nodeB~nodeE也将分别获得包含result_A、result_B、result_C和result_E的相同的候选集合。然后,任一主网节点会根据自身维护的第二区块链子网对应的数据验证条件从候选集合中确定目标验证结果,假设数据验证条件为“所有候选验证结果中内容相同的候选验证结果来源于nodeA和nodeB”,因此任一主网节点需要对候选集合中的所有候选验证结果的内容进行比对排查,假设result_A、result_C和result_E的内容均为比对一致的比对结果(形如“yes”),而result_B中包含有比对不一致的比对结果(形如“no”),那么根据上述数据验证条件,显然分别来自nodeA和nodeB的result_A和result_B的内容不相同,因此在候选集合中不存在满足上述数据验证条件的候选验证结果,于是无法确定目标验证结果,对于这种情况,可以将携带比对不一致的比对结果的候选验证结果作为目标验证结果,也即将result_B确定为目标验证结果;或者,也可以不确定、不透出目标验证结果,此时subnet1将因为等待超时而认为所述合约状态不存在于subnet2。nodeA~nodeE均会执行上述共识阶段的操作,确定出相同内容的目标验证结果,或者也均不确定目标验证结果。然后,在nodeA~nodeE在确定出相同的目标验证结果result_B的情况下,任一主网节点均会透出确定得到的目标验证结果result_B,例如nodeA会将包含交易数据的目标验证结果在节点设备1上透出,以使同样部署在节点设备1上的属于subnet1的子网节点nodeA1获取该目标验证结果,以及,nodeA1在检查目标验证结果中包含比对不一致的比对结果的情况下,确定自身持有的合约状态不存在于subnet2中,从而最终满足nodeA1作为数据验证服务的需求方对相应数据的验证需求,同时,其他的主网节点也会进行类似的操作以在各自所处的节点设备上透出目标验证结果,但由于目标验证结果中没有携带作为目标数据的合约状态,因此在其他主网节点本身没有持有该合约状态的情况下,subnet1中的除nodeA以外的子网节点将无法通过目标验证结果中的“no”知晓是何目标数据不存在于subnet2中,起到了隐私保护的效果。After the voting phase ends, any main network node will obtain the same candidate verification results to form the same candidate set. For example, nodeA will receive candidate verification results result_B, result_C and result_E from nodeB, nodeC and nodeE respectively, plus The result_A generated by itself forms a candidate set including result_A, result_B, result_C, and result_E. Similarly, other main network nodes such as nodeB~nodeE will also obtain the same candidate set including result_A, result_B, result_C, and result_E. Then, any main network node will determine the target verification result from the candidate set according to the data verification condition corresponding to the second blockchain subnet maintained by itself, assuming that the data verification condition is "the source of the candidate verification result with the same content in all candidate verification results nodeA and nodeB", so any main network node needs to compare and check the content of all candidate verification results in the candidate set, assuming that the contents of result_A, result_C and result_E are all consistent comparison results (like " yes"), and result_B contains inconsistent comparison results (such as "no"), then according to the above data verification conditions, it is obvious that the contents of result_A and result_B from nodeA and nodeB are different, so in the candidate set There is no candidate verification result that satisfies the above data verification conditions, so the target verification result cannot be determined. In this case, the candidate verification result with the comparison result that is inconsistent can be used as the target verification result, that is, result_B is determined as the target Verification result; or, it is also possible to be indeterminate and not reveal the target verification result. At this time, subnet1 will consider that the contract state does not exist in subnet2 because of the waiting timeout. NodeA~nodeE will perform the operation of the above consensus stage to determine the target verification result of the same content, or they will not be sure of the target verification result. Then, when nodeA~nodeE determine the same target verification result result_B, any main network node will reveal the confirmed target verification result result_B, for example, nodeA will send the target verification result containing transaction data to the node device 1, so that the subnet node nodeA1 belonging to subnet1 that is also deployed on node device 1 obtains the target verification result, and nodeA1 confirms that the target verification result contains an inconsistent comparison result. The contract status held by itself does not exist in subnet2, so as to finally meet the verification requirements of nodeA1 as the demander of the data verification service for the corresponding data. The target verification result is revealed on the device, but since the target verification result does not carry the contract status as the target data, in the case that other main network nodes do not hold the contract status themselves, the subnet nodes in subnet1 except nodeA It will be impossible to know what target data does not exist in subnet2 through the "no" in the target verification result, which has the effect of privacy protection.
图3是一示例性实施例提供的一种验证区块链数据的方法的流程图。该方法应用于区块链主网中的主网节点,在所述区块链主网与区块链子网构成的区块链系统中,所述区块链子网中的子网节点所处的节点设备上部署有所述区块链主网中的主网节点,所述区块链子网至少包括第一区块链子网和第二区块链子网,所述区块链主网中的主网节点维护有第二区块链子网对应的数据验证条件;所述方法包括:步骤302,接收第一区块链子网向区块链主网发起的数据验证交易,所述数据验证交易用于对第二区块链子网上是否存在目标数据进行验证;步骤304,执行所述数据验证交易,以在自身所处节点设备上部署有第二区块链子网中的任一子网节点的情况下生成候选验证结果,并将所述候选验证结果广播至所述区块链主网中的其他主网节点,其中,所述候选验证结果用于表明所述任一子网节点上是否存在所述目标数据;步骤306,从获取到的所有候选验证结果中确定一个满足所述数据验证条件的目标验证结果,以由第一区块链子网根据所述目标验证结果确定所述目标数据是否存在于第二区块链子网。Fig. 3 is a flowchart of a method for verifying blockchain data provided by an exemplary embodiment. The method is applied to the main network nodes in the blockchain main network. In the blockchain system composed of the blockchain main network and the blockchain subnet, the subnet nodes in the blockchain subnet are located The main network nodes in the blockchain main network are deployed on the node device, and the blockchain subnet includes at least the first blockchain subnet and the second blockchain subnet, and the main network nodes in the blockchain main network The network node maintains data verification conditions corresponding to the second block chain subnet; the method includes: step 302, receiving a data verification transaction initiated by the first block chain subnet to the block chain main network, and the data verification transaction is used for Verify whether the target data exists on the second block chain subnet; step 304, execute the data verification transaction, so that when any subnet node in the second block chain subnet is deployed on the node device where it is located Generate candidate verification results, and broadcast the candidate verification results to other main network nodes in the blockchain main network, wherein the candidate verification results are used to indicate whether the Target data; step 306, determine a target verification result that satisfies the data verification condition from all obtained candidate verification results, so that the first block chain subnet can determine whether the target data exists in the Second blockchain subnet.
如前所述,所述数据验证条件包括下述至少之一:所述所有候选验证结果中内容相同的候选验证结果超过第一预设数量;所述所有候选验证结果中内容相同的候选验证结果来源于预设主网节点;所述所有候选验证结果中内容相同且来源于第二区块链子网中子网节点的候选验证结果超过第二预设数量。As mentioned above, the data verification conditions include at least one of the following: the candidate verification results with the same content among all the candidate verification results exceed the first preset number; the candidate verification results with the same content among all the candidate verification results Originated from a preset main network node; the content of all candidate verification results is the same and the candidate verification results originating from subnet nodes in the second blockchain subnet exceed a second preset number.
如前所述,所述候选验证结果包括候选收据;所述方法还包括:将所述目标验证结果设置为所述数据验证交易对应的交易收据。As mentioned above, the candidate verification result includes a candidate receipt; the method further includes: setting the target verification result as a transaction receipt corresponding to the data verification transaction.
如前所述,第一区块链子网通过以下途径获得所述交易收据:第一区块链子网中的子网节点监听自身所处节点设备上部署的主网节点生成的所述交易收据。As mentioned above, the first block chain subnet obtains the transaction receipt through the following method: the subnet nodes in the first block chain subnet listen to the transaction receipt generated by the main network node deployed on the node device where it is located.
如前所述,所述数据验证交易包括目标数据的数据描述信息以及第二区块链子网的网络标识;其中,所述网络标识用于指示所述主网节点:将自身所处节点设备上部署的对应于所述网络标识的子网节点确定为所述任一子网节点;所述数据描述信息用于指示所述主网节点:将所述任一子网节点上匹配于所述数据描述信息的数据确定为所述目标数据。As mentioned above, the data verification transaction includes the data description information of the target data and the network identifier of the second blockchain subnet; wherein, the network identifier is used to instruct the main network node to: put itself on the node device The deployed sub-network node corresponding to the network identifier is determined as the any sub-network node; the data description information is used to instruct the main network node: match any sub-network node with the data Data describing information is determined as the target data.
如前所述,所述将所述候选验证结果广播至所述区块链主网中的其他主网节点,包括:将所述候选验证结果进行签名后广播至所述区块链主网中除所述任一主网节点以外的主网节点;其中,所述所有候选验证结果包括:自身生成的候选验证结果以及从其他的主网节点接收到且验签成功的候选验证结果。As mentioned above, the broadcasting of the candidate verification results to other main network nodes in the blockchain main network includes: broadcasting the candidate verification results to the blockchain main network after signing A main network node other than any main network node; wherein, all candidate verification results include: candidate verification results generated by itself and candidate verification results received from other main network nodes and successfully verified.
如前所述,所述生成所述候选验证结果包括:在确定所述任一子网节点上存在所述目标数据的情况下,生成包含所述目标数据的所述候选验证结果,以使第一区块链子网中的子网节点在所述目标验证结果中包含所述目标数据的情况下,确定所述目标数据存在于第二区块链子网。As mentioned above, the generating the candidate verification result includes: when it is determined that the target data exists on the any subnetwork node, generating the candidate verification result containing the target data, so that the first A subnetwork node in a block chain subnet determines that the target data exists in a second block chain subnet when the target verification result includes the target data.
如前所述,所述数据验证交易包括所述目标数据;所述生成所述候选验证结果包括:将所述任一子网节点上的数据与所述目标数据进行比对,并生成包含比对结果的所述候选验证结果,以使第一区块链子网中的子网节点在确定所述目标验证结果中包含的所述比对结果为比对一致的情况下,确定所述目标数据存在于第二区块链子网。As mentioned above, the data verification transaction includes the target data; the generation of the candidate verification results includes: comparing the data on any subnetwork node with the target data, and generating a comparison The candidate verification result of the result, so that the subnet node in the first block chain subnet determines the target data when the comparison result contained in the target verification result is determined to be consistent. Exists on the second blockchain subnet.
如前所述,还包括:响应并执行用于创建新区块链子网的子网创建交易,获取并维护所述新区块链子网对应的数据验证条件,所述子网创建交易中包含所述新区块链子网对应的数据验证条件。As mentioned above, it also includes: responding to and executing a subnet creation transaction for creating a new blockchain subnet, obtaining and maintaining the data verification conditions corresponding to the new blockchain subnet, and the subnet creation transaction includes the new zone The data verification conditions corresponding to the block chain subnet.
如前所述,还包括:响应并执行用于更新所述第二区块链子网对应的数据验证条件的条件更改交易,将自身维护的所述数据验证条件更新为新数据验证条件,所述条件更改交易中包含第二区块链子网对应的所述新数据验证条件。As mentioned above, it also includes: responding to and executing a condition change transaction for updating the data verification conditions corresponding to the second blockchain subnet, updating the data verification conditions maintained by itself to new data verification conditions, the The condition modification transaction includes the new data verification condition corresponding to the second blockchain subnet.
如前所述,所述数据验证交易包括调用所述区块链主网上部署的数据验证智能合约的交易;所述执行所述数据验证交易,包括:调用所述数据验证智能合约,以生成所述候选验证结果并确定出所述目标验证结果。As mentioned above, the data verification transaction includes the transaction of calling the data verification smart contract deployed on the main network of the block chain; the execution of the data verification transaction includes: calling the data verification smart contract to generate the The candidate verification result is determined and the target verification result is determined.
如前所述,所述数据验证交易包括调用所述区块链主网上部署的数据验证智能合约的交易;所述执行所述数据验证交易,包括:调用所述数据验证智能合约,以生成所述候选验证结果;所述从获取到的所有候选验证结果中确定一个满足所述数据验证条件的目标验证结果,包括:通过本地部署的共识模块,确定出所述目标验证结果。As mentioned above, the data verification transaction includes the transaction of calling the data verification smart contract deployed on the main network of the block chain; the execution of the data verification transaction includes: calling the data verification smart contract to generate the The candidate verification result; the determining a target verification result that satisfies the data verification condition from all the obtained candidate verification results includes: determining the target verification result through a locally deployed consensus module.
如前所述,所述数据验证条件由所述数据验证智能合约所维护;和/或,所述数据验证条件由其他智能合约所维护。As mentioned above, the data verification condition is maintained by the data verification smart contract; and/or, the data verification condition is maintained by other smart contracts.
如前所述,所述目标数据包括下述之一:交易数据、状态数据、收据数据。As mentioned above, the target data includes one of the following: transaction data, status data, and receipt data.
图4是一示例性实施例提供的一种设备的示意结构图。请参考图4,在硬件层面,该设备包括处理器402、内部总线404、网络接口406、内存408以及非易失性存储器410,当然还可能包括其他业务所需要的硬件。本说明书一个或多个实施例可以基于软件方式来实现,比如由处理器402从非易失性存储器410中读取对应的计算机程序到内存408中然后运行。当然,除了软件实现方式之外,本说明书一个或多个实施例并不排除其他实现方式,比如逻辑器件抑或软硬件结合的方式等等,也就是说以下处理流程的执行主体并不限定于各个逻辑单元,也可以是硬件或逻辑器件。Fig. 4 is a schematic structural diagram of a device provided by an exemplary embodiment. Please refer to FIG. 4 , at the hardware level, the device includes a processor 402 , an internal bus 404 , a network interface 406 , a memory 408 and a non-volatile memory 410 , and of course may include hardware required by other services. One or more embodiments of this specification may be implemented based on software, for example, the processor 402 reads a corresponding computer program from the non-volatile memory 410 into the memory 408 and executes it. Of course, in addition to software implementations, 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 to say, the execution subject of the following processing flow is not limited to each A logic unit, which can also be a hardware or logic device.
如图5所示,图5是本说明书根据一示例性实施例提供的一种验证区块链数据的装置的框图,该装置可以应用于如图4所示的设备中,以实现本说明书的技术方案。该装置应用于区块链主网中的主网节点,在所述区块链主网与区块链子网构成的区块链系统中,所述区块链子网中的子网节点所处的节点设备上部署有所述区块链主网中的主网节点,所述区块链子网至少包括第一区块链子网和第二区块链子网,所述区块链主网中的主网节点维护有第二区块链子网对应的数据验证条件;所述装置包括:交易接收模块501,用于接收第一区块链子网向区块链主网发起的数据验证交易,所述数据验证交易用于对第二区块链子网上是否存在目标数据进行验证;交易执行模块502,用于执行所述数据验证交易,以在自身所处节点设备上部署有第二区块链子网中的任一子网节点的情况下 生成候选验证结果,并将所述候选验证结果广播至所述区块链主网中的其他主网节点,其中,所述候选验证结果用于表明所述任一子网节点上是否存在所述目标数据;条件验证模块503,用于从获取到的所有候选验证结果中确定一个满足所述数据验证条件的目标验证结果,以由第一区块链子网根据所述目标验证结果确定所述目标数据是否存在于第二区块链子网。As shown in Figure 5, Figure 5 is a block diagram of a device for verifying blockchain data provided in this specification according to an exemplary embodiment, and the device can be applied to the device shown in Figure 4 to realize the Technical solutions. The device is applied to the main network nodes in the blockchain main network. In the blockchain system composed of the blockchain main network and the blockchain subnet, the subnet nodes in the blockchain subnet are located The main network nodes in the blockchain main network are deployed on the node device, and the blockchain subnet includes at least the first blockchain subnet and the second blockchain subnet, and the main network nodes in the blockchain main network The network node maintains the data verification conditions corresponding to the second block chain subnet; the device includes: a transaction receiving module 501, which is used to receive the data verification transaction initiated by the first block chain subnet to the block chain main network, and the data The verification transaction is used to verify whether the target data exists on the second block chain subnet; the transaction execution module 502 is used to execute the data verification transaction to deploy the second block chain subnet on the node device where it is located. In the case of any subnet node, a candidate verification result is generated, and the candidate verification result is broadcast to other main network nodes in the blockchain main network, wherein the candidate verification result is used to indicate that any Whether the target data exists on the subnetwork node; the condition verification module 503 is used to determine a target verification result that satisfies the data verification condition from all the obtained candidate verification results, so that the first block chain subnet can use The target verification result determines whether the target data exists in the second block chain subnetwork.
如前所述,所述数据验证条件包括下述至少之一:所述所有候选验证结果中内容相同的候选验证结果超过第一预设数量;所述所有候选验证结果中内容相同的候选验证结果来源于预设主网节点;所述所有候选验证结果中内容相同且来源于第二区块链子网中子网节点的候选验证结果超过第二预设数量。As mentioned above, the data verification conditions include at least one of the following: the candidate verification results with the same content among all the candidate verification results exceed the first preset number; the candidate verification results with the same content among all the candidate verification results Originated from a preset main network node; the content of all candidate verification results is the same and the candidate verification results originating from subnet nodes in the second blockchain subnet exceed a second preset number.
如前所述,所述候选验证结果包括候选收据;所述装置还包括:收据设置模块504,用于将所述目标验证结果设置为所述数据验证交易对应的交易收据。As mentioned above, the candidate verification result includes a candidate receipt; the device further includes: a receipt setting module 504, configured to set the target verification result as a transaction receipt corresponding to the data verification transaction.
如前所述,第一区块链子网通过以下途径获得所述交易收据:第一区块链子网中的子网节点监听自身所处节点设备上部署的主网节点生成的所述交易收据。As mentioned above, the first block chain subnet obtains the transaction receipt through the following method: the subnet nodes in the first block chain subnet listen to the transaction receipt generated by the main network node deployed on the node device where it is located.
如前所述,所述数据验证交易包括目标数据的数据描述信息以及第二区块链子网的网络标识;其中,所述网络标识用于指示所述主网节点:将自身所处节点设备上部署的对应于所述网络标识的子网节点确定为所述任一子网节点;所述数据描述信息用于指示所述主网节点:将所述任一子网节点上匹配于所述数据描述信息的数据确定为所述目标数据。As mentioned above, the data verification transaction includes the data description information of the target data and the network identifier of the second blockchain subnet; wherein, the network identifier is used to instruct the main network node to: put itself on the node device The deployed sub-network node corresponding to the network identifier is determined as the any sub-network node; the data description information is used to instruct the main network node: match any sub-network node with the data Data describing information is determined as the target data.
如前所述,所述交易执行模块502具体用于:将所述候选验证结果进行签名后广播至所述区块链主网中除所述任一主网节点以外的主网节点;其中,所述所有候选验证结果包括:自身生成的候选验证结果以及从其他的主网节点接收到且验签成功的候选验证结果。As mentioned above, the transaction execution module 502 is specifically configured to: broadcast the candidate verification result to the main network nodes in the blockchain main network except any main network node after signing; wherein, All the candidate verification results include: candidate verification results generated by itself and candidate verification results received from other main network nodes and successfully verified.
如前所述,所述交易执行模块502具体用于:在确定所述任一子网节点上存在所述目标数据的情况下,生成包含所述目标数据的所述候选验证结果,以使第一区块链子网中的子网节点在所述目标验证结果中包含所述目标数据的情况下,确定所述目标数据存在于第二区块链子网。As mentioned above, the transaction execution module 502 is specifically configured to: generate the candidate verification result containing the target data when it is determined that the target data exists on any of the subnetwork nodes, so that the first A subnetwork node in a block chain subnet determines that the target data exists in a second block chain subnet when the target verification result includes the target data.
如前所述,所述数据验证交易包括所述目标数据;所述交易执行模块502具体用于:将所述任一子网节点上的数据与所述目标数据进行比对,并生成包含比对结果的所述候选验证结果,以使第一区块链子网中的子网节点在确定所述目标验证结果中包含的所述比对结果为比对一致的情况下,确定所述目标数据存在于第二区块链子网。As mentioned above, the data verification transaction includes the target data; the transaction execution module 502 is specifically configured to: compare the data on any subnetwork node with the target data, and generate an inclusion ratio The candidate verification result of the result, so that the subnet node in the first block chain subnet determines the target data when the comparison result contained in the target verification result is determined to be consistent. Exists on the second blockchain subnet.
如前所述,还包括:子网创建交易执行模块505,用于响应并执行用于创建新区块链子网的子网创建交易,获取并维护所述新区块链子网对应的数据验证条件,所述子网创建交易中包含所述新区块链子网对应的数据验证条件。As mentioned above, it also includes: a subnet creation transaction execution module 505, which is used to respond to and execute a subnet creation transaction for creating a new blockchain subnet, acquire and maintain the data verification conditions corresponding to the new blockchain subnet, and The subnet creation transaction includes the data verification conditions corresponding to the new blockchain subnet.
如前所述,还包括:条件更改交易执行模块506,用于响应并执行用于更新所述第二区块链子网对应的数据验证条件的条件更改交易,将自身维护的所述数据验证条件更新为新数据验证条件,所述条件更改交易中包含第二区块链子网对应的所述新数据验证条件。As mentioned above, it also includes: a condition change transaction execution module 506, which is used to respond to and execute a condition change transaction for updating the data verification conditions corresponding to the second blockchain subnet, and convert the data verification conditions maintained by itself to The new data verification condition is updated, and the condition modification transaction includes the new data verification condition corresponding to the second block chain subnet.
如前所述,所述数据验证交易包括调用所述区块链主网上部署的数据验证智能合约的交易;所述交易执行模块502具体用于:调用所述数据验证智能合约,以生成所述候选验证结果并确定出所述目标验证结果。As mentioned above, the data verification transaction includes the transaction of calling the data verification smart contract deployed on the main network of the block chain; the transaction execution module 502 is specifically used to: call the data verification smart contract to generate the Candidate verification results and determine the target verification result.
如前所述,所述数据验证交易包括调用所述区块链主网上部署的数据验证智能合约的交易;所述交易执行模块502具体用于:调用所述数据验证智能合约,以生成所述候选验证结果;以及,通过本地部署的共识模块,确定出所述目标验证结果。As mentioned above, the data verification transaction includes the transaction of calling the data verification smart contract deployed on the main network of the block chain; the transaction execution module 502 is specifically used to: call the data verification smart contract to generate the a candidate verification result; and, through a locally deployed consensus module, determine the target verification result.
如前所述,所述数据验证条件由所述数据验证智能合约所维护;和/或,所述数据验证条件由其他智能合约所维护。As mentioned above, the data verification condition is maintained by the data verification smart contract; and/or, the data verification condition is maintained by other smart contracts.
如前所述,所述目标数据包括下述之一:交易数据、状态数据、收据数据。As mentioned above, the target data includes one of the following: transaction data, status data, and receipt data.
相应的,本说明书还提供一种装置,所述装置包括有处理器;用于存储处理器可执行指令的存储器;其中,所述处理器被配置为实现上述全部方法实施例提供的实现验证区块链数据的方法的步骤。Correspondingly, this specification also provides a device, the device includes a processor; a memory for storing processor-executable instructions; wherein, the processor is configured to implement the implementation verification area provided by all the above method embodiments The steps of the method of blockchain data.
相应的,本说明书还提供一种计算机可读存储介质,其上存储有可执行的指令;其中,该指令被处理器执行时,实现上述全部方法实施例提供的实现验证区块链数据的方法的步骤。Correspondingly, this specification also provides a computer-readable storage medium on which executable instructions are stored; wherein, when the instructions are executed by the processor, the methods for verifying blockchain data provided by all the above method embodiments are implemented. A step of.
如图6所示,图6是本说明书根据一示例性实施例提供的一种验证区块链数据的系统的架构图,从图中可以很直观地表现出,第一区块链子网610中部署的任一子网节点均与区块链主网600中的某一主网节点处于相同的节点设备。该区块链系统包含区块链子网和区块链主网600,其中,所述区块链子网中的子网节点所处的节点设备上部署有所述区块链主网600中的主网节点,所述区块链子网至少包括第一区块链子网610和第二区块链子网,所述区块链主网600中的主网节点维护有第二区块链子网对应的数据验证条件;所述系统包括:第一区块链子网610,用于向区块链主网600发起数据验证交易,所述数据验证交易用于对第二区块链子网上是否存在目标数据进行验证;区块链主网600,所述区块链主网600中的任一主网节点执行所述数据验证交易,以在所述任一主网节点所处节点设备上部署有第二区块链子网中的任一子网节点的情况下生成候选验证结果,并将所述候选验证结果广播至所述区块链主网600中的其他主网节点,其中,所述候选验证结果用于表明所述任一子网节点上是否存在所述目标数据;所述任一主网节点从获取到的所有候选验证结果中确定一个满足所述数据验证条件的目标验证结果,以由第一区块链子网610根据所述目标验证结果确定所述目标数据是否存在于第二区块链子网。As shown in Figure 6, Figure 6 is an architecture diagram of a system for verifying blockchain data provided by this specification according to an exemplary embodiment. It can be intuitively shown from the figure that the first blockchain subnet 610 Any deployed subnetwork node is in the same node device as a certain mainnet node in the blockchain mainnet 600 . The block chain system includes a block chain subnet and a block chain main network 600, wherein, the node device where the subnet node in the block chain subnet is located is deployed with the block chain main network 600. network nodes, the block chain subnet includes at least a first block chain subnet 610 and a second block chain subnet, and the main network nodes in the block chain main network 600 maintain data corresponding to the second block chain subnet Verification conditions; the system includes: a first block chain subnet 610, which is used to initiate a data verification transaction to the block chain main network 600, and the data verification transaction is used to verify whether there is target data on the second block chain subnet Block chain main network 600, any main network node in the block chain main network 600 executes the data verification transaction, so that the second block is deployed on the node device where any main network node is located In the case of any subnet node in the chain subnet, a candidate verification result is generated, and the candidate verification result is broadcast to other main network nodes in the blockchain main network 600, wherein the candidate verification result is used for Indicate whether the target data exists on any of the subnet nodes; any of the main network nodes determines a target verification result that satisfies the data verification conditions from all obtained candidate verification results, and the first district The block chain subnet 610 determines whether the target data exists in the second block chain subnet according to the target verification result.
如前所述,所述数据验证条件包括下述至少之一:所述所有候选验证结果中内容相同的候选验证结果超过第一预设数量;所述所有候选验证结果中内容相同的候选验证结果来源于预设主网节点;所述所有候选验证结果中内容相同且来源于第二区块链子网中子网节点的候选验证结果超过第二预设数量。As mentioned above, the data verification conditions include at least one of the following: the candidate verification results with the same content among all the candidate verification results exceed the first preset number; the candidate verification results with the same content among all the candidate verification results Originated from a preset main network node; the content of all candidate verification results is the same and the candidate verification results originating from subnet nodes in the second blockchain subnet exceed a second preset number.
如前所述,所述候选验证结果包括候选收据;所述区块链主网600还用于:使所述任一主网节点将所述目标验证结果设置为所述数据验证交易对应的交易收据。As mentioned above, the candidate verification results include candidate receipts; the block chain main network 600 is also used to: enable any of the main network nodes to set the target verification result as the transaction corresponding to the data verification transaction Receipt.
如前所述,第一区块链子网610通过以下途径获得所述交易收据:使第一区块链子网610中的子网节点监听自身所处节点设备上部署的主网节点生成的所述交易收据。As mentioned above, the first block chain subnet 610 obtains the transaction receipt through the following method: make the subnet nodes in the first block chain subnet 610 listen to the transaction receipt generated by the main network node deployed on the node device where it is located. transaction receipt.
如前所述,所述数据验证交易包括目标数据的数据描述信息以及第二区块链子网的网络标识;其中,所述网络标识用于指示所述任一主网节点:将自身所处节点设备上部署的对应于所述网络标识的子网节点确定为所述任一子网节点;所述数据描述信息用于指示所述任一主网节点:将所述任一子网节点上匹配于所述数据描述信息的数据确定为所述目标数据。As mentioned above, the data verification transaction includes the data description information of the target data and the network identification of the second blockchain subnet; wherein, the network identification is used to indicate that any main network node: The subnetwork node deployed on the device corresponding to the network identifier is determined as any subnetwork node; the data description information is used to indicate any main network node: match any subnetwork node The data based on the data description information is determined as the target data.
如前所述,所述区块链主网600具体用于:使所述任一主网节点将所述候选验证结果进行签名后广播至所述区块链主网600中除所述任一主网节点以外的主网节点;其中,所述所有候选验证结果包括:自身生成的候选验证结果以及从其他的主网节点接收到且验签成功的候选验证结果。As mentioned above, the blockchain main network 600 is specifically used to: enable any of the main network nodes to sign the candidate verification result and broadcast it to the blockchain main network 600 A main network node other than the main network node; wherein, all the candidate verification results include: candidate verification results generated by itself and candidate verification results received from other main network nodes and successfully verified.
如前所述,所述区块链主网600具体用于:使所述任一主网节点在确定所述任一子网节点上存在所述目标数据的情况下,生成包含所述目标数据的所述候选验证结果;所述第一区块链子网610还用于:使第一区块链子网610中的子网节点在所述目标验证结果中包含所述目标数据的情况下,确定所述目标数据存在于第二区块链子网。As mentioned above, the block chain main network 600 is specifically used to: make any of the main network nodes determine that the target data exists on any of the sub-network nodes, generate a block containing the target data the candidate verification result; the first blockchain subnetwork 610 is also used to: make the subnetwork nodes in the first blockchain subnetwork 610 determine that the target data is included in the target verification result The target data exists in the second blockchain subnet.
如前所述,所述数据验证交易包括所述目标数据;所述区块链主网600具体用于:使所述任一主网节点将所述任一子网节点上的数据与所述目标数据进行比对,并生成包含比对结果的所述候选验证结果;所述第一区块链子网610还用于:使第一区块链子网610中的子网节点在确定所述目标验证结果中包含的所述比对结果为比对一致的情况下,确定所述目标数据存在于第二区块链子网。As mentioned above, the data verification transaction includes the target data; the block chain main network 600 is specifically used to: enable the any main network node to combine the data on the any sub-network node with the The target data is compared, and the candidate verification result containing the comparison result is generated; the first block chain subnetwork 610 is also used to: make the subnetwork nodes in the first block chain subnetwork 610 determine the target If the comparison result included in the verification result is consistent, it is determined that the target data exists in the second blockchain subnetwork.
如前所述,所述区块链主网600还用于:响应于用于创建新区块链子网的子网创建交易,以使所述区块链主网600中的主网节点在执行所述子网创建交易后获取并维护所述新区块链子网对应的数据验证条件,所述子网创建交易中包含所述新区块链子网对应的数据验证条件。As mentioned above, the block chain main network 600 is also used to: respond to the subnet creation transaction for creating a new block chain subnet, so that the main network nodes in the block chain main network 600 execute the Obtain and maintain the data verification conditions corresponding to the new blockchain subnet after the subnet creation transaction, and the subnet creation transaction includes the data verification conditions corresponding to the new blockchain subnet.
如前所述,所述区块链主网600还用于:响应于用于更新所述第二区块链子网对应 的数据验证条件的条件更改交易,以使所述区块链主网600中的主网节点在执行所述条件更改交易后,将自身维护的所述数据验证条件更新为新数据验证条件,所述条件更改交易中包含第二区块链子网对应的所述新数据验证条件。As mentioned above, the block chain main network 600 is also used for: changing the transaction in response to the conditions for updating the data verification conditions corresponding to the second block chain subnet, so that the block chain main network 600 After executing the condition change transaction, the main network node in the node updates the data verification condition maintained by itself to the new data verification condition, and the condition change transaction includes the new data verification corresponding to the second blockchain subnet. condition.
如前所述,所述数据验证交易包括调用所述区块链主网600上部署的数据验证智能合约的交易;所述区块链主网600具体用于:使任一主网节点调用所述数据验证智能合约,以生成所述候选验证结果并确定出所述目标验证结果。As mentioned above, the data verification transaction includes the transaction of invoking the data verification smart contract deployed on the block chain main network 600; the block chain main network 600 is specifically used to: enable any main network node to call the The data verification smart contract is used to generate the candidate verification result and determine the target verification result.
如前所述,所述数据验证交易包括调用所述区块链主网600上部署的数据验证智能合约的交易;所述区块链主网600具体用于:使任一主网节点调用所述数据验证智能合约,以生成所述候选验证结果;以及,通过所述任一主网节点上部署的共识模块,确定出所述目标验证结果。As mentioned above, the data verification transaction includes the transaction of invoking the data verification smart contract deployed on the block chain main network 600; the block chain main network 600 is specifically used to: enable any main network node to call the The data verification smart contract is used to generate the candidate verification result; and the target verification result is determined through the consensus module deployed on any main network node.
如前所述,所述数据验证条件由所述数据验证智能合约所维护;和/或,所述数据验证条件由其他智能合约所维护。As mentioned above, the data verification condition is maintained by the data verification smart contract; and/or, the data verification condition is maintained by other smart contracts.
如前所述,所述目标数据包括下述之一:交易数据、状态数据、收据数据。As mentioned above, the target data includes one of the following: transaction data, status data, and receipt data.
对于上述装置或系统实施例而言,由于其基本对应于方法实施例,所以相关之处参见方法实施例的部分说明即可。以上所描述的装置实施例仅仅是示意性的,其中所述作为分离部件说明的模块可以是或者也可以不是物理上分开的,作为模块显示的部件可以是或者也可以不是物理模块,即可以位于一个地方,或者也可以分布到多个网络模块上。可以根据实际的需要选择其中的部分或者全部模块来实现本说明书方案的目的。本领域普通技术人员在不付出创造性劳动的情况下,即可以理解并实施。As for the above device or system embodiments, since they basically correspond to the method embodiments, for relevant parts, please refer to part of the description of the method embodiments. The device embodiments described above are only illustrative, and the modules described as separate components may or may not be physically separated, and the components shown as modules may or may not be physical modules, that is, they may be located in One place, or it can be distributed to multiple network modules. Part or all of the modules can be selected according to actual needs to achieve the purpose of the solution in this specification. It can be understood and implemented by those skilled in the art without creative effort.
上述实施例阐明的系统、装置、模块或单元,具体可以由计算机芯片或实体实现,或者由具有某种功能的产品来实现。一种典型的实现设备为计算机。具体的,计算机例如可以为个人计算机、膝上型计算机、蜂窝电话、相机电话、智能电话、个人数字助理、媒体播放器、导航设备、电子邮件设备、游戏控制台、平板计算机、可穿戴设备或者这些设备中的任何设备的组合。The systems, devices, modules, or units described in the above embodiments can be specifically implemented by computer chips or entities, or by products with certain functions. A typical implementing device is a computer. Specifically, the computer may be, for example, 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 device, a game console, a tablet computer, a wearable device, or Combinations of any of these devices.
为了描述的方便,描述以上装置时以功能分为各种单元分别描述。当然,在实施本说明书时可以把各单元的功能在同一个或多个软件和/或硬件中实现。For the convenience of description, when describing the above devices, functions are divided into various units and described separately. Of course, when implementing this specification, the functions of each unit can be implemented in one or more pieces of software and/or hardware.
本领域内的技术人员应明白,本发明的实施例可提供为方法、系统、或计算机程序产品。因此,本发明可采用完全硬件实施例、完全软件实施例、或结合软件和硬件方面的实施例的形式。而且,本发明可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质(包括但不限于磁盘存储器、CD-ROM、光学存储器等)上实施的计算机程序产品的形式。Those skilled in the art should understand that the embodiments of the present invention may be provided as methods, systems, or computer program products. Accordingly, the present invention can take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) having computer-usable program code embodied therein.
本发明是参照根据本发明实施例的方法、设备(系统)、和计算机程序产品的流程图和/或方框图来描述的。应理解可由计算机程序指令实现流程图和/或方框图中的每一流程和/或方框、以及流程图和/或方框图中的流程和/或方框的结合。可提供这些计算机程序指令到通用计算机、专用计算机、嵌入式处理机或其他可编程数据处理设备的处理器以产生一个机器,使得通过计算机或其他可编程数据处理设备的处理器执行的指令产生用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的装置。The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It should be understood that each procedure and/or block in the flowchart and/or block diagram, and a combination of procedures and/or blocks in the flowchart and/or block diagram can be realized by computer program instructions. These computer program instructions may be provided to a general purpose computer, special purpose computer, embedded processor, or processor of other programmable data processing equipment to produce a machine such that the instructions executed by the processor of the computer or other programmable data processing equipment produce a An apparatus for realizing the functions specified in one or more procedures of the flowchart and/or one or more blocks of the block diagram.
本说明书可以在由计算机执行的计算机可执行指令的一般上下文中描述,例如程序模块。一般地,程序模块包括执行特定任务或实现特定抽象数据类型的例程、程序、对象、组件、数据结构等等。也可以在分布式计算环境中实践本说明书,在这些分布式计算环境中,由通过通信网络而被连接的远程处理设备来执行任务。在分布式计算环境中,程序模块可以位于包括存储设备在内的本地和远程计算机存储介质中。The specification may be described in the general context of computer-executable instructions, such as program modules, being executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform particular tasks or implement particular abstract data types. The present description may also be practiced in distributed computing environments where tasks are performed by remote processing devices that are linked through a communications network. In a distributed computing environment, program modules may be located in both local and remote computer storage media including storage devices.
这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令装置的制造品,该指令装置实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能。These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing apparatus to operate in a specific manner, such that the instructions stored in the computer-readable memory produce an article of manufacture comprising instruction means, the instructions The device realizes the function specified in one or more procedures of the flowchart and/or one or more blocks of the block diagram.
这些计算机程序指令也可装载到计算机或其他可编程数据处理设备上,使得在计算机或其他可编程设备上执行一系列操作步骤以产生计算机实现的处理,从而在计算机或 其他可编程设备上执行的指令提供用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的步骤。在一个典型的配置中,计算机包括一个或多个处理器(CPU)、输入/输出接口、网络接口和内存。These computer program instructions can also be loaded onto a computer or other programmable data processing device, causing a series of operational steps to be performed on the computer or other programmable device to produce a computer-implemented process, thereby The instructions provide steps for implementing the functions specified in the flow chart or blocks of the flowchart and/or the block or blocks of the block diagrams. In a typical configuration, a computer includes one or more processors (CPUs), input/output interfaces, network interfaces and memory.
内存可能包括计算机可读介质中的非永久性存储器,随机存取存储器(RAM)和/或非易失性内存等形式,如只读存储器(ROM)或闪存(flash RAM)。内存是计算机可读介质的示例。Memory may include non-permanent storage in computer-readable media, in the form of random access memory (RAM) and/or nonvolatile memory such as read-only memory (ROM) or flash RAM. Memory is an example of computer readable media.
计算机可读介质包括永久性和非永久性、可移动和非可移动媒体可以由任何方法或技术来实现信息存储。信息可以是计算机可读指令、数据结构、程序的模块或其他数据。计算机的存储介质的例子包括,但不限于相变内存(PRAM)、静态随机存取存储器(SRAM)、动态随机存取存储器(DRAM)、其他类型的随机存取存储器(RAM)、只读存储器(ROM)、电可擦除可编程只读存储器(EEPROM)、快闪记忆体或其他内存技术、只读光盘只读存储器(CD-ROM)、数字多功能光盘(DVD)或其他光学存储、磁盒式磁带、磁盘存储、量子存储器、基于石墨烯的存储介质或其他磁性存储设备或任何其他非传输介质,可用于存储可以被计算设备访问的信息。按照本文中的界定,计算机可读介质不包括暂存电脑可读媒体(transitory media),如调制的数据信号和载波。Computer-readable media, including both permanent and non-permanent, removable and non-removable media, can be implemented by any method or technology for storage of information. Information may be computer readable instructions, data structures, modules of a program, 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 computing devices. As defined herein, computer-readable media excludes transitory computer-readable media, such as modulated data signals and carrier waves.
还需要说明的是,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、商品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、商品或者设备所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括所述要素的过程、方法、商品或者设备中还存在另外的相同要素。It should also be noted that the term "comprises", "comprises" or any other variation thereof is intended to cover a non-exclusive inclusion such that a process, method, article, or apparatus comprising a set of elements includes not only those elements, but also includes Other elements not expressly listed, or elements inherent in the process, method, commodity, or apparatus are also included. Without further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of additional identical elements in the process, method, article or apparatus comprising said element.
上述对本说明书特定实施例进行了描述。其它实施例在所附权利要求书的范围内。在一些情况下,在权利要求书中记载的动作或步骤可以按照不同于实施例中的顺序来执行并且仍然可以实现期望的结果。另外,在附图中描绘的过程不一定要求示出的特定顺序或者连续顺序才能实现期望的结果。在某些实施方式中,多任务处理和并行处理也是可以的或者可能是有利的。The foregoing describes specific embodiments of this specification. Other implementations are within the scope of the following claims. In some cases, the actions or steps recited in the claims can be performed in an order different from that in the embodiments and still achieve desirable results. In addition, the processes depicted in the accompanying figures do not necessarily require the particular order shown, or sequential order, to achieve desirable results. Multitasking and parallel processing are also possible or may be advantageous in certain embodiments.
在本说明书一个或多个实施例使用的术语是仅仅出于描述特定实施例的目的,而非旨在限制本说明书一个或多个实施例。在本说明书一个或多个实施例和所附权利要求书中所使用的单数形式的“一种”、“所述”和“该”也旨在包括多数形式,除非上下文清楚地表示其他含义。还应当理解,本文中使用的术语“和/或”是指并包含一个或多个相关联的列出项目的任何或所有可能组合。Terms used in one or more embodiments of the present specification are for the purpose of describing specific embodiments only, and are not intended to limit the one or more embodiments of the present specification. As used in one or more embodiments of this specification and the appended claims, the singular forms "a", "the", and "the" are also intended to include the plural forms unless the context clearly dictates otherwise. It should also be understood that the term "and/or" as used herein refers to and includes any and all possible combinations of one or more of the associated listed items.
应当理解,尽管在本说明书一个或多个实施例可能采用术语第一、第二、第三等来描述各种信息,但这些信息不应限于这些术语。这些术语仅用来将同一类型的信息彼此区分开。例如,在不脱离本说明书一个或多个实施例范围的情况下,第一信息也可以被称为第二信息,类似地,第二信息也可以被称为第一信息。取决于语境,如在此所使用的词语“如果”可以被解释成为“在……时”或“当……时”或“响应于确定”。It should be understood that although the terms first, second, third, etc. may be used in one or more embodiments of the present specification to describe various information, the information should not be limited to these terms. These terms are only used to distinguish information of the same type from one another. For example, without departing from the scope of one or more embodiments of this specification, first information may also be called second information, and similarly, second information may also be called first information. Depending on the context, the word "if" as used herein may be interpreted as "at" or "when" or "in response to a determination."
以上所述仅为本说明书一个或多个实施例的较佳实施例而已,并不用以限制本说明书一个或多个实施例,凡在本说明书一个或多个实施例的精神和原则之内,所做的任何修改、等同替换、改进等,均应包含在本说明书一个或多个实施例保护的范围之内。The above descriptions are only preferred embodiments of one or more embodiments of this specification, and are not intended to limit one or more embodiments of this specification. Within the spirit and principles of one or more embodiments of this specification, Any modification, equivalent replacement, improvement, etc. should be included in the scope of protection of one or more embodiments of this specification.

Claims (32)

  1. 一种验证区块链数据的方法,应用于包含区块链子网和区块链主网的区块链系统,其中,所述区块链子网中的子网节点所处的节点设备上部署有所述区块链主网中的主网节点,所述区块链子网至少包括第一区块链子网和第二区块链子网,所述区块链主网中的主网节点维护有第二区块链子网对应的数据验证条件;所述方法包括:A method for verifying blockchain data, applied to a blockchain system including a blockchain subnet and a blockchain main network, wherein the node device where the subnet node in the blockchain subnet is located is deployed with The main network node in the block chain main network, the block chain subnet includes at least the first block chain subnet and the second block chain subnet, and the main network node in the block chain main network maintains the first The data verification conditions corresponding to the two block chain subnets; the method includes:
    第一区块链子网向区块链主网发起数据验证交易,所述数据验证交易用于对第二区块链子网上是否存在目标数据进行验证;The first blockchain subnet initiates a data verification transaction to the blockchain main network, and the data verification transaction is used to verify whether the target data exists on the second blockchain subnet;
    所述区块链主网中的任一主网节点执行所述数据验证交易,以在所述任一主网节点所处节点设备上部署有第二区块链子网中的任一子网节点的情况下生成候选验证结果,并将所述候选验证结果广播至所述区块链主网中的其他主网节点,其中,所述候选验证结果用于表明所述任一子网节点上是否存在所述目标数据;Any main network node in the blockchain main network executes the data verification transaction, so that any subnet node in the second blockchain subnet is deployed on the node device where the any main network node is located In the case of , a candidate verification result is generated, and the candidate verification result is broadcast to other main network nodes in the blockchain main network, wherein the candidate verification result is used to indicate whether any subnet node is said target data exists;
    所述任一主网节点从获取到的所有候选验证结果中确定一个满足所述数据验证条件的目标验证结果,以由第一区块链子网根据所述目标验证结果确定所述目标数据是否存在于第二区块链子网。The any main network node determines a target verification result that satisfies the data verification condition from all obtained candidate verification results, so that the first blockchain subnet can determine whether the target data exists according to the target verification result on the second blockchain subnet.
  2. 根据权利要求1所述的方法,所述数据验证条件包括下述至少之一:The method according to claim 1, the data verification conditions include at least one of the following:
    所述所有候选验证结果中内容相同的候选验证结果超过第一预设数量;Candidate verification results with the same content among all candidate verification results exceed a first preset number;
    所述所有候选验证结果中内容相同的候选验证结果来源于预设主网节点;The candidate verification results with the same content among all the candidate verification results come from the preset main network node;
    所述所有候选验证结果中内容相同且来源于第二区块链子网中子网节点的候选验证结果超过第二预设数量。Among all the candidate verification results, the candidate verification results with the same content and originating from subnetwork nodes in the second blockchain subnetwork exceed a second preset number.
  3. 根据权利要求1所述的方法,所述候选验证结果包括候选收据;所述方法还包括:The method of claim 1, the candidate verification result comprising a candidate receipt; the method further comprising:
    所述任一主网节点将所述目标验证结果设置为所述数据验证交易对应的交易收据。The any main network node sets the target verification result as the transaction receipt corresponding to the data verification transaction.
  4. 根据权利要求3所述的方法,第一区块链子网通过以下途径获得所述交易收据:According to the method described in claim 3, the first blockchain subnet obtains the transaction receipt through the following means:
    第一区块链子网中的子网节点监听自身所处节点设备上部署的主网节点生成的所述交易收据。The subnetwork nodes in the first blockchain subnetwork monitor the transaction receipt generated by the mainnet node deployed on the node device where they are located.
  5. 根据权利要求1所述的方法,所述数据验证交易包括目标数据的数据描述信息以及第二区块链子网的网络标识;其中,The method according to claim 1, the data verification transaction includes the data description information of the target data and the network identification of the second blockchain subnet; wherein,
    所述网络标识用于指示所述任一主网节点:将自身所处节点设备上部署的对应于所述网络标识的子网节点确定为所述任一子网节点;The network identifier is used to indicate any main network node: determine the subnetwork node corresponding to the network identifier deployed on the node device where it is located as the any subnetwork node;
    所述数据描述信息用于指示所述任一主网节点:将所述任一子网节点上匹配于所述数据描述信息的数据确定为所述目标数据。The data description information is used to instruct the any main network node to determine the data matching the data description information on any sub-network node as the target data.
  6. 根据权利要求1所述的方法,所述任一主网节点将所述候选验证结果广播至所述区块链主网中的其他主网节点,包括:According to the method according to claim 1, said any main network node broadcasts said candidate verification result to other main network nodes in said block chain main network, comprising:
    所述任一主网节点将所述候选验证结果进行签名后广播至所述区块链主网中除所述任一主网节点以外的主网节点;The any main network node signs the candidate verification result and broadcasts it to the main network nodes in the blockchain main network except the any main network node;
    其中,所述所有候选验证结果包括:自身生成的候选验证结果以及从其他的主网节点接收到且验签成功的候选验证结果。Wherein, all the candidate verification results include: candidate verification results generated by itself and candidate verification results received from other main network nodes and successfully verified.
  7. 根据权利要求1所述的方法,The method according to claim 1,
    所述任一主网节点生成所述候选验证结果包括:所述任一主网节点在确定所述任一子网节点上存在所述目标数据的情况下,生成包含所述目标数据的所述候选验证结果;The generation of the candidate verification result by any main network node includes: when the any main network node determines that the target data exists on the any sub-network node, generating the candidate validation results;
    所述方法还包括:第一区块链子网中的子网节点在所述目标验证结果中包含所述目标数据的情况下,确定所述目标数据存在于第二区块链子网。The method further includes: if the subnetwork node in the first blockchain subnetwork includes the target data in the target verification result, determining that the target data exists in the second blockchain subnetwork.
  8. 根据权利要求1所述的方法,所述数据验证交易包括所述目标数据;The method of claim 1, said data verification transaction comprising said target data;
    所述任一主网节点生成所述候选验证结果包括:所述任一主网节点将所述任一子网节点上的数据与所述目标数据进行比对,并生成包含比对结果的所述候选验证结果;The generation of the candidate verification result by any main network node includes: comparing the data on the any sub-network node with the target data by the any main network node, and generating all the verification results containing the comparison result. Describe candidate validation results;
    所述方法还包括:第一区块链子网中的子网节点在确定所述目标验证结果中包含的所述比对结果为比对一致的情况下,确定所述目标数据存在于第二区块链子网。The method further includes: when the subnetwork node in the first block chain subnetwork determines that the comparison result included in the target verification result is the same as the comparison result, determining that the target data exists in the second area Block chain subnet.
  9. 根据权利要求1所述的方法,还包括:The method according to claim 1, further comprising:
    所述区块链主网响应于用于创建新区块链子网的子网创建交易,以使所述区块链主 网中的主网节点在执行所述子网创建交易后获取并维护所述新区块链子网对应的数据验证条件,所述子网创建交易中包含所述新区块链子网对应的数据验证条件。The block chain main network responds to the subnet creation transaction for creating a new block chain subnet, so that the main network nodes in the block chain main network obtain and maintain the The data verification conditions corresponding to the new block chain subnet, the subnet creation transaction includes the data verification conditions corresponding to the new block chain subnet.
  10. 根据权利要求1所述的方法,还包括:The method according to claim 1, further comprising:
    所述区块链主网响应于用于更新所述第二区块链子网对应的数据验证条件的条件更改交易,以使所述区块链主网中的主网节点在执行所述条件更改交易后,将自身维护的所述数据验证条件更新为新数据验证条件,所述条件更改交易中包含第二区块链子网对应的所述新数据验证条件。The block chain main network responds to the condition change transaction for updating the data verification conditions corresponding to the second block chain subnet, so that the main network nodes in the block chain main network perform the condition change After the transaction, the data verification condition maintained by itself is updated to a new data verification condition, and the condition modification transaction includes the new data verification condition corresponding to the second blockchain subnet.
  11. 根据权利要求1所述的方法,所述数据验证交易包括调用所述区块链主网上部署的数据验证智能合约的交易;所述任一主网节点执行所述数据验证交易,包括:The method according to claim 1, wherein the data verification transaction includes a transaction calling a data verification smart contract deployed on the main network of the block chain; the execution of the data verification transaction by any of the main network nodes includes:
    调用所述数据验证智能合约,以生成所述候选验证结果并确定出所述目标验证结果。Invoking the data verification smart contract to generate the candidate verification result and determine the target verification result.
  12. 根据权利要求1所述的方法,所述数据验证交易包括调用所述区块链主网上部署的数据验证智能合约的交易;The method according to claim 1, wherein the data verification transaction comprises a transaction invoking a data verification smart contract deployed on the main network of the block chain;
    所述任一主网节点执行所述数据验证交易,包括:调用所述数据验证智能合约,以生成所述候选验证结果;The execution of the data verification transaction by any main network node includes: calling the data verification smart contract to generate the candidate verification result;
    所述任一主网节点从获取到的所有候选验证结果中确定一个满足所述数据验证条件的目标验证结果,包括:通过所述任一主网节点上部署的共识模块,确定出所述目标验证结果。The any main network node determines a target verification result that satisfies the data verification condition from all obtained candidate verification results, including: determining the target verification result through the consensus module deployed on any main network node Validation results.
  13. 根据权利要求11或12所述的方法,所述数据验证条件由所述数据验证智能合约所维护;和/或,所述数据验证条件由其他智能合约所维护。According to the method according to claim 11 or 12, the data verification conditions are maintained by the data verification smart contract; and/or, the data verification conditions are maintained by other smart contracts.
  14. 根据权利要求1所述的方法,所述目标数据包括下述之一:交易数据、状态数据、收据数据。The method according to claim 1, said target data comprises one of the following: transaction data, status data, receipt data.
  15. 一种区块链系统,包含区块链子网和区块链主网,其中,所述区块链子网中的子网节点所处的节点设备上部署有所述区块链主网中的主网节点,所述区块链子网至少包括第一区块链子网和第二区块链子网,所述区块链主网中的主网节点维护有第二区块链子网对应的数据验证条件;所述系统包括:A block chain system, including a block chain subnet and a block chain main network, wherein the node device where the subnet node in the block chain subnet is located is deployed with the main block chain in the block chain main network network node, the block chain subnet includes at least the first block chain subnet and the second block chain subnet, and the main network node in the block chain main network maintains the data verification conditions corresponding to the second block chain subnet ; the system includes:
    第一区块链子网,用于向区块链主网发起数据验证交易,所述数据验证交易用于对第二区块链子网上是否存在目标数据进行验证;The first block chain subnet is used to initiate a data verification transaction to the block chain main network, and the data verification transaction is used to verify whether the target data exists on the second block chain subnet;
    区块链主网,所述区块链主网中的任一主网节点执行所述数据验证交易,以在所述任一主网节点所处节点设备上部署有第二区块链子网中的任一子网节点的情况下生成候选验证结果,并将所述候选验证结果广播至所述区块链主网中的其他主网节点,其中,所述候选验证结果用于表明所述任一子网节点上是否存在所述目标数据;所述任一主网节点从获取到的所有候选验证结果中确定一个满足所述数据验证条件的目标验证结果,以由第一区块链子网根据所述目标验证结果确定所述目标数据是否存在于第二区块链子网。Block chain main network, any main network node in the block chain main network executes the data verification transaction, so that the second block chain subnet is deployed on the node device where the any main network node is located In the case of any sub-network node of the blockchain, a candidate verification result is generated, and the candidate verification result is broadcast to other main network nodes in the blockchain main network, wherein the candidate verification result is used to indicate that any Whether the target data exists on a sub-network node; said any main network node determines a target verification result that satisfies the data verification condition from all obtained candidate verification results, so that the first block chain sub-network The target verification result determines whether the target data exists in the second blockchain subnet.
  16. 一种验证区块链数据的方法,应用于区块链主网中的主网节点,在所述区块链主网与区块链子网构成的区块链系统中,所述区块链子网中的子网节点所处的节点设备上部署有所述区块链主网中的主网节点,所述区块链子网至少包括第一区块链子网和第二区块链子网,所述区块链主网中的主网节点维护有第二区块链子网对应的数据验证条件;所述方法包括:A method for verifying block chain data, applied to the main network nodes in the block chain main network, in the block chain system composed of the block chain main network and the block chain subnet, the block chain subnet The main network node in the block chain main network is deployed on the node device where the subnet node in the block chain is located, and the block chain subnet includes at least the first block chain subnet and the second block chain subnet, the The main network node in the blockchain main network maintains data verification conditions corresponding to the second blockchain subnet; the method includes:
    接收第一区块链子网向区块链主网发起的数据验证交易,所述数据验证交易用于对第二区块链子网上是否存在目标数据进行验证;Receive a data verification transaction initiated by the first block chain subnet to the block chain main network, and the data verification transaction is used to verify whether the target data exists on the second block chain subnet;
    执行所述数据验证交易,以在自身所处节点设备上部署有第二区块链子网中的任一子网节点的情况下生成候选验证结果,并将所述候选验证结果广播至所述区块链主网中的其他主网节点,其中,所述候选验证结果用于表明所述任一子网节点上是否存在所述目标数据;Execute the data verification transaction to generate a candidate verification result when any subnet node in the second blockchain subnet is deployed on the node device where it is located, and broadcast the candidate verification result to the zone Other main network nodes in the block chain main network, wherein the candidate verification result is used to indicate whether the target data exists on any of the subnet nodes;
    从获取到的所有候选验证结果中确定一个满足所述数据验证条件的目标验证结果,以由第一区块链子网根据所述目标验证结果确定所述目标数据是否存在于第二区块链子网。Determine a target verification result that satisfies the data verification condition from all obtained candidate verification results, so that the first blockchain subnet can determine whether the target data exists in the second blockchain subnet according to the target verification result .
  17. 根据权利要求16所述的方法,所述数据验证条件包括下述至少之一:The method according to claim 16, the data verification condition comprises at least one of the following:
    所述所有候选验证结果中内容相同的候选验证结果超过第一预设数量;Candidate verification results with the same content among all candidate verification results exceed a first preset number;
    所述所有候选验证结果中内容相同的候选验证结果来源于预设主网节点;The candidate verification results with the same content among all the candidate verification results come from the preset main network node;
    所述所有候选验证结果中内容相同且来源于第二区块链子网中子网节点的候选验证结果超过第二预设数量。Among all the candidate verification results, the candidate verification results with the same content and originating from subnetwork nodes in the second blockchain subnetwork exceed a second preset number.
  18. 根据权利要求16所述的方法,所述候选验证结果包括候选收据;所述方法还包括:The method of claim 16, the candidate verification result comprising a candidate receipt; the method further comprising:
    将所述目标验证结果设置为所述数据验证交易对应的交易收据。The target verification result is set as the transaction receipt corresponding to the data verification transaction.
  19. 根据权利要求18所述的方法,第一区块链子网通过以下途径获得所述交易收据:According to the method described in claim 18, the first blockchain subnet obtains the transaction receipt through the following means:
    第一区块链子网中的子网节点监听自身所处节点设备上部署的主网节点生成的所述交易收据。The subnetwork nodes in the first blockchain subnetwork monitor the transaction receipt generated by the mainnet node deployed on the node device where they are located.
  20. 根据权利要求16所述的方法,所述数据验证交易包括目标数据的数据描述信息以及第二区块链子网的网络标识;其中,The method according to claim 16, the data verification transaction includes the data description information of the target data and the network identification of the second blockchain subnet; wherein,
    所述网络标识用于指示所述主网节点:将自身所处节点设备上部署的对应于所述网络标识的子网节点确定为所述任一子网节点;The network identifier is used to indicate the main network node: determine the subnetwork node corresponding to the network identifier deployed on the node device where it is located as the any subnetwork node;
    所述数据描述信息用于指示所述主网节点:将所述任一子网节点上匹配于所述数据描述信息的数据确定为所述目标数据。The data description information is used to instruct the main network node to determine the data matching the data description information on any sub-network node as the target data.
  21. 根据权利要求16所述的方法,所述将所述候选验证结果广播至所述区块链主网中的其他主网节点,包括:The method according to claim 16, said broadcasting said candidate verification result to other main network nodes in said blockchain main network, comprising:
    将所述候选验证结果进行签名后广播至所述区块链主网中除所述任一主网节点以外的主网节点;Sign the candidate verification result and broadcast it to the main network nodes in the blockchain main network except any main network node;
    其中,所述所有候选验证结果包括:自身生成的候选验证结果以及从其他的主网节点接收到且验签成功的候选验证结果。Wherein, all the candidate verification results include: candidate verification results generated by itself and candidate verification results received from other main network nodes and successfully verified.
  22. 根据权利要求16所述的方法,所述生成所述候选验证结果包括:在确定所述任一子网节点上存在所述目标数据的情况下,生成包含所述目标数据的所述候选验证结果,以使第一区块链子网中的子网节点在所述目标验证结果中包含所述目标数据的情况下,确定所述目标数据存在于第二区块链子网。The method according to claim 16, said generating the candidate verification result comprises: generating the candidate verification result containing the target data when it is determined that the target data exists on the any subnetwork node , so that the subnetwork nodes in the first blockchain subnetwork determine that the target data exists in the second blockchain subnetwork when the target verification result contains the target data.
  23. 根据权利要求16所述的方法,所述数据验证交易包括所述目标数据;The method of claim 16, said data verification transaction comprising said target data;
    所述生成所述候选验证结果包括:将所述任一子网节点上的数据与所述目标数据进行比对,并生成包含比对结果的所述候选验证结果,以使第一区块链子网中的子网节点在确定所述目标验证结果中包含的所述比对结果为比对一致的情况下,确定所述目标数据存在于第二区块链子网。The generating the candidate verification result includes: comparing the data on the any subnetwork node with the target data, and generating the candidate verification result including the comparison result, so that the first block chain subnet The sub-network nodes in the network determine that the target data exists in the second block chain sub-network when it is determined that the comparison result included in the target verification result is a consistent comparison.
  24. 根据权利要求16所述的方法,还包括:The method of claim 16, further comprising:
    响应并执行用于创建新区块链子网的子网创建交易,获取并维护所述新区块链子网对应的数据验证条件,所述子网创建交易中包含所述新区块链子网对应的数据验证条件。Respond to and execute the subnet creation transaction used to create a new blockchain subnet, acquire and maintain the data verification conditions corresponding to the new blockchain subnet, and the subnet creation transaction includes the data verification conditions corresponding to the new blockchain subnet .
  25. 根据权利要求16所述的方法,还包括:The method of claim 16, further comprising:
    响应并执行用于更新所述第二区块链子网对应的数据验证条件的条件更改交易,将自身维护的所述数据验证条件更新为新数据验证条件,所述条件更改交易中包含第二区块链子网对应的所述新数据验证条件。Responding to and executing a condition change transaction for updating the data verification condition corresponding to the second blockchain subnet, updating the data verification condition maintained by itself to a new data verification condition, the condition change transaction includes the second zone The new data verification conditions corresponding to the block chain subnet.
  26. 根据权利要求16所述的方法,所述数据验证交易包括调用所述区块链主网上部署的数据验证智能合约的交易;所述执行所述数据验证交易,包括:The method according to claim 16, wherein the data verification transaction includes a transaction calling a data verification smart contract deployed on the main network of the block chain; the execution of the data verification transaction includes:
    调用所述数据验证智能合约,以生成所述候选验证结果并确定出所述目标验证结果。Invoking the data verification smart contract to generate the candidate verification result and determine the target verification result.
  27. 根据权利要求16所述的方法,所述数据验证交易包括调用所述区块链主网上部署的数据验证智能合约的交易;The method according to claim 16, wherein the data verification transaction comprises a transaction invoking a data verification smart contract deployed on the main network of the block chain;
    所述执行所述数据验证交易,包括:调用所述数据验证智能合约,以生成所述候选验证结果;The execution of the data verification transaction includes: calling the data verification smart contract to generate the candidate verification result;
    所述从获取到的所有候选验证结果中确定一个满足所述数据验证条件的目标验证结果,包括:通过本地部署的共识模块,确定出所述目标验证结果。The determining a target verification result satisfying the data verification condition from all obtained candidate verification results includes: determining the target verification result through a locally deployed consensus module.
  28. 根据权利要求26或27所述的方法,所述数据验证条件由所述数据验证智能合 约所维护;和/或,所述数据验证条件由其他智能合约所维护。The method according to claim 26 or 27, the data verification condition is maintained by the data verification smart contract; and/or, the data verification condition is maintained by other smart contracts.
  29. 根据权利要求16所述的方法,所述目标数据包括下述之一:交易数据、状态数据、收据数据。The method of claim 16, said target data comprising one of: transaction data, status data, receipt data.
  30. 一种验证区块链数据的装置,应用于区块链主网中的主网节点,在所述区块链主网与区块链子网构成的区块链系统中,所述区块链子网中的子网节点所处的节点设备上部署有所述区块链主网中的主网节点,所述区块链子网至少包括第一区块链子网和第二区块链子网,所述区块链主网中的主网节点维护有第二区块链子网对应的数据验证条件;所述装置包括:A device for verifying block chain data, applied to the main network nodes in the block chain main network, in the block chain system composed of the block chain main network and the block chain subnet, the block chain subnet The main network node in the block chain main network is deployed on the node device where the subnet node in the block chain is located, and the block chain subnet includes at least the first block chain subnet and the second block chain subnet, the The main network node in the blockchain main network maintains data verification conditions corresponding to the second blockchain subnet; the device includes:
    交易接收模块,用于接收第一区块链子网向区块链主网发起的数据验证交易,所述数据验证交易用于对第二区块链子网上是否存在目标数据进行验证;The transaction receiving module is used to receive the data verification transaction initiated by the first block chain subnet to the block chain main network, and the data verification transaction is used to verify whether the target data exists on the second block chain subnet;
    交易执行模块,用于执行所述数据验证交易,以在自身所处节点设备上部署有第二区块链子网中的任一子网节点的情况下生成候选验证结果,并将所述候选验证结果广播至所述区块链主网中的其他主网节点,其中,所述候选验证结果用于表明所述任一子网节点上是否存在所述目标数据;The transaction execution module is used to execute the data verification transaction, so as to generate a candidate verification result when any subnet node in the second blockchain subnet is deployed on the node device where it is located, and send the candidate verification result to The result is broadcast to other main network nodes in the blockchain main network, wherein the candidate verification result is used to indicate whether the target data exists on any subnet node;
    条件验证模块,用于从获取到的所有候选验证结果中确定一个满足所述数据验证条件的目标验证结果,以由第一区块链子网根据所述目标验证结果确定所述目标数据是否存在于第二区块链子网。A condition verification module, configured to determine a target verification result that satisfies the data verification condition from all obtained candidate verification results, so that the first block chain subnet can determine whether the target data exists in the Second blockchain subnet.
  31. 一种计算机可读存储介质,其上存储有计算机指令,该指令被处理器执行时实现如权利要求16-29中任一项所述方法的步骤。A computer-readable storage medium, on which computer instructions are stored, and when the instructions are executed by a processor, the steps of the method according to any one of claims 16-29 are implemented.
  32. 一种电子设备,包括:An electronic device comprising:
    处理器;processor;
    用于存储处理器可执行指令的存储器;memory for storing processor-executable instructions;
    其中,所述处理器通过运行所述可执行指令以实现如权利要求1-14或16-29中任一项所述的方法。Wherein, the processor implements the method according to any one of claims 1-14 or 16-29 by running the executable instructions.
PCT/CN2022/104372 2021-09-30 2022-07-07 Blockchain data verification WO2023050966A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202111160864.6 2021-09-30
CN202111160864.6A CN113886495A (en) 2021-09-30 2021-09-30 Method and device for verifying block chain data, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
WO2023050966A1 true WO2023050966A1 (en) 2023-04-06

Family

ID=79004661

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/104372 WO2023050966A1 (en) 2021-09-30 2022-07-07 Blockchain data verification

Country Status (2)

Country Link
CN (1) CN113886495A (en)
WO (1) WO2023050966A1 (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113886495A (en) * 2021-09-30 2022-01-04 支付宝(杭州)信息技术有限公司 Method and device for verifying block chain data, electronic equipment and storage medium
CN117349867B (en) * 2023-12-04 2024-02-09 成都峰潮信息技术有限公司 Intelligent contract deployment method, system, equipment and medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109040198A (en) * 2018-07-13 2018-12-18 瑞典爱立信有限公司 information generation and transmission system and method
CN112685505A (en) * 2021-01-07 2021-04-20 腾讯科技(深圳)有限公司 Transaction data processing method and device, computer equipment and storage medium
WO2021073755A1 (en) * 2019-10-18 2021-04-22 DFINITY Stiftung Messaging in distributed networks
CN113259460A (en) * 2021-06-02 2021-08-13 支付宝(杭州)信息技术有限公司 Cross-chain interaction method and device
CN113886495A (en) * 2021-09-30 2022-01-04 支付宝(杭州)信息技术有限公司 Method and device for verifying block chain data, electronic equipment and storage medium

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107301536B (en) * 2017-06-12 2019-07-12 腾讯科技(深圳)有限公司 Resource transfers method and device
WO2019165330A1 (en) * 2018-02-24 2019-08-29 Neji, Inc. System and methods for proof of network element
US11971896B2 (en) * 2019-08-15 2024-04-30 Telepathy Labs, Inc. System and method for querying multiple data sources
WO2021073756A1 (en) * 2019-10-18 2021-04-22 DFINITY Stiftung Read access for computational results of a distributed network
CN111539726B (en) * 2020-04-20 2024-03-19 中国工商银行股份有限公司 Block chain consensus system and method
CN113259456B (en) * 2021-06-02 2021-10-15 支付宝(杭州)信息技术有限公司 Cross-chain interaction method and device

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109040198A (en) * 2018-07-13 2018-12-18 瑞典爱立信有限公司 information generation and transmission system and method
WO2021073755A1 (en) * 2019-10-18 2021-04-22 DFINITY Stiftung Messaging in distributed networks
CN112685505A (en) * 2021-01-07 2021-04-20 腾讯科技(深圳)有限公司 Transaction data processing method and device, computer equipment and storage medium
CN113259460A (en) * 2021-06-02 2021-08-13 支付宝(杭州)信息技术有限公司 Cross-chain interaction method and device
CN113886495A (en) * 2021-09-30 2022-01-04 支付宝(杭州)信息技术有限公司 Method and device for verifying block chain data, electronic equipment and storage medium

Also Published As

Publication number Publication date
CN113886495A (en) 2022-01-04

Similar Documents

Publication Publication Date Title
WO2023050966A1 (en) Blockchain data verification
CN113259460B (en) Cross-chain interaction method and device
CN113067904B (en) Method for building block chain sub-network and block chain system
CN113259456B (en) Cross-chain interaction method and device
CN113067897B (en) Cross-chain interaction method and device
WO2023050986A1 (en) Maintenance of network architecture information of blockchain system
CN113259453B (en) Cross-chain interaction method and device
CN113067895B (en) Method for building block chain sub-network and block chain system
WO2023124746A1 (en) Cross-subnet interaction permission control
WO2024001022A1 (en) Cross-subnet calling
CN113259117B (en) Method for synchronizing node information lists
CN113259120B (en) Method for synchronizing node information lists
CN113259118B (en) Method for synchronizing node information lists
CN113259461B (en) Cross-chain interaction method and block chain system
CN113326290B (en) Cross-network query control method
CN113259454B (en) Cross-chain interaction method and device
CN113067896B (en) Method for adding node in block chain sub-network and block chain system
CN113259464B (en) Method for building block chain sub-network and block chain system
CN114374699A (en) Cross-chain interaction method and cross-chain interaction auditing method
WO2023207076A1 (en) Method and apparatus for establishing blockchain subnet
CN113259463B (en) Cross-chain interaction method and block chain system
CN113067838B (en) Cross-chain interaction method and device
CN113259237B (en) Transaction forwarding method between block chain networks
CN114363162A (en) Block chain log generation method and device, electronic equipment and storage medium
CN116743765A (en) Block chain system and cross-chain interaction method and device

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 22874363

Country of ref document: EP

Kind code of ref document: A1