CN113067914B - Method and device for distributing subnet identification, electronic equipment and storage medium - Google Patents

Method and device for distributing subnet identification, electronic equipment and storage medium Download PDF

Info

Publication number
CN113067914B
CN113067914B CN202110611567.2A CN202110611567A CN113067914B CN 113067914 B CN113067914 B CN 113067914B CN 202110611567 A CN202110611567 A CN 202110611567A CN 113067914 B CN113067914 B CN 113067914B
Authority
CN
China
Prior art keywords
network
blockchain
block chain
node
subnet
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202110611567.2A
Other languages
Chinese (zh)
Other versions
CN113067914A (en
Inventor
陶友贤
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Alipay Hangzhou Information Technology Co Ltd
Original Assignee
Alipay Hangzhou Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Alipay Hangzhou Information Technology Co Ltd filed Critical Alipay Hangzhou Information Technology Co Ltd
Priority to CN202110611567.2A priority Critical patent/CN113067914B/en
Publication of CN113067914A publication Critical patent/CN113067914A/en
Application granted granted Critical
Publication of CN113067914B publication Critical patent/CN113067914B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/50Address allocation
    • 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
    • H04L12/00Data switching networks
    • H04L12/28Data switching networks characterised by path configuration, e.g. LAN [Local Area Networks] or WAN [Wide Area Networks]
    • H04L12/44Star or tree networks
    • 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 
    • 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/50Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols using hash chains, e.g. blockchains or hash trees

Abstract

The present specification provides a method, an apparatus, an electronic device, and a storage medium for allocating subnet identifications, wherein the method is applied to a block chain node in a first block chain network, the first block chain network is included in a tree system in which a block chain main network is a root node and each block chain sub-network is respectively another node, and any block chain sub-network in the tree system is managed by a block chain network corresponding to its parent node, and the method includes: obtaining a transaction for adding a second blockchain network as a child node of the first blockchain network; in response to the transaction, combining a first network tag corresponding to the first blockchain network with the first parameter to form a second network tag corresponding to the second blockchain network; the value of the second network label on the first parameter is different from the existing sub-node of the first block chain network; and generating a subnet identification based on the second network label, and distributing the generated subnet identification to the second blockchain network.

Description

Method and device for distributing subnet identification, electronic equipment and storage medium
Technical Field
One or more embodiments of the present disclosure relate to the field of blockchain technologies, and in particular, to a method, an apparatus, an electronic device, and a storage medium for allocating subnet identifications.
Background
The blockchain technique is built on top of a transport network, such as a point-to-point network. Nodes in the blockchain network utilize a chained data structure to validate and store data and employ a distributed node consensus algorithm to generate and update data. Under the scene of establishing a new blockchain network based on the existing blockchain network system, a tree system formed by a plurality of blockchain networks with management relations among each other is formed, and as any blockchain network in the tree system can only acquire subnet information of the blockchain network managed by the blockchain network, subnet identifications distributed to the newly established blockchain network may be repeated with subnet identifications of the blockchain networks which are not managed by the blockchain network, so that conflicts are generated in subsequent various service processing.
Disclosure of Invention
In view of the above, one or more embodiments of the present disclosure provide a method for controlling an operation state of a blockchain subnet and a blockchain system.
To achieve the above object, one or more embodiments of the present disclosure provide the following technical solutions:
according to a first aspect of one or more embodiments of the present disclosure, a method for controlling an operation state of a blockchain subnet is provided, where the method is applied to a tree system in which a blockchain main network is a root node and each blockchain subnet is another node, and any blockchain subnet in the tree system is managed by a blockchain network corresponding to a parent node of the blockchain subnet, and the method includes:
each node in the first block chain network respectively acquires a transaction for controlling the operation state of a block chain subnet, and control information and a target subnet identifier contained in the transaction are transmitted to a subnet state control event generated by triggering after the transaction is executed;
and the first node equipment extracts the control information and the target subnet identification from the acquired subnet state control event, and controls the running state of the first subnet node according to the control information under the condition that the first blockchain subnet corresponding to the target subnet identification is determined to be a sub node of the first blockchain network and the first subnet node in the first blockchain subnet is locally deployed.
According to a second aspect of one or more embodiments of the present specification, there is provided an apparatus for assigning subnet identifications, where the apparatus is applied to a block chain node in a first block chain network, where the first block chain network is included in a tree system that uses a block chain main network as a root node and each block chain sub-network is respectively another node, and any block chain sub-network in the tree system is managed by a block chain network corresponding to its parent node, the apparatus including:
a transaction acquisition module for acquiring a transaction for adding the second blockchain network as a child node of the first blockchain network;
a tag formation module to combine a first network tag corresponding to the first blockchain network with the first parameter to form a second network tag corresponding to the second blockchain network in response to the transaction; the value of the second network label on the first parameter is different from the existing sub-node of the first block chain network;
and the identifier generating module is used for generating a subnet identifier based on the second network tag and distributing the generated subnet identifier to the second blockchain network.
According to a third aspect of embodiments herein, there is provided an electronic apparatus including:
a processor; a memory for storing processor-executable instructions; wherein the processor implements the steps of the above method for assigning subnet identifications by executing the executable instructions.
According to a fourth aspect of embodiments herein, there is provided a computer-readable storage medium having stored thereon executable instructions; wherein the instructions, when executed by the processor, implement the steps of the above-described method of assigning subnet identifications.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the specification.
Drawings
FIG. 1 is a schematic diagram of creating an intelligent contract, provided by an exemplary embodiment.
FIG. 2 is a schematic diagram of a calling smart contract provided by an exemplary embodiment.
FIG. 3 is a schematic diagram of creating and invoking an intelligent contract according to an exemplary embodiment.
Fig. 4 is a schematic diagram of a block chain network tree system according to an exemplary embodiment.
Fig. 5 is a flowchart of a method for assigning subnet identifications provided in an exemplary embodiment.
Fig. 6 is a schematic structural diagram of an apparatus according to an exemplary embodiment.
Fig. 7 is a block diagram of an apparatus for assigning subnet identifications according to an exemplary embodiment.
Detailed Description
Reference will now be made in detail to the exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, like numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with one or more embodiments of the present specification. Rather, they are merely examples of apparatus and methods consistent with certain aspects of one or more embodiments of the specification, as detailed in the claims which follow.
It should be noted that: in other embodiments, the steps of the corresponding methods are not necessarily performed in the order shown and described herein. In some other embodiments, the method may include more or fewer steps than those described herein. Moreover, a single step described in this specification may be broken down into multiple steps for description in other embodiments; multiple steps described in this specification may be combined into a single step in other embodiments.
Blockchains are generally divided into three types: public chain (Public Blockchain), Private chain (Private Blockchain) and alliance chain (Consortium Blockchain). In addition, there are various types of combinations, such as private chain + federation chain, federation chain + public chain, and other different combinations. The most decentralized of these is the public chain. The public chain is represented by bitcoin and ether house, and the participators joining the public chain can read the data record on the chain, participate in transaction, compete for accounting right of new blocks, and the like. Furthermore, each participant (i.e., node) is free to join and leave the network and perform related operations. Private chains are the opposite, with the network's write rights controlled by an organization or organization and the data read rights specified by the organization. Briefly, a private chain can be a weakly centralized system with strictly limited and few participating nodes. This type of blockchain is more suitable for use within a particular establishment. A federation chain is a block chain between a public chain and a private chain, and "partial decentralization" can be achieved. Each node in a federation chain typically has a physical organization or organization corresponding to it; participants jointly maintain blockchain operation by authorizing to join the network and forming a benefit-related alliance.
Whether public, private, or alliance, may provide the functionality of an intelligent contract. An intelligent contract on a blockchain is a contract that can be executed on a blockchain system triggered by a transaction. An intelligent contract may be defined in the form of code.
Taking the ethernet as an example, the support user creates and invokes some complex logic in the ethernet network, which is the biggest challenge of ethernet to distinguish from bitcoin blockchain technology. The core of the ethernet plant as a programmable blockchain is the ethernet plant virtual machine (EVM), each ethernet plant node can run the EVM. The EVM is a well-behaved virtual machine, which means that a variety of complex logic can be implemented through it. The user issuing and invoking smart contracts in the etherhouse is running on the EVM. In fact, what the virtual machine directly runs is virtual machine code (virtual machine bytecode, hereinafter referred to as "bytecode"). The intelligent contracts deployed on the blockchain may be in the form of bytecodes.
For example, as shown in fig. 1, after Bob sends a transaction containing information to create an intelligent contract to the ethernet network, the EVM of node 1 may execute the transaction and generate a corresponding contract instance. The "0 x6f8ae93 …" in fig. 1 represents the address of the contract, the data field of the transaction holds the byte code, and the to field of the transaction is empty. After agreement is reached between the nodes through the consensus mechanism, this contract is successfully created and can be invoked in subsequent procedures. After the contract is created, a contract account corresponding to the intelligent contract appears on the blockchain and has a specific address, and the contract code is stored in the contract account. The behavior of the intelligent contract is controlled by the contract code. In other words, an intelligent contract causes a virtual account to be generated on a blockchain that contains a contract code and an account store (Storage).
As shown in fig. 2, still taking an ethernet house as an example, after Bob sends a transaction for invoking an intelligent contract to the ethernet house network, the EVM of a certain node may execute the transaction and generate a corresponding contract instance. The from field of the transaction in FIG. 2 is the address of the account of the initiator of the transaction (i.e., Bob), the "0 x6f8ae93 …" in the to field represents the address of the smart contract being invoked, and the value field is the value in EtherFang that is kept in the data field of the transaction as the method and parameters for invoking the smart contract. After invoking the smart contract, the value of balance may change. Subsequently, a client can view the current value of balance through a blockchain node (e.g., node 6 in fig. 2). The intelligent contract is independently executed at each node in the blockchain network in a specified mode, and all execution records and data are stored on the blockchain, so that after the transaction is completed, transaction certificates which cannot be tampered and cannot be lost are stored on the blockchain.
A schematic diagram of creating an intelligent contract and invoking the intelligent contract is shown in fig. 3. To create an intelligent contract in an ethernet workshop, the intelligent contract needs to be compiled, compiled into byte codes, deployed to a block chain and the like. The intelligent contract is called in the Ethernet workshop, a transaction pointing to the intelligent contract address is initiated, and the intelligent contract codes are distributed and run in the virtual machine of each node in the Ethernet workshop network.
It should be noted that, in addition to the creation of the smart contracts by the users, the smart contracts may also be set by the system in the creation block. Such contracts are generally referred to as foundational contracts. In general, the data structure, parameters, attributes and methods of some blockchain networks may be set in the startup contract. Further, an account with system administrator privileges may create a contract at the system level, or modify a contract at the system level (simply referred to as a system contract). In addition to EVM in the ethernet, different blockchain networks may employ various virtual machines, which is not limited herein.
After executing a transaction that invokes a smart contract, a node in the blockchain network generates a corresponding receipt (receipt) for recording information related to executing the smart contract. In this way, information about the contract execution results may be obtained by querying the receipt of the transaction. The contract execution result may be represented as an event (event) in the receipt. The message mechanism can implement message passing through events in the receipt to trigger the blockchain node to execute corresponding processing. The structure of the event may be, for example:
Event:
[topic][data]
[topic][data]
......
in the above example, the number of events may be one or more; wherein, each event respectively comprises fields of a subject (topic) and data (data). The tile chain node may perform the preset process by listening to topic of the event, in case that predefined topic is listened to, or read the related content from the data field of the corresponding event, and may perform the preset process based on the read content.
In the event mechanism, it is equivalent to that there is a client with a monitoring function at a monitoring party (e.g. a user with a monitoring requirement), for example, an SDK or the like for implementing the monitoring function is run on the client, and the client monitors events generated by the blockchain node, and the blockchain node only needs to generate a receipt normally. The passage of transaction information may be accomplished in other ways than through the event mechanism described above. For example, the monitoring code can be embedded in a blockchain platform code running at blockchain nodes, so that the monitoring code can monitor one or more data of transaction content of blockchain transactions, contract states of intelligent contracts, receipts generated by contracts and the like, and send the monitored data to a predefined monitoring party. Since the snoop code is deployed in the blockchain platform code, rather than at the snooper's client, this implementation based on snoop code is relatively more proactive than the event mechanism. The above monitoring code may be added by a developer of the blockchain platform in the development process, or may be embedded by the monitoring party based on the own requirement, which is not limited in this specification.
The blockchain technology is different from the traditional technology in one of decentralization characteristics, namely accounting is performed on each node, or distributed accounting is performed, and the traditional centralized accounting is not performed. To be a difficult-to-defeat, open, non-falsifiable data record decentralized honest and trusted system, the blockchain system needs to be secure, unambiguous, and irreversible in the shortest possible time for distributed data records. In different types of blockchain networks, in order to keep the ledger consistent among the nodes recording the ledger, a consensus algorithm is generally adopted to ensure that the consensus mechanism is the aforementioned mechanism. For example, a common mechanism of block granularity can be implemented between block nodes, such as after a node (e.g., a unique node) generates a block, if the generated block is recognized by other nodes, other nodes record the same block. For another example, a common mechanism of transaction granularity may be implemented between the blockchain nodes, such as after a node (e.g., a unique node) acquires a blockchain transaction, if the blockchain transaction is approved by other nodes, each node that approves the blockchain transaction may add the blockchain transaction to the latest block maintained by itself, and finally, each node may be ensured to generate the same latest block. The consensus mechanism is a mechanism for the blockchain node to achieve a global consensus on the block information (or called blockdata), which can ensure that the latest block is accurately added to the blockchain. The current mainstream consensus mechanisms include: proof of Work (POW), Proof of stock (POS), Proof of commission rights (DPOS), Practical Byzantine Fault Tolerance (PBFT) algorithm, HoneyBadgerBFT algorithm, etc.
Due to the decentralized characteristic of the blockchain network, all blockchain nodes in the blockchain network can maintain the same blockchain data, and the special requirements of part of nodes cannot be met. Taking a federation chain as an example, all federation members (i.e., node members in a federation) may form a blockchain network, and all federation members respectively have corresponding blockchain nodes in the blockchain network, and may obtain all transactions and related data occurring on the blockchain network through the corresponding blockchain nodes. In some cases, however, there may be some security-required transactions that some coalition members wish to complete, which may both wish to be able to verify on the blockchain or to take advantage of other advantages of blockchain technology, and avoid other coalition members from viewing the transactions and associated data. Although the federating members can additionally build a new blockchain network in a manner similar to the blockchain network including all federating members described above, the new blockchain network is built from scratch, which consumes a lot of resources and is time-consuming in both the building process and the post-building configuration process. The demand between the members of the federation is often temporary or has a certain timeliness, so that the newly-built blockchain network can quickly lose significance due to the disappearance of the demand, thereby further increasing the link establishment cost of the blockchain network. The demands among the federation members often change, and the federation members corresponding to each demand often differ, so that a new blockchain network may need to be established whenever a change occurs in a federation member, thereby causing a great waste of resources and time.
For this purpose, the established blockchain network may be used as a blockchain master network, and a blockchain sub-network may be established on the basis of the blockchain master network. Then, in a federation chain scenario such as that described above, federation members can build the required blockchain subnets on a blockchain master basis based on their own needs, already participating in the blockchain master. Because the block chain sub-networks are established on the basis of the block chain main network, compared with the process of completely and independently establishing a block chain network, the block chain sub-networks are greatly reduced in consumed resources, required time consumption and the like, and are extremely high in flexibility.
The process of quickly establishing the block chain sub-network based on the block chain main network comprises the following steps: each block link point in a block chain main network respectively acquires a transaction for establishing a block chain sub-network, the transaction comprises configuration information of the block chain sub-network, the configuration information comprises identity information of node members participating in establishing the block chain sub-network, each block link point in the block chain main network respectively executes the transaction to reveal the configuration information, and when the configuration information comprises identity information of a node member corresponding to a first block link point, node equipment for deploying the first block chain node starts a second block chain node belonging to the block chain sub-network based on an innovation block comprising the configuration information.
The transaction for establishing the blockchain sub-network can be initiated by an administrator of the blockchain main network, that is, the administrator is only allowed to establish the blockchain sub-network on the basis of the blockchain main network, and the establishment permission of the blockchain sub-network is prevented from being opened to a common user, so that the security problem caused by the establishment permission can be prevented. In some cases, a common user of the blockchain main network may also be allowed to initiate a transaction for building the blockchain sub-network, so as to meet networking requirements of the common user, and the common user can still quickly build the blockchain sub-network under the condition that an administrator is not convenient to initiate the transaction.
For example, as shown in fig. 4, the main network of the blockchain is subnet0, and the subnet0 includes blockchain link points nodeA, nodeB, nodeC, nodeD, and nodeE. Assume nodeA, nodeB, nodeC, and nodeD wish to build a blockchain subnet: if nodeA is an administrator and only allows the administrator to initiate a transaction to build a blockchain subnet, the transaction to build the blockchain subnet can be initiated by nodeA to subnet 0; if the nodeb is an administrator and only the administrator is allowed to initiate a transaction for building the blockchain subnet, nodeb a to nodeb d need to make a request to nodeb, so that nodeb initiates the transaction for building the blockchain subnet to subnet 0; if the node E is an administrator but allows a common user to initiate the transaction of building the blockchain sub-network, the node A-node E can initiate the transaction of building the blockchain sub-network to the subnet 0. Of course, the blockchain link point initiating the transaction for building the blockchain subnet does not necessarily participate in the built blockchain subnet, regardless of the administrator or the general user, for example, although the blockchain subnet is finally built by nodeA, nodeB, nodeC and nodeD, the transaction for building the blockchain subnet may be initiated by nodeE to subnet0, but the transaction for building the blockchain subnet is not necessarily initiated by nodeA to nodeD.
When the blockchain sub-network is constructed on the basis of the blockchain main network, it is easy to understand that a logical hierarchical relationship exists between the blockchain sub-network and the blockchain main network. For example, when a blockchain subnet1 is established on the subnet0 shown in fig. 4, it can be considered that the subnet0 is at the first layer, the subnet1 is at the second layer, the subnet0 is the parent network of the subnet1, and the subnet1 is the subnet 0. And the blockchain sub-network may also constitute a corresponding blockchain sub-network, for example, another blockchain sub-network bnet3 may be further constituted on the basis of the sub-net 1 in fig. 4, at this time, it may be considered that the sub-net is in the third layer, the sub-net 1 is the parent network corresponding to the sub-net 3, the sub-net 3 is the subnet of the sub-net 1, and the sub-net 3 is the grandchild network of the sub-net 0, similarly, the sub-net 3 may still newly constitute the blockchain sub-network on the basis thereof, so that such a multi-level tree structure is formed between the blockchain networks, and in this specification, any blockchain network is managed by its corresponding parent network, that is, managed by the blockchain network constituting any blockchain network of the blockchain network, so that in the blockchain sub-network as shown in fig. 4, the main level of the blockchain is the root network, and each blockchain sub-network is the corresponding tree node sub-chain sub-network of the other blockchain sub-network, and its corresponding system is represented by any blockchain sub-chain sub-network of the blockchain system, as a specific example, when the block chain master network is a bottom layer block chain network, the block chain master network is managed by the block chain master network itself. The block chain master network in this specification may be a bottom layer block chain network, where the bottom layer block chain network refers to a block chain sub-network that is not established on the basis of other block chain networks, and therefore there is no other block chain network except the block chain master network and the block chain master network can manage the block chain master network, for example, the subnet0 in fig. 4 may be considered as a block chain master network belonging to a bottom layer block chain network type, and the subnet0 manages the subnet0 itself, and of course, the block chain master network may also be a sub-network of another block chain network, which is not limited in this specification. The block chain network tree system realizes layer-by-layer management by managing the corresponding child nodes through the father nodes, reduces the management pressure of the block chain main network, and simultaneously avoids exposing subnet information of an upper network to a lower network, thereby realizing the secret management of networks at all levels.
After the transaction for establishing the blockchain sub-network is sent to the blockchain main network, the consensus nodes in the blockchain main network perform consensus, and after the consensus is passed, each main network node executes the transaction to complete establishment of the blockchain sub-network. The consensus process depends on the consensus mechanism employed, such as any of the consensus mechanisms described above, and is not limited by the present specification.
The configuration information is included in the transaction of the block chain sub-network, and the configuration information can be used for configuring the block chain sub-network, so that the block chain sub-network meets networking requirements. For example, by including the identity information of the node members in the configuration information, it is possible to specify which blockchain nodes the constructed blockchain subnet includes.
The identity information of the node member may include a public key of the node, or other information capable of representing the node identity, such as a node ID, which is not limited in this specification. Taking a public key as an example, each blockchain node has one or more corresponding sets of public-private key pairs, and the private key is held by the blockchain node and the public key is public and uniquely corresponds to the private key, so that the identity of the corresponding blockchain node can be characterized by the public key. Therefore, for blockchain nodes that are desired to be node members of a blockchain subnet, the public keys of these blockchain nodes can be added to the transaction of the building blockchain subnet as the identity information of the node members. The public and private key pair described above may be used in the process of signature verification. For example, in a signed consensus algorithm, such as the sub net1, the above-mentioned nodeA1 signs a message with its own private key, and broadcasts the signed message in the sub net1, while nodeB1, nodeC1 and nodeD1 can verify that the received message is signed with the public key of nodeA1 to confirm that the received message is indeed from nodeA1 and has not been tampered with.
The first master network node may be a blockchain node on the blockchain master network that belongs to a node member indicated by the configuration information. When the blockchain subnet is constructed, the first master network node does not directly participate in the construction of the blockchain subnet and becomes a node member thereof, but the first subnet node needs to be generated by the node device for deploying the first master network node and becomes a node member in the blockchain subnet by the first subnet node. The first main network node and the first sub-network node correspond to the same blockchain member, for example, correspond to the same alliance chain member in an alliance chain scene, but the first main network node belongs to a blockchain main network and the first sub-network node belongs to a blockchain sub-network, so that the blockchain member can participate in the transaction of the blockchain main network and the blockchain sub-network respectively; moreover, because the blockchain main network and the blockchain sub-network belong to two mutually independent blockchain networks, the blocks generated by the first main network node and the blocks generated by the first sub-network node are respectively stored in different storages (the adopted storages can be databases, for example) on the node device, so that mutual isolation between the storages used by the first main network node and the first sub-network node respectively is realized, and thus, data generated by the blockchain sub-network can only be synchronized among the node members of the blockchain sub-network, so that the blockchain members only participating in the blockchain main network cannot obtain the data generated by the blockchain sub-network, the data isolation between the blockchain main network and the blockchain sub-network is realized, and the transaction requirements between partial blockchain members (namely, the blockchain members participating in the blockchain sub-network) are met.
It can be seen that the first master network node and the first sub-network node are logically divided block chain link points, and from the perspective of physical devices, the node devices which are equivalent to the first master network node and the first sub-network node are deployed to participate in both the block chain master network and the block chain sub-network. Since the blockchain main network and the blockchain sub-network are independent from each other, so that the identity systems of the two blockchain networks are also independent from each other, even though the first main network node and the first sub-network node may adopt the same public key, the first main network node and the first sub-network node should be regarded as different blockchain nodes. For example, in fig. 4, the nodeA in subnet0 corresponds to a first master network node, and the node device deploying the nodeA generates nodeA1 belonging to subnet1, and the nodeA1 corresponds to a first sub-network node. It can be seen that, since the identity systems are independent of each other, even if the public key adopted by the first subnet node is different from that of the first master network node, the implementation of the solution in this specification is not affected.
Of course, the node members of the blockchain sub-network are not necessarily only part of the node members of the blockchain main network. In some cases, the node members of the blockchain subnet may be completely consistent with the node members of the blockchain main network, and at this time, all the blockchain members may obtain data on the blockchain main network and the blockchain subnet, but data generated by the blockchain main network and the blockchain subnet may still be isolated from each other, for example, one type of service may be implemented on the blockchain main network, and another type of service may be implemented on the blockchain subnet, so that service data generated by the two types of services may be isolated from each other.
In addition to the identity information of the node members described above, the configuration information may include at least one of: the network identifier of the blockchain subnet, the identity information of an administrator of the blockchain subnet, the attribute configuration for the blockchain platform code, and the like, which are not limited in this specification. The network identifier is used to uniquely characterize the blockchain subnet, and thus the network identifier of the blockchain subnet should be distinguished from the blockchain main network and other blockchain subnets established on the blockchain main network. Identity information of an administrator of the blockchain subnet, such as a public key of a node member as the administrator; the administrators of the blockchain main network and the blockchain sub-network may be the same or different.
One of the advantages of building the blockchain subnet by using the blockchain master network is that since the first master network node is already deployed on the node device generating the first subnet node, the blockchain platform code used by the first master network node can be multiplexed on the first subnet node, so that repeated deployment of the blockchain platform code is avoided, and the building efficiency of the blockchain subnet is greatly improved. Then, if the configuration information does not include the attribute configuration for the blockchain platform code, the first subnet node may reuse the attribute configuration adopted on the first master network node; if the configuration information includes the attribute configuration for the blockchain platform code, the first subnet node may adopt the attribute configuration, so that the attribute configuration adopted by the first subnet node is not limited by the attribute configuration of the first main network node and is not related to the first main network node. The attribute configuration for blockchain platform code may include at least one of: code version number, whether consensus is required, type of consensus algorithm, block size, etc., which is not limited in this specification.
The transactions that make up the blockchain subnet include transactions that invoke contracts. The address of the invoked smart contract, the method invoked and the incoming parameters may be specified in the transaction. For example, the contract invoked may be the aforementioned startup contract or system contract, the method invoked may be a method that builds a blockchain subnet, and the incoming parameters may include the configuration information described above. In one embodiment, the transaction may contain the following information:
from:Administrator
to:Subnet
method:AddSubnet(string)
string:genesis
the from field is information of the initiator of the transaction, such as administeror indicating that the initiator is an Administrator; the to field is the address of the intelligent contract being called, for example, the intelligent contract may be a Subnet contract, and the to field is specifically the address of the Subnet contract; the method field is a called method, for example, the method used in the Subnet contract to build the blockchain Subnet may be AddSubnet (string), and string is a parameter in the AddSubnet () method, and the value of the parameter is represented by the aforementioned example, which is specifically the aforementioned configuration information.
Take the example that nodes nodeA-nodeS on Subnet0 execute a transaction that invokes the AddSubnet () method in the Subnet contract. After the transaction passes the consensus, nodeA-nodeE respectively execute the AddSubnet () method and transmit configuration information to obtain corresponding execution results.
The execution result of the contract may include the configuration information, and the execution result may be in the receipt as described above, and the receipt may contain the event related to the execution of the adsubnet () method, i.e., the networking event. The topoc of a networking event may contain a predefined networking event identification to distinguish it from other events. For example, in an event related to the execution of the AddSubnet () method, the content of topic is a keyword subnet, and the keyword is distinguished from topic in the event generated by other methods. Then, nodeA to nodeE can determine to monitor the event related to executing the AddSubnet () method, that is, the networking event, when the topic including the keyword subnet is monitored by monitoring topic included in each event in the generated receipt. For example, the events in the receipt are as follows:
Event:
[topic:other][data]
[topic:subnet][data]
......
then, when the nodeA-nodeE monitors the 1 st event, the event is determined to be irrelevant to the AddSubnet () method because the contained topic content is other; and when the 2 nd event is monitored by the nodeA to nodeE, determining that the event is related to the AddSubnet () method because the contained topic content is subnet, and further reading a data field corresponding to the event, wherein the data field comprises the configuration information. Taking the example that the configuration information includes the public key of the node member of the blockchain subnet, the content of the data field may include, for example:
{subnet1;
the public key of nodeA, the IP of nodeA, port number … of nodeA;
public key of nodeB, IP of nodeB, port number … of nodeB;
public key of nodeC, IP of nodeC, port number … of nodeC;
the public key of nodeD, the IP of nodeD, port number … of nodeD;
}
where subnet1 is the network identification of the blockchain subnet that one wishes to create. Each blockchain link point in the blockchain master network may record network identifiers of all blockchain subnets that have been created on the blockchain master network, or other information related to the blockchain subnets, which may be maintained in the Subnet contract, for example, and may specifically correspond to values of one or more contract states included in the Subnet contract. Then, nodeA-nodeE can determine whether the subnet1 already exists according to the recorded network identifiers of all the created subnet block chains; if not, subnet1 is the new blockchain subnet that needs to be created currently, and if so, subnet1 is already present.
In addition to the network identifier of the new blockchain subnet that is desired to be created, a predefined new network identifier may be used, which indicates that the corresponding networking event is used to create the new blockchain subnet. For example, the subnet1 may be replaced by newsbnet, where newsbnet is a predefined new network identifier, and when the nodeA to nodeE recognize that the data field includes newsbnet, it may be determined that an event including newsbnet is a networking event and a new blockchain subnet needs to be created.
Besides the network identification subnet1, the data field also contains the identity information of each node member. The node device deploying the first master network node may monitor the generated receipt, and obtain, by the node device deploying the first master network node, configuration information or an innovation block included in the networking event when the networking event is monitored and the content of the networking event indicates that the first master network node belongs to the node member. For example, when determining that subnet1 is a blockchain subnet that needs to be newly built, nodeA to nodeE further identify the identity information of the node members included in the data field to determine their own processing methods. For example, the nodeA to nodeD may find that the data field includes identity information such as their own public key, IP address, and port number, and assume that nodeA to nodeD are respectively deployed on node devices 1 to 4, taking nodeA and node device 1 as an example: the nodeA triggers the node device 1, so that the node device 1 obtains the configuration information from the data field based on the message mechanism and generates a created block containing the configuration information, and the node device 1 deploys the nodeA1 locally, and then loads the generated created block by the nodeA1, so as to form 1 node member in subnet 1; similarly, nodeB will trigger NodeB1 to be generated by node device 2, nodeC will trigger NodeC1 to be generated by node device 3, and nodeD will trigger NodeD1 to be generated by node device 4. And the nodeE finds that the identity information contained in the data field is not matched with the nodeE, and if the nodeE is deployed on the node device 5, the node device 5 does not generate a creation block according to the configuration information in the data field, and does not generate a node in the subnet 1.
As mentioned above, the first master network node and the first subnet node do not necessarily adopt the same identity information. Therefore, in the above embodiment, the data field may include the identity information previously generated for nodeA 1-nodeD 1, and is different from the identity information of nodeA-nodeD. Taking nodeA and node device 1 as an example: if identity information of nodeA1 is found in the data field, node device 1 may generate a created block, deploy nodeA1, and load the created block by nodeA1, or if identity information of nodeA1 is found in the data field, nodeA may trigger node device 1 to generate a created block, deploy nodeA1, and load the created block by nodeA 1; the nodeB-nodeD processing modes are similar, and are not described in detail here.
In addition to configuration information, the execution results of the contract may include a foundational block. In other words, in addition to the configuration information contained in the data field, the created block containing the configuration information may be directly generated in the process of executing the contract call, so that the created block is contained in the data field, and for the nodeA to nodeD described above, the corresponding node devices 1 to 4 may directly obtain the created block from the data field through a message mechanism without self-generation, so that the deployment efficiency of nodeA1 to nodeD1 may be improved.
In this specification, the transaction for creating the blockchain subnet may not be a transaction for calling an intelligent contract, so that the blockchain network that does not support the intelligent contract may also implement the technical solution of this specification, thereby quickly creating the blockchain subnet on the basis of the blockchain main network. For example, a group network transaction type identifier may be predefined, and when a transaction includes the group network transaction type identifier, it indicates that the transaction is used for building a new blockchain subnet, that is, the transaction is a transaction for building a blockchain subnet. The blockchain platform code may include related processing logic for component blockchain subnets, so that when a first master network node running the blockchain platform code performs a transaction, if the transaction is found to include the above networking transaction type identifier, and the first master network node belongs to a node member indicated by configuration information in the transaction, a node device deploying the first master network node may be triggered to generate an innovation block including the configuration information and start the first subnet node based on the above processing logic, and the innovation block is loaded by the first subnet node to form a blockchain node in the blockchain subnet.
The node device realizes the deployment of a blockchain node on the node device by creating an instance of running blockchain platform codes in the process. For the first master network node, a first instance is created by the node device in the above process and formed by the first instance running blockchain platform code. Similarly, for the first subnet node, a second instance different from the first instance is created by the node device in the above process, and is formed by the second instance running the blockchain platform code. For example, the node device may first create a first instance in a process to form a first blockchain node in a blockchain master network; when the node member corresponding to the node device wishes to participate in building the blockchain subnet, a second instance may be created in the process, where the second instance is different from the first instance, and forms a second blockchain node in the blockchain subnet. When the first instance and the second instance are located in the same process, the cross-process interaction is not involved, so that the deployment difficulty of the first subnet node can be reduced, and the deployment efficiency can be improved. Of course, the second instance may also be in a different process on the node device than the first instance, and this specification does not limit this; for example, the node device may create a first instance in a first process to form a first blockchain node in a blockchain master network; when the node member corresponding to the node device wishes to participate in building the blockchain subnet, a second process different from the first process may be started, and a second instance different from the first instance may be created in the second process, so that the second blockchain node in the blockchain subnet is formed by the second instance. In fact, each block link point deployed on any node device referred to in the embodiments of this specification is a different block chain instance running on any node device, blocks generated by each block link point deployed on any node device are respectively stored in different storages (for example, a database) on any node device, and the storages used by each block link point deployed on any node device are isolated from each other.
By the method, the block chain sub-network can be created on the block chain main network. Taking fig. 4 as an example, the subnet0 originally includes nodeA to nodeE, and can construct subnet1 on the basis of subnet0, where subnet1 includes nodeA1 to nodeD1, and nodeA1, nodeB and nodeB1, nodeC and nodeC1, and nodeD1 are respectively disposed on the same node device. Similarly, a subnet2 or more block chain subnets can be constructed on subnet0, where subnet2 includes nodeA2, nodeB2, nodeC2, and nodeE2, and nodeA1, nodeA2, nodeB1, nodeB2, nodeC1, nodeD1, and nodeE2 are respectively deployed on the same node device. And, subnet1, subnet2, etc. may be used as a blockchain main network, and a blockchain subnet is further constructed on the basis, for example, a blockchain subnet3 is constructed on the basis of subnet1, the process is similar to the construction of subnet1 or subnet2, only the blockchain is replaced by a main blockchain subnet1, which is not described herein, and finally, the subnet3 includes nodeA3, nodeB3 and nodeC3, so that nodeA and nodeA1, nodeA2, nodeA3, nodeB and nodeB1, nodeB2, nodeB3, nodeC and nodeC1, nodeC2 and nodeC3 are respectively deployed on the same node device.
The building of the blockchain subnets on the blockchain main network in the manner described above, where Subnet identifications (i.e. the network identifications described above) of the newly built blockchain subnets may be determined by configuration information carried in a transaction, or may be generated by themselves when executing a Subnet contract, and may ensure that Subnet identifications between blockchain subnets built on the blockchain main network are not duplicated, which is essentially because the blockchain main network can know Subnet information including Subnet identifications of the blockchain subnets built and managed by the blockchain main network, and these information may be maintained in the Subnet contract described above, specifically may correspond to values of one or more contract states included in the Subnet contract, and then node a to node may determine whether Subnet identifications carried in the configuration information are duplicated according to the recorded Subnet identifications of all blockchain subnets already created, so as to abandon assignment of subnets in the configuration information to the newly built blockchain subnets when determining duplication, or automatically generating a subnet identification which is not repeated with the subnet identifications of all the blockchain subnets managed by the current main network as the subnet identification of the newly-built blockchain network. However, in a multi-level tree system scenario composed of a blockchain main network and a plurality of blockchain sub-networks, subnet information of all other blockchain networks cannot be known necessarily by any blockchain network in the tree system, for example, for a blockchain main network subnet0, subnet information of a subnet3 having a cross-layer relationship with the blockchain main network cannot be known, for a blockchain subnet1 or a subnet2, since they are managed parties of the subnet0, subnet information of the subnet0 cannot be known, and in summary, when any blockchain network in the multi-level tree system builds a new blockchain network, it cannot be guaranteed that a subnet identifier allocated to the blockchain network is globally unique in the tree system, and therefore, a blockchain network with a duplicate subnet identifier may appear between different levels, resulting in some services that need to point to a blockchain network corresponding to a specific subnet identifier generate errors during processing, for example, a transaction is erroneously sent to multiple blockchain networks with the same subnet identification during the transaction routing process, resulting in a serious system error.
Therefore, the present specification proposes a method for allocating subnet identifiers, which is applied to a blockchain node in a first blockchain network, where the first blockchain network is included in the blockchain network tree system, so that the first blockchain network can allocate a globally unique subnet identifier for a newly-established blockchain network thereof without knowing subnet identifiers of all blockchain networks in the tree system, thereby ensuring normal execution of subsequent services.
Fig. 5 is a flowchart of a method for assigning subnet identifications provided in an exemplary embodiment. The method is applied to block chain link points in a first block chain network, the first block chain network is included in a tree system which takes a block chain main network as a root node and each block chain sub-network as other nodes, any block chain sub-network in the tree system is managed by the block chain network corresponding to a father node of the block chain sub-network, and the method comprises the following steps:
step 502, a transaction is obtained for adding a second blockchain network as a child node of the first blockchain network.
In an embodiment of this specification, the first blockchain network is a blockchain main network corresponding to a root node in the tree system; or, the first block chain network is a block chain sub-network corresponding to other nodes except the root node in the tree system.
In the embodiments of this specification, any blockchain subnet in the tree system is managed by a blockchain network corresponding to its parent node, which means that each blockchain node in the blockchain network corresponding to the parent node of any blockchain subnet can control the operation state, operation configuration, and the like of any blockchain subnet by initiating a transaction, and can acquire subnet information of any blockchain subnet, including subnet identifiers, operation states, identity information of node members, plug-in configuration information, and the like.
In an embodiment of the present specification, the transaction for adding the second blockchain network as a child node of the first blockchain network may include a transaction for building the second blockchain network based on the first blockchain network, or a transaction for registering a built second blockchain network as a child node of the first blockchain network.
When the transaction is a transaction for establishing a second blockchain network based on a first blockchain network, the transaction is the transaction for establishing the blockchain subnet, specifically, the transaction includes configuration information of the second blockchain network, and the configuration information includes identity information of a node member participating in establishing the second blockchain network; and generating an creation block containing the configuration information, the second network tag and the generated subnet identifier based on the transaction by using the block chain link point of the configuration information, which contains the identity information in the first block chain network, and starting the block chain link point belonging to the second block chain network based on the creation block so as to add the second block chain network as a sub node of the first block chain network, wherein the process is the same as the process of establishing the block chain subnet based on the block chain master network, and is not repeated here.
When the transaction is a transaction for registering the established second blockchain network as a sub-node of the first blockchain network, the transaction comprises identity information of the second blockchain network; and when the block chain nodes in the first block chain network execute the transactions respectively, acquiring the identity information of the second block chain network from the transactions, and associating and storing the acquired identity information of the second block chain network with the generated subnet identification so as to add the second block chain network as a child node of the first block chain network. The method for adding the established second blockchain network as the sub-node of the first blockchain network by initiating a transaction may also be referred to as a registration networking method, in which subnet information of the blockchain subnet to be added is directly registered to the existing blockchain network, so that the existing blockchain subnet obtains relevant information of the blockchain subnet to be added, such as subnet identification and operating state of the blockchain subnet to be added, wherein public keys and plug configuration information of each node member, IP addresses and port information of each node device, and the like, which are written into a contract state of a system contract corresponding to the existing blockchain network, so that the existing blockchain network obtains management rights of the blockchain subnet to be added, and after the registration is completed, it means that the blockchain subnet to be added is successfully added as the sub-node of the existing blockchain network, in this embodiment, the existing blockchain network is the first blockchain network, and the blockchain subnet to be added is the second blockchain network. The subnet nodes in the second blockchain network added through the registration networking manner may be completely or partially different from the node devices deployed at each node in the existing blockchain network, for example, subnet0 establishes one subnet4 in the registration manner, and assuming that the main network nodes nodeA to nodeE included in subnet0 themselves are respectively deployed in node devices 1 to 5, the subnet node corresponding to subnet4 may be deployed in any node device other than node devices 1 to 5, or subnet node nodeA4 in subnet4 may be deployed in node device 1, and subnet node nodeF4 in subnet4 is deployed in node device 6, of course, the subnet nodes in subnet4 may also be all deployed in node devices 1 to 5.
The above-mentioned transaction for adding the second blockchain network as a child node of the first blockchain network may be initiated by an administrator of the first blockchain network, that is, only allowing the administrator to add the blockchain network on the basis of the first blockchain network, and avoiding opening the addition authority of the blockchain network to a general user, so as to prevent a security problem caused thereby. In some cases, a general user of the first blockchain network may also be allowed to initiate a transaction for adding the second blockchain network as a child node of the first blockchain network, so as to meet networking requirements of the general user, so that the general user can still quickly and conveniently establish the blockchain network on the basis of the first blockchain network under the condition that an administrator is not convenient to initiate the transaction.
Step 504, in response to the transaction, combining a first network tag corresponding to the first blockchain network with the first parameter to form a second network tag corresponding to the second blockchain network; and the value of the second network label on the first parameter is different from the existing sub-nodes of the first block chain network.
The transactions for adding the second blockchain network as the first blockchain network include transactions that invoke contracts, such as the aforementioned startup contracts or system contracts. Therefore, when the blockchain node in the first blockchain network acquires the transaction, the related process in step 504 is executed by invoking the intelligent contract related to the first blockchain network. The called intelligent contract can acquire a first network tag corresponding to the first blockchain network and each network tag of the blockchain network corresponding to the existing sub-node of the first blockchain network by reading the self-maintained contract state, or the called intelligent contract can call a system contract of the local blockchain node by initiating a local transaction mode, so that the called intelligent contract acquires the first network tag corresponding to the first blockchain network maintained in the contract state of the intelligent contract and each network tag of the blockchain network corresponding to the existing sub-node of the first blockchain network, which are returned by the system contract.
When the intelligent contract is called and executed by the transaction, a first parameter is newly added on the basis of the first network label, and the intelligent contract and the first network label are combined to form a second network label to be used as a network label of the second block chain network.
Taking the procedure of building subnet2 by subnet0 in fig. 4 as an example, assuming that subnet1 is already built and subnet2 is not yet built at this time, the first blockchain network is subnet0, the second blockchain network is subnet2, and the existing sub-node of the first blockchain network is subnet 1. When nodeA on subnet0 acquires a transaction to add subnet2 as a child node of subnet0, nodeA responds to the transaction and invokes execution of a Subnet contract (i.e., a system contract) on Subnet0, which, when executed, first, the self-maintenance contract state is read to know that the network label of the subnet0 is '0' (the first network label), then the self-maintenance subnet1 is continuously read, the subnet contract state includes subnet identification and network tag of subnet1, assuming that the network tag of subnet1 is "0.1", it can be seen that the value of the network tag of subnet1 is 1 in the first parameter, and therefore, the value of the first parameter added newly on the basis of the network label "0" of the subnet1 should be different from 1, for example, may be 2, 3, 4, etc., taking the value of the first parameter as 3 as an example, at this time, "0.3" formed by combining the first network tag "0" and the newly added first parameter "3" is taken as the network tag (second network tag) corresponding to the subnet 2.
As an embodiment, a value of the second network tag on the first parameter is a sum of a first value and a second value, the first value is a preset fixed value, and the second value is a value of a network tag corresponding to a blockchain network corresponding to a newly added subnode among existing subnodes of the first blockchain network on the first parameter. Still taking the process of the subnet0 of fig. 4 to construct subnet2 as an example, when nodeA on subnet0 acquires and responds to a transaction to add subnet2 as a child node of subnet0, invoking a Subnet contract on the Subnet0, reading the Subnet contract from the contract state maintained by the Subnet contract to obtain that the network tag of the Subnet0 is "0", the network tag of the Subnet1 of the existing child node of the Subnet0 is "0.1", that is, it can be determined that the value of the network tag of subnet1 on the first parameter is 1, and subnet1 is the newly added child node of subnet0, therefore, it is first determined that the value of the first parameter newly added on the basis of the network tag "0" of the subnet0 should be the sum of the value of the subnet1 on the first parameter and a fixed value, where the fixed value is set to be 1, that is, the value of the added first parameter should be 1+1=2, and then "0.2" formed by combining the network tag "0" of the subnet0 and the added first parameter "2" is taken as the network tag corresponding to the subnet 2. And after subnet2 has been constructed and assigned "0.2" as the second network tag in the manner described above, if subnet0 needs to establish a new blockchain network subnet a, then the first blockchain network is subnet0, the second blockchain network is subnet a, while the existing sub-nodes of the first blockchain network are subnet1 and subnet2, for example when nodeA on subnet0 acquires and responds to a transaction to add subnet a as a child of subnet0, invoking execution of a Subnet contract on Subnet0, reading the network tag of Subnet0 as "0", the network tags of the existing sub-nodes Subnet1 and Subnet2 of Subnet0 as "0.1" and "0.2" respectively, since the subnet2 is the newly added sub-node of subnet0, it is first determined that the value of the newly added first parameter should be the value of subnet2 added to the first parameter plus a fixed value on the basis of the network tag "0" of subnet0, i.e., 2+1=3, then "0.3" formed by combining the network tag "0" of the subnet0 with the newly added first parameter "3" is taken as the network tag corresponding to the subnet a at this time.
In this embodiment of the present specification, the second network tag is a tag formed by splicing the first network tag and the first parameter according to a predetermined sequence. For example, in the case where the first network label is "0" and the first parameter is "1", the second network label may be represented as "0.1" in the order of the first network label to the left and the first parameter to the right, and for example, in the case where the first network label is "0.1" and the first parameter is "2", the second network label may be represented as "0.1.2". In another embodiment, the first network label and the second network label may also be represented in the form of a parameter table (including parameter names and corresponding values), for example, the first network label may be represented as "a = 0", and when the first parameter value is 2, the second network label may be represented as "a = 0; b =2 ", where a and b are different parameter names, and 0 and 2 are the values of a and b, respectively, and for another example, the first network label may be represented as" a = 0; b =2 ", and when the first parameter takes a value of 1, the second network label may be denoted as" a = 0; b = 2; c =1 ", it is to be noted that the parameter name of the newly added first parameter may be automatically generated, or may be specified by information carried by a transaction for adding the second blockchain network as a child node of the first blockchain network.
According to the scheme, each blockchain network in the tree system maintains one network tag, each network tag is composed of one or more parameters, when the second blockchain network is added to the first blockchain network, the newly added network tag of the second blockchain network is obtained by superposing one new parameter on the basis of the network tag of the first blockchain network, and the network tags of the second blockchain network are the same as the existing sub-nodes of the first blockchain network and have the same parameter structure (parameter number, parameter arrangement mode and parameter name), so that the more the number of the network tags is, the higher the level of the blockchain network corresponding to the network tag with the larger parameter number in the tree system is. According to the forming mode of the network tags, the network tags corresponding to any block chain network in the tree system can be guaranteed to be globally unique, the network level corresponding to the block chain network to which the network tags belong can be determined according to the quantity of parameters in any network tag, the network tags of the block chain network corresponding to lower nodes of the block chain network to which the network tags belong are determined according to values of parameters in any network tag, and therefore the positions of the block chain network in the tree system are determined, and the lower nodes comprise father nodes and grandfather nodes which are located in the same branch with the block chain network. For example, assuming that the network tag of the blockchain master network corresponding to the root node in the tree system is "0", it may be determined that, for a blockchain network having a network tag of "0.1.2", the blockchain network is located at the third layer in the tree system, meanwhile, the network tag corresponding to the parent node of the blockchain network is "0.1", the network tag corresponding to the grandparent node of the blockchain network is "0", and values of three parameters included in the network tags are respectively used for indicating branch nodes on a certain network level, so as to locate the location of the blockchain network in the tree system. Particularly, when the value of the newly added first parameter is determined by adding a fixed value to the value of the first parameter of the network tag corresponding to the blockchain network corresponding to the newly added sub-node in the existing sub-nodes of the first blockchain network, the value of the second blockchain network can be determined to be the subnet added to the first blockchain network for the second time through the value of the formed second network tag on the first parameter.
Step 506, generating a subnet identification based on the second network tag, and allocating the generated subnet identification to the second blockchain network.
As described above, in the execution process, the contract invoked by the transaction first forms a second network tag based on the first network tag, and then the contract will continue to generate a subnet identifier based on the second network tag, and create and maintain a contract state of the second blockchain network according to the transaction, where the contract state includes the second network tag and the generated subnet identifier. As described above, when the contract is a system contract, the system contract on the first blockchain network maintains the subnet contract states of the blockchain subnets (existing sub-nodes) managed by the first blockchain network, and subnet contract states corresponding to any existing sub-node record subnet information such as a subnet identifier of the corresponding blockchain subnet, a public key and common type information of a node member, plug-in configuration information, and a creation block.
In this embodiment, after the second network tag is formed, a subnet identifier is further generated and allocated to the second blockchain network as a subnet identifier of the second blockchain network, for example, when the transaction is a transaction for building the second blockchain network based on the first blockchain network, a blockchain node on the first blockchain network includes the second network tag and a subnet identifier generated based on the second network tag in an established block generated after the transaction is performed, and starts a blockchain link point belonging to the second blockchain network based on the established block to add the second blockchain network as a child node of the first blockchain network, on the other hand, after the transaction is performed, a system contract on the first blockchain network creates and maintains a contract state of the second blockchain network according to the transaction, the contract state includes the second network tag and the generated subnet identifier, through the above process, the generated subnet identification is finally allocated to the second blockchain network, and is also recorded in the system contract corresponding to the first blockchain network to be managed by the first blockchain network.
As another example, when the transaction is a transaction that registers the established second blockchain network as a child of the first blockchain network, after the block chain node in the first block chain network executes the transaction, the acquired identity information of the second block chain network and the generated subnet identification are associated and stored, so that the second block chain network is added as a child node of the first block chain network, on the other hand, after the transaction is executed, a system contract on the first blockchain network is created and maintained with a contract state of the second blockchain network according to the transaction, the contract state comprises a second network label and the generated subnet identification, and the generated subnet identification is finally distributed to the second blockchain network through the process, and also recorded in a system contract corresponding to the first blockchain network to be managed by the first blockchain network.
In an embodiment, the generating a subnet identification based on the second network tag includes:
arranging N-system numbers obtained by respectively converting values of all parameters in the second network tag according to a preset sequence, and generating the N-system numbers formed by arrangement as the subnet identifications, wherein N is an integer not less than 2; or
And arranging N-system numbers obtained by respectively converting the values of the parameters except the network tag corresponding to the block link main network in the second network tag according to a preset sequence, and generating the N-system numbers formed by arrangement as the subnet identification, wherein N is an integer not less than 2.
Taking fig. 4 as an example, assuming that the Subnet0 forms a network tag "0.2" corresponding to the Subnet2 in the execution process of the Subnet contract on the Subnet0 under the condition of establishing the Subnet2, and the network tag can be split into two parameters whose values are 0 and 2, so that a 16-system number "0 x 20" formed by converting 0 and 2 into 16-system numbers and arranging them in reverse order can be used as the Subnet identifier of the Subnet 2; on the other hand, in the case of building the Subnet3, the Subnet1 forms a network tag "0.1.1" corresponding to the Subnet3 in the execution process of the Subnet contract on the Subnet1, and the network tag can be split into three parameters with values of 0, 1 and 1, so that a 16-system number "0 x 110" formed by converting 0, 1 and 1 into 16-system numbers and arranging the 16-system numbers in reverse order can be used as the Subnet identifier of the Subnet 3. In addition, the higher order bits of the N-ary number may be complemented by 0 until the number of bits is M bits, and for example, "0 x 00000020" obtained by complementing 0 to 8 bits of "0 x 20" determined above may be used as the subnet identifier of the subnet2, so as to unify the number of bits of the subnet identifier corresponding to each blockchain network in the tree system.
In another embodiment, also taking fig. 4 as an example, assuming that the Subnet0 forms a network tag "0.2" corresponding to the Subnet2 in the execution process of the Subnet contract on the Subnet0 when the Subnet2 is established, and the network tag can be split into two parameters with values of 0 and 2, respectively, and the parameter with value of 0 is a parameter contained in the network tag of the Subnet0 as the main network of the block chain, and therefore will not participate in the generation of the Subnet identifier, so that the remaining 2 can be converted into 16 and arranged in reverse order to form a 16-ary number "0 x 2" as the Subnet identifier of the Subnet 2; assuming that the Subnet1 forms a network tag corresponding to Subnet3 as "0.1.1" in the execution process of the Subnet contract on Subnet1 when the Subnet3 is established, the network tag can be split into three parameters with values of 0, 1 and 1 respectively, and since the network tag of the Subnet0 as the main network of the blockchain is "0", the network tag of the Subnet3 including the parameter with value of 0 in sbutant 0 will not participate in the generation of the Subnet identifier, so that the 16-system number "0 x 11" formed by converting the remaining two parameters 1 and 1 into 16-system and arranging them in reverse order can be used as the Subnet identifier of the Subnet 3. In addition, the integer number (int) which is arranged to form an N-system number and then converted into a 10-system number can be used as the final subnet identification, for example, "0 x 11" determined above can be converted from a 16-system number into a 10-system number "17" to be used as the subnet identification of the subnet3, so as to be compatible with different block link point systems.
In the above embodiment, according to the fact that the parameters in the second network tag are not carried after being converted into the N-ary, therefore, each parameter in the second network label corresponds to one digit in the generated N-ary subnet identification, however, in some application scenarios, the number of subnets of a certain level is often large, at this time, the value of the parameter for indicating the level branch node is often large, therefore, after the conversion into the N-ary system, a carry may occur, which results in that the specific parameter in the second network tag corresponds to more than two digits in the generated N-ary subnet identifier, and at this time, considering that the generation of the subnet identifier needs to ensure global uniqueness, therefore, the upper limit of each parameter in all the network tags in the tree system can be uniformly specified in advance, therefore, when a specific N-ary number is generated for any parameter, the number of digits of the generated N-ary number generated for the parameter is defined according to the upper limit of the parameter. For example, assume that the second network label is "0.31.32", where the upper limit of the first-bit parameter from left to right is 1, the upper limit of the second-bit parameter is 32, and the upper limit of the third-bit parameter is 64, so that after converting it into 16-bit system, the first-bit parameter thereof needs 1-bit 16-bit system number to be represented, and the second-bit and third-bit parameters need at least 2-bit 16-bit system number to be represented, so that the 16-bit number "0 x201F 0" formed by converting 0, 31, and 32 into 16-bit system and arranging them in reverse order is used as the subnet identifier of subnet 3.
In the embodiment of the present specification, a concept of a network tag is introduced when a second blockchain network is added to a first blockchain network, and a subnet identifier is generated by the formed second network tag and allocated to the second blockchain network, so that it can be ensured that the generated subnet identifier has global uniqueness, which is caused by the combined action of the following four factors: firstly, the unique corresponding interconversion can be carried out between the subnet identification and the network label according to a preset rule; the second network tag is formed by adding a new parameter on the basis of the first network tag, which means that the number of parameters of the network tags of the blockchain network between different levels is different inevitably, so that the generated second network tag is different from the network tags of the blockchain network of the second blockchain network at different levels; third, the blockchain network at the same level as the second blockchain network has the same number of parameters as the second network tag, these network tags can be classified into two types, one is a network tag of a blockchain network corresponding to a child node of a first blockchain network, and the other is a network tag of a blockchain corresponding to a child node of another blockchain network at the same network level (equal generation number from the root node) as the first blockchain network, because the second network tag is formed on the basis of the first network tag, the parameter characteristics of the first network label are reserved, the first network label is different from the network labels of other blockchain networks of the same network level of the first blockchain network, therefore, the generated second network tag is ensured to be different from the network tags of the block chains corresponding to the sub-nodes of other block chain networks of the first block chain network in the same network level; and fourthly, because the value of the second network label on the newly added first parameter is different from the existing sub-node of the first block chain network, the generated second network label is ensured to be different from the network label of the block chain network corresponding to the sub-node of the first block chain network.
Optionally, the combining the first network tag corresponding to the first blockchain network with the first parameter to form the second network tag corresponding to the second blockchain network includes:
if the transaction contains a first parameter, combining a first network tag corresponding to the first blockchain network and the first parameter contained in the transaction to form a second network tag corresponding to the second blockchain network under the condition that the value of the first parameter contained in the transaction is different from the value of the network tag corresponding to the blockchain network corresponding to the existing sub-node of the first blockchain network on the first parameter;
and if the transaction contains the subnet identification to be configured, converting the subnet identification to be configured to obtain a corresponding network label to be configured, wherein the network label to be configured contains a first network label, and the network label to be configured is used as a second network label under the condition that the value of a first parameter of the network label to be configured is different from the existing sub-node of the first block chain network.
In this embodiment of the present specification, the transaction may include a first parameter or a subnet identifier to be configured, and when the first parameter or the subnet identifier to be configured meets a requirement for ensuring global uniqueness of the second network tag, the second network tag is specified through the transaction.
Taking the procedure of building subnet2 by subnet0 in fig. 4 as an example, assuming that subnet1 is already built and subnet2 is not yet built at this time, the first blockchain network is subnet0, the second blockchain network is subnet2, and the existing sub-node of the first blockchain network is subnet 1. When nodeA on subnet0 acquires a transaction to add subnet2 as a child node of subnet0, nodeA responds to the transaction and invokes execution of a Subnet contract on Subnet0, which, when executed, firstly, the self-maintenance contract state is read to know that the network label of the subnet0 is '0', then the self-maintenance subnet contract state of the subnet1 is continuously read, the subnet contract state includes subnet identification and network tag of subnet1, assuming that the network tag of subnet1 is "0.1", therefore, the value of the network tag of the subnet1 on the first parameter is 1, and then the network tag to be configured carried in the read transaction is "0.5", the network label to be configured contains a value of a first parameter of 5, which is different from the value of subnet1 on the first parameter, therefore, "0.5" formed by combining the first network tag "0" with the first parameter "5" in the network tag to be configured carried by the transaction can be used as the network tag (second network tag) corresponding to subnet 2. Or, when the transaction includes the subnet identifier to be configured as "0 x 30", first converting the transaction into the network tag "0.3" to be configured according to a preset conversion rule, and then determining whether the network tag "0" of the subnet0 is included in the network tag to be configured according to the network tags of the subnet0 and the subnet1, and a value 3 on the first parameter is different from a value 1 of the subnet1 on the first parameter, so that the converted network tag "0.3" to be configured may be used as the second network tag, and subsequently, when the subnet identifier is generated based on the second network tag and allocated to the second blockchain network subnet2, the subnet identifier "0 x 30" to be configured carried by the transaction may be directly used as the subnet identifier of the subnet2 and allocated to the subnet 2.
In an embodiment of this specification, an intelligent contract is deployed in any block chain network in the tree system, and a network tag of the any block chain network and subnet information of the block chain network corresponding to a child node of the any block chain network are recorded in a contract state of the intelligent contract deployed in the any block chain network, where the subnet information includes a subnet identifier and a network tag. In an embodiment, the intelligent contract is the system contract, as described above, when the block link point in the first block link network forms the second network tag in response to the transaction, the first network tag corresponding to the first block link network and the subnet information, including the network tag, of the block link network corresponding to the existing child node of the first block link network are recorded in the contract state of the intelligent contract of the first block link network, after the second block link network is added, the subnet information of the second block link network is also added to the intelligent contract of the first block link network, and at the same time, the second block link network also deploys the intelligent contract and records the second network tag corresponding to the second block link network and the generated subnet identifier in the contract state of the intelligent contract of the second block link network.
FIG. 6 is a schematic block diagram of an apparatus provided in an exemplary embodiment. Referring to fig. 6, at the hardware level, the apparatus includes a processor 602, an internal bus 604, a network interface 606, a memory 608 and a non-volatile memory 610, but may also include hardware required for other services. One or more embodiments of the present description may be implemented in software, such as by processor 602 reading corresponding computer programs from non-volatile memory 610 into memory 608 and then executing. Of course, besides software implementation, the one or more embodiments in this specification do not exclude other implementations, such as logic devices or combinations of software and hardware, and so on, that is, the execution subject of the following processing flow is not limited to each logic unit, and may also be hardware or logic devices.
Fig. 7 is a block diagram of an apparatus for assigning subnet identifications, which may be applied to the device shown in fig. 6 to implement the technical solution of the present specification, where the apparatus is applied to a blockchain node in a first blockchain network, the first blockchain network is included in a tree system that uses a blockchain main network as a root node and each blockchain sub-network is respectively another node, and any blockchain sub-network in the tree system is managed by a blockchain network corresponding to its parent node, and the apparatus includes:
a transaction obtaining module 701, configured to obtain a transaction for adding the second blockchain network as a child node of the first blockchain network;
a tag formation module 702, configured to combine, in response to the transaction, a first network tag corresponding to the first blockchain network with the first parameter to form a second network tag corresponding to the second blockchain network; the value of the second network label on the first parameter is different from the existing sub-node of the first block chain network;
an identifier generating module 703 is configured to generate a subnet identifier based on the second network tag, and allocate the generated subnet identifier to the second blockchain network.
Alternatively to this, the first and second parts may,
the transaction is a transaction for establishing a second blockchain network based on the first blockchain network, or
The transaction is a transaction for registering the established second blockchain network as a child node of the first blockchain network.
Alternatively to this, the first and second parts may,
when the transaction is a transaction for establishing a second blockchain network based on the first blockchain network, the transaction contains configuration information of the second blockchain network, and the configuration information comprises identity information of node members participating in establishing the second blockchain network; generating a creation block containing the configuration information, a second network tag and the generated subnet identification based on the transaction by using the block link point of the first blockchain network, the identity information of which is contained in the configuration information, and starting a block link point belonging to a second blockchain network based on the creation block so as to add the second blockchain network as a child node of the first blockchain network;
when the transaction is a transaction in which the established second blockchain network is registered as a sub-node of the first blockchain network, the transaction includes identity information of the second blockchain network; and when the block chain nodes in the first block chain network execute the transactions respectively, acquiring the identity information of the second block chain network from the transactions, and associating and storing the acquired identity information of the second block chain network with the generated subnet identification so as to add the second block chain network as a child node of the first block chain network.
Optionally, a value of the second network tag on the first parameter is a sum of a first value and a second value, the first value is a preset fixed value, and the second value is a value of a network tag corresponding to a blockchain network corresponding to a newly added subnode among existing subnodes of the first blockchain network on the first parameter.
Optionally, the second network tag is formed by splicing the first network tag and the first parameter according to a predetermined sequence.
Optionally, the identifier generating module 703 generates the subnet identifier based on the second network tag, including:
arranging N-system numbers obtained by respectively converting values of all parameters in the second network tag according to a preset sequence, and generating the N-system numbers formed by arrangement as the subnet identifications, wherein N is an integer not less than 2; or
And arranging N-system numbers obtained by respectively converting the values of the parameters except the network tag corresponding to the block link main network in the second network tag according to a preset sequence, and generating the N-system numbers formed by arrangement as the subnet identification, wherein N is an integer not less than 2.
Optionally, the label forming module 702 is specifically configured to:
if the transaction contains a first parameter, combining a first network tag corresponding to the first blockchain network and the first parameter contained in the transaction to form a second network tag corresponding to the second blockchain network under the condition that the value of the first parameter contained in the transaction is different from the value of the network tag corresponding to the blockchain network corresponding to the existing sub-node of the first blockchain network on the first parameter;
and if the transaction contains the subnet identification to be configured, converting the subnet identification to be configured to obtain a corresponding network label to be configured, wherein the network label to be configured contains a first network label, and the network label to be configured is used as a second network label under the condition that the value of a first parameter of the network label to be configured is different from the existing sub-node of the first block chain network.
Optionally, an intelligent contract is deployed in any block chain network in the tree system, and a network tag of any block chain network and subnet information of the block chain network corresponding to a child node of any block chain network are recorded in a contract state of the intelligent contract deployed in any block chain network, where the subnet information includes a subnet identifier and a network tag.
Optionally, the transaction for adding the second blockchain network as a child node of the first blockchain network includes a transaction that invokes a contract.
Optionally, the contracts include startup contracts or system contracts.
Optionally, the contract is created and maintained with a contract state of the second blockchain network according to the transaction, and the contract state includes the second network tag and the generated subnet identifier.
Alternatively to this, the first and second parts may,
the transaction is initiated by an administrator of the first blockchain network; alternatively, the first and second electrodes may be,
the transaction is initiated by a normal user of the first blockchain network.
Optionally, the first block chain network is a block chain master network corresponding to a root node in the tree system; or, the first block chain network is a block chain sub-network corresponding to other nodes except the root node in the tree system.
Correspondingly, the present specification also provides an apparatus comprising a processor; a memory for storing processor-executable instructions; wherein the processor is configured to implement the steps of the method for assigning subnet identifications provided by all of the above method embodiments.
Accordingly, the present specification also provides a computer readable storage medium having executable instructions stored thereon; wherein the instructions, when executed by the processor, implement the steps of the method for assigning subnet identifications provided by all of the above method embodiments.
For the device embodiments, since they substantially correspond to the method embodiments, reference may be made to the partial description of the method embodiments for relevant points. The above-described embodiments of the apparatus are merely illustrative, wherein the modules described as separate parts may or may not be physically separate, and the parts displayed as modules may or may not be physical modules, may be located in one place, or may be distributed on a plurality of network modules. Some or all of the modules can be selected according to actual needs to achieve the purpose of the solution in the specification. One of ordinary skill in the art can understand and implement it without inventive effort.
The systems, devices, modules or units illustrated in the above embodiments may be implemented by a computer chip or an entity, or by a product with certain functions. One typical implementation device is a computer. In particular, the computer may be, for example, a personal computer, a laptop computer, a cellular telephone, 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.
For convenience of description, the above devices are described as being divided into various units by function, and are described separately. Of course, the functions of the various elements may be implemented in the same one or more software and/or hardware implementations of the present description.
As will be appreciated by one skilled in the art, embodiments of the present invention may be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
This description may be described in the general context of computer-executable instructions, such as program modules, being executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform particular tasks or implement particular abstract data types. The specification may also be practiced in distributed computing environments where tasks are performed by remote processing devices that are linked through a communications network. In a distributed computing environment, program modules may be located in both local and remote computer storage media including memory storage devices.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks. In a typical configuration, a computer includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include forms of volatile memory in a computer readable medium, Random Access Memory (RAM) and/or non-volatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM). Memory is an example of a computer-readable medium.
Computer-readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), Read Only Memory (ROM), Electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), Digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic disk storage, quantum memory, graphene-based storage media or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device. As defined herein, a computer readable medium does not include a transitory computer readable medium such as a modulated data signal and a carrier wave.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
The foregoing description has been directed to specific embodiments of this disclosure. Other embodiments are within the scope of the following claims. In some cases, the actions or steps recited in the claims may be performed in a different order than in the embodiments and still achieve desirable results. In addition, the processes depicted in the accompanying figures do not necessarily require the particular order shown, or sequential order, to achieve desirable results. In some embodiments, multitasking and parallel processing may also be possible or may be advantageous.
The terminology used in the description of the one or more embodiments is for the purpose of describing the particular embodiments only and is not intended to be limiting of the description of the one or more embodiments. As used in one or more embodiments of the present specification and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It should also be understood that the term "and/or" as used herein refers to and encompasses any and all possible combinations of one or more of the associated listed items.
It should be understood that although the terms first, second, third, etc. may be used in one or more embodiments of the present description to describe various information, such information should not be limited to these terms. These terms are only used to distinguish one type of information from another. For example, first information may also be referred to as second information, and similarly, second information may also be referred to as first information, without departing from the scope of one or more embodiments herein. The word "if" as used herein may be interpreted as "at … …" or "when … …" or "in response to a determination", depending on the context.
The above description is only for the purpose of illustrating the preferred embodiments of the one or more embodiments of the present disclosure, and is not intended to limit the scope of the one or more embodiments of the present disclosure, and any modifications, equivalent substitutions, improvements, etc. made within the spirit and principle of the one or more embodiments of the present disclosure should be included in the scope of the one or more embodiments of the present disclosure.

Claims (14)

1. A method for distributing subnet identification is applied to block chain link points in a first block chain network, the first block chain network is included in a tree system which takes a block chain main network as a root node and each block chain sub-network as other nodes, and any block chain subnet in the tree system is managed by a block chain network corresponding to a father node of the block chain subnet, the method comprises the following steps:
obtaining a transaction for adding a second blockchain network as a child node of the first blockchain network; when the transaction is a transaction for establishing a second blockchain network based on the first blockchain network, the transaction contains configuration information of the second blockchain network, and the configuration information comprises identity information of node members participating in establishing the second blockchain network; when the configuration information contains identity information of node members corresponding to the first block chain link point, the node equipment deploying the first block chain node generates an appearance creation block containing the configuration information, a second network label and the generated subnet identification based on the transaction, and starts a block chain link point belonging to a second block chain network based on the appearance creation block so as to add the second block chain network as a child node of the first block chain network;
when the transaction is a transaction in which the established second blockchain network is registered as a sub-node of the first blockchain network, the transaction includes identity information of the second blockchain network; when the block chain nodes in the first block chain network execute the transactions respectively, acquiring the identity information of the second block chain network from the transactions, and associating and storing the acquired identity information of the second block chain network with the generated subnet identification so as to add the second block chain network as a child node of the first block chain network;
in response to the transaction, combining a first network tag corresponding to the first blockchain network with the first parameter to form a second network tag corresponding to the second blockchain network; the value of the second network label on the first parameter is different from the existing sub-node of the first block chain network;
and generating a subnet identification based on the second network label, and distributing the generated subnet identification to the second blockchain network.
2. The method according to claim 1, wherein a value of the second network tag on the first parameter is a sum of a first value and a second value, the first value is a preset fixed value, and the second value is a value of a network tag on the first parameter, where the network tag corresponds to a blockchain network corresponding to a newly added subnode among existing subnodes of the first blockchain network.
3. The method of claim 1, wherein the second network tag is a tag formed by splicing the first network tag and the first parameter in a predetermined order.
4. The method of claim 1, the generating a subnet identification based on the second network tag, comprising:
arranging N-system numbers obtained by respectively converting values of all parameters in the second network tag according to a preset sequence, and generating the N-system numbers formed by arrangement as the subnet identifications, wherein N is an integer not less than 2; or
And arranging N-system numbers obtained by respectively converting the values of the parameters except the network tag corresponding to the block link main network in the second network tag according to a preset sequence, and generating the N-system numbers formed by arrangement as the subnet identification, wherein N is an integer not less than 2.
5. The method of claim 1, the combining a first network tag corresponding to a first blockchain network with a first parameter to form a second network tag corresponding to a second blockchain network, comprising:
if the transaction contains a first parameter, combining a first network tag corresponding to the first blockchain network and the first parameter contained in the transaction to form a second network tag corresponding to the second blockchain network under the condition that the value of the first parameter contained in the transaction is different from the value of the network tag corresponding to the blockchain network corresponding to the existing sub-node of the first blockchain network on the first parameter;
and if the transaction contains the subnet identification to be configured, converting the subnet identification to be configured to obtain a corresponding network label to be configured, wherein the network label to be configured contains a first network label, and the network label to be configured is used as a second network label under the condition that the value of a first parameter of the network label to be configured is different from the existing sub-node of the first block chain network.
6. The method according to claim 1, wherein an intelligent contract is deployed in any blockchain network in the tree system, and a network tag of the any blockchain network and subnet information of the blockchain network corresponding to a subnode of the any blockchain network are recorded in a contract state of the intelligent contract deployed in the any blockchain network, and the subnet information includes a subnet identifier and a network tag.
7. The method of claim 1, the transaction for adding a second blockchain network as a child of a first blockchain network comprising a transaction invoking a contract.
8. The method of claim 7, the contract comprising a startup contract or a system contract.
9. The method of claim 7, the contract created from the transaction and maintained with a contract state for a second blockchain network, the contract state including a second network tag and the generated subnet identification.
10. The method of claim 1, wherein the first and second light sources are selected from the group consisting of,
the transaction is initiated by an administrator of the first blockchain network; alternatively, the first and second electrodes may be,
the transaction is initiated by a normal user of the first blockchain network.
11. The method of claim 1, wherein the first blockchain network is a blockchain master network corresponding to a root node in the tree system; or, the first block chain network is a block chain sub-network corresponding to other nodes except the root node in the tree system.
12. A device for distributing subnet identification is applied to block chain link points in a first block chain network, the first block chain network is included in a tree system which takes a block chain main network as a root node and each block chain sub-network as other nodes, and any block chain subnet in the tree system is managed by a block chain network corresponding to a father node of the block chain subnet, the device comprises:
a transaction acquisition module for acquiring a transaction for adding the second blockchain network as a child node of the first blockchain network; when the transaction is a transaction for establishing a second blockchain network based on the first blockchain network, the transaction contains configuration information of the second blockchain network, and the configuration information comprises identity information of node members participating in establishing the second blockchain network; when the configuration information contains identity information of node members corresponding to the first block chain link point, the node equipment deploying the first block chain node generates an appearance creation block containing the configuration information, a second network label and the generated subnet identification based on the transaction, and starts a block chain link point belonging to a second block chain network based on the appearance creation block so as to add the second block chain network as a child node of the first block chain network;
when the transaction is a transaction in which the established second blockchain network is registered as a sub-node of the first blockchain network, the transaction includes identity information of the second blockchain network; when the block chain nodes in the first block chain network execute the transactions respectively, acquiring the identity information of the second block chain network from the transactions, and associating and storing the acquired identity information of the second block chain network with the generated subnet identification so as to add the second block chain network as a child node of the first block chain network;
a tag formation module to combine a first network tag corresponding to the first blockchain network with the first parameter to form a second network tag corresponding to the second blockchain network in response to the transaction; the value of the second network label on the first parameter is different from the existing sub-node of the first block chain network;
and the identifier generating module is used for generating a subnet identifier based on the second network tag and distributing the generated subnet identifier to the second blockchain network.
13. An electronic device, comprising:
a processor;
a memory for storing processor-executable instructions;
wherein the processor implements the method of any one of claims 1-11 by executing the executable instructions.
14. A computer-readable storage medium having stored thereon computer instructions, which, when executed by a processor, carry out the steps of the method according to any one of claims 1-11.
CN202110611567.2A 2021-06-02 2021-06-02 Method and device for distributing subnet identification, electronic equipment and storage medium Active CN113067914B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110611567.2A CN113067914B (en) 2021-06-02 2021-06-02 Method and device for distributing subnet identification, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110611567.2A CN113067914B (en) 2021-06-02 2021-06-02 Method and device for distributing subnet identification, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN113067914A CN113067914A (en) 2021-07-02
CN113067914B true CN113067914B (en) 2021-08-17

Family

ID=76568506

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110611567.2A Active CN113067914B (en) 2021-06-02 2021-06-02 Method and device for distributing subnet identification, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN113067914B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114254395B (en) * 2022-03-01 2022-05-06 南开大学 Content-publishing-oriented consensus formation method for autonomous network
CN115086319A (en) * 2022-06-13 2022-09-20 杭州复杂美科技有限公司 Multi-subnet blockchain network, transaction broadcasting method and device thereof, and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102014377A (en) * 2011-01-06 2011-04-13 常熟理工学院 Distributed wireless sensor network-based IPv6 address configuration implementing method
WO2018176406A1 (en) * 2017-03-31 2018-10-04 北京大学深圳研究生院 Top-level domain name management method and system based on alliance chain
CN109639550A (en) * 2018-12-06 2019-04-16 北京磁云数字科技有限公司 A kind of multi-tiling chain network network-building method, apparatus and system
CN110505223A (en) * 2019-08-15 2019-11-26 腾讯科技(深圳)有限公司 Block chain multichain management method and device

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107528886B (en) * 2017-07-25 2020-07-31 中国科学院计算技术研究所 Block chain full-network splitting method and system

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102014377A (en) * 2011-01-06 2011-04-13 常熟理工学院 Distributed wireless sensor network-based IPv6 address configuration implementing method
WO2018176406A1 (en) * 2017-03-31 2018-10-04 北京大学深圳研究生院 Top-level domain name management method and system based on alliance chain
CN109639550A (en) * 2018-12-06 2019-04-16 北京磁云数字科技有限公司 A kind of multi-tiling chain network network-building method, apparatus and system
CN110505223A (en) * 2019-08-15 2019-11-26 腾讯科技(深圳)有限公司 Block chain multichain management method and device

Also Published As

Publication number Publication date
CN113067914A (en) 2021-07-02

Similar Documents

Publication Publication Date Title
CN113067904B (en) Method for building block chain sub-network and block chain system
CN113067895B (en) Method for building block chain sub-network and block chain system
CN113098983B (en) Task execution method and device based on intelligent contract
CN113098982B (en) Block chain message transmission method and device
CN113067897B (en) Cross-chain interaction method and device
CN113067914B (en) Method and device for distributing subnet identification, electronic equipment and storage medium
CN113259457B (en) Information synchronization method and device for block chain sub-network
CN113067899B (en) Method and device for starting/closing block link point service
CN113259458B (en) Method and device for starting/closing block link point service
CN113067896B (en) Method for adding node in block chain sub-network and block chain system
CN113326290B (en) Cross-network query control method
CN113259120B (en) Method for synchronizing node information lists
CN113067898B (en) Method for scheduling computing services for business process contracts
CN113259466B (en) Block chain subnet operation state control method and block chain system
CN113259459B (en) Block chain subnet operation state control method and block chain system
CN113259462B (en) Block chain message distribution method and device
CN113259119B (en) Block chain message distribution method and device
CN113259465B (en) Business execution method based on off-chain computing service
CN113259237B (en) Transaction forwarding method between block chain networks
CN115086338A (en) Block chain subnet building method and device
CN114363162A (en) Block chain log generation method and device, electronic equipment and storage medium
CN113259236A (en) Transaction forwarding method between block chain networks
CN114363349B (en) Block chain sub-network starting method and device
CN113098984B (en) Method for forming multi-layer block chain system based on registration mechanism and block chain system
CN114297171A (en) Account data reading and writing method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant