WO2023207076A1 - 区块链子网的组建方法及装置 - Google Patents

区块链子网的组建方法及装置 Download PDF

Info

Publication number
WO2023207076A1
WO2023207076A1 PCT/CN2022/135222 CN2022135222W WO2023207076A1 WO 2023207076 A1 WO2023207076 A1 WO 2023207076A1 CN 2022135222 W CN2022135222 W CN 2022135222W WO 2023207076 A1 WO2023207076 A1 WO 2023207076A1
Authority
WO
WIPO (PCT)
Prior art keywords
blockchain
node
subnet
main network
configuration information
Prior art date
Application number
PCT/CN2022/135222
Other languages
English (en)
French (fr)
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 WO2023207076A1 publication Critical patent/WO2023207076A1/zh

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/104Peer-to-peer [P2P] networks
    • H04L67/1044Group management mechanisms 
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q40/00Finance; Insurance; Tax strategies; Processing of corporate or income taxes
    • G06Q40/04Trading; Exchange, e.g. stocks, commodities, derivatives or currency exchange
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/104Peer-to-peer [P2P] networks
    • H04L67/1059Inter-group management mechanisms, e.g. splitting, merging or interconnection of groups
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/32Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials
    • H04L9/3247Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials involving digital signatures

Definitions

  • the embodiments of this specification belong to the field of blockchain technology, and particularly relate to a method and device for establishing a blockchain subnet.
  • Blockchain technology is built on a transmission network (such as a peer-to-peer network).
  • Network nodes in the transmission network use chained data structures to verify and store data, and use distributed node consensus algorithms to generate and update data. All nodes in the same blockchain network are in a peer position and have completely consistent block data.
  • node members corresponding to some nodes in multiple blockchain networks sometimes need to implement small-scale transactions to prevent other node members from obtaining these transactions and related data.
  • one or more embodiments of this specification provide a method and device for establishing a blockchain subnet.
  • a method for establishing a blockchain subnet including: multiple main network nodes respectively obtain transactions for establishing a blockchain subnet, and the transaction includes the block chain subnet.
  • Configuration information of the blockchain subnet the configuration information includes the identity information of the node members participating in the establishment of the blockchain subnet, and the multiple main network nodes belong to at least two blockchain main networks; the multiple main network nodes
  • the network nodes respectively execute the transaction to reveal the configuration information; the node devices deployed with the main network nodes execute respectively: in the case where the configuration information includes the identity information of the node members corresponding to the main network nodes deployed by itself. , load the genesis block generated based on the configuration information to start the subnet nodes belonging to the blockchain subnet.
  • another method for establishing a blockchain subnet including: multiple node devices respectively obtain configuration information of the blockchain subnet, among the multiple node devices Deploying main network nodes belonging to at least two blockchain main networks, the configuration information includes identity information of node members participating in establishing the blockchain subnet; the multiple node devices respectively execute: when the configuration information includes itself In the case of identity information of node members corresponding to the deployed main network nodes, load the genesis block generated based on the configuration information to start the subnet nodes belonging to the blockchain subnet.
  • a device for building a blockchain subnet including: a transaction acquisition unit for multiple main network nodes to respectively acquire transactions for building a blockchain subnet, so
  • the transaction includes the configuration information of the blockchain subnet, the configuration information includes the identity information of the node members participating in the establishment of the blockchain subnet, and the multiple main network nodes belong to at least two blockchain main networks.
  • Transaction execution unit used for the plurality of main network nodes to execute the transaction respectively to reveal the configuration information
  • Node startup unit used for node equipment deployed with the main network node to respectively execute: in the configuration If the information includes the identity information of the node members corresponding to the main network nodes deployed by itself, load the genesis block generated based on the configuration information to start the subnet nodes belonging to the blockchain subnet.
  • another device for building a blockchain subnet including: an information acquisition unit for multiple node devices to respectively acquire the configuration information of the blockchain subnet, so The main network nodes deployed in the plurality of node devices belong to at least two blockchain main networks, and the configuration information includes the identity information of the node members participating in forming the blockchain subnet; a node startup unit is used for the multiple The node device performs respectively: when the configuration information includes the identity information of the node member corresponding to the main network node deployed by itself, load the genesis block generated based on the configuration information to start the subnet belonging to the blockchain subnet. network node.
  • an electronic device including: a processor; a memory for storing executable instructions by the processor; wherein the processor executes the executable instructions To implement the method described in any one of the first aspects.
  • a computer-readable storage medium on which computer instructions are stored.
  • the instructions are executed by a processor, the method as described in any one of the first aspects is implemented. A step of.
  • At least one mainnet node in each blockchain mainnet can jointly form a blockchain subnet with at least one mainnet node in other blockchain mainnets. , that is, building a cross-mainnet blockchain subnet based on the multiple blockchain mainnets. Since this blockchain subnet is independent of each of the above-mentioned blockchain mainnets, transactions and related data conducted in this subnet will not be obtained by other node members in the above-mentioned mainnets. It can be seen that based on the newly established blockchain subnet, it can meet the needs of small-scale transactions between various node members participating in the formation of the subnet.
  • Figure 1 is a schematic diagram of creating a smart contract provided by an exemplary embodiment.
  • Figure 2 is a schematic diagram of calling a smart contract provided by an exemplary embodiment.
  • Figure 3 is a schematic diagram of creating and calling a smart contract provided by an exemplary embodiment.
  • Figure 4 is a flow chart of a method for establishing a blockchain subnet provided by an exemplary embodiment.
  • Figure 5 is a schematic diagram of establishing a blockchain subnet based on multiple blockchain mainnets according to an exemplary embodiment.
  • Figure 6 is a flow chart of another method of establishing a blockchain subnet provided by an exemplary embodiment.
  • Figure 7 is a schematic structural diagram of a device provided by an exemplary embodiment.
  • Figure 8 is a block diagram of a device for building a blockchain subnet provided in an exemplary embodiment.
  • Figure 9 is a block diagram of another device for building a blockchain subnet provided by an exemplary embodiment.
  • the steps of the corresponding method are not necessarily performed in the order shown and described in this specification.
  • methods may include more or fewer steps than described in this specification.
  • a single step described in this specification may be broken down into multiple steps for description in other embodiments; and multiple steps described in this specification may also be combined into a single step in other embodiments. describe.
  • Blockchains are generally divided into three types: Public Blockchain, Private Blockchain and Consortium Blockchain.
  • the most decentralized one is the public chain. Participants who join the public chain can read data records on the chain, participate in transactions, and compete for the accounting rights of new blocks.
  • each participant i.e., node
  • the private chain has the writing permission of the network controlled by an organization or institution, and the data reading permission is regulated by the organization.
  • a private chain can be a weakly centralized system with strict restrictions and few participating nodes. This type of blockchain is more suitable for internal use within specific organizations.
  • the alliance chain is a blockchain between the public chain and the private chain, which can achieve "partial decentralization".
  • Each node in the alliance chain usually has a corresponding entity or organization; participants join the network through authorization and form a stakeholder alliance to jointly maintain the operation of the blockchain.
  • Smart contracts on the blockchain are contracts that can be triggered and executed by transactions on the blockchain system. Smart contracts can be defined in the form of code.
  • EVM Ethereum Virtual Machine
  • bytecode virtual machine code
  • the EVM of node 1 can execute the transaction and generate the corresponding contract instance.
  • "0x6f8ae93" in Figure 1 represents the address of this contract.
  • the data field of the transaction can store bytecode, and the to field of the transaction is empty (null).
  • the contract is successfully created and can be called in the subsequent process.
  • a contract account corresponding to the smart contract appears on the blockchain and has a specific address.
  • the contract code will be saved in the contract account.
  • the behavior of smart contracts is controlled by the contract code.
  • smart contracts enable virtual accounts containing contract code and account storage (Storage) to be generated on the blockchain.
  • the EVM of a certain node can execute the transaction and generate a corresponding contract instance.
  • the from field of the transaction in Figure 2 is the address of the account of the transaction initiator (i.e. Bob).
  • the "0x6f8ae93" in the to field represents the address of the called smart contract.
  • the value field can be a number in Ethereum.
  • the value of the asset and the data field of the transaction save the methods and parameters for calling the smart contract.
  • the value of balance may change.
  • a client can view the current value of balance through a certain blockchain node (such as node 6 in Figure 2).
  • Smart contracts are executed independently by each node in the blockchain network in a prescribed manner. All execution records and data are saved on the blockchain. Therefore, when the transaction is completed, the information is stored on the blockchain and cannot be tampered with. Lost transaction documents.
  • FIG. 3 The schematic diagram of creating a smart contract and calling a smart contract is shown in Figure 3.
  • To create a smart contract in Ethereum you need to go through the process of writing the smart contract, turning it into bytecode, and deploying it to the blockchain.
  • Calling a smart contract in Ethereum is to initiate a transaction pointing to the smart contract address.
  • the smart contract code is distributed and runs in the virtual machine of each node in the Ethereum network.
  • smart contracts can also be set by the system in the genesis block. This type of contract is generally called a creation contract. Generally, some data structures, parameters, attributes and methods of the blockchain network can be set in the genesis contract. In addition, accounts with system administrator rights can create system-level contracts or modify system-level contracts (referred to as system contracts). In addition, in addition to the EVM in Ethereum, different blockchain networks may also use various virtual machines, which are not limited here.
  • Contract execution results can be represented as events in receipts.
  • the message mechanism can realize message delivery through events in receipts to trigger blockchain nodes to perform corresponding processing.
  • the structure of the event can be, for example:
  • the number of events may be one or more; each event includes fields such as topic and data.
  • the blockchain node can listen to the topic of the event, and then perform preset processing when listening to the predefined topic, or read the relevant content from the data field of the corresponding event, and can execute the preset based on the read content. deal with.
  • One of the decentralized features of blockchain technology that distinguishes it from traditional technology is that accounting is performed on each node, or distributed accounting, instead of traditional centralized accounting.
  • accounting is performed on each node, or distributed accounting, instead of traditional centralized accounting.
  • the blockchain system In order for the blockchain system to become a decentralized, honest and trustworthy system that is hard to break, open, and cannot tamper with data records, it needs to make distributed data records secure, clear, and irreversible in the shortest possible time.
  • a consensus algorithm is usually used to ensure it, that is, the consensus mechanism mentioned above. After a node (such as a unique node) generates a block, if the generated block is recognized by other nodes, other nodes will record the same block.
  • the process by which the blocks generated above are recognized by other nodes is the consensus mechanism.
  • the consensus mechanism is a mechanism for blockchain nodes to reach a consensus across the entire network on block information (or block data), which can ensure that the latest blocks are accurately added to the blockchain.
  • the current mainstream consensus mechanisms include: Proof of Work (POW), Proof of Stake (POS), Delegated Proof of Stake (DPOS), Practical Byzantine Fault Tolerance (PBFT) ) algorithm, HoneyBadgerBFT algorithm, etc.
  • all blockchain nodes in the blockchain network maintain the same block data, which cannot meet the special needs of some nodes.
  • all alliance members i.e., node members within the alliance
  • All alliance members can form a blockchain network. All alliance members have corresponding blockchain nodes in the blockchain network and can pass through the corresponding zones. Blockchain nodes obtain all transactions and related data that occur on the blockchain network.
  • there may be some alliance members in different blockchain networks who want to complete some transactions with confidentiality requirements. These alliance members hope that these transactions can be stored on the blockchain or with the help of blockchain technology. Among other advantages, it can prevent other alliance members in its blockchain network from viewing these transactions and related data.
  • these alliance members can additionally form a new blockchain network, which is similar to the above-mentioned blockchain network containing all alliance members, building a new blockchain network from scratch requires a large amount of resources, and regardless of The establishment process of the blockchain network or the configuration process after it is built are very time-consuming.
  • the demands among alliance members are often temporary or time-sensitive, 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 among alliance members often change, and the alliance members corresponding to each demand are often different. Therefore, whenever alliance members change, a new blockchain network may need to be formed, resulting in a waste of resources and time. A lot of waste.
  • This manual can use multiple established blockchain networks as the blockchain main network, and build blockchain subnets based on multiple blockchain main networks. Then, in a consortium chain scenario such as the one mentioned above, consortium members can establish the required blockchain subnet based on their own needs based on the blockchain mainnet they participate in while already participating in the blockchain mainnet. Since the blockchain subnet is established on the basis of the blockchain main network, the construction process of the blockchain subnet consumes more resources and takes more time than establishing a completely independent blockchain network. are greatly reduced and the flexibility is extremely high. The following describes the construction plan of the blockchain subnet in this specification in conjunction with Figure 4.
  • Figure 4 is a flow chart of a method for establishing a blockchain subnet provided by an exemplary embodiment. As shown in Figure 4, this method is applied to blockchain nodes and may include the following steps 402 to 406.
  • Step 402 Multiple main network nodes obtain transactions for establishing a blockchain subnet respectively.
  • the transactions include configuration information of the blockchain subnet.
  • the configuration information includes the identities of node members participating in establishing the blockchain subnet.
  • Information, the multiple main network nodes belong to at least two blockchain main networks.
  • any main network node belongs to a corresponding blockchain main network, and each main network node described in the embodiment of this specification belongs to at least two blockchain main networks.
  • the n main network nodes participating in the establishment of the blockchain subnet in this solution belong to m blockchain main networks, where n ⁇ m ⁇ 2, and n and m are both positive integers.
  • FIG 5 there are three blockchain mainnets mainnet1, mainnet2 and mainnet3.
  • the mainnet nodes nodeA and nodeB in mainnet1, nodeH in mainnet2 and nodeM in mainnet3 are participating in the formation of the blockchain subnet subnet1.
  • the “at least two blockchain mainnets” mentioned in this plan are “multiple blockchain mainnets”, hereinafter referred to as multiple blockchain mainnets.
  • transactions to establish a blockchain subnet can be initiated by the administrator of the main network, that is, only administrators are allowed to establish blockchain subnets based on this main network and other main networks, and Avoid opening the permissions to create a blockchain subnet to ordinary users to prevent security issues caused by this.
  • ordinary users of the main network can also be allowed to initiate the above-mentioned transactions to form a blockchain subnet to meet the networking needs of ordinary users, so that ordinary users can still quickly initiate transactions even when it is inconvenient for administrators to initiate transactions.
  • Establish a blockchain subnet Establish a blockchain subnet.
  • the main network nodes included in the blockchain main network mainnet1 are nodeA, nodeB, nodeC, nodeD and nodeE, etc.
  • the main network nodes included in the blockchain main network mainnet2 are nodeF, nodeG, nodeH, nodeI. etc.
  • the main network nodes included in the blockchain mainnet mainnet3 are nodeJ, nodeK, nodeL, nodeM, etc.
  • nodeA is the administrator of mainnet1 and only allows the administrator to initiate transactions to form a blockchain subnet
  • nodeA can initiate the above establishment to mainnet1 Blockchain subnet transactions
  • nodeF is the administrator and only allows the administrator to initiate transactions to establish a blockchain subnet
  • nodeG ⁇ nodeI need to request nodeF so that nodeF initiates the above-mentioned transaction to establish a blockchain subnet to mainnet2
  • nodeJ is the administrator but allows ordinary users to initiate transactions to establish a blockchain subnet
  • nodeK ⁇ nodeM can initiate the above transactions to establish a blockchain subnet to mainnet3.
  • node members corresponding to the blockchain nodes that initiate the transaction to form the blockchain subnet do not necessarily participate in the formed blockchain subnet.
  • nodeE can initiate the above-mentioned transaction to form a blockchain subnet to mainnet1, and it does not necessarily have to be initiated by nodeA or nodeB to mainnet1, nodeH to mainnet2, and/or nodeM to mainnet3. Transactions on the blockchain subnet.
  • any blockchain mainnet in this manual can be the underlying blockchain network.
  • the underlying blockchain network is not a blockchain subnet established on the basis of other blockchain networks.
  • mainnet1 in Figure 5 can The blockchain mainnet is considered to be the underlying blockchain network type.
  • any blockchain main network can also be a subnet of other blockchain networks.
  • a next-level blockchain subnet (such as subnet1.1) can be further established based on subnet1 and other subnets in Figure 5.
  • subnet1 can be considered to be the blockchain main network corresponding to the blockchain subnet, and this does not affect that subnet1 also belongs to the blockchain subnets corresponding to mainnet1, mainnet2, and mainnet3. 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.
  • Each main network node in the multiple blockchain main networks can obtain the transaction respectively.
  • This description takes each main network node participating in the establishment of a blockchain subnet as an example.
  • the transaction obtained by the node can be processed by the administrator or ordinary user of any blockchain main network.
  • the administrator of each blockchain main network can decide in advance to form a blockchain subnet.
  • each administrator can initiate the transaction in the corresponding main network respectively, so that the main network can participate in the formation of the subnet.
  • the corresponding participants of each blockchain main network (such as the above-mentioned administrators or ordinary users) can initiate transactions to form a blockchain subnet in the corresponding main network.
  • the transaction obtained by the node can also be initiated by an administrator or an ordinary user of another blockchain main network in the other blockchain main network, and processed by the other blockchain main network.
  • the blockchain mainnet is synchronized to any of the blockchain mainnets.
  • the administrator as an example, the administrator of a certain main network among the multiple blockchain main networks can initiate the transaction in the main network, and the main network will synchronize the transaction to other main networks. , so that other main network nodes participating in the formation of blockchain subnets can obtain it.
  • the above-mentioned transactions can be synchronized between one of the above-mentioned main networks and other main networks through any cross-chain interaction technology, and this specification does not limit this.
  • this method only requires the participants corresponding to any blockchain mainnet to initiate transactions to form a blockchain subnet in the mainnet, and other blocks
  • the transaction can be obtained by the chain subnet and the mainnet nodes therein, without the above-mentioned participants or participants from other mainnets repeatedly initiating the transaction in other mainnets, thus helping to simplify the initiation process of the transaction.
  • the efficiency of building the blockchain subnet will be improved to a certain extent.
  • the main network node of the other blockchain main network can maintain the data of any blockchain main network.
  • the mainnet node of the other blockchain mainnet can synchronize the transaction to any blockchain mainnet in various ways.
  • the main network node can be any node in the other blockchain main network, or it can also be a specific node therein, such as the management node, central node or the transaction designated for the main network. A certain node, etc.
  • the transaction may include the main network identifier of the blockchain main network to which each main network node participating in forming the blockchain subnet belongs.
  • the main network node may use the main network identifier included in the transaction to The identifier determines which blockchain mainnet this transaction should be synced to.
  • the mainnet node nodeD in mainnet1 can send a request to mainnet2 if the transaction contains the mainnet identifier of mainnet2. Synchronize the transaction.
  • nodeD can determine the nodes in nodeF ⁇ nodeI that have network connections with itself, such as nodeI, based on the node list of mainnet2, and then can send the transaction to nodeI through the network connection, so that nodeI can synchronize the received transaction.
  • nodeF ⁇ nodeH nodes in mainnet2
  • nodeH nodes that need to participate in building the blockchain subnet
  • mainnet1 synchronizing the transaction to mainnet3 is similar to this and will not be described again. In this way, the other blockchain main network can quickly synchronize the transaction to the blockchain main network to which other main network nodes participating in forming the blockchain subnet belong based on the main network identification.
  • the transaction may also include the identity information (such as public keys, etc.) of each main network node participating in the establishment of the blockchain subnet.
  • the main network node can use the identity information contained in the transaction to The information determines which mainnet nodes this transaction should be synchronized to.
  • the mainnet node nodeD in mainnet1 can include the public key of the node nodeM in mainnet3 in the transaction.
  • synchronize the transaction to nodeM Specifically, nodeD can determine nodeM from nodeJ ⁇ nodeM according to the node list of mainnet3.
  • nodeD and nodeM have established a network connection
  • the transaction can be directly sent to nodeM; but when the network connection is not established, nodeD can directly send the transaction to nodeM.
  • the node among nodeJ ⁇ nodeL that has established a network connection with itself, such as nodeJ can be determined, and then the transaction can be sent to nodeJ through the network connection, so that nodeJ can send the received transaction to nodeM.
  • the other blockchain main network can directly synchronize the transaction to other main network nodes participating in the formation of the blockchain subnet based on the identity information of the main network node, further improving the efficiency of the transaction. Synchronization efficiency.
  • the main network node of another blockchain main network can obtain the node list of the main network node of any blockchain main network in one of the following ways.
  • the list can be obtained from any of the blockchain mainnets.
  • any blockchain main network described in this solution can be an independent blockchain network, or it can also be a subnet of other blockchain networks, that is, the blockchain network can have a parent blockchain network.
  • the main network node of the other blockchain main network can also be Get the node list from the parent blockchain network.
  • the main network node can obtain it in advance according to a fixed period or in response to the transaction, or it can update according to the change notification sent by any of the blockchain main networks after its own node changes, or It is updated according to the change notification sent by the parent blockchain network after determining the node change of any blockchain main network, which will not be described again.
  • the main network node of the other blockchain main network can automatically update the node list.
  • the administrator or ordinary user of another blockchain main network can also submit the list to the main network node after collecting the node list (such as through off-chain collection).
  • a list update transaction can be initiated in the main network, and the main network node executes the transaction to record the list.
  • the administrator or ordinary user of the other blockchain main network can manually maintain (such as record or update) the node list of each main network node in any blockchain main network for all Cross-chain interaction between another blockchain main network and any blockchain network, such as synchronizing the transaction.
  • Step 404 The multiple main network nodes execute the transaction respectively to reveal the configuration information.
  • Step 406 The node devices deployed with the main network nodes respectively execute: in the case where the configuration information includes the identity information of the node members corresponding to the main network nodes deployed by themselves, load the genesis block generated based on the configuration information. to launch subnet nodes belonging to said blockchain subnet.
  • the consensus nodes in the blockchain main network will conduct consensus, and after passing the consensus, the transactions will be executed by each blockchain node. Complete the establishment of the blockchain subnet.
  • the consensus process depends on the consensus mechanism used, such as any of the consensus mechanisms mentioned above, and this specification does not limit this.
  • the configuration information can be used to configure the formed blockchain subnet so that the formed blockchain subnet meets the networking requirements. For example, by including in the configuration information the identity information of the node members participating in forming the blockchain subnet, it is possible to specify which node members the formed blockchain subnet corresponds to.
  • the identity information of the node members may include public keys, or other information that can characterize the identities of the node members, such as node IDs. This specification does not limit this.
  • each main network node has one or more corresponding public and private key pairs.
  • the main network node holds the private key and the public key is made public and uniquely corresponds to the private key. Therefore, the public key can be used to To represent the identity of the corresponding main network node, the public key can also be used to represent the identity of the node member corresponding to the main network node.
  • the public keys of the corresponding blockchain nodes of these node members on the blockchain mainnet can be added to the above-mentioned transaction to form the blockchain subnet as the above-mentioned node members. identity information.
  • the main network node can execute the transaction to disclose the configuration information to the node device where it is located.
  • the configuration information can be disclosed through an event mechanism.
  • any one of the multiple blockchain mainnets includes at least one mainnet node that participates in forming a blockchain subnet.
  • the mainnet may also include subnets that do not participate in forming a subnet.
  • the main network nodes of the network that is, some main network nodes in the main network participate in forming subnets).
  • the main network nodes participating in forming subnets in the multiple blockchain main networks can be called network master nodes (i.e., the multiple main network nodes described in steps 402-406 Main network node), and the remaining main network nodes that do not participate in forming the subnet are called non-networking master nodes.
  • nodeA and nodeB in mainnet1, nodeH in mainnet2, and nodeM in mainnet3 are the network master nodes, while the other nodes in mainnet1 to mainnet3 are non-network master nodes.
  • the following is an explanation of the process of the network master node participating in the establishment of the blockchain main network.
  • the networking master node may be a blockchain node on the blockchain main network corresponding to the node member indicated by the configuration information.
  • the network master node does not directly join the blockchain subnet. Instead, the node device used to deploy the node generates the corresponding subnet node, and the subnet node joins the blockchain subnet. net.
  • the networking master node and the corresponding subnet node correspond to the same node member. For example, in the alliance chain scenario, they correspond to the same alliance chain member. However, the network master node belongs to the blockchain main network and the subnet node belongs to the blockchain main network.
  • the blockchain subnet allows the node members to participate in the transactions of the blockchain main network and the blockchain subnet respectively; and, since the blockchain main network and the blockchain subnet are two independent blockchain networks , so that the blocks generated by the networking master node and the blocks generated by the subnet nodes are stored in different storages on the node device (the storage used can be a database, for example), realizing the separation of the networking master node and the subnet node.
  • the storage used is isolated from each other, so the data generated by the blockchain subnet will only be synchronized between the various subnet nodes in the blockchain subnet, so that node members who only participate in the blockchain mainnet cannot obtain the zone.
  • the data generated on the blockchain subnet realizes the data isolation between the blockchain main network and the blockchain subnet, and meets the transaction needs between some node members (that is, node members participating in the blockchain subnet).
  • the networking master node and subnet nodes are logically divided blockchain nodes. From the perspective of physical equipment, it is equivalent to the above-mentioned node devices deploying the networking master node and subnet nodes participating in the blockchain master node at the same time. network and blockchain subnet. Since the blockchain main network and the blockchain subnet are independent of each other, the identity systems of the two blockchain networks are also independent of each other. Therefore, even if the network main node and the subnet node can use the exact same public key, they should still Think of the two as different blockchain nodes.
  • nodeA in mainnet1 is equivalent to the master node of the network, and the node device deploying nodeA generates nodeA1 belonging to subnet1, which is equivalent to the subnet node. It can be seen that since the identity systems are independent of each other, even if the public key used by the subnet node is different from the main node of the network, it will not affect the implementation of the solution in this manual.
  • the node members participating in the blockchain subnet are not necessarily only part of the node members participating in the blockchain mainnet.
  • the node members participating in the blockchain subnet can be completely consistent with the node members participating in the blockchain main network.
  • all node 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.
  • one type of business can be implemented on the blockchain main network and another type of business can be implemented on the blockchain subnet, so that the two types of Business data generated by businesses are isolated from each other.
  • all nodes in at least one blockchain mainnet can participate in forming the subnet1.
  • all nodes nodeA ⁇ nodeE in mainnet1 participate in forming subnet1.
  • the node members corresponding to nodeA1 ⁇ nodeE1 in subnet1 are exactly the same as the node members corresponding to nodeA ⁇ nodeE in mainnet1.
  • 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 identity information for the blockchain platform This manual does not limit the attribute configuration of the code.
  • the network identifier is used to uniquely characterize the blockchain subnet, so the network identifier of the blockchain subnet should be distinguished from the multiple blockchain mainnets and other blockchain subnets established on each blockchain mainnet.
  • the identity information of the administrator of the blockchain subnet for example, can be the public key of the node member who is the administrator; wherein, the administrator of the blockchain subnet can be the same as the administrator of at least one of the blockchain main networks. ; Alternatively, the administrator of the blockchain subnet may be different from the administrator of each blockchain main network.
  • One of the advantages of building a blockchain subnet through the blockchain main network is that since the network master node has been deployed on the node device that generates the subnet node, the blockchain platform code used by the network master node can be Reuse on subnet nodes eliminates the need for repeated deployment of blockchain platform code and greatly improves the efficiency of building blockchain subnets. Then, if the configuration information does not contain attribute configuration for the blockchain platform code, the subnet node can reuse the attribute configuration adopted on any group network master node. For example, the management node or master node of the blockchain subnet can be used.
  • Attribute configuration if the configuration information contains attribute configuration for the blockchain platform code, the subnet node can adopt this attribute configuration, so that the attribute configuration used by the subnet node is not limited to the attribute configuration of the network master node, and The network master node has nothing to do with it.
  • the attribute configuration of 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. This specification does not limit this.
  • Transactions that build a blockchain subnet can 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 contract called can be the aforementioned creation contract or system contract
  • the method called can be a method of establishing a blockchain subnet
  • the parameters passed in can include the above configuration information.
  • the transaction may include the following information:
  • the from field is the information of the initiator of the transaction.
  • Administrator indicates that the initiator is the administrator; the to field is the address of the called smart contract.
  • the smart contract can be a Subnet contract, then the to field is specifically the Subnet The address of the contract; the method field is the method called.
  • 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 the nodes nodeA ⁇ nodeE on mainnet1 as an example to execute a transaction that calls the AddSubnet() method in the Subnet contract. After the transaction passes the consensus, nodeA ⁇ nodeE execute the AddSubnet() method respectively and pass in the configuration information to obtain the corresponding execution results.
  • the execution result of the contract may include the configuration information.
  • the execution results of the contract may include the receipt mentioned above, which may include events related to the execution of the AddSubnet() method, that is, networking events.
  • the topic of the networking event can contain a predefined networking event identifier to distinguish it from other events. For example, in an 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, nodeA ⁇ nodeE or node devices 1 ⁇ 5 where nodeA ⁇ nodeE are deployed can listen to the topics contained in each event in the receipt generated. When the topic containing the keyword subnet is monitored, it can be determined that the listening and executing AddSubnet( ) method-related events, that is, networking events. For example, the events in the receipt are as follows:
  • the content of the data field may include:
  • nodeA's public key nodeA's IP, nodeA's port number...
  • nodeB s public key, nodeB’s IP, nodeB’s port number...;
  • nodeD s public key, nodeD’s IP, nodeD’s port number...;
  • subnet1 is the network identifier of the blockchain subnet you want to create.
  • Each blockchain node in the blockchain main network can record the network identifiers of all blockchain subnets that have been created on the blockchain main network, or other information related to these blockchain subnets. This information can, for example, be maintained in In the above-mentioned Subnet contract, it may specifically correspond to the value of one or more contract states contained in the Subnet contract. Then, you can determine whether the above-mentioned subnet1 already exists based on the recorded network identifiers of all created blockchain subnets: If the network identifier does not exist, it means that subnet1 is the new blockchain subnet that currently needs to be created. If the network identifier exists , indicating that subnet1 already exists.
  • the above data field also contains the identity information of each node member participating in the formation of the blockchain subnet.
  • the node device deployed with the main network node can obtain the configuration information through the message mechanism. For example, the main network node can monitor the generated receipt, and when the content of the monitored networking event records the identity information of its corresponding node member, trigger the node device where it is located to obtain the networking event. The genesis block or the configuration information contained. For another example, the node device deploying the networking master node can monitor the generated receipt, and obtain the network event when the content of the network event monitored indicates that the networking master node belongs to the node member. The genesis block or the configuration information included in the networking event.
  • node devices can listen directly for receipts. Assume that nodeA ⁇ nodeM are deployed on node devices 1 ⁇ 13 respectively. Node devices 1 ⁇ 13 can monitor the receipts generated by nodeA ⁇ nodeM respectively. Then when it is detected that subnet1 is a newly established blockchain subnet, node device 1 ⁇ M will further identify the identity information of the node members contained in the data field to determine its own processing method. Taking nodeA and node device 1 as an example: If node device 1 finds that the data field contains nodeA's public key, IP address, port number and other identity information, then node device 1 obtains the configuration information from the data field based on the above message mechanism.
  • the genesis block can be generated according to the configuration information, and the subnet node nodeA1 belonging to the blockchain subnet can be started by loading the genesis block; similarly, node device 2 can generate nodeB1, node device 8 can generate nodeH1, node Device 13 can spawn nodeM1. And, node device 3 will find that the identity information contained in the data field does not match itself, then the node device 3 will not generate a genesis block based on the configuration information in the data field, nor will it generate a blockchain node in subnet1.
  • the main network nodes in the blockchain main network can monitor receipts and trigger the node equipment to perform relevant processing based on the monitoring results. For example, when nodeA ⁇ nodeM determines that subnet1 is a newly established blockchain subnet, they will further identify the identity information of the node members contained in the data field to determine their own processing method. For example, nodeA, nodeB, nodeH and nodeM will find that the data field contains their own public key, IP address and port number and other identity information. Assume that nodeA, nodeB, nodeH and nodeM are deployed on node devices 1 to 2, node devices 8 and 8 respectively.
  • nodeA will trigger node device 1, so that node device 1 can generate a creation based on the configuration information when it obtains configuration information from the data field based on the above message mechanism. block, and start the subnet node nodeA1 belonging to the blockchain subnet by loading the genesis block; similarly, nodeB will trigger node device 2 to generate nodeB1, nodeH will trigger node device 8 to generate nodeC1, and nodeM will trigger node device 13 to generate nodeM1. Also, nodeC will find that the identity information contained in the data field does not match itself. Assuming that nodeC is deployed on node device 3, node device 3 will not generate a genesis block based on the configuration information in the data field, nor will it generate subnet1. Blockchain nodes in .
  • the data field may contain identity information generated in advance for nodeA1, nodeB1, nodeH1, and nodeM1, and is different from the identity information of nodeA, nodeB, nodeH, and nodeM.
  • node device 1 finds the identity information of nodeA1 in the data field, it can generate and load the genesis block to start nodeA1; or, if nodeA finds the identity information of nodeA1 in the data field, Then nodeA will trigger node device 1 to generate and load the genesis block to start nodeA1.
  • Other blockchain nodes or node devices are handled in a similar manner and will not be described here.
  • the execution results of the contract can also include the genesis block.
  • node device 8 and node device 13 can directly obtain the genesis block from the data field through the message mechanism without generating it themselves, which can improve the performance of nodeA1, nodeB1, nodeH1 and nodeM1. Deployment efficiency.
  • the transaction to establish a blockchain subnet may not be a transaction that calls a smart contract, so that a blockchain network that does not support smart contracts can also implement the technical solution of this specification, thereby based on multiple blockchain main networks Quickly create a blockchain subnet.
  • a set of network transaction type identifiers can be predefined. When a transaction contains this group of network transaction type identifiers, it indicates that the transaction is used to form a new blockchain subnet, that is, the transaction is a transaction that forms a blockchain subnet.
  • the blockchain platform code can include relevant processing logic for building a blockchain subnet, so that when the main network node running the blockchain platform code executes a transaction, if it is found that the transaction contains the above-mentioned network transaction type identifier , and the identity information of the node member corresponding to the main network node is included in the configuration information in the transaction, the node device deploying the main network node can be triggered based on the above processing logic to generate a genesis block containing the configuration information and pass Loading this genesis block starts subnet nodes belonging to the blockchain subnet.
  • the node device pulls up a process and creates an instance running the blockchain platform code in the process, which is equivalent to deploying a blockchain node on the node device.
  • the node device creates the first instance of running the blockchain platform code in the above process.
  • the node device creates a second instance running the blockchain platform code in the above process.
  • the first instance and the second instance are located in the same process, since no cross-process interaction is involved, the difficulty of deploying subnet nodes can be reduced and the deployment efficiency can be improved; of course, the second instance may also be located on separate node devices from the first instance. In different processes, this manual does not limit this.
  • a blockchain subnet can be created on the blockchain mainnet.
  • mainnet1 originally included nodeA ⁇ nodeE
  • mainnet2 originally included nodeF ⁇ nodeI
  • mainnet3 originally included nodeJ ⁇ nodeM.
  • subnet1 Based on mainnet1, mainnet2, and mainnet3, subnet1 can be formed.
  • This subnet1 includes nodeA1, nodeB1, nodeH1, and nodeM1, and nodeA and nodeA1, nodeB and nodeB1, nodeH and nodeH1, nodeM and nodeM1 are deployed on the same node device respectively.
  • subnet2 or more blockchain subnets can be established based on mainnet1 and mainnet2, where subnet2 includes nodeA2, nodeG2 and nodeH2, and nodeA and nodeA1, nodeA2, nodeH and nodeH1, nodeH2, nodeG and nodeG1 are respectively deployed in the same on the node device.
  • subnet1, subnet2, etc. can also be used as the new blockchain main network, and on this basis, the next-level blockchain subnet can be further established. The process is similar to the establishment of subnet1 or subnet2, and will not be repeated here.
  • At least one mainnet node in each blockchain mainnet can jointly form a blockchain subnet with at least one mainnet node in other blockchain mainnets. , that is, building a cross-mainnet blockchain subnet based on multiple blockchain mainnets. Since this blockchain subnet is independent of each of the above-mentioned blockchain mainnets, transactions and related data conducted in this subnet will not be obtained by other node members in the above-mentioned mainnets. It can be seen that based on the newly established blockchain subnet, it can meet the needs of small-scale transactions between various node members participating in the formation of the subnet.
  • FIG. 6 is a flow chart of another method for establishing a blockchain subnet provided by an exemplary embodiment. As shown in Figure 6, the method may include the following steps 602 and 604.
  • Step 602 Multiple node devices obtain configuration information of the blockchain subnet respectively.
  • the main network nodes deployed in the multiple node devices belong to at least two blockchain main networks.
  • the configuration information includes participating in the establishment of the blockchain subnet. Identity information of node members of the network.
  • Step 604 The multiple node devices respectively execute: in the case where the configuration information includes the identity information of the node members corresponding to the main network nodes deployed by themselves, load the genesis block generated based on the configuration information to start the node devices belonging to all nodes. Describe the subnet nodes of the blockchain subnet.
  • the main network nodes deployed in the plurality of node devices can respectively execute transactions to form a blockchain subnet, so that each node device can obtain the configuration information revealed by the corresponding main network node executing the transaction.
  • transaction initiation and execution methods there is no essential difference between the above-mentioned transaction initiation and execution methods and the foregoing solution.
  • the specific process please refer to the records of the foregoing embodiments, which will not be described again here.
  • the configuration information may also be sent by other devices to the node device where the main network node is deployed in an off-chain manner.
  • any node device among the plurality of node devices may receive the configuration information sent by other devices in an off-chain manner.
  • each participant of a blockchain subnet to be established can determine the configuration information of the subnet at the same time or obtain it separately after negotiating to determine the formation of the subnet, and then send the configuration information to the deployed device through other methods.
  • the corresponding node device of the main network node When other devices send the configuration information to any node device, they may send the message through a general network connection without being based on the blockchain main network or other blockchains in which the node device participates.
  • the node members corresponding to the main network nodes participating in the establishment of the blockchain subnet can also specify the configuration information to the node device.
  • the configuration information can be input through the human-computer interaction interface of the node device or include the configuration information.
  • Configuration file of configuration information so that the node device can obtain the configuration information accordingly.
  • the above configuration information can be collected by the node member itself or obtained through negotiation with other node members.
  • the above configuration file can be generated by the node member itself or obtained from other relevant parties, which will not be described again.
  • multiple node devices deployed with main network nodes can respectively obtain the configuration information of the blockchain subnet to be formed. Further, the node device can generate a genesis block based on the obtained configuration information.
  • the foregoing embodiments take obtaining the configuration information as an example to illustrate. In fact, the multiple node devices can also obtain the genesis block generated according to the configuration information in the above manner, such as the genesis block containing the configuration information, etc. .
  • each node device can load the genesis block to start the genesis block belonging to the node device after determining that the configuration information includes the identity information of the node member corresponding to the main network node deployed by itself.
  • the subnet node of the blockchain subnet For the generation and loading process of the genesis block, please refer to the records of the foregoing embodiments, and will not be described again here.
  • a cross-mainnet blockchain subnet can also be established based on multiple blockchain mainnets. Since this blockchain subnet is independent of each of the above-mentioned blockchain mainnets, transactions and related data conducted in this subnet will not be obtained by other node members in the above-mentioned mainnets. It can be seen that the blockchain subnet established through this solution can also meet the needs of small-scale transactions between various node members participating in the formation of the subnet.
  • Figure 7 is a schematic structural diagram of a device provided by an exemplary embodiment. Please refer to Figure 7.
  • the device includes a processor 702, an internal bus 704, a network interface 706, a memory 708, and a non-volatile memory 710.
  • the processor 702 reads the corresponding computer program from the non-volatile memory 710 into the memory 708 and then runs it.
  • the execution subject of the following processing flow is not limited to each A logic unit can also be a hardware or logic device.
  • FIG 8 is a block diagram of a device for building a blockchain subnet provided in this specification according to an exemplary embodiment.
  • This device can be applied to the equipment shown in Figure 7 to implement the instructions of this specification.
  • the device includes: a transaction acquisition unit 801, which is used by multiple main network nodes to obtain transactions for establishing a blockchain subnet respectively.
  • the transactions include configuration information of the blockchain subnet, and the configuration information includes participating in the establishment of the zone. Identity information of node members of the blockchain subnet.
  • the multiple main network nodes belong to at least two blockchain main networks; the transaction execution unit 802 is used for the multiple main network nodes to execute the transaction respectively to reveal The configuration information; the node startup unit 803 is used for the node devices deployed with the main network node to respectively execute: in the case where the configuration information includes the identity information of the node members corresponding to the main network nodes deployed by itself, load based on The genesis block generated by the configuration information is used to start the subnet nodes belonging to the blockchain subnet.
  • the transaction acquisition unit 801 is also used to: any main network node obtains the transaction initiated by the administrator or ordinary user of any blockchain main network in the blockchain main network; or , any main network node obtains the transaction initiated by the administrator or ordinary user of another blockchain main network in the other blockchain main network, and the transaction is initiated by the other blockchain main network Sync to any of the blockchain mainnets mentioned.
  • the main network node of another blockchain main network maintains a node list of the main network nodes of any blockchain main network
  • the transaction acquisition unit 801 is also used to: the other
  • the main network node of the blockchain main network sends the transaction to the main network of any blockchain according to the node list when the transaction contains the main network identifier of any blockchain main network.
  • the list sends the transaction to the mainnet node of any of the blockchain mainnets.
  • the transaction acquisition unit 801 is also used to: obtain the node list from any of the blockchain main networks; obtain all the transactions submitted by the administrator or ordinary users of the other blockchain main network.
  • the node list in the case where any of the blockchain main networks and the other blockchain main network are managed by a parent blockchain network, obtain the said node list from the parent blockchain network Node list.
  • the transaction of establishing a blockchain subnet includes a transaction of calling a smart contract.
  • the transaction execution unit 802 is also configured to: the execution result of the smart contract includes the genesis block, and the node device where the main network node is deployed obtains the genesis block through a message mechanism; or, The execution result of the smart contract includes the configuration information.
  • the node device where the main network node is deployed obtains the configuration information through a message mechanism, and generates the genesis block based on the obtained configuration information.
  • the receipt generated by executing the smart contract includes networking events related to the establishment of the blockchain subnet.
  • the transaction execution unit 802 is also configured to: the main network node monitors the generated receipt, and When the content of the monitored networking event records the identity information of its corresponding node member, trigger the node device where it is located to obtain the genesis block or the configuration information contained in the networking event; Alternatively, the node device deploying the main network node monitors the generated receipt, and when the content of the monitored networking event indicates that the main network node belongs to the node member, obtain the network event. The genesis block or the configuration information contained.
  • the networking event includes an event in which the subject name in the receipt contains a predefined networking identifier.
  • the content of the networking event includes the following identification, it indicates that the networking event is related to the establishment of the blockchain subnet: the network identification of the blockchain subnet that is desired to be established, and the network The identifier is different from the network identifier of the existing blockchain subnet; or, a predefined new network identifier, which indicates that the networking event is used to form a new blockchain subnet.
  • the transaction includes a networking transaction type identifier, and the networking transaction type identifier indicates that the transaction is used to establish a new blockchain subnet.
  • the configuration information also includes at least one of the following: the network identifier of the blockchain subnet, the identity information of the administrator of the blockchain subnet, and the attribute configuration for the blockchain platform code.
  • the blockchain subnet has the same administrator as at least one of the blockchain main networks; or, the blockchain subnet has different administrators from each of the blockchain main networks.
  • the node startup unit 803 is also configured to: the node device create a second instance that runs the platform code corresponding to the blockchain subnet, and trigger the second instance to load the genesis block.
  • any of the blockchain main networks is an underlying blockchain network, or a subnet managed by other blockchain networks.
  • FIG. 9 is a block diagram of another device for building a blockchain subnet provided in this specification according to an exemplary embodiment.
  • the device includes: an information acquisition unit 901, used for multiple node devices to respectively acquire the configuration information of the blockchain subnet.
  • the main network nodes deployed in the multiple node devices belong to at least two blockchain main networks.
  • the configuration information It includes the identity information of the node members participating in the establishment of the blockchain subnet; the node starting unit 902 is used for the multiple node devices to respectively execute: the configuration information includes the identity of the node member corresponding to the main network node deployed by itself. In the case of information, load the genesis block generated based on the configuration information to start the subnet nodes belonging to the blockchain subnet.
  • the information acquisition unit 901 is also used for one of the following: any node device receives the configuration information sent by other devices in an off-chain manner; any node device obtains the configuration information specified by a node member, The node member corresponds to the main network node deployed locally by any node device; any node device obtains the configuration information revealed by the locally deployed main network node by executing a transaction to establish a blockchain subnet.
  • a typical implementation device is a computer.
  • the computer may be, for example, a personal computer, a laptop computer, a cellular phone, a camera phone, a smartphone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or A combination of any of these devices.
  • embodiments of the present disclosure may be provided as methods, systems, or computer program products. Accordingly, the present disclosure may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment that combines software and hardware aspects. Furthermore, the present disclosure 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 specific tasks or implement specific abstract data types.
  • This specification may also be practiced in distributed computing environments where tasks are performed by remote processing devices connected through communications networks.
  • 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 that causes a computer or other programmable data processing apparatus to operate in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including the instruction means, the instructions
  • the device implements the functions specified in a process or processes of the flowchart and/or a block or 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, random access memory (RAM) and/or non-volatile memory in the form of read-only memory (ROM) or flash memory (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 includes both persistent and non-volatile, removable and non-removable media that can be implemented by any method or technology for storage of information.
  • Information may be computer-readable instructions, data structures, modules of programs, 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), and read-only memory.
  • PRAM phase change memory
  • SRAM static random access memory
  • DRAM dynamic random access memory
  • RAM random access memory
  • read-only memory read-only memory
  • ROM read-only memory
  • EEPROM electrically erasable programmable read-only memory
  • flash memory or other memory technology
  • compact disc read-only memory CD-ROM
  • DVD digital versatile disc
  • Magnetic tape cartridges magnetic disk storage, quantum memory, graphene-based storage media or other magnetic storage devices, or any other non-transmission medium, can be used to store information that can be accessed by computing devices.
  • computer-readable media does not include transitory media, such as modulated data signals and carrier waves.
  • first, second, third, etc. may use the terms first, second, third, etc. 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 each other.
  • first information may also be called second information, and similarly, the second information may also be called first information.
  • word “if” as used herein may be interpreted as "when” or “when” or “in response to determining.”

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Business, Economics & Management (AREA)
  • Finance (AREA)
  • Computer Security & Cryptography (AREA)
  • Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Accounting & Taxation (AREA)
  • Development Economics (AREA)
  • Mathematical Physics (AREA)
  • Economics (AREA)
  • Marketing (AREA)
  • Strategic Management (AREA)
  • Technology Law (AREA)
  • General Business, Economics & Management (AREA)
  • General Physics & Mathematics (AREA)
  • Computing Systems (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Financial Or Insurance-Related Operations Such As Payment And Settlement (AREA)

Abstract

本说明书一个或多个实施例提供一种区块链子网的组建方法和装置。该方法可以包括:区块链主网中的各区块链节点分别获取组建区块链子网的交易,所述交易包含所述区块链子网的配置信息,所述配置信息包括参与组建所述区块链子网的节点成员的身份信息;所述区块链主网中的各区块链节点分别执行所述交易;其中,当所述配置信息包含第一区块链节点对应的节点成员的身份信息时,部署第一区块链节点的节点设备基于所述交易生成包含所述配置信息的创世块并基于所述创世块启动属于所述区块链子网的第二区块链节点。

Description

区块链子网的组建方法及装置 技术领域
本说明书实施例属于区块链技术领域,尤其涉及一种区块链子网的组建方法及装置。
背景技术
区块链(Blockchain)技术构建在传输网络(例如点对点网络)之上。传输网络中的网络节点利用链式数据结构来验证与存储数据,并采用分布式节点共识算法来生成和更新数据。同一区块链网络中的所有节点处于对等地位,拥有完全一致的区块数据。但多个区块链网络中的一些节点所对应的节点成员有时存在实现小范围交易的需求,以避免其他节点成员获得这些交易及其相关数据。
发明内容
有鉴于此,本说明书一个或多个实施例提供一种区块链子网的组建方法和装置。
为实现上述目的,本说明书一个或多个实施例提供技术方案如下。
根据本说明书一个或多个实施例的第一方面,提出了一种区块链子网的组建方法,包括:多个主网节点分别获取组建区块链子网的交易,所述交易包含所述区块链子网的配置信息,所述配置信息包括参与组建所述区块链子网的节点成员的身份信息,所述多个主网节点归属于至少两个区块链主网;所述多个主网节点分别执行所述交易以透出所述配置信息;部署有所述主网节点的节点设备分别执行:在所述配置信息包括自身部署的主网节点所对应节点成员的身份信息的情况下,加载基于所述配置信息生成的创世块以启动属于所述区块链子网的子网节点。
根据本说明书一个或多个实施例的第二方面,提出了另一种区块链子网的组建方法,包括:多个节点设备分别获取区块链子网的配置信息,所述多个节点设备中部署主网节点属于至少两个区块链主网,所述配置信息包括参与组建所述区块链子网的节点成员的身份信息;所述多个节点设备分别执行:在所述配置信息包括自身部署的主网节点所对应节点成员的身份信息的情况下,加载基于所述配置信息生成的创世块以启动属于所述区块链子网的子网节点。
根据本说明书一个或多个实施例的第三方面,提出了一种区块链子网的组建装置,包括:交易获取单元,用于多个主网节点分别获取组建区块链子网的交易,所述交易包含所述区块链子网的配置信息,所述配置信息包括参与组建所述区块链子网的节点成员的身份信息,所述多个主网节点归属于至少两个区块链主网;交易执行单元,用于所述多个主网节点分别执行所述交易以透出所述配置信息;节点启动单元,用于部署有所述主网节点的节点设备分别执行:在所述配置信息包括自身部署的主网节点所对应节点成员的身份信息的情况下,加载基于所述配置信息生成的创世块以启动属于所述区块链子网的子网节点。
根据本说明书一个或多个实施例的第四方面,提出了另一种区块链子网的组建装置, 包括:信息获取单元,用于多个节点设备分别获取区块链子网的配置信息,所述多个节点设备中部署主网节点属于至少两个区块链主网,所述配置信息包括参与组建所述区块链子网的节点成员的身份信息;节点启动单元,用于所述多个节点设备分别执行:在所述配置信息包括自身部署的主网节点所对应节点成员的身份信息的情况下,加载基于所述配置信息生成的创世块以启动属于所述区块链子网的子网节点。
根据本说明书一个或多个实施例的第五方面,提出了一种电子设备,包括:处理器;用于存储处理器可执行指令的存储器;其中,所述处理器通过运行所述可执行指令以实现如第一方面中任一项所述的方法。
根据本说明书一个或多个实施例的第六方面,提出了一种计算机可读存储介质,其上存储有计算机指令,该指令被处理器执行时实现如第一方面中任一项所述方法的步骤。
通过上述实施例,对于多个区块链主网,每个区块链主网中的至少一个主网节点可以与其他区块链主网中的至少一个主网节点共同组建一区块链子网,即基于所述多个区块链主网组建跨主网的区块链子网。由于该区块链子网独立于上述各个区块链主网,在该子网中进行的交易及其相关数据并不会被上述主网中的其他节点成员所获得。可见,基于新组建的该区块链子网,可以满足参与组建该子网的各个节点成员之间的小范围交易的需求。
附图说明
为了更清楚地说明本说明书实施例的技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本说明书中记载的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。
图1是一示例性实施例提供的一种创建智能合约的示意图。
图2是一示例性实施例提供的一种调用智能合约的示意图。
图3是一示例性实施例提供的一种创建和调用智能合约的示意图。
图4是一示例性实施例提供的一种区块链子网的组建方法的流程图。
图5是一示例性实施例提供的一种基于多个区块链主网组建区块链子网的示意图。
图6是一示例性实施例提供的另一种区块链子网的组建方法的流程图。
图7是一示例性实施例提供的一种设备的结构示意图。
图8是一示例性实施例提供的一种区块链子网的组建装置的框图。
图9是一示例性实施例提供的另一种区块链子网的组建装置的框图。
具体实施方式
这里将详细地对示例性实施例进行说明,其示例表示在附图中。下面的描述涉及附图时,除非另有表示,不同附图中的相同数字表示相同或相似的要素。以下示例性实施 例中所描述的实施方式并不代表与本说明书一个或多个实施例相一致的所有实施方式。相反,它们仅是与如所附权利要求书中所详述的、本说明书一个或多个实施例的一些方面相一致的装置和方法的例子。
需要说明的是:在其他实施例中并不一定按照本说明书示出和描述的顺序来执行相应方法的步骤。在一些其他实施例中,其方法所包括的步骤可以比本说明书所描述的更多或更少。此外,本说明书中所描述的单个步骤,在其他实施例中可能被分解为多个步骤进行描述;而本说明书中所描述的多个步骤,在其他实施例中也可能被合并为单个步骤进行描述。
区块链一般被划分为三种类型:公有链(Public Blockchain),私有链(Private Blockchain)和联盟链(Consortium Blockchain)。此外,还有多种类型的结合,比如私有链+联盟链、联盟链+公有链等不同组合形式。其中去中心化程度最高的是公有链。加入公有链的参与者可以读取链上的数据记录、参与交易以及竞争新区块的记账权等。而且,各参与者(即节点)可自由加入以及退出网络,并进行相关操作。私有链则相反,该网络的写入权限由某个组织或者机构控制,数据读取权限受组织规定。简单来说,私有链可以为一个弱中心化***,参与节点具有严格限制且少。这种类型的区块链更适合于特定机构内部使用。联盟链则是介于公有链以及私有链之间的区块链,可实现“部分去中心化”。联盟链中各个节点通常有与之相对应的实体机构或者组织;参与者通过授权加入网络并组成利益相关联盟,共同维护区块链运行。
不论是公有链、私有链还是联盟链,都可能提供智能合约的功能。区块链上的智能合约是在区块链***上可以被交易触发执行的合约。智能合约可以通过代码的形式定义。
以以太坊为例,支持用户在以太坊网络中创建并调用一些复杂的逻辑。以太坊作为一个可编程区块链的核心是以太坊虚拟机(EVM),每个以太坊节点都可以运行EVM。EVM是一个图灵完备的虚拟机,这意味着可以通过它实现各种复杂的逻辑。用户在以太坊中发布和调用智能合约就是在EVM上运行的。实际上,虚拟机直接运行的是虚拟机代码(虚拟机字节码,下简称“字节码”)。部署在区块链上的智能合约可以是字节码的形式。
例如图1所示,Bob将一个包含创建智能合约信息的交易发送到以太坊网络后,节点1的EVM可以执行这个交易并生成对应的合约实例。图1中的“0x6f8ae93…”代表了这个合约的地址,交易的data字段保存的可以是字节码,交易的to(到)字段为空(null)。节点间通过共识机制达成一致后,这个合约成功创建,并且可以在后续过程中被调用。合约创建后,区块链上出现一个与该智能合约对应的合约账户,并拥有一个特定的地址,合约代码将保存在该合约账户中。智能合约的行为由合约代码控制。换句话说,智能合约使得区块链上产生包含合约代码和账户存储(Storage)的虚拟账户。
如图2所示,仍以以太坊为例,Bob将一个用于调用智能合约的交易发送到以太坊网络后,某一节点的EVM可以执行这个交易并生成对应的合约实例。图2中交易的from(来自)字段是交易发起方(即Bob)的账户的地址,to字段中的“0x6f8ae93…”代表了被调用的智能合约的地址,value字段在以太坊中可以是数字资产的数值,交易的data字段保存的调用智能合约的方法和参数。调用智能合约后,balance的值可能改变。后 续,某个客户端可以通过某一区块链节点(例如图2中的节点6)查看balance的当前值。智能合约以规定的方式在区块链网络中每个节点独立的执行,所有执行记录和数据都保存在区块链上,所以当交易完成后,区块链上就保存了无法篡改、不会丢失的交易凭证。
创建智能合约和调用智能合约的示意图如图3所示。以太坊中要创建一个智能合约,需要经过编写智能合约、变成字节码、部署到区块链等过程。以太坊中调用智能合约,是发起一笔指向智能合约地址的交易,智能合约代码分布式的运行在以太坊网络中每个节点的虚拟机中。
需要说明的是,除了可以由用户创建智能合约,也可以在创世块中由***设置智能合约。这类合约一般称为创世合约。一般的,创世合约中可以设置一些区块链网络的数据结构、参数、属性和方法。此外,具有***管理员权限的账户可以创建***级的合约,或者修改***级的合约(简称为***合约)。另外除了以太坊中的EVM外,不同的区块链网络还可能采用各种的虚拟机,这里并不限定。
区块链网络中的节点在执行调用智能合约的交易后,会生成相应的收据(receipt),以用于记录与执行该智能合约相关的信息。这样,可以通过查询交易的收据来获得合约执行结果的相关信息。合约执行结果可以表现为收据中的事件(event)。消息机制可以通过收据中的事件实现消息传递,以触发区块链节点执行相应的处理。事件的结构譬如可以为:
Event:
[topic][data]
[topic][data]
......
在上述示例中,事件的数量可以为一个或多个;其中,每个事件分别包括主题(topic)和数据(data)等字段。区块链节点可以通过监听事件的topic,从而在监听到预定义的topic的情况下,执行预设处理,或者从相应事件的data字段读取相关内容,以及可以基于读取的内容执行预设处理。
区块链技术区别于传统技术的去中心化特点之一,就是在各个节点上进行记账,或者称为分布式记账,而不是传统的集中式记账。区块链***要成为一个难以攻破的、公开的、不可篡改数据记录的去中心化诚实可信***,需要在尽可能短的时间内做到分布式数据记录的安全、明确及不可逆。不同类型的区块链网络中,为了在各个记录账本的节点中保持账本的一致,通常采用共识算法来保证,即前述提到的共识机制。在节点(例如某个独特的节点)产生一个区块后,如果产生的这个区块得到其它节点的认可,其它节点记录相同的区块。上述产生的区块得到其它节点的认可的过程,就是共识机制。共识机制是区块链节点就区块信息(或称区块数据)达成全网一致共识的机制,可以保证最新区块被准确添加至区块链。当前主流的共识机制包括:工作量证明(Proof of Work,POW)、股权证明(Proof of Stake,POS)、委任权益证明(Delegated Proof of Stake,DPOS)、实用拜占庭容错(Practical Byzantine Fault Tolerance,PBFT)算法, HoneyBadgerBFT算法等。
由于区块链网络的去中心化特性,使得区块链网络中的所有区块链节点均会维护相同的区块数据,无法满足部分节点的特殊需求。以联盟链为例,所有联盟成员(即联盟内的节点成员)可以组成一区块链网络,所有联盟成员在该区块链网络中分别存在对应的区块链节点,并可以通过对应的区块链节点获得该区块链网络上发生的所有交易和相关数据。但在一些情况下,可能存在不同区块链网络中的部分联盟成员希望完成一些具有保密需求的交易,这些联盟成员既希望这些交易能够在区块链上存证或借助于区块链技术的其他优势,又能够避免其所在区块链网络中的其他联盟成员查看到这些交易和相关数据。虽然这些联盟成员可以额外组建一新的区块链网络,其建立方式与上述包含所有联盟成员的区块链网络类似,但是从头开始建立一条新的区块链网络需要消耗大量的资源,且无论是该区块链网络的建立过程或是建成后的配置过程都非常耗时。联盟成员之间的需求往往是临时的或者具有一定的时效性,使得新建的区块链网络很快就会由于需求消失而失去存在的意义,从而进一步增加了上述区块链网络的建链成本。而联盟成员之间的需求经常会变化,且每一需求所对应的联盟成员也往往不同,因而每当联盟成员发生变化时就可能需要组建一新的区块链网络,从而造成资源和时间的大量浪费。
本说明书可以将已组建的多个区块链网络作为区块链主网,并基于多个区块链主网组建区块链子网。那么,在诸如上述的联盟链场景下,联盟成员可以在已经参与区块链主网的情况下,基于自身需求而基于自身所参与的区块链主网组建所需的区块链子网。由于区块链子网是在区块链主网的基础上所建立,使得区块链子网的组建过程相比于完全独立地组建一条区块链网络,所消耗的资源和所需的耗时等都极大地降低,灵活性极高。以下结合图4对本说明书的区块链子网的组建方案进行说明。
请参见图4,图4是一示例性实施例提供的一种区块链子网的组建方法的流程图。如图4所示,该方法应用于区块链节点,可以包括以下步骤402至步骤406。
步骤402,多个主网节点分别获取组建区块链子网的交易,所述交易包含所述区块链子网的配置信息,所述配置信息包括参与组建所述区块链子网的节点成员的身份信息,所述多个主网节点归属于至少两个区块链主网。
可以理解的是,任一主网节点归属于一个相应的区块链主网,而本说明书实施例所述的各个主网节点归属于至少两个区块链主网。可见,本方案中参与组建区块链子网的n个主网节点属于m个区块链主网,其中,n≥m≥2,所述n和m均为正整数。如图5所示,存在三个区块链主网mainnet1、mainnet2和mainnet3,其中,mainnet1中的主网节点nodeA和nodeB、mainnet2中的nodeH和mainnet3中的nodeM即为参与组建区块链子网subnet1的多个主网节点,此时n=4、m=3。可见,本方案所述的“至少两个区块链主网”,即为“多个区块链主网”,下称多个区块链主网。而且,任一区块链主网中存在至少一个主网节点参与组建所述区块链子网。
如前所述,对于任一区块链主网,组建区块链子网的交易可由该主网的管理员发起,即仅允许管理员基于该主网和其他主网组建区块链子网,而避免将区块链子网的组建权限开放给普通用户,以防止由此导致的安全性问题。在一些情况下,也可以允许该主网的普通用户发起上述组建区块链子网的交易,以满足普通用户的组网需求,使得普通用 户在管理员不便于发起交易的情况下依然能够快捷地组建区块链子网。
以图5所示为例,区块链主网mainnet1包含的主网节点为nodeA、nodeB、nodeC、nodeD和nodeE等,区块链主网mainnet2包含的主网节点为nodeF、nodeG、nodeH、nodeI等,区块链主网mainnet3包含的主网节点为nodeJ、nodeK、nodeL、nodeM等。假定nodeA、nodeB、nodeH和nodeM分别对应的节点成员希望组建一区块链子网:如果nodeA为mainnet1的管理员且仅允许管理员发起组建区块链子网的交易,那么可由nodeA向mainnet1发起上述组建区块链子网的交易;如果nodeF为管理员且仅允许管理员发起组建区块链子网的交易,那么nodeG~nodeI需要向nodeF进行请求,使得nodeF向mainnet2发起上述组建区块链子网的交易;如果nodeJ为管理员但允许普通用户发起组建区块链子网的交易,那么nodeK~nodeM均可以向mainnet3发起上述组建区块链子网的交易。当然,不论是管理员或者普通用户,发起组建区块链子网的交易的区块链节点对应的节点成员并不一定参与所组建的区块链子网,比如虽然最终由nodeA、nodeB、nodeH和nodeM分别对应的节点成员组建区块链子网,但可由nodeE向mainnet1发起上述组建区块链子网的交易,而并不一定由nodeA或nodeB向mainnet1、nodeH向mainnet2和/或nodeM向mainnet3发起该组建区块链子网的交易。
基于多个区块链主网组建区块链子网时,容易理解的是,会使得该区块链子网与所述多个区块链主网之间存在逻辑上的层次关系。比如在基于图5所示的mainnet1、mainnet2和mainnet3组建区块链子网subnet1时,可以认为mainnet1、mainnet2和mainnet3处于第一层、subnet1处于第二层。那么,本说明书中的任一区块链主网可以为底层区块链网络,底层区块链网络并非在其他区块链网络的基础上组建的区块链子网,比如图5中的mainnet1可以认为属于底层区块链网络类型的区块链主网。当然,任一区块链主网也可以为其他区块链网络的子网,比如可以在图5中subnet1及其他子网的基础上进一步组建下一级区块链子网(如subnet1.1),此时可以认为subnet1为该区块链子网对应的区块链主网,而这并不影响该subnet1同时属于mainnet1、mainnet2和mainnet3对应的区块链子网。可见,区块链主网与区块链子网实际上是相对概念,同一区块链网络在一些情况下可以为区块链主网、另一些情况下可以为区块链子网。
所述多个区块链主网中的各个主网节点可以分别获取所述交易,本说明书以参与组建区块链子网的各个主网节点为例进行说明。以任一区块链主网中的任一主网节点为例:在一实施例中,该节点获取到的所述交易可以由所述任一区块链主网的管理员或普通用户在该主网中发起。以管理员为例,各个区块链主网的管理员可以预先协商决定组建区块链子网,此后各个管理员可以分别在相应的主网中发起所述交易,以便该主网中参与组建区块链子网的主网节点获取。在该方式下,可以由各个区块链主网对应的参与方(如上述管理员或普通用户)分别在相应主网中发起组建区块链子网的交易。
在另一实施例中,该节点获取到的所述交易也可以由另一区块链主网的管理员或普通用户在所述另一区块链主网中发起,并由所述另一区块链主网同步至所述任一区块链主网。仍以管理员为例,所述多个区块链主网中的某一主网的管理员可以在该主网中发起所述交易,并由该主网将该交易同步至其他各个主网,以便其他各个主网中参与组建区块链子网的主网节点获取。其中,上述某一主网与其他主网之间可以通过任一跨链交互技术实现上述交易的同步,本说明书并不对此进行限制。基于所述多个区块链主网之 间的交易同步机制,该方式只需任一区块链主网对应的参与方在该主网中发起组建区块链子网的交易,其他各个区块链子网及其中的主网节点即可获取到该交易,而无需上述参与方或其他主网的参与方在其他主网中重复发起所述交易,从而有助于简化所述交易的发起流程,同时一定程度上提升区块链子网的组建效率。
对于任一区块链主网从另一区块链主网处同步所述交易的方案,所述另一区块链主网的主网节点可以维护有所述任一区块链主网的主网节点的节点列表,该列表用于记录所述任一区块链主网中各个主网节点的节点标识、身份信息、通信地址等节点信息。基于该列表,所述另一区块链主网的主网节点可以通过多种方式向所述任一区块链主网同步所述交易。其中,该主网节点可以为所述另一区块链主网中的任一节点,或者也可以为其中的特定节点,如可以为该主网的管理节点、中心节点或者所述交易指定的某一节点等。
在一实施例中,所述交易可以包含参与组建区块链子网的各个主网节点所属区块链主网的主网标识,此时,该主网节点可以根据所述交易中包含的主网标识确定应该将该交易同步至哪些区块链主网。以图5为例,假设mainnet1的管理员在该主网中发起组建区块链子网的交易,则mainnet1中的主网节点nodeD可以在该交易中包含mainnet2的主网标识的情况下,向mainnet2同步该交易。具体的,nodeD可以根据mainnet2的节点列表确定nodeF~nodeI中与自身建立有网络连接的节点,如nodeI,进而可以通过该网络连接向nodeI发送所述交易,以由nodeI将接收到的该交易同步至mainnet2中的其他节点(即nodeF~nodeH),或者仅同步至需要参与组建区块链子网的节点(即nodeH)。mainnet1向mainnet3同步所述交易的过程与此类似,不再赘述。通过该方式,所述另一区块链主网可以基于主网标识将所述交易快速同步至参与组建区块链子网的其他主网节点所属的区块链主网。
在另一实施例中,所述交易也可以包含参与组建区块链子网的各个主网节点的身份信息(如公钥等),此时,该主网节点可以根据所述交易中包含的身份信息确定应该将该交易同步至哪些主网节点。仍以图5为例,假设mainnet1的管理员在该主网中发起组建区块链子网的交易,则mainnet1中的主网节点nodeD可以在该交易中包含mainnet3中的节点nodeM的公钥的情况下,向nodeM同步该交易。具体的,nodeD可以根据mainnet3的节点列表从nodeJ~nodeM中确定nodeM,进而,在nodeD与nodeM建立有网络连接的情况下,可以直接将所述交易发送至nodeM;而在未建立该网络连接的情况下,可以确定nodeJ~nodeL中与自身建立有网络连接的节点,如nodeJ,进而可以通过该网络连接向nodeJ发送所述交易,以由nodeJ将接收到的该交易发送至nodeM。通过该方式,所述另一区块链主网可以基于主网节点的身份信息将所述交易针对性地直接同步至参与组建区块链子网的其他主网节点,进一步提升了所述交易的同步效率。
其中,另一区块链主网的主网节点可以通过下述之一的方式获取所述任一区块链主网的主网节点的节点列表。例如,可以从所述任一区块链主网处获取该列表。再例如,本方案所述的任一区块链主网可以为独立区块链网络,或者也可以为其他区块链网络的子网,即该区块链网络可以具有父级区块链网络。而在所述任一区块链主网与所述另一区块链主网由同一父级区块链网络所管理的情况下,所述另一区块链主网的主网节点也可以从该父级区块链网络处获取所述节点列表。对于上述两种获取方式,该主网节点可 以按照固定周期预先获取或者响应于所述交易获取,也可以根据所述任一区块链主网在自身节点变更后发送的变更通知进行更新,或者根据所述父级区块链网络在确定所述任一区块链主网的节点变更后发送的变更通知进行更新,不再赘述。通过上述方式,所述另一区块链主网的主网节点可以实现对所述节点列表的自动更新。再例如,所述另一区块链主网的管理员或普通用户也可以在采集(如通过链下方式采集)到所述节点列表的情况下,向所述主网节点提交该列表。例如可以在该主网中发起列表更新交易,以又所述主网节点执行该交易记录该列表。通过该方式,所述另一区块链主网的管理员或普通用户可以手动维护(如记录或更新)所述任一区块链主网中各个主网节点的节点列表,以便用于所述另一区块链主网与所述任一区块链网络之间的跨链交互,如同步所述交易。
步骤404,所述多个主网节点分别执行所述交易以透出所述配置信息。
步骤406,部署有所述主网节点的节点设备分别执行:在所述配置信息包括自身部署的主网节点所对应节点成员的身份信息的情况下,加载基于所述配置信息生成的创世块以启动属于所述区块链子网的子网节点。
上述组建区块链子网的交易在被发送至任一区块链主网后,由该区块链主网内的共识节点进行共识,并在通过共识后由各区块链节点执行该交易,以完成区块链子网的组建。共识过程取决于所采用的共识机制,譬如上文所述的任一共识机制,本说明书并不对此进行限制。
通过在上述组建区块链子网的交易中包含配置信息,该配置信息可以用于对所组建的区块链子网进行配置,使得组建的区块链子网符合组网需求。例如,通过在配置信息中包含参与组建所述区块链子网的节点成员的身份信息,可以指定组建的区块链子网对应于哪些节点成员。
节点成员的身份信息可以包括公钥,或者采用节点ID等其他能够表征节点成员的身份的信息,本说明书并不对此进行限制。以公钥为例,每个主网节点都存在对应的一组或多组公私钥对,由主网节点持有私钥而公钥被公开且唯一对应于该私钥,因而可以通过公钥来表征相应主网节点的身份,也可以通过该公钥来表征该主网节点对应的节点成员的身份。因此,对于希望加入区块链子网的节点成员,可以将这些节点成员在区块链主网上对应的区块链节点的公钥添加至上述组建区块链子网的交易中,以作为上述节点成员的身份信息。
在获取到组建区块链子网的交易的情况下,所述主网节点可以执行该交易以向自身所处的节点设备透出所述配置信息。其中,可以通过事件机制透出所述配置信息,具体透出方式可参见下文实施例,此处暂不赘述。
如前所述,对于所述多个区块链主网中的任一主网,其包含至少一个参与组建区块链子网的主网节点,当然,该主网中也可能包含不参与组建子网的主网节点(即该主网中的部分主网节点参与组建子网)。对此,为了区分上述两类主网节点,可以将所述多个区块链主网中参与组建子网的主网节点称为组网主节点(即步骤402-406中所述的多个主网节点),而不参与组建子网的其余主网节点称为非组网主节点。如图5所示,mainnet1中的nodeA和nodeB、mainnet2中的nodeH和mainnet3中的nodeM即为组网主节点,而mainnet1~mainnet3中的其他节点则为非组网主节点。下面针对组网主节点 参与组建区块链主网的过程进行说明。
组网主节点可以为区块链主网上由所述配置信息所指示的节点成员对应的区块链节点。在组建区块链子网时,并非由组网主节点直接加入区块链子网,而是需要由用于部署该节点的节点设备生成相应的子网节点,并由该子网节点加入区块链子网。所述组网主节点和相应的子网节点对应于同一个节点成员,比如在联盟链场景下对应于同一联盟链成员,但该组网主节点属于区块链主网、该子网节点属于区块链子网,使得该节点成员可以分别参与到区块链主网和区块链子网的交易中;并且,由于区块链主网和区块链子网属于相互独立的两个区块链网络,使得组网主节点生成的区块与子网节点生成的区块分别存入所述节点设备上的不同存储(采用的存储譬如可以为数据库),实现了组网主节点与子网节点分别使用的存储之间的相互隔离,因而区块链子网所产生的数据仅会在区块链子网中的各个子网节点之间同步,使得仅参与了区块链主网的节点成员无法获得区块链子网上产生的数据,实现了区块链主网与区块链子网之间的数据隔离,满足了部分节点成员(即参与区块链子网的节点成员)之间的交易需求。
组网主节点和子网节点是在逻辑上划分出来的区块链节点,而从物理设备的角度来说,相当于上述部署了组网主节点和子网节点的节点设备同时参与了区块链主网和区块链子网。由于区块链主网与区块链子网之间相互独立,使得这两个区块链网络的身份体系也相互独立,因而即便组网主节点和子网节点可以采用完全相同的公钥,仍然应当将两者视为不同的区块链节点。譬如在图5中,mainnet1中的nodeA相当于组网主节点,而部署该nodeA的节点设备生成了属于subnet1的nodeA1,该nodeA1即相当于子网节点。可见,由于身份体系相互独立,所以即便子网节点所采用的公钥区别于组网主节点,也不影响本说明书方案的实施。
当然,参与区块链子网的节点成员并不一定只是参与区块链主网的节点成员中的一部分。在一些情况下,参与区块链子网的节点成员可以与参与区块链主网的节点成员完全一致,此时所有的节点成员都可以获得区块链主网和区块链子网上的数据,但是区块链主网与区块链子网所产生的数据依然可以相互隔离,比如可以通过在区块链主网上实现一类业务、在区块链子网上实现另一类业务,从而可以使得这两类业务分别产生的业务数据之间相互隔离。例如,对于图5所示的多个区块链主网mainnet1、mainnet2和mainnet3,至少一个区块链主网中的全部节点均可以参与组建所述subnet1。以mainnet1中的全部节点nodeA~nodeE均参与组建subnet1为例,此时subnet1中的nodeA1~nodeE1所对应的节点成员即与mainnet1中的nodeA~nodeE所对应的节点成员完全一致。
除了上述的节点成员的身份信息之外,配置信息还可以包括下述至少之一:所述区块链子网的网络标识、所述区块链子网的管理员的身份信息、针对区块链平台代码的属性配置等,本说明书并不对此进行限制。网络标识用于唯一表征该区块链子网,因而该区块链子网的网络标识应当区别于所述多个区块链主网和各个区块链主网上组建的其他区块链子网。区块链子网的管理员的身份信息,譬如可以为作为管理员的节点成员的公钥;其中,所述区块链子网的管理员可以与至少一个所述区块链主网的管理员相同;或者,所述区块链子网的管理员也可以与各个区块链主网的管理员均不相同。
通过区块链主网来组建区块链子网的优势之一,就是由于生成子网节点的节点设备 上已经部署了组网主节点,因而可以将组网主节点所使用的区块链平台代码复用在子网节点上,免去了区块链平台代码的重复部署,极大地提高了区块链子网的组建效率。那么,如果配置信息中未包含针对区块链平台代码的属性配置,子网节点可以复用任一组网主节点上采用的属性配置,如可以采用区块链子网的管理节点或主节点的属性配置;如果配置信息中包含了针对区块链平台代码的属性配置,子网节点可以采用该属性配置,使得子网节点所采用的属性配置不受限于组网主节点的属性配置、与组网主节点无关。针对区块链平台代码的属性配置可以包括下述至少之一:代码版本号、是否需要共识、共识算法类型、区块大小等,本说明书并不对此进行限制。
组建区块链子网的交易可以包括调用合约的交易。该交易中可以指明被调用的智能合约的地址、调用的方法和传入的参数。例如,调用的合约可以为前述的创世合约或***合约,调用的方法可以为组建区块链子网的方法,传入的参数可以包括上述的配置信息。在一实施例中,该交易可以包含如下信息:
from:Administrator
to:Subnet
method:AddSubnet(string)
string:genesis
其中,from字段为该交易的发起方的信息,譬如Administrator表明该发起方为管理员;to字段为被调用的智能合约的地址,譬如该智能合约可以为Subnet合约,则to字段具体为该Subnet合约的地址;method字段为调用的方法,譬如在Subnet合约中用于组建区块链子网的方法可以为AddSubnet(string),而string为AddSubnet()方法中的参数,上述示例中通过genesis表征该参数的取值,该genesis具体为前述的配置信息。
以mainnet1上的节点nodeA~nodeE执行调用Subnet合约中AddSubnet()方法的交易为例。在交易通过共识后,nodeA~nodeE分别执行AddSubnet()方法并传入配置信息,得到相应的执行结果。
合约的执行结果可以包括所述配置信息。合约的执行结果可以包括前文所述的收据,该收据中可以包含与执行AddSubnet()方法相关的event,即组网事件。组网事件的topic可以包含预定义的组网事件标识,以区别于其他的事件。譬如在与执行AddSubnet()方法相关的event中,topic的内容为关键词subnet,且该关键词区别于其他方法所产生event中的topic。那么,nodeA~nodeE或者部署nodeA~nodeE的节点设备1~5通过监听生成的收据中各个event所含的topic,可以在监听到包含关键词subnet的topic的情况下,确定监听到与执行AddSubnet()方法相关的event,即组网事件。例如,收据中的event如下:
Event:
[topic:other][data]
[topic:subnet][data]
......
那么,在监听到第1条event时,由于所含topic的内容为other,确定该event与AddSubnet()方法无关;以及,在监听到第2条event时,由于所含topic的内容为subnet,确定该event与AddSubnet()方法相关,并进而读取该event对应的data字段,该data字段包含上述的配置信息。以配置信息包括区块链子网的节点成员的公钥为例,data字段的内容例如可以包括:
{subnet1;
nodeA的公钥,nodeA的IP、nodeA的端口号…;
nodeB的公钥,nodeB的IP、nodeB的端口号…;
nodeC的公钥,nodeC的IP、nodeC的端口号…;
nodeD的公钥,nodeD的IP、nodeD的端口号…;
}
其中,subnet1为希望创建的区块链子网的网络标识。区块链主网中的各个区块链节点可以记录该区块链主网上已创建的所有区块链子网的网络标识,或者与这些区块链子网相关的其他信息,这些信息譬如可以维护在上述的Subnet合约中,具体可以对应于该Subnet合约所含的一个或多个合约状态的取值。那么,可以根据记录的已创建的所有区块链子网的网络标识,确定上述的subnet1是否已经存在:如果该网络标识不存在,说明subnet1是当前需要创建的新区块链子网,如果该网络标识存在,则说明subnet1已经存在。
除了采用希望创建的新的区块链子网的网络标识之外,还可以采用预定义的新建网络标识,该新建网络标识表明相应的组网事件用于组建新的区块链子网。例如,可以将上述的subnet1替换为newsubnet,该newsubnet为预定义的新建网络标识,nodeA~nodeE在识别到data字段包含newsubnet时,即可确定包含该newsubnet的event为组网事件,需要创建新的区块链子网。
除了网络标识subnet1之外,上述data字段中还包含参与组建区块链子网的各个节点成员的身份信息等内容。部署有主网节点的节点设备可以通过消息机制获取所述配置信息。例如,主网节点可以监听生成的收据,并在监听到的所述组网事件的内容记录有自身所对应节点成员的身份信息的情况下,触发自身所处的节点设备获取所述组网事件包含的所述创世块或所述配置信息。再例如,部署所述组网主节点的节点设备可以监听生成的收据,并在监听到的所述组网事件的内容表明所述组网主节点属于所述节点成员的情况下,获取所述组网事件中包含的所述创世块或所述配置信息。
如前所述,节点设备可以直接监听收据。假定nodeA~nodeM分别部署在节点设备1~13上,节点设备1~13可以监听nodeA~nodeM分别生成的收据,那么在监听到subnet1是需要新组建的区块链子网的情况下,节点设备1~M会进一步识别data字段中包含的节点成员的身份信息,以确定自身的处理方式。以nodeA和节点设备1为例:如果节点设备1发现data字段包含nodeA的公钥、IP地址和端口号等身份信息,那么节点设备1在基于上述的消息机制从data字段获得配置信息的情况下,可以根据所述配置信息生成创世块,并通过加载创世块启动属于所述区块链子网的子网节点nodeA1;类似地,节 点设备2可以生成nodeB1、节点设备8可以生成nodeH1、节点设备13可以生成nodeM1。以及,节点设备3会发现data字段包含的身份信息与自身均不匹配,则该节点设备3不会根据data字段中的配置信息生成创世块,也不会生成subnet1中的区块链节点。
如前所述,区块链主网中的主网节点可以监听收据,并根据监听结果触发节点设备执行相关处理。例如,nodeA~nodeM在确定subnet1是需要新组建的区块链子网的情况下,会进一步识别data字段中包含的节点成员的身份信息,以确定自身的处理方式。比如,nodeA、nodeB、nodeH和nodeM会发现在data字段包含自身的公钥、IP地址和端口号等身份信息,假定nodeA、nodeB、nodeH和nodeM分别部署在节点设备1~2、节点设备8和节点设备13上,以nodeA和节点设备1为例:nodeA会触发节点设备1,使得节点设备1在基于上述的消息机制从data字段获得配置信息的情况下,可以根据所述配置信息生成创世块,并通过加载创世块启动属于所述区块链子网的子网节点nodeA1;类似地,nodeB会触发节点设备2生成nodeB1、nodeH会触发节点设备8生成nodeC1、nodeM会触发节点设备13生成nodeM1。以及,nodeC会发现data字段包含的身份信息与自身均不匹配,假定nodeC部署在节点设备3上,那么该节点设备3不会根据data字段中的配置信息生成创世块,也不会生成subnet1中的区块链节点。
如前所述,参与组建区块链子网的组网主节点与区块链子网中包含的子网节点并不一定采用相同的身份信息。因此,在上述实施例中,data字段中可以包含预先为nodeA1、nodeB1、nodeH1和nodeM1生成的身份信息,且区别于nodeA、nodeB、nodeH和nodeM的身份信息。仍以nodeA和节点设备1为例:节点设备1如果在data字段中发现了nodeA1的身份信息,可以生成并加载创世块启动nodeA1;或者,nodeA如果在data字段中发现了nodeA1的身份信息,那么nodeA会触发节点设备1生成并加载创世块启动nodeA1。其他区块链节点或节点设备的处理方式类似,此处不再一一赘述。
除了配置信息之外,合约的执行结果也可以包括创世块。换言之,除了可以在data字段中包含配置信息,还可以直接在执行合约调用的过程中生成包含配置信息的创世块,从而将创世块包含于data字段中,那么对于上述的nodeA、nodeB、nodeH和nodeM而言,相应的节点设备1~2、节点设备8和节点设备13可以通过消息机制直接从data字段获得创世块,而无需自行生成,可以提升对nodeA1、nodeB1、nodeH1和nodeM1的部署效率。
在本说明书中,组建区块链子网的交易也可以并非是调用智能合约的交易,使得不支持智能合约的区块链网络也可以实现本说明书的技术方案,从而基于多个区块链主网快捷地创建出区块链子网。例如,可以预先定义一组网交易类型标识,当交易包含该组网交易类型标识时,就表明该交易用于组建新的区块链子网,即该交易为组建区块链子网的交易。区块链平台代码可以包含相关的用于组建区块链子网的处理逻辑,使得运行该区块链平台代码的主网节点在执行交易时,如果发现该交易中包含上述的组网交易类型标识,且该主网节点对应的节点成员的身份信息被包含于该交易中的配置信息中,可以基于上述处理逻辑来触发部署该主网节点的节点设备生成包含该配置信息的创世块并通过加载该创世块启动属于区块链子网的子网节点。
节点设备通过拉起一进程,并在该进程中创建一个运行区块链平台代码的实例,相 当于在该节点设备上部署一区块链节点。对于任一组网主节点而言,由节点设备在上述进程中创建运行区块链平台代码的第一实例而形成。类似地,对于子网节点而言,由节点设备在上述进程中创建运行区块链平台代码的第二实例而形成。当第一实例与第二实例位于同一进程时,由于不涉及跨进程交互,可以降低对子网节点的部署难度、提高部署效率;当然,第二实例也可能与第一实例分别处于节点设备上的不同进程中,本说明书并不对此进行限制。
通过上述方式,可以在区块链主网上创建出区块链子网。以图5为例,mainnet1原本包含nodeA~nodeE、mainnet2原本包含nodeF~nodeI、mainnet3原本包含nodeJ~nodeM,基于mainnet1、mainnet2和mainnet3可以组建出subnet1,该subnet1包含nodeA1、nodeB1、nodeH1和nodeM1,且nodeA与nodeA1、nodeB与nodeB1、nodeH与nodeH1、nodeM与nodeM1分别部署在同一节点设备上。类似地,还可以基于mainnet1和mainnet2组建出subnet2或更多的区块链子网,其中subnet2包含nodeA2、nodeG2和nodeH2,且nodeA与nodeA1、nodeA2,nodeH与nodeH1、nodeH2,nodeG与nodeG1分别部署在同一节点设备上。以及,还可以将subnet1、subnet2等作为新的区块链主网,并在此基础上进一步组建出下一级区块链子网,其过程与subnet1或subnet2的组建相似,此处不再赘述。
通过上述实施例,对于多个区块链主网,每个区块链主网中的至少一个主网节点可以与其他区块链主网中的至少一个主网节点共同组建一区块链子网,即基于多个区块链主网组建跨主网的区块链子网。由于该区块链子网独立于上述各个区块链主网,在该子网中进行的交易及其相关数据并不会被上述主网中的其他节点成员所获得。可见,基于新组建的该区块链子网,可以满足参与组建该子网的各个节点成员之间的小范围交易的需求。
本说明书还提出另一种区块链子网的组建方法。请参见图6,图6是一示例性实施例提供的另一种区块链子网的组建方法的流程图。如图6所示,该方法可以包括以下步骤602和步骤604。
步骤602,多个节点设备分别获取区块链子网的配置信息,所述多个节点设备中部署主网节点属于至少两个区块链主网,所述配置信息包括参与组建所述区块链子网的节点成员的身份信息。
步骤604,所述多个节点设备分别执行:在所述配置信息包括自身部署的主网节点所对应节点成员的身份信息的情况下,加载基于所述配置信息生成的创世块以启动属于所述区块链子网的子网节点。
在该方案中,所述多个节点设备中部署的主网节点可以分别执行组建区块链子网的交易,从而各个节点设备可以获取相应主网节点执行该交易透出的所述配置信息。此时,上述交易的发起和执行方式与前述方案并不存在本质区别,具体过程可以参见前述实施例的记载,此处不再赘述。
或者,所述配置信息也可以由其他设备通过链下方式发送至部署有所述主网节点的节点设备。换言之,所述多个节点设备中的任一节点设备可以接收其他设备通过链下方式发送的所述配置信息。例如,待组建的区块链子网的各个参与方可以在协商确定组建该子网的情况下,可以同时确定或者分别获取该子网的配置信息,进而通过其他方式将 该配置信息发送至部署有主网节点的相应节点设备。其中,其他设备向任一节点设备发送所述配置信息时,可以不基于所述区块链主网或者该节点设备所参与的其他区块链,而以一般形式的网络连接发送该消息。
再或者,参与组建区块链子网的主网节点对应的节点成员也可以向所述节点设备指定所述配置信息,例如可以通过该节点设备的人机交互界面输入所述配置信息或包含所述配置信息的配置文件,以便节点设备据此获取所述配置信息。其中,上述配置信息可以由该节点成员自行采集或者通过与其他节点成员协商得到,上述配置文件可以由该节点成员自行生成或者从其他相关方处获取,不再赘述。
通过上述方式,部署有主网节点的多个节点设备可以分别获取待组建的区块链子网的配置信息,进一步的,节点设备可以基于获取到的配置信息生成的创世块。前述实施例以获取所述配置信息为例进行说明,实际上,所述多个节点设备也可以通过上述方式获取根据所述配置信息生成的创世块,如包含该配置信息的创世块等。
基于上述方式生成或获取到的创世块,各个节点设备可以在确定所述配置信息包括自身部署的主网节点所对应节点成员的身份信息的情况下,加载该创世块以启动属于所述区块链子网的子网节点。其中,所述创世块的生成及加载过程可以参见前述实施例的记载,此处不再赘述。
通过上述实施例,也可以基于多个区块链主网组建跨主网的区块链子网。由于该区块链子网独立于上述各个区块链主网,在该子网中进行的交易及其相关数据并不会被上述主网中的其他节点成员所获得。可见,基于通过该方案组建的区块链子网,也可以满足参与组建该子网的各个节点成员之间的小范围交易的需求。
图7是一示例性实施例提供的一种设备的示意结构图。请参考图7,在硬件层面,该设备包括处理器702、内部总线704、网络接口706、内存708以及非易失性存储器710,当然还可能包括其他业务所需要的硬件。本说明书一个或多个实施例可以基于软件方式来实现,比如由处理器702从非易失性存储器710中读取对应的计算机程序到内存708中然后运行。当然,除了软件实现方式之外,本说明书一个或多个实施例并不排除其他实现方式,比如逻辑器件抑或软硬件结合的方式等等,也就是说以下处理流程的执行主体并不限定于各个逻辑单元,也可以是硬件或逻辑器件。
如图8所示,图8是本说明书根据一示例性实施例提供的一种区块链子网的组建装置的框图,该装置可以应用于如图7所示的设备中,以实现本说明书的技术方案。该装置包括:交易获取单元801,用于多个主网节点分别获取组建区块链子网的交易,所述交易包含所述区块链子网的配置信息,所述配置信息包括参与组建所述区块链子网的节点成员的身份信息,所述多个主网节点归属于至少两个区块链主网;交易执行单元802,用于所述多个主网节点分别执行所述交易以透出所述配置信息;节点启动单元803,用于部署有所述主网节点的节点设备分别执行:在所述配置信息包括自身部署的主网节点所对应节点成员的身份信息的情况下,加载基于所述配置信息生成的创世块以启动属于所述区块链子网的子网节点。
可选的,所述交易获取单元801还用于:任一主网节点获取所述任一区块链主网的管理员或普通用户在该区块链主网中发起的所述交易;或者,任一主网节点获取另一区 块链主网的管理员或普通用户在所述另一区块链主网中发起的所述交易,所述交易由所述另一区块链主网同步至所述任一区块链主网。
可选的,所述另一区块链主网的主网节点维护有所述任一区块链主网的主网节点的节点列表,所述交易获取单元801还用于:所述另一区块链主网的主网节点在所述交易包含所述任一区块链主网的主网标识的情况下,根据所述节点列表将所述交易发送至所述任一区块链主网的主网节点;或者,所述另一区块链主网的主网节点在所述交易包含所述任一区块链主网的主网节点的身份信息的情况下,根据所述节点列表将所述交易发送至所述任一区块链主网的主网节点。
可选的,所述交易获取单元801还用于:从所述任一区块链主网处获取所述节点列表;获取所述另一区块链主网的管理员或普通用户提交的所述节点列表;在所述任一区块链主网与所述另一区块链主网由父级区块链网络所管理的情况下,从所述父级区块链网络处获取所述节点列表。
可选的,所述组建区块链子网的交易包括调用智能合约的交易。
可选的,所述交易执行单元802还用于:所述智能合约的执行结果包括所述创世块,部署有所述主网节点的节点设备通过消息机制获取所述创世块;或者,所述智能合约的执行结果包括所述配置信息,部署有所述主网节点的节点设备通过消息机制获取所述配置信息,并根据获取到的所述配置信息生成所述创世块。
可选的,执行所述智能合约生成的收据中包含与组建所述区块链子网相关的组网事件,所述交易执行单元802还用于:所述主网节点监听生成的收据,并在监听到的所述组网事件的内容记录有自身所对应节点成员的身份信息的情况下,触发自身所处的节点设备获取所述组网事件包含的所述创世块或所述配置信息;或者,部署所述主网节点的节点设备监听生成的收据,并在监听到的所述组网事件的内容表明所述主网节点属于所述节点成员的情况下,获取所述组网事件中包含的所述创世块或所述配置信息。
可选的,所述组网事件包括:所述收据中的主题名称包含预定义的组网标识的事件。
可选的,当所述组网事件的内容包含下述标识时,表明所述组网事件与组建所述区块链子网相关:希望组建的所述区块链子网的网络标识,且该网络标识区别于已有区块链子网的网络标识;或者,预定义的新建网络标识,所述新建网络标识表明所述组网事件用于组建新的区块链子网。
可选的,所述交易包含组网交易类型标识,所述组网交易类型标识表明所述交易用于组建新的区块链子网。
可选的,所述配置信息还包括下述至少之一:所述区块链子网的网络标识、所述区块链子网的管理员的身份信息、针对区块链平台代码的属性配置。
可选的,所述区块链子网与至少一个所述区块链主网的管理员相同;或者,所述区块链子网与各个所述区块链主网的管理员均不相同。
可选的,所述节点启动单元803还用于:所述节点设备创建运行所述区块链子网所对应平台代码的第二实例,并触发所述第二实例加载所述创世块。
可选的,任一所述区块链主网为底层区块链网络,或者为其他区块链网络所管理的子网。
可选的,任一所述区块链主网中存在至少一个主网节点参与组建所述区块链子网。
如图9所示,图9是本说明书根据一示例性实施例提供的另一种区块链子网的组建装置的框图,该装置可以应用于如图7所示的设备中,以实现本说明书的技术方案。该装置包括:信息获取单元901,用于多个节点设备分别获取区块链子网的配置信息,所述多个节点设备中部署主网节点属于至少两个区块链主网,所述配置信息包括参与组建所述区块链子网的节点成员的身份信息;节点启动单元902,用于所述多个节点设备分别执行:在所述配置信息包括自身部署的主网节点所对应节点成员的身份信息的情况下,加载基于所述配置信息生成的创世块以启动属于所述区块链子网的子网节点。
可选的,所述信息获取单元901还用于下述之一:任一节点设备接收其他设备通过链下方式发送的所述配置信息;任一节点设备获取节点成员指定的所述配置信息,该节点成员对应于所述任一节点设备本地部署的主网节点;任一节点设备获取本地部署的主网节点通过执行组建区块链子网的交易透出的所述配置信息。
上述实施例阐明的***、装置、模块或单元,具体可以由计算机芯片或实体实现,或者由具有某种功能的产品来实现。一种典型的实现设备为计算机。具体的,计算机例如可以为个人计算机、膝上型计算机、蜂窝电话、相机电话、智能电话、个人数字助理、媒体播放器、导航设备、电子邮件设备、游戏控制台、平板计算机、可穿戴设备或者这些设备中的任何设备的组合。
为了描述的方便,描述以上装置时以功能分为各种单元分别描述。当然,在实施本说明书时可以把各单元的功能在同一个或多个软件和/或硬件中实现。
本领域内的技术人员应明白,本公开的实施例可提供为方法、***、或计算机程序产品。因此,本公开可采用完全硬件实施例、完全软件实施例、或结合软件和硬件方面的实施例的形式。而且,本公开可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质(包括但不限于磁盘存储器、CD-ROM、光学存储器等)上实施的计算机程序产品的形式。
本公开是参照根据本公开实施例的方法、设备(***)、和计算机程序产品的流程图和/或方框图来描述的。应理解可由计算机程序指令实现流程图和/或方框图中的每一流程和/或方框、以及流程图和/或方框图中的流程和/或方框的结合。可提供这些计算机程序指令到通用计算机、专用计算机、嵌入式处理机或其他可编程数据处理设备的处理器以产生一个机器,使得通过计算机或其他可编程数据处理设备的处理器执行的指令产生用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的装置。
本说明书可以在由计算机执行的计算机可执行指令的一般上下文中描述,例如程序模块。一般地,程序模块包括执行特定任务或实现特定抽象数据类型的例程、程序、对象、组件、数据结构等等。也可以在分布式计算环境中实践本说明书,在这些分布式 计算环境中,由通过通信网络而被连接的远程处理设备来执行任务。在分布式计算环境中,程序模块可以位于包括存储设备在内的本地和远程计算机存储介质中。
这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令装置的制造品,该指令装置实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能。
这些计算机程序指令也可装载到计算机或其他可编程数据处理设备上,使得在计算机或其他可编程设备上执行一系列操作步骤以产生计算机实现的处理,从而在计算机或其他可编程设备上执行的指令提供用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的步骤。在一个典型的配置中,计算机包括一个或多个处理器(CPU)、输入/输出接口、网络接口和内存。
内存可能包括计算机可读介质中的非永久性存储器,随机存取存储器(RAM)和/或非易失性内存等形式,如只读存储器(ROM)或闪存(flash RAM)。内存是计算机可读介质的示例。
计算机可读介质包括永久性和非永久性、可移动和非可移动媒体可以由任何方法或技术来实现信息存储。信息可以是计算机可读指令、数据结构、程序的模块或其他数据。计算机的存储介质的例子包括,但不限于相变内存(PRAM)、静态随机存取存储器(SRAM)、动态随机存取存储器(DRAM)、其他类型的随机存取存储器(RAM)、只读存储器(ROM)、电可擦除可编程只读存储器(EEPROM)、快闪记忆体或其他内存技术、只读光盘只读存储器(CD-ROM)、数字多功能光盘(DVD)或其他光学存储、磁盒式磁带、磁盘存储、量子存储器、基于石墨烯的存储介质或其他磁性存储设备或任何其他非传输介质,可用于存储可以被计算设备访问的信息。按照本文中的界定,计算机可读介质不包括暂存电脑可读媒体(transitory media),如调制的数据信号和载波。
还需要说明的是,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、商品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、商品或者设备所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括所述要素的过程、方法、商品或者设备中还存在另外的相同要素。
上述对本说明书特定实施例进行了描述。其它实施例在所附权利要求书的范围内。在一些情况下,在权利要求书中记载的动作或步骤可以按照不同于实施例中的顺序来执行并且仍然可以实现期望的结果。另外,在附图中描绘的过程不一定要求示出的特定顺序或者连续顺序才能实现期望的结果。在某些实施方式中,多任务处理和并行处理也是可以的或者可能是有利的。
在本说明书一个或多个实施例使用的术语是仅仅出于描述特定实施例的目的,而非旨在限制本说明书一个或多个实施例。在本说明书一个或多个实施例和所附权利要求书中所使用的单数形式的“一种”、“所述”和“该”也旨在包括多数形式,除非上下文清楚地表示其他含义。还应当理解,本文中使用的术语“和/或”是指并包含一个或多个相关联的列出项目的任何或所有可能组合。
应当理解,尽管在本说明书一个或多个实施例可能采用术语第一、第二、第三等来描述各种信息,但这些信息不应限于这些术语。这些术语仅用来将同一类型的信息彼此区分开。例如,在不脱离本说明书一个或多个实施例范围的情况下,第一信息也可以被称为第二信息,类似地,第二信息也可以被称为第一信息。取决于语境,如在此所使用的词语“如果”可以被解释成为“在……时”或“当……时”或“响应于确定”。
以上所述仅为本说明书一个或多个实施例的较佳实施例而已,并不用以限制本说明书一个或多个实施例,凡在本说明书一个或多个实施例的精神和原则之内,所做的任何修改、等同替换、改进等,均应包含在本说明书一个或多个实施例保护的范围之内。

Claims (21)

  1. 一种组建区块链子网的方法,包括:
    多个主网节点分别获取组建区块链子网的交易,所述交易包含所述区块链子网的配置信息,所述配置信息包括参与组建所述区块链子网的节点成员的身份信息,所述多个主网节点归属于至少两个区块链主网;
    所述多个主网节点分别执行所述交易以透出所述配置信息;
    部署有所述主网节点的节点设备分别执行:在所述配置信息包括自身部署的主网节点所对应节点成员的身份信息的情况下,加载基于所述配置信息生成的创世块以启动属于所述区块链子网的子网节点。
  2. 根据权利要求1所述的方法,任一区块链主网中的任一主网节点获取所述交易,包括:
    任一主网节点获取所述任一区块链主网的管理员或普通用户在该区块链主网中发起的所述交易;或者,
    任一主网节点获取另一区块链主网的管理员或普通用户在所述另一区块链主网中发起的所述交易,所述交易由所述另一区块链主网同步至所述任一区块链主网。
  3. 根据权利要求2所述的方法,所述另一区块链主网的主网节点维护有所述任一区块链主网的主网节点的节点列表,所述另一区块链主网将所述交易同步至所述任一区块链主网,包括:
    所述另一区块链主网的主网节点在所述交易包含所述任一区块链主网的主网标识的情况下,根据所述节点列表将所述交易发送至所述任一区块链主网的主网节点;或者,
    所述另一区块链主网的主网节点在所述交易包含所述任一区块链主网的主网节点的身份信息的情况下,根据所述节点列表将所述交易发送至所述任一区块链主网的主网节点。
  4. 根据权利要求3所述的方法,所述另一区块链主网的主网节点通过下述之一的方式获取所述节点列表:
    从所述任一区块链主网处获取所述节点列表;
    获取所述另一区块链主网的管理员或普通用户提交的所述节点列表;
    在所述任一区块链主网与所述另一区块链主网由父级区块链网络所管理的情况下,从所述父级区块链网络处获取所述节点列表。
  5. 根据权利要求1所述的方法,所述组建区块链子网的交易包括调用智能合约的交易。
  6. 根据权利要求5所述的方法,
    所述智能合约的执行结果包括所述创世块,部署有所述主网节点的节点设备通过消息机制获取所述创世块;或者,
    所述智能合约的执行结果包括所述配置信息,部署有所述主网节点的节点设备通过消息机制获取所述配置信息,并根据获取到的所述配置信息生成所述创世块。
  7. 根据权利要求6所述的方法,执行所述智能合约生成的收据中包含与组建所述区块链子网相关的组网事件,部署有所述主网节点的节点设备通过消息机制获取所述创世块或所述配置信息,包括:
    所述主网节点监听生成的收据,并在监听到的所述组网事件的内容记录有自身所对 应节点成员的身份信息的情况下,触发自身所处的节点设备获取所述组网事件包含的所述创世块或所述配置信息;或者,
    部署所述主网节点的节点设备监听生成的收据,并在监听到的所述组网事件的内容表明所述主网节点属于所述节点成员的情况下,获取所述组网事件中包含的所述创世块或所述配置信息。
  8. 根据权利要求7所述的方法,所述组网事件包括:所述收据中的主题名称包含预定义的组网标识的事件。
  9. 根据权利要求7所述的方法,当所述组网事件的内容包含下述标识时,表明所述组网事件与组建所述区块链子网相关:
    希望组建的所述区块链子网的网络标识,且该网络标识区别于已有区块链子网的网络标识;或者,
    预定义的新建网络标识,所述新建网络标识表明所述组网事件用于组建新的区块链子网。
  10. 根据权利要求1所述的方法,所述交易包含组网交易类型标识,所述组网交易类型标识表明所述交易用于组建新的区块链子网。
  11. 根据权利要求1所述的方法,所述配置信息还包括下述至少之一:
    所述区块链子网的网络标识、所述区块链子网的管理员的身份信息、针对区块链平台代码的属性配置。
  12. 根据权利要求1所述的方法,所述区块链子网与至少一个所述区块链主网的管理员相同;或者,所述区块链子网与各个所述区块链主网的管理员均不相同。
  13. 根据权利要求1所述的方法,所述节点设备加载基于所述创世块,包括:
    所述节点设备创建运行所述区块链子网所对应平台代码的第二实例,并触发所述第二实例加载所述创世块。
  14. 根据权利要求1所述的方法,任一所述区块链主网为底层区块链网络,或者为其他区块链网络所管理的子网。
  15. 根据权利要求1所述的方法,任一所述区块链主网中存在至少一个主网节点参与组建所述区块链子网。
  16. 一种组建区块链子网的方法,包括:
    多个节点设备分别获取区块链子网的配置信息,所述多个节点设备中部署主网节点属于至少两个区块链主网,所述配置信息包括参与组建所述区块链子网的节点成员的身份信息;
    所述多个节点设备分别执行:在所述配置信息包括自身部署的主网节点所对应节点成员的身份信息的情况下,加载基于所述配置信息生成的创世块以启动属于所述区块链子网的子网节点。
  17. 根据权利要求16所述的方法,任一节点设备获取所述配置信息,包括下述之一:
    任一节点设备接收其他设备通过链下方式发送的所述配置信息;
    任一节点设备获取节点成员指定的所述配置信息,该节点成员对应于所述任一节点设备本地部署的主网节点;
    任一节点设备获取本地部署的主网节点通过执行组建区块链子网的交易透出的所 述配置信息。
  18. 一种组建区块链子网的装置,包括:
    交易获取单元,用于多个主网节点分别获取组建区块链子网的交易,所述交易包含所述区块链子网的配置信息,所述配置信息包括参与组建所述区块链子网的节点成员的身份信息,所述多个主网节点归属于至少两个区块链主网;
    交易执行单元,用于所述多个主网节点分别执行所述交易以透出所述配置信息;
    节点启动单元,用于部署有所述主网节点的节点设备分别执行:在所述配置信息包括自身部署的主网节点所对应节点成员的身份信息的情况下,加载基于所述配置信息生成的创世块以启动属于所述区块链子网的子网节点。
  19. 一种组建区块链子网的装置,包括:
    信息获取单元,用于多个节点设备分别获取区块链子网的配置信息,所述多个节点设备中部署主网节点属于至少两个区块链主网,所述配置信息包括参与组建所述区块链子网的节点成员的身份信息;
    节点启动单元,用于所述多个节点设备分别执行:在所述配置信息包括自身部署的主网节点所对应节点成员的身份信息的情况下,加载基于所述配置信息生成的创世块以启动属于所述区块链子网的子网节点。
  20. 一种电子设备,包括:
    处理器;
    用于存储处理器可执行指令的存储器;
    其中,所述处理器通过运行所述可执行指令以实现如权利要求1-17中任一项所述的方法。
  21. 一种计算机可读存储介质,其上存储有计算机指令,该指令被处理器执行时实现如权利要求1-17中任一项所述方法的步骤。
PCT/CN2022/135222 2022-04-29 2022-11-30 区块链子网的组建方法及装置 WO2023207076A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202210473060.X 2022-04-29
CN202210473060.XA CN115086338A (zh) 2022-04-29 2022-04-29 区块链子网的组建方法及装置

Publications (1)

Publication Number Publication Date
WO2023207076A1 true WO2023207076A1 (zh) 2023-11-02

Family

ID=83247429

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/135222 WO2023207076A1 (zh) 2022-04-29 2022-11-30 区块链子网的组建方法及装置

Country Status (2)

Country Link
CN (1) CN115086338A (zh)
WO (1) WO2023207076A1 (zh)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115086338A (zh) * 2022-04-29 2022-09-20 蚂蚁区块链科技(上海)有限公司 区块链子网的组建方法及装置

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110933173A (zh) * 2019-12-03 2020-03-27 上海墨珩网络科技有限公司 一种基于区块链技术的组网方法和装置
CN112163950A (zh) * 2020-09-25 2021-01-01 湖南和信安华区块链科技有限公司 一种方便扩展、节点资源复用的区块链链网构建方法、***及终端设备
US20210083872A1 (en) * 2018-05-15 2021-03-18 Kelvin Zero Inc. Systems, methods, and devices for secure blockchain transaction and subnetworks
CN113259118A (zh) * 2021-06-02 2021-08-13 支付宝(杭州)信息技术有限公司 同步节点信息列表的方法
CN113259120A (zh) * 2021-06-02 2021-08-13 支付宝(杭州)信息技术有限公司 同步节点信息列表的方法
CN113259117A (zh) * 2021-06-02 2021-08-13 支付宝(杭州)信息技术有限公司 同步节点信息列表的方法
CN113269546A (zh) * 2021-07-19 2021-08-17 域世安(北京)科技有限公司 一种基于区块链的用户身份证照***及方法
CN114363335A (zh) * 2021-12-31 2022-04-15 支付宝(杭州)信息技术有限公司 跨链交互方法及装置
CN115086338A (zh) * 2022-04-29 2022-09-20 蚂蚁区块链科技(上海)有限公司 区块链子网的组建方法及装置

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
DE102016224537B4 (de) * 2016-12-08 2018-06-21 Bundesdruckerei Gmbh Masterblockchain
CN111010394B (zh) * 2019-08-15 2021-06-08 腾讯科技(深圳)有限公司 区块链多链管理方法和装置
CN113923232B (zh) * 2021-06-02 2024-03-19 支付宝(杭州)信息技术有限公司 区块链子网的信息同步方法及装置
CN113067904B (zh) * 2021-06-02 2021-09-14 支付宝(杭州)信息技术有限公司 组建区块链子网的方法和区块链***
CN113067838B (zh) * 2021-06-02 2021-09-24 支付宝(杭州)信息技术有限公司 跨链交互方法及装置

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20210083872A1 (en) * 2018-05-15 2021-03-18 Kelvin Zero Inc. Systems, methods, and devices for secure blockchain transaction and subnetworks
CN110933173A (zh) * 2019-12-03 2020-03-27 上海墨珩网络科技有限公司 一种基于区块链技术的组网方法和装置
CN112163950A (zh) * 2020-09-25 2021-01-01 湖南和信安华区块链科技有限公司 一种方便扩展、节点资源复用的区块链链网构建方法、***及终端设备
CN113259118A (zh) * 2021-06-02 2021-08-13 支付宝(杭州)信息技术有限公司 同步节点信息列表的方法
CN113259120A (zh) * 2021-06-02 2021-08-13 支付宝(杭州)信息技术有限公司 同步节点信息列表的方法
CN113259117A (zh) * 2021-06-02 2021-08-13 支付宝(杭州)信息技术有限公司 同步节点信息列表的方法
CN113269546A (zh) * 2021-07-19 2021-08-17 域世安(北京)科技有限公司 一种基于区块链的用户身份证照***及方法
CN114363335A (zh) * 2021-12-31 2022-04-15 支付宝(杭州)信息技术有限公司 跨链交互方法及装置
CN115086338A (zh) * 2022-04-29 2022-09-20 蚂蚁区块链科技(上海)有限公司 区块链子网的组建方法及装置

Also Published As

Publication number Publication date
CN115086338A (zh) 2022-09-20

Similar Documents

Publication Publication Date Title
CN113067904B (zh) 组建区块链子网的方法和区块链***
CN113067894B (zh) 节点退出区块链子网的方法
CN113067895B (zh) 组建区块链子网的方法和区块链***
CN113098983B (zh) 基于智能合约的任务执行方法及装置
CN113055190B (zh) 针对客户端的访问控制方法
CN113067897B (zh) 跨链交互方法及装置
CN113067901B (zh) 区块链子网的创建方法
WO2022252996A1 (zh) 为业务流程合约调度计算服务的方法
CN113067896B (zh) 区块链子网中加入节点的方法和区块链***
WO2023207076A1 (zh) 区块链子网的组建方法及装置
CN113259120B (zh) 同步节点信息列表的方法
CN113259117B (zh) 同步节点信息列表的方法
CN113259118B (zh) 同步节点信息列表的方法
CN113259464B (zh) 组建区块链子网的方法和区块链***
CN113326290B (zh) 跨网查询控制方法
CN114363162A (zh) 区块链日志的生成方法及装置、电子设备、存储介质
CN113259458A (zh) 一种启动/关闭区块链节点服务的方法和装置
WO2023185043A1 (zh) 一种可调用资源的分配方法和装置
WO2022252993A1 (zh) 基于链外计算服务的业务执行方法
CN113259459B (zh) 区块链子网运行状态的控制方法和区块链***
CN113259119B (zh) 区块链消息的分发方法及装置
CN113259237A (zh) 区块链网络间的交易转发方法
CN113923227A (zh) 区块链消息的分发方法及装置
CN114363349B (zh) 区块链子网的启动方法及装置
CN113098984B (zh) 基于注册机制形成多层区块链***的方法和区块链***

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: 22939890

Country of ref document: EP

Kind code of ref document: A1