Communication method and system based on alliance block chain, and alliance block chain
By dividing nodes into consensus nodes, communication nodes and hierarchical node groups in the alliance blockchain network, and using hierarchical broadcasting method, the problem of optimization of communication performance of alliance blockchain network is solved, and the effect of improving consensus efficiency and reducing message redundancy is achieved.
Patent Information
- Application Number
- CN202311369706.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-10-20
- Publication Date
- 2025-04-22
AI Technical Summary
How to optimize the communication performance of the alliance blockchain network, especially when messaging between multiple blockchain nodes, avoid network blocking and consensus performance degradation.
By dividing blockchain nodes into consensus nodes, communication nodes and hierarchical node groups, the node groups at each level are determined based on the sorting and number of nodes of other blockchain nodes. The consensus node sends messages to the communication nodes, and the communication nodes then broadcast them layer by layer to the first node of each level.
It effectively avoids consensus node network blockage, improves consensus efficiency, reduces message redundancy, and meets practical application needs.
Smart Images

Figure CN119865296A_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of computer technology and may involve fields such as blockchain. Specifically, the present application relates to a communication method and system based on alliance blockchain, and an alliance blockchain. Background Art
[0002] Blockchain is a new application model of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanism, encryption algorithm, etc. As blockchain technology becomes more and more mature, consortium blockchain network has also emerged. The difference between consortium blockchain network and traditional blockchain network is that participants in consortium blockchain network need to undergo specific identity authentication before joining the chain.
[0003] The number of nodes connected to the alliance blockchain network can range from dozens to hundreds or even thousands. When synchronizing messages in the alliance blockchain network, messages need to be propagated between multiple blockchain nodes. Therefore, how to optimize the communication performance of the alliance blockchain network is one of the important issues that need to be improved. Summary of the invention
[0004] The embodiment of the present application provides a communication method and system based on alliance blockchain, and alliance blockchain, which can optimize the communication performance of alliance blockchain. The technical solution is as follows:
[0005] On the one hand, an embodiment of the present application provides a communication method based on a consortium blockchain, wherein the consortium blockchain includes multiple blockchain nodes, the multiple blockchain nodes include a consensus node, at least one communication node, and at least one node group of each level, the node group of each level includes multiple first nodes, the node group of each level is determined based on the ranking of each other blockchain node and the number of nodes of each level, the number of nodes of each level is determined based on the total number of nodes of the consortium blockchain and the number of concurrent nodes corresponding to the consortium blockchain, and the other blockchain nodes are blockchain nodes in the consortium blockchain other than the consensus node and the communication node;
[0006] The method comprises:
[0007] When the consensus node obtains the message to be broadcast, it establishes a connection with the at least one communication node and sends the message to the at least one communication node;
[0008] When any communication node receives the message, it establishes a connection with each first node corresponding to the communication node in the first level, and sends the received message to each first node corresponding to the first level;
[0009] When receiving the message, the first node of any level establishes a connection with the first nodes corresponding to the first node in the next level of the level, and sends the message to the first nodes corresponding to the next level.
[0010] On the other hand, an embodiment of the present application provides a communication system based on a consortium blockchain, the system comprising:
[0011] The first processing module is deployed in the consensus node, and is used to establish a connection with the communication node when obtaining a message to be broadcast, and send the message to the at least one communication node; wherein the alliance blockchain network includes multiple blockchain nodes, the multiple blockchain nodes include a consensus node, a communication node, and a node group of at least one level, each node group of each level includes multiple first nodes, the node group of each level is determined based on the sorting results of each other blockchain node and the number of nodes of each level, and the sorting results at least include the sorting based on the node identifier; the number of nodes of each level is determined based on the total number of nodes of the alliance blockchain and the number of concurrent nodes corresponding to the alliance blockchain; the other blockchain nodes are blockchain nodes in the alliance blockchain except the consensus node and the communication node;
[0012] A second processing module, deployed in the communication node, is used to establish a connection with each first node corresponding to the communication node in the first level when receiving the message, and send the received message to each first node corresponding to the first level;
[0013] The third processing module is deployed in each first node of each level, and is used to establish a connection with the first nodes corresponding to the first node in the next level of the level when receiving the message, and send the message to the corresponding first nodes in the next level.
[0014] Optionally, the multiple blockchain nodes further include multiple second nodes, and the third processing module is further used to:
[0015] When the first node of the last level receives the message, the message is sent to a first preset number of randomly selected second nodes, so that the second node receiving the message sends the message to other randomly selected second nodes.
[0016] Optionally, the third processing module is used to: for each first node of any level, when the first node receives the message, determine each first node corresponding to the first node in the next level, and establish a connection with each first node corresponding to the first node in the next level;
[0017] The first node determines the first nodes corresponding to the first node in the next level in the following manner:
[0018] Determine the target number of first nodes of the next layer corresponding to each first node of the layer according to the number of nodes of the layer and the number of nodes of the next layer of the layer;
[0019] Sort the first nodes at each level according to the node identifiers of the first nodes at each level;
[0020] According to the order of the first node among the first nodes of the level and the order among the first nodes of the next level of the level, the target number of first nodes corresponding to the first node are determined from the first nodes of the next level of the level, and connections are established with the determined corresponding first nodes.
[0021] Optionally, the number of levels of the at least one level and the number of nodes in each level are determined in the following manner:
[0022] Determining the total number of nodes of any one of the consortium blockchains;
[0023] If the total number of nodes is not greater than a first threshold, determining the number of levels as a first number;
[0024] Determine a target number range to which the total number of nodes belongs among multiple candidate number ranges;
[0025] According to the target number range, determine the number of concurrent nodes corresponding to any alliance blockchain, where the number of concurrent nodes is the number of first nodes of the next level corresponding to the first node of any level;
[0026] The number of nodes at each level is determined according to the concurrent number of nodes and the total number of nodes.
[0027] Optionally, the second processing module is used for:
[0028] When receiving the message, determining a first broadcast mode corresponding to the message according to first broadcast reference information, where the first broadcast reference information includes at least one of a message type of the message or a total number of nodes of any one of the alliance blockchains;
[0029] If the first broadcast mode is a target broadcast mode, a connection is established with each first node corresponding to the communication node in the first level, and the received message is sent to each first node corresponding to the first level.
[0030] Optionally, the second processing module is used for:
[0031] According to the first broadcast reference information and the first mapping relationship, a first broadcast mode corresponding to the message is determined from at least two message broadcast modes, wherein the first mapping relationship includes a correspondence between each broadcast reference information in at least two broadcast reference information and the message broadcast mode.
[0032] Optionally, the second processing module is used for:
[0033] When receiving the message, determining second broadcast reference information of the received message, where the second broadcast reference information includes at least one of a message type of the message or a total number of nodes of any one of the consortium blockchains;
[0034] According to the second broadcast reference information and the second mapping relationship, a target broadcast hierarchical architecture corresponding to the message is determined from at least two broadcast hierarchical architectures, wherein the second mapping relationship includes a correspondence between each reference information of at least two broadcast reference information and a broadcast hierarchical architecture, and at least one of the following information corresponding to different broadcast hierarchical architectures is different:
[0035] The number of levels of the at least one level; the number of nodes of the at least one level;
[0036] Establish connections with the communication nodes and the first nodes corresponding to the first level of the target broadcast hierarchy architecture, and send the received messages to the first nodes corresponding to the first level of the target broadcast hierarchy architecture.
[0037] Optionally, the consensus node is obtained by electing from multiple super nodes of the alliance blockchain based on a first consensus mechanism, and the multiple super nodes are obtained by electing from multiple blockchain nodes of the alliance blockchain based on a second consensus mechanism; the communication node is obtained by electing from other super nodes in the alliance blockchain except the consensus node based on a third consensus mechanism.
[0038] Optionally, the first nodes of other levels except the last level in the alliance blockchain are elected from the other blockchain nodes based on the fourth consensus mechanism.
[0039] Optionally, for any first node at any level, the third processing module is further used to:
[0040] When the first node fails to send a message to any first node corresponding to the first node at a next level, determining first nodes corresponding to the any first node at a next level;
[0041] The first node establishes a connection with each first node corresponding to any of the first nodes in the next layer, and sends the message to each first node corresponding to any of the first nodes in the next layer.
[0042] Optionally, the information to be broadcast is obtained by synchronizing the consensus node in the alliance blockchain with consensus nodes in other alliance blockchains in the alliance blockchain network.
[0043] On the other hand, an embodiment of the present application further provides a consortium blockchain, wherein the consortium blockchain includes multiple blockchain nodes, the multiple blockchain nodes include a consensus node, at least one communication node, and at least one node group of each level, the node group of each level includes multiple first nodes, the node group of each level is determined based on the sorting results of each other blockchain node and the number of nodes of each level, and the sorting results at least include the sorting based on the node identifier; the number of nodes of each level is determined based on the total number of nodes of the consortium blockchain and the number of concurrent nodes corresponding to the consortium blockchain; the other blockchain nodes are blockchain nodes in the consortium blockchain other than the consensus node and the communication node;
[0044] in:
[0045] The consensus node is used to establish a connection with the communication node when obtaining a message to be broadcast, and send the message to the at least one communication node;
[0046] Any communication node is configured to, upon receiving the message, establish a connection with each first node corresponding to the communication node in the first level, and send the received message to each first node corresponding to the first level;
[0047] The first node of any level is used to establish a connection with each corresponding first node in the next level of the level when receiving the message, and send the message to each corresponding first node in the next level.
[0048] On the other hand, an embodiment of the present application further provides an electronic device, which includes a memory and a processor, wherein a computer program is stored in the memory, and the processor executes the computer program to implement the method provided in any optional embodiment of the present application.
[0049] On the other hand, an embodiment of the present application further provides a computer-readable storage medium, in which a computer program is stored. When the computer program is executed by a processor, the method provided in any optional embodiment of the present application is implemented.
[0050] On the other hand, an embodiment of the present application further provides a computer program product, which includes a computer program, and when the computer program is executed by a processor, it implements the method provided in any optional embodiment of the present application.
[0051] The beneficial effects of the technical solution provided by the embodiment of the present application are as follows:
[0052] In the solution provided by the embodiment of the present application, in the alliance blockchain, the blockchain nodes are divided into consensus nodes, communication nodes and the first nodes of each level. When the consensus node obtains the message to be broadcast, it is sent by the consensus node to the communication node, and the communication node broadcasts the message in layers to the first nodes of each level, which can avoid network congestion of the consensus node, prevent the decline of consensus performance, and improve consensus efficiency. In addition, it avoids the message redundancy caused by the same node receiving repeated messages multiple times, so it can better meet the actual application needs. BRIEF DESCRIPTION OF THE DRAWINGS
[0053] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in describing the embodiments of the present application are briefly introduced below.
[0054] Figure 1A A schematic diagram of the structure of a blockchain network provided in an embodiment of the present application;
[0055] Figure 1B A schematic diagram of the structure of a blockchain provided in an embodiment of the present application;
[0056] Figure 2 A schematic diagram of a consortium blockchain network provided in an embodiment of the present application;
[0057] Figure 3 A schematic diagram of communication between consensus nodes in a consortium blockchain network provided in an embodiment of the present application;
[0058] Figure 4 A flowchart of a communication method based on a consortium blockchain provided in an embodiment of the present application;
[0059] Figure 5 A schematic diagram of a correspondence between a communication node and a first node provided in an embodiment of the present application;
[0060] Figure 6 A schematic diagram of a node communication scenario provided in an embodiment of the present application;
[0061] Figure 7 A schematic diagram of the structure of a consortium blockchain provided in an embodiment of the present application;
[0062] Figure 8 A schematic diagram of the structure of a communication system based on a consortium blockchain provided in an embodiment of the present application;
[0063] Fig. 9 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0064] The embodiments of the present application are described below in conjunction with the drawings in the present application. It should be understood that the implementation methods described below in conjunction with the drawings are exemplary descriptions for explaining the technical solutions of the embodiments of the present application and do not constitute a limitation on the technical solutions of the embodiments of the present application.
[0065] It will be understood by those skilled in the art that, unless specifically stated, the singular forms "one", "said", and "the" used herein may also include plural forms. It should be further understood that the terms "including" and "comprising" used in the embodiments of the present application refer to that the corresponding features can be implemented as the presented features, information, data, steps, operations, elements and / or components, but do not exclude the implementation as other features, information, data, steps, operations, elements, components and / or combinations thereof supported by the technical field. It should be understood that when we say that an element is "connected" or "coupled" to another element, the one element may be directly connected or coupled to the other element, or it may refer to that the one element and the other element establish a connection relationship through an intermediate element. In addition, the "connection" or "coupling" used herein may include wireless connection or wireless coupling. The term "and / or" used herein indicates at least one of the items defined by the term, for example, "A and / or B" may be implemented as "A", or as "B", or as "A and B". When describing multiple (two or more) items, if the relationship between the multiple items is not clearly defined, the multiple items may refer to one, multiple or all of the multiple items. For example, the description of "parameter A includes A1, A2, A3" can be implemented as parameter A including A1 or A2 or A3, and can also be implemented as parameter A including at least two of the three items A1, A2, A3.
[0066] An embodiment of the present application provides a communication method based on a consortium blockchain. In the consortium blockchain, the method is adopted, whereby the communication node of the consortium blockchain receives messages from the consensus node and sends them in layers to the first nodes of each layer in the consortium blockchain, thereby avoiding network congestion at the consensus node resulting in a decrease in consensus performance, improving consensus efficiency, and avoiding message redundancy caused by the same node receiving repeated messages multiple times, thereby better meeting actual application needs.
[0067] Blockchain is a new application mode of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanism, encryption algorithm, etc. It has the characteristics of decentralization, tamper-proof, and traceability. Blockchain is essentially a decentralized database, a string of data blocks generated by cryptographic methods. Each data block contains a batch of network transaction information, which is used to verify the validity of its information (anti-counterfeiting) and generate the next block. In the blockchain, data can no longer be stored in a centralized hardware or management agency, but is jointly maintained by blockchain nodes with equal rights and obligations. Transaction data can be transmitted to each node through the network. The node can verify the validity of the transaction and count the corresponding block into its local blockchain if the verification is passed. Once the data is verified and added to the blockchain, it can be permanently stored. The consensus algorithm and hash chain data storage can be used to achieve data non-tampering in time, thereby ensuring the security and authenticity of the data.
[0068] For example, in Figure 1A The blockchain network 100 shown may include multiple nodes 101, and the multiple nodes 101 may be various electronic devices forming the blockchain network. Each node 101 can receive input information when performing normal work, and maintain the shared data in the blockchain network based on the received input information. In order to ensure the information intercommunication within the blockchain network, there may be an information connection between each node in the blockchain network, and information can be transmitted between nodes through the above information connection. For example, when any node in the blockchain network receives input information, other nodes in the blockchain network obtain the input information according to the consensus algorithm, and store the input information as data in the shared data, so that the data stored on all nodes in the blockchain network are consistent.
[0069] Each node in the blockchain network has a corresponding node identifier, and each node in the blockchain network can store the node identifiers of other nodes, so that the generated blocks can be broadcast to other nodes in the blockchain network according to the node identifiers of other nodes. Each node can maintain a node identifier list as shown in the following table. Among them, the node identifier can be an IP (Internet Protocol, a protocol for interconnecting networks) address or any other information that can be used to identify the node. Table 1 only uses the IP address as an example for illustration.
[0070] node Node ID Node 1 117.114.151.174 Node 2 117.116.189.145 … … Node N xx.xx.xx.xx
[0071] Table 1
[0072] Each node in the blockchain network stores the same blockchain. The blockchain consists of multiple blocks, see Figure 1BThe blockchain consists of multiple blocks. The genesis block includes a block header and a block body. The block header stores the input information characteristic value, version number, timestamp and difficulty value, and the block body stores the input information; the next block of the genesis block takes the genesis block as the parent block, and the next block also includes a block header and a block body. The block header stores the input information characteristic value of the current block, the block header characteristic value, version number, timestamp and difficulty value of the parent block, and so on, so that the block data stored in each block in the blockchain is associated with the block data stored in the parent block, ensuring the security of the input information in the block.
[0073] In the embodiments of the present application, the blockchain node may be an electronic device, such as a server, a user terminal, etc. Among them, the server may be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server providing cloud computing services. The user terminal may be a smart phone, a tablet computer, a laptop computer, a desktop computer, an intelligent voice interaction device (such as a smart speaker), a wearable electronic device (such as a smart watch), a vehicle-mounted terminal, a smart home appliance (such as a smart TV), an AR / VR device, etc., but is not limited thereto.
[0074] It should be noted that in the optional embodiments of the present application, the object information and other related data involved (such as the message to be broadcast is block information, and the block information contains the user's transaction information), when the embodiments in the present application are applied to specific products or technologies, it is necessary to obtain the permission or consent of the object, and the collection, use and processing of the relevant data need to comply with the relevant laws, regulations and standards of the relevant countries and regions. In other words, if the embodiments of the present application involve data related to the object, it needs to be obtained through the authorization and consent of the object, the authorization and consent of the relevant departments, and in compliance with the relevant laws, regulations and standards of the country and region. If personal information is involved in the embodiments, the acquisition of all personal information requires the consent of the individual. If sensitive information is involved, the separate consent of the information subject needs to be obtained. The embodiments also need to be implemented with the authorization and consent of the object.
[0075] In order to better understand and illustrate the method provided in the embodiments of the present application, some of the terms involved in the embodiments of the present application are explained below.
[0076] Blockchain node: A network node in a blockchain distributed system is an electronic device connected through a network, such as a server, user terminal, etc.
[0077] Alliance blockchain network: It can be jointly operated by many institutions or organizations, including multiple blockchain nodes, and each institution or organization can manage one or more blockchain nodes. Compared with traditional blockchain networks, participants in the alliance blockchain network need to undergo specific identity verification before joining.
[0078] Gossip protocol: Uses a random and contagious method to spread information to the entire network, and within a certain period of time, makes all nodes in the system consistent. A node randomly selects other nodes in the network to transmit information, and the node that receives the information continues to pass the information to other randomly selected nodes.
[0079] Figure 2 A schematic diagram of a consortium blockchain network provided in an embodiment of the present application is illustratively illustrated by taking the consortium blockchain network including four consortium blockchains as an example. Figure 2 The alliance blockchain network includes four alliance blockchains, namely alliance blockchain A, alliance blockchain B, alliance blockchain C and alliance blockchain D. Each alliance blockchain can correspond to different institutions or organizations. Alliance blockchain A includes blockchain nodes A1, A2, A3 and A4, alliance blockchain B includes blockchain nodes B1, B2 and B3, alliance blockchain C includes blockchain nodes C1, C2 and C3, and alliance blockchain D includes blockchain nodes D1, D2, D3 and D4.
[0080] In each alliance blockchain, there are multiple blockchain nodes. For any alliance blockchain, a super node can be elected from each blockchain node of the alliance blockchain based on the second consensus mechanism. For example, a delegated proof of stake (DPOS) mechanism is adopted to vote on each blockchain node of the alliance blockchain through an election system, and a second preset number of blockchain nodes with a higher number of votes are selected as super nodes. Among them, the second consensus mechanism adopted by different alliance blockchains when selecting super nodes can be the same or different. The selected super node can be responsible for the authorization and signature of various matters in the alliance blockchain, and the second preset number can be set as needed.
[0081] After determining multiple super nodes in the alliance blockchain, a consensus node can be elected from the multiple super nodes of the alliance blockchain based on the first consensus mechanism. The elected consensus node is responsible for block consensus on the entire alliance blockchain network.
[0082] For the consensus nodes in each alliance blockchain in the alliance blockchain network, each consensus node needs to reach a consensus on data (such as block transaction information) through network communication. The consensus process usually includes three stages: proposal stage, pre-submission stage and submission stage. In the proposal stage, the master consensus node needs to package the block containing all transactions into the proposal and send the proposal information to each slave consensus node. After receiving the proposal information, the slave consensus node needs to vote or reply to the proposal information. In the pre-submission and submission stages, each consensus node can send node status information, including the voting information collected in the proposal stage. Among them, the master consensus node is the node responsible for proposing new blocks in the alliance blockchain network. The master consensus node is not fixed and can be taken turns by the consensus nodes in each alliance blockchain. When a consensus node becomes the master consensus node, the other consensus nodes automatically become slave consensus nodes. The master consensus node proposes the new block, and the slave consensus node verifies and votes on the proposal of the new block. After consensus is reached between the consensus nodes, the consensus nodes of each alliance blockchain can notify other blockchain nodes in each alliance blockchain to upload the generated new block to the chain.
[0083] For example, Figure 3 As shown, node A4 in alliance blockchain A is a consensus node, node B3 in alliance blockchain B is a consensus node, node C2 in alliance blockchain C is a consensus node, and node D1 in alliance blockchain D is a consensus node. The consensus nodes of each alliance blockchain can communicate with each other, conduct block consensus, and synchronize messages to be broadcast.
[0084] The solution of the present application can be applied in the communication scenario between blockchain nodes in a consortium blockchain network, and specifically in the communication process between the consensus node in each consortium blockchain and other blockchain nodes in the consortium blockchain.
[0085] The following describes several embodiments to illustrate the technical solutions of the embodiments of the present application and the technical effects produced by the technical solutions of the present application. It should be noted that the following embodiments can refer to, draw on or combine with each other, and the same terms, similar features and similar implementation steps in different embodiments will not be described repeatedly.
[0086] In the embodiment of the present application, for any alliance blockchain in the alliance blockchain network, the communication method provided in the present application can be used to realize communication between nodes. For the convenience of description, a alliance blockchain in the alliance blockchain network is used as an example for detailed description.
[0087] For any alliance blockchain in the alliance blockchain network, in the alliance blockchain, one or more communication nodes can be elected from other super nodes except the consensus node based on the third consensus mechanism, which are responsible for receiving messages to be broadcast sent by other nodes and broadcasting them in layers to other blockchain nodes of the alliance blockchain.
[0088] like Figure 4 As shown, the communication method based on the alliance blockchain provided in the embodiment of the present application may include the following steps S110 to S130.
[0089] S110: When the consensus node obtains the message to be broadcast, it establishes a connection with at least one communication node and sends the message to the at least one communication node.
[0090] The consensus node in the alliance blockchain can be the main consensus node in the entire alliance blockchain network, or it can be a slave consensus node. The message to be broadcast can be generated by the consensus node or obtained from other consensus nodes. When the alliance blockchain network includes at least two alliance blockchains, the message to be broadcast is synchronized by the consensus nodes in at least two alliance blockchains. The message to be broadcast can include the status information of the consensus node, the height information of the block, etc. The status information of the consensus node can include the current consensus stage, consensus round, etc.
[0091] When the consensus node obtains the message to be broadcast, it can establish a peer-to-peer connection with the communication node in the alliance blockchain based on the peer-to-peer communication protocol and send the message to the communication node.
[0092] Optionally, the alliance blockchain may include one or more consensus nodes and one or more communication nodes. When there is only one consensus node in the alliance blockchain, the consensus node establishes a connection with each communication node in the alliance blockchain and sends a message to each communication node. When there are multiple consensus nodes in the alliance blockchain, for each consensus node in the alliance blockchain, one or more communication nodes corresponding to the consensus node can be determined based on the third mapping relationship, and the consensus node can be connected to the corresponding communication node and send a message to the corresponding communication node. Among them, the third mapping relationship contains the correspondence between the consensus node and the communication node in the alliance blockchain.
[0093] When there are too many communication nodes in the alliance network, the consensus node may establish a connection with each communication node in turn and send messages, which may cause network congestion in the consensus node, thereby causing the consensus performance to deteriorate. In order to avoid the above situation, the number of communication nodes in the embodiment of the present application is usually set to be less than the third preset number.
[0094] S120: When any communication node receives a message, it establishes a connection with each first node corresponding to the communication node in the first level, and sends the received message to each first node corresponding to the first level.
[0095] In the alliance blockchain, when a communication node receives a message, it can determine the first nodes corresponding to the communication node in the first level from the node group of the first level, establish a point-to-point connection with the first nodes corresponding to the first level, and send the received message to the first nodes of the first level corresponding to the communication node.
[0096] The first nodes corresponding to the communication nodes in the first level may be determined in the following manner:
[0097] When there is only one communication node, the communication node corresponds to all first nodes of the first level;
[0098] When there are multiple communication nodes, for each communication node, the communication node may determine the target number of first nodes of the first level corresponding to each communication node based on the number of communication nodes and the number of nodes of the first level. The first nodes of each level are sorted according to the node identifiers (such as node names) of all first nodes of each level. The target number of first nodes corresponding to the communication node is determined from the first nodes of the first level based on the sorting of the communication node among the communication nodes and the sorting between the first nodes of the first level.
[0099] Assume that there are two communication nodes in a consortium blockchain, such as Figure 5 As shown, the first level includes 10 first nodes, and it can be determined that each communication node corresponds to 5 first nodes in the first level. The communication nodes are sorted into E1 nodes and E2 nodes, and the sorting results of the first nodes in the first level based on the node identifiers are F1 to F10, so it can be determined that the communication node E1 corresponds to the first nodes F1 to F5 in the first level, and the communication node E2 corresponds to the first nodes F6 to F10 in the first level. Among them, the order of the communication nodes can be the order determined during the election based on the third consensus mechanism, such as sorting according to the number of votes.
[0100] It should be noted that if the number of nodes in the first level cannot completely divide the number of communication nodes, the determined target number is rounded up, and the number of first nodes in the first level corresponding to the last communication node is the remainder. For example, if the first level includes 9 first nodes, the target number is still 5, and the communication node E1 corresponds to the first nodes F1 to F5 in the first level, and the communication node E2 corresponds to the first nodes F6 to F9 in the first level.
[0101] When there are multiple communication nodes, the communication node may also store a fourth mapping relationship, and for each communication node, the communication node may determine the first nodes of the first level corresponding to itself based on the fourth mapping relationship. The fourth mapping relationship includes the corresponding relationship between each communication node and each first node of the first level.
[0102] In the embodiment of the present application, the number of levels of the alliance blockchain and the number of nodes at each level can be determined in the following manner:
[0103] The total number of nodes of the blockchain nodes in the alliance blockchain is determined. If the total number of nodes is not greater than the first threshold, the number of levels of the alliance blockchain is determined as the first number, and the target number range to which the total number of nodes of the alliance blockchain belongs is determined from multiple preset candidate number ranges corresponding to the first number. According to the target number range to which the alliance blockchain belongs, the number of concurrent nodes corresponding to the alliance blockchain is determined. Among them, the number of concurrent nodes is the number of first nodes of the next level corresponding to the first node of any level. According to the number of concurrent nodes corresponding to the alliance blockchain and the total number of nodes of the alliance blockchain, the number of nodes of each level in the alliance blockchain is determined.
[0104] Optionally, when stratifying the alliance blockchain, the remaining blockchain nodes except the consensus nodes and the communication nodes are stratified, so the total number of blockchain nodes in the alliance blockchain determined can be the total number of blockchain nodes except the consensus nodes and the communication nodes in the alliance blockchain.
[0105] Optionally, when determining the first node included in each level, the multiple first nodes included in the node group in each level can be determined based on the ranking of the remaining other blockchain nodes and the number of nodes determined for each level. Among them, other blockchain nodes refer to blockchain nodes other than consensus nodes and communication nodes in the alliance blockchain. When sorting other blockchain nodes, they can be sorted according to the node identifiers of other blockchain nodes, or they can be elected from the remaining other blockchain nodes based on the fourth consensus mechanism and sorted according to the election results, or they can be randomly sorted from the remaining other blockchain nodes. The way of electing the first node of each level based on the fourth consensus mechanism can make the communication performance of the first nodes of each level be sorted from high to low according to the level, and the communication efficiency is higher. For example, the fourth consensus mechanism adopted can be a DPOS consensus mechanism, based on the ranking of the pledged rights and interests of each other blockchain node, the first nodes of each level are selected from high to low in turn, so that the higher the level, the higher the network configuration condition of the first node, and the stronger the message forwarding ability.
[0106] For example, it is assumed that the total number of blockchain nodes other than consensus nodes and communication nodes in the alliance blockchain is 4000, and the first threshold is 65792. Since the total number of nodes is less than the first threshold, the number of levels of the alliance blockchain is set to 2. The preset multiple candidate number ranges can be shown in Table 2. By looking up the table, it can be seen that the target number range to which the total number of nodes of the alliance blockchain belongs is [273,4160], and the corresponding node concurrency of the alliance blockchain is 64, that is, each first node of the first level corresponds to 64 first nodes of the second level. Based on the node concurrency of the alliance blockchain and the total number of nodes of other blockchain nodes, it can be determined that the number of nodes of the first level in the alliance blockchain is 64, and the number of nodes of the second level is 3936.
[0107]
[0108] Table 2
[0109] The case where the total number of remaining blockchain nodes of the alliance blockchain is greater than the first threshold is explained in detail later, and please refer to the subsequent instructions.
[0110] When the blockchain nodes are layered in the embodiment of the present application, the number of nodes at each level can be determined based on the total number of nodes of the alliance blockchain and the number of concurrent nodes corresponding to the alliance blockchain. And according to the ranking of each other blockchain node and the number of nodes at each level, the multiple first nodes included in the node group of each level are determined. Among them, the number of concurrent nodes corresponding to the alliance blockchain can be pre-set for the alliance blockchain, or it can be determined by the target number range to which the total number of nodes of the above-mentioned alliance blockchain belongs. When sorting the nodes of each other blockchain, they can be sorted according to the node identification of each other blockchain node, or they can be sorted according to the network configuration conditions (communication quality) of each other blockchain node, and this application does not limit this.
[0111] For example, assume that the alliance blockchain contains 500 blockchain nodes, namely nodes H1 to H500, where node H1 is a consensus node, node H2 is a communication node, and nodes H3 to H500 are other blockchain nodes. The node concurrency number of the alliance blockchain is set to 8.
[0112] Since the total number of nodes of other blockchain nodes in the alliance blockchain is 498, and the number of concurrent nodes of the alliance blockchain is 8, it can be determined that the number of nodes in the first level of the alliance blockchain is 8, the number of nodes in the second level is 8×8, and the number of nodes in the third level is 498-(8×8+8).
[0113] Based on the node identifier, the other blockchain nodes are sorted, and the sorting results are H3, H4, H5...H500. According to the sorting results of the other blockchain nodes and the number of nodes at each level, it can be determined that the node group of the first level of the alliance blockchain includes H3~H10, the node group of the second level includes H11~H74, and the node group of the third level includes H75~H500.
[0114] In an embodiment of the present application, different message broadcasting methods can be selected based on the different first broadcast reference information of the message. Specifically, when receiving a message, the communication node can determine the first broadcast reference message, wherein the first broadcast reference information includes at least one of the message type of the message or the total number of nodes of the alliance blockchain. According to the first broadcast reference information, the first broadcasting method corresponding to the message is determined. If the first broadcasting method is a target broadcasting method, the communication node establishes a connection with each first node of the first level and sends the received message to each first node of the first level.
[0115] Optionally, the communication node stores a first mapping relationship, the first mapping relationship including a correspondence between each of at least two broadcast reference information and a message broadcast mode. The communication node can determine a first broadcast mode corresponding to the message from at least two message broadcast modes based on the first broadcast reference information and the first mapping relationship.
[0116] Optionally, the message broadcasting method includes one or more of a point-to-point broadcasting method, a broadcasting method based on the Gossip protocol, and a hierarchical broadcasting method. The target broadcasting method is a hierarchical broadcasting method. Among them, the point-to-point broadcasting method is a serial communication method, in which the communication node establishes a point-to-point connection with each other blockchain node in the alliance blockchain in turn and sends messages. The broadcasting method based on the Gossip protocol is that the communication node randomly sends messages to the surrounding adjacent blockchain nodes, and the blockchain node that receives the message continues to send messages to other surrounding adjacent blockchain nodes. After several rounds of propagation, the message broadcasting of all nodes is completed. The hierarchical broadcasting method is a propagation method in which the communication node sends a message to the first node of the first level, and the first node of the first level continues to send messages to the first node of the next level.
[0117] Optionally, the first mapping relationship includes at least one of a first sub-mapping relationship, a second sub-mapping relationship, and a third sub-mapping relationship, the first sub-mapping relationship includes a correspondence between each message type in at least two message types and a message broadcasting method, the second sub-mapping relationship includes a correspondence between each node number range in at least two node number ranges and a message broadcasting method, and the third sub-mapping relationship includes a correspondence between different combinations of message types and node number ranges and message broadcasting methods.
[0118] When the first broadcast reference information only includes the message type, the first broadcast mode corresponding to the message is determined based on the first sub-mapping relationship. For example, for message types with high information propagation delay requirements, a hierarchical broadcast mode is adopted, and the propagation efficiency is higher. For message types with low information propagation delay requirements, a point-to-point broadcast mode can be adopted, and the propagation efficiency is lower. When the first broadcast reference information only includes the total number of nodes of the alliance blockchain, the first number range to which the total number of nodes of the alliance blockchain belongs can be determined from multiple preset node number ranges, and the first broadcast mode of the message is determined based on the second sub-mapping relationship. For example, for an alliance blockchain with a small number of nodes, a point-to-point broadcast mode or a broadcast mode based on the Gossip protocol can be adopted, and for an alliance blockchain with a large number of nodes, a hierarchical broadcast mode is adopted. When the first broadcast reference information includes the message type of the message and the total number of nodes of the alliance blockchain, the first number range to which the total number of nodes of the alliance blockchain belongs can be determined from multiple preset node number ranges, and the first broadcast mode corresponding to the message can be determined based on the third sub-mapping relationship according to a combination of the message type and the first number range of the received message.
[0119] In an embodiment of the present application, different broadcast hierarchical architectures can be selected based on the difference in the second broadcast reference information of the message. Specifically, when receiving the message, the communication node can determine the second broadcast reference message, and determine the target broadcast hierarchical architecture corresponding to the message from at least two broadcast hierarchical architectures according to the second broadcast reference information and the second mapping relationship. The communication node establishes a connection with each first node of the first level of the target broadcast hierarchical architecture, and sends the received message to each first node of the first level of the target broadcast hierarchical architecture. Among them, the second broadcast reference information includes at least one of the message type of the message or the total number of nodes of the alliance blockchain. The second mapping relationship includes the correspondence between each reference information of at least two broadcast reference information and the broadcast hierarchical architecture, and at least one of the following information corresponding to different broadcast hierarchical architectures is different: the number of levels of the alliance blockchain, the number of nodes of at least one level.
[0120] For example, assuming that there are two broadcast hierarchical structures, the first broadcast hierarchical structure is divided into two layers, the number of nodes in the first layer and the number of nodes in the second layer are 1:8, and the second broadcast hierarchical structure is divided into three layers, the number of nodes in the first layer, the number of nodes in the second layer and the number of nodes in the third layer are 1:3:9. When the second reference information is a message type, if the message type is type a, it can be determined that the target broadcast hierarchical structure corresponding to type a is the first broadcast hierarchical structure.
[0121] Optionally, different node concurrency numbers may be set for different message types. For different message types, the number of levels in the broadcast hierarchy and the number of nodes in each level may be determined based on the node concurrency numbers corresponding to the message types.
[0122] S130: When receiving the message, the first node of any level establishes a connection with the first nodes corresponding to the first node in the next level of the level, and sends the message to the first nodes corresponding to the next level.
[0123] In an embodiment of the present application, for each first node in the node group of any level in the alliance blockchain, when receiving a message, multiple first nodes of the next level corresponding to the first node can be determined, and the first node establishes point-to-point connections with the determined multiple first nodes of the next level in turn, and sends the message to the corresponding multiple first nodes.
[0124] Optionally, based on the number of nodes at the level and the number of nodes at the level below the level, a target number of first nodes at the next level corresponding to each first node at the level is determined, and based on the node identifiers of the first nodes at the levels, the first nodes at the levels are sorted, and based on the sorting of the first nodes among the first nodes at the level and the sorting among the first nodes at the level below the level, the target number of first nodes corresponding to the first node are determined from the first nodes at the level below the level, and a connection is established with the determined corresponding first nodes.
[0125] Take the example of determining that a first node of the first level corresponds to multiple first nodes of the second level. Assuming that there are 3 first nodes in the first level and 9 first nodes in the second level, according to the number of nodes in the first level and the number of nodes in the second level, it is determined that each first node of the first level corresponds to 3 first nodes of each second level, that is, the target number is 3. Of course, the target number can also be determined based on the number of concurrent nodes corresponding to the alliance blockchain. According to the node identifiers of the first nodes of each level, the first nodes of each level are sorted. The sorting of the first nodes of the first level is M1, M2, M3, and the sorting of the first nodes of the second level is N1~N9. For the M2 node in the first level, the second group of target number of first nodes N4, N5, and N6 corresponding to the M2 node are determined from the first nodes of the second level according to the sorting.
[0126] Among them, the number of levels in the alliance blockchain and the number of nodes in each level have been explained in detail above, and this application will not repeat them here. Please refer to the above content.
[0127] In the embodiment of the present application, for any first node of any level, when the first node fails to send a message to any first node of the next level corresponding to the first node, it can be considered that the first node that fails to receive the message has a communication failure, and at this time, the first nodes of the next level corresponding to the first node with the failure can be determined. The first node establishes a connection with the first nodes of the next level corresponding to the first node with the failure, and sends a message to the first nodes of the next level corresponding to the first node with the failure.
[0128] Optionally, when the first node fails to send a message to any first node corresponding to the next level of the first node, the first node may also determine any other first node in the next level as a proxy node, and send indication information to the proxy node to instruct the proxy node to send the message to each first node in the next level corresponding to the failed node when receiving the message. The proxy node may be the first node in the next level corresponding to the first node, or may not correspond to the first node. The indication information includes at least the node identifier of the failed node, and may also include the node identifiers of each first node in the next level corresponding to the failed node.
[0129] By setting a proxy node or interlayer broadcast (sending a message from the first node to the first node of the next lower level) as a propagation method, fault tolerance is enhanced, and the problem of information propagation failure due to a node communication failure is avoided.
[0130] In an embodiment of the present application, the alliance blockchain also includes multiple second nodes. When the first node of the last level of the alliance blockchain receives a message, it can send the message to a first preset number of randomly selected second nodes. The second node that receives the message continues to send the message to other randomly selected second nodes.
[0131] When randomly selecting the first preset number of second nodes, several surrounding adjacent second nodes may be randomly selected based on the Gossip communication protocol.
[0132] Optionally, when determining the number of levels of the alliance blockchain and the number of nodes at each level, if the total number of nodes of other blockchain nodes of the alliance blockchain is greater than a first threshold, the first threshold number of blockchain nodes may be screened out from other blockchain nodes for stratification, and the blockchain nodes exceeding the first threshold may be used as second nodes. The first threshold number of blockchain nodes screened out from other blockchain nodes may be randomly selected or may be selected based on the ranking results of the node identifiers, and this application does not impose any restrictions on this.
[0133] In an embodiment of the present application, when a communication node selects different message broadcasting methods based on the first broadcast reference information of a message, the first node that receives the message can also autonomously select a target broadcasting method based on the first broadcast reference information of the message through the above method. Alternatively, when the communication node sends a message to the first node of the first level, it can also synchronously send a notification message containing the selected target broadcasting method, so that the first node that receives the message uses the target broadcasting method in the notification message to continue to send the message to the first node of the next level, and synchronously sends a notification message containing the target broadcasting method.
[0134] When the communication node selects different broadcast hierarchical structures based on the second broadcast reference information of the message, the first node that receives the message can also autonomously select the target hierarchical structure based on the second broadcast reference information of the message through the above method. Alternatively, when sending a message to the first node of the first level, the communication node can also synchronously send a notification message containing the selected target hierarchical structure, so that the first node that receives the message determines the first node of the next level corresponding to the target hierarchical structure according to the target hierarchical structure in the notification message, and sends the message and the notification message containing the target hierarchical structure to the determined first node of the next level, so that the first node of the next level continues to send messages to the first node of the next level of the target hierarchical structure. Among them, each first node stores the first nodes of each level corresponding to different broadcast hierarchical structures.
[0135] based on Figure 4 The communication method shown in the figure divides the blockchain nodes into consensus nodes, communication nodes and the first nodes of each level in the alliance blockchain. When the consensus node obtains the message to be broadcast, it is sent by the consensus node to the communication node, and the communication node broadcasts the message in layers to the first nodes of each level, which can avoid network congestion of the consensus node, prevent the decline of consensus performance, and improve consensus efficiency. In addition, it avoids the message redundancy caused by the same node receiving repeated messages multiple times, so it can better meet the actual application needs.
[0136] In an embodiment of the present application, through a layered broadcasting method, at each level, the first node can simultaneously broadcast messages to multiple first nodes of the next level, thereby avoiding communication congestion caused by broadcast messages, improving the message propagation efficiency, and reducing the message transmission delay.
[0137] In the embodiment of the present application, when the alliance blockchain network includes only one alliance blockchain, the alliance blockchain includes multiple consensus nodes. Based on the above detailed description of the consensus process, the multiple consensus nodes of the alliance blockchain also include a master consensus node and a slave consensus node, and the multiple consensus nodes communicate with each other to achieve the block consensus of the alliance blockchain. The consensus process can be found in the above description and will not be repeated here.
[0138] It should be noted that the consensus mechanisms involved in the embodiments of the present application include but are not limited to the delegated proof of stake (DPOS), proof-of-work (PoW), and practical Byzantine fault tolerance (PBFT). Different consensus mechanisms have different node selection methods. The first to fourth consensus mechanisms can adopt the same consensus mechanism or different consensus mechanisms. The embodiments of the present application do not limit this and can be set as needed.
[0139] Moreover, since the blockchain nodes in the alliance blockchain are constantly changing, when a blockchain node is added, deleted, or added as the first node in the first level, it will cause changes in the hierarchical architecture (nodes at each level change). Therefore, maintaining a hierarchical architecture of three or more levels is more complicated and requires more resources. Therefore, in the embodiment of the present application, the number of levels can be set to two layers, which is convenient for the maintenance of the hierarchical architecture and reduces the performance loss caused by changes in the hierarchical relationship. Based on the order of the node identifiers of the first nodes of each level, multiple first nodes of the next level corresponding to any first node of any level can be determined respectively.
[0140] In order to better understand and illustrate the method provided in the embodiment of the present application, the optional implementation method of the method provided in the present application is introduced below in combination with a specific scenario embodiment. Assume that a consortium blockchain network includes three consortium blockchains, namely consortium blockchain X, consortium blockchain Y and consortium blockchain Z, each of which contains a consensus node. In the consensus stage, the consensus nodes in each consortium blockchain represent each consortium blockchain, perform block consensus on the entire consortium blockchain network, and generate new block information.
[0141] In the alliance blockchain X, there are 1 consensus node X1, 1 communication node X2, 3 first nodes X3-X5 of the first level, 8 first nodes X6-X13 of the second level, and 10 second nodes X14-X23, such as Figure 6 shown.
[0142] When the consensus nodes of alliance blockchain X, alliance blockchain Y and alliance blockchain Z generate new block information, the consensus nodes of each alliance blockchain need to broadcast the generated new block information to each blockchain node of their own alliance blockchain. Therefore, for alliance blockchain X, consensus node X1 can establish a connection with communication node X2 and send the new block information to be broadcast to communication node X2; communication node X2 can establish connections with first nodes X3, X4 and X5 respectively, and send the received new block information to first nodes X3, X4 and X5; for first node X3, the number of nodes of the second level and the number of nodes of the first level can be determined, and the node identifiers (such as node names) of all blockchain nodes in alliance blockchain X are used to sort all blockchain nodes in alliance blockchain X to obtain sorting results X1 to X23. According to the sorting of first node X3 in the first level and the sorting of each blockchain node in the second level, it is determined that first node X3 corresponds to first nodes X6, X7, and X8 in the second level. The first node X3 establishes connections with the first nodes X6, X7, and X8, and sends the received new block information to the first nodes X6, X7, and X8. Similarly, for the first node X4 and the first node X5, they correspond to X9, X10, X11 and X12, X13 in the second level, respectively.
[0143] When the first nodes X6 to X13 of the second level receive new block information, for each first node of the second level, a second node can be randomly selected based on the Gossip protocol, and the new block information can be sent to the second node. Figure 6 The first node X6 corresponds to the second nodes X14 and X15, the first node X7 corresponds to the second nodes X16 and X17, the first node X8 corresponds to the second node X18, the first node X9 corresponds to the second nodes X19, X20, and X21, the first node X11 corresponds to the second node X22, and the first node X13 corresponds to the second node X23.
[0144] In the embodiment of the present application, each blockchain node in the alliance blockchain is layered, and when determining the first node of each layer, the network status of the alliance blockchain must also be considered. If the network status of the alliance blockchain is unstable, the number of concurrent nodes corresponding to the alliance blockchain can be reduced to improve the success rate of node broadcasting. For other blockchain nodes that are not layered, they can be used as the second node, and the first node of the last layer sends a message to the second node based on the broadcast method of the Gossip protocol.
[0145] In an embodiment of the present application, the user node that generates the transaction information may also send the transaction information to the consensus node in the alliance blockchain through the communication node in the same alliance blockchain, and the consensus node verifies the transaction information and packages it into a new block.
[0146] based on Figure 4 The communication method based on the alliance blockchain shown in the embodiment of the present application also provides an alliance blockchain, such as Figure 7 The alliance blockchain 200 includes multiple blockchain nodes, which can be divided into a consensus node 210, at least one communication node 220, and at least one level of node group, and each level of node group includes multiple first nodes 230-240.
[0147] In the alliance blockchain, when the consensus node 210 obtains the message to be broadcast, it establishes a connection with the communication node 220 and sends the message to the communication node 220. The message to be broadcast may include the status information of the consensus node 210, the height information of the block, etc. The status information of the consensus node 210 may include the current consensus stage, consensus round, etc.
[0148] When receiving the message, the communication node 220 establishes a connection with each corresponding first node 230 in the first level, and sends the received message to each first node 230 in the first level.
[0149] Among them, when the communication node 220 receives a message, it can determine the first nodes of the first level corresponding to the communication node 220 from the first nodes 230 of the first level, and establish a point-to-point connection with the corresponding first nodes of the first level, and send the received message to the first nodes of the first level corresponding to the communication node 220.
[0150] Optionally, when determining the first nodes of the first level corresponding to the communication node 220, if there is only one communication node 220, the communication node 220 corresponds to all the first nodes 230 of the first level; if there are multiple communication nodes 220, for each communication node 220, the target number of first nodes of the first level corresponding to each communication node 220 can be determined according to the number of communication nodes 220 and the number of nodes of the first level. The first nodes 230 to 240 of each level are sorted according to the node identifiers of all the first nodes 230 to 240 of each level. According to the sorting of the communication node among the communication nodes and the sorting between the first nodes 230 of the first level, the target number of first nodes corresponding to the communication node is determined from the first nodes 230 of the first level.
[0151] For the first node of any level, when receiving a message, the first node establishes a connection with each first node of the next level of the level, and sends the message to each first node of the next level.
[0152] Among them, for each first node of any level in the alliance blockchain, when receiving a message, it can determine the multiple first nodes corresponding to the first node in the next level, and the first node establishes point-to-point connections with the multiple first nodes of the determined next level in turn, and sends the message to the corresponding multiple first nodes.
[0153] Optionally, when determining the multiple first nodes corresponding to the first node of any level in the next level of the level, the target number of first nodes of the next level corresponding to each first node of the level can be determined based on the number of nodes of the level and the number of nodes of the next level of the level, the first nodes of each level can be sorted according to the node identifiers of the first nodes of each level, and the target number of first nodes corresponding to the first node can be determined from the first nodes of the next level of the level based on the sorting of the first node among the first nodes of the level and the sorting between the first nodes of the next level of the level, and a connection can be established with the determined corresponding first nodes.
[0154] It should be noted that the details of the alliance blockchain network have been elaborated in detail in the above-mentioned communication method, and this application will not repeat them here. Please refer to the above-mentioned content.
[0155] Based on the same principle as the communication method based on the alliance blockchain provided in this application, the embodiment of this application also provides a communication system based on the alliance blockchain, which can be implemented as any electronic device, such as a server, Figure 8 As shown, the communication system 300 may include a first processing module 310 , a second processing module 320 and a third processing module 330 .
[0156] The first processing module 310 is deployed in the consensus node, and is used to establish a connection with the communication node when obtaining a message to be broadcast, and send the message to at least one communication node; wherein the alliance blockchain network includes multiple blockchain nodes, the multiple blockchain nodes include consensus nodes, communication nodes and at least one node group of a layer, each node group of a layer includes multiple first nodes, and each node group of a layer is determined based on the sorting results of each other blockchain node and the number of nodes of each layer, and the sorting results at least include the sorting based on the node identifier; the number of nodes of each layer is determined based on the total number of nodes in the alliance blockchain and the number of concurrent nodes corresponding to the alliance blockchain; other blockchain nodes are blockchain nodes in the alliance blockchain except the consensus node and the communication node;
[0157] The second processing module 320 is deployed in the communication node, and is used to establish a connection with each first node corresponding to the communication node in the first level when receiving a message, and send the received message to each first node corresponding to the first level;
[0158] The third processing module 330 is deployed in each first node of each level, and is used to establish a connection with the first nodes corresponding to the first node in the next level of the level when receiving a message, and send the message to the corresponding first nodes in the next level.
[0159] Optionally, the multiple blockchain nodes further include multiple second nodes, and the third processing module 330 is further used to:
[0160] When the first node at the last level receives the message, it sends the message to a first preset number of randomly selected second nodes, so that the second node receiving the message sends the message to other randomly selected second nodes.
[0161] Optionally, the third processing module 330 is used to: for each first node of any level, when the first node receives the message, determine each first node corresponding to the first node in the next level, and establish a connection with each first node corresponding to the first node in the next level;
[0162] The first node determines the first nodes corresponding to the first node in the next level in the following manner:
[0163] Determine the target number of first nodes of the next layer corresponding to each first node of the layer according to the number of nodes of the layer and the number of nodes of the next layer of the layer;
[0164] Sort the first nodes at each level according to the node identifiers of the first nodes at each level;
[0165] According to the order of the first node among the first nodes of the level and the order among the first nodes of the next level of the level, the target number of first nodes corresponding to the first node are determined from the first nodes of the next level of the level, and connections are established with the determined corresponding first nodes.
[0166] Optionally, the number of levels of at least one level and the number of nodes in each level are determined in the following manner:
[0167] Determine the total number of nodes in any consortium blockchain;
[0168] If the total number of nodes is not greater than the first threshold, the number of levels is determined to be the first number;
[0169] Determine a target number range to which the total number of nodes belongs among multiple candidate number ranges;
[0170] According to the target number range, determine the number of concurrent nodes corresponding to any alliance blockchain. The number of concurrent nodes is the number of first nodes of the next level corresponding to the first node of any level;
[0171] Determine the number of nodes at each level based on the number of concurrent nodes and the total number of nodes.
[0172] Optionally, the second processing module 320 is used to:
[0173] When receiving the message, determining a first broadcast mode corresponding to the message according to the first broadcast reference information, where the first broadcast reference information includes at least one of a message type of the message or a total number of nodes of any alliance blockchain;
[0174] If the first broadcast mode is a target broadcast mode, a connection is established with each first node corresponding to the communication node in the first level, and the received message is sent to each first node corresponding to the first level.
[0175] Optionally, the second processing module 320 is used to:
[0176] According to the first broadcast reference information and the first mapping relationship, a first broadcast mode corresponding to the message is determined from at least two message broadcast modes, wherein the first mapping relationship includes a correspondence between each broadcast reference information in the at least two broadcast reference information and the message broadcast mode.
[0177] Optionally, the second processing module 320 is used to:
[0178] When receiving the message, determining second broadcast reference information of the received message, the second broadcast reference information including at least one of a message type of the message or a total number of nodes of any consortium blockchain;
[0179] According to the second broadcast reference information and the second mapping relationship, a target broadcast hierarchical architecture corresponding to the message is determined from at least two broadcast hierarchical architectures, the second mapping relationship including a correspondence between each reference information of at least two broadcast reference information and the broadcast hierarchical architecture, and at least one of the following information corresponding to different broadcast hierarchical architectures is different:
[0180] The number of levels of at least one level; The number of nodes of at least one level;
[0181] A connection is established with each first node corresponding to the communication node in the first level of the target broadcast hierarchy architecture, and the received message is sent to each first node corresponding to the first level of the target broadcast hierarchy architecture.
[0182] Optionally, the consensus node is elected from multiple super nodes of any alliance blockchain based on the first consensus mechanism, and the multiple super nodes are elected from multiple blockchain nodes of any alliance blockchain based on the second consensus mechanism; the communication node is elected from other super nodes except the consensus node in any alliance blockchain based on the third consensus mechanism.
[0183] Optionally, the first nodes of other levels except the last level in any alliance blockchain are elected from other blockchain nodes of any alliance blockchain based on the fourth consensus mechanism, and the other blockchain nodes are blockchain nodes other than consensus nodes and communication nodes in any alliance blockchain.
[0184] Optionally, for any first node at any level, the third processing module 330 is further configured to:
[0185] When the first node fails to send a message to any first node corresponding to the first node at the next level, determining first nodes corresponding to any first node at the next level;
[0186] The first node establishes a connection with each first node corresponding to any first node in the next layer, and sends a message to each first node corresponding to any first node in the next layer.
[0187] Optionally, the information to be broadcasted is obtained by synchronizing the consensus node in the alliance blockchain with the consensus nodes in other alliance blockchains in the alliance blockchain network.
[0188] The embodiment of the present application also provides an electronic device, which includes at least one processor, and the processor is configured to execute the steps of the method provided in any optional embodiment of the present application. Optionally, the electronic device may also include a transceiver and / or a memory coupled to the processor, and a computer program is stored in the memory. When the processor runs the computer program, it can implement the solution provided in any optional embodiment of the present application. Optionally, the electronic device may be a user terminal or a server.
[0189] Fig. 9 FIG. 1 is a schematic diagram showing a structure of an electronic device to which an embodiment of the present invention is applicable. Fig. 9 As shown, the electronic device may be a server or a user terminal, and the electronic device may be used to implement the method provided in any embodiment of the present invention.
[0190] like Fig. 9 As shown in FIG. 1 , the electronic device 2000 may mainly include at least one processor 2001 ( Fig. 92002, a communication module 2003 and an input / output interface 2004, etc. Optionally, the components can be connected and communicated through a bus 2005. It should be noted that: Fig. 9 The structure of the electronic device 2000 shown in the figure is merely illustrative and does not constitute a limitation on the electronic device to which the method provided in the embodiment of the present application is applicable.
[0191] The memory 2002 may be used to store operating systems and application programs, etc. The application program may include a computer program that implements the method shown in the embodiment of the present invention when called by the processor 2001, and may also include a program for implementing other functions or services. The memory 2002 may be a ROM (Read Only Memory) or other types of static storage devices that can store static information and instructions, a RAM (Random Access Memory) or other types of dynamic storage devices that can store information and computer programs, or an EEPROM (Electrically Erasable Programmable Read Only Memory), a CD-ROM (Compact Disc Read Only Memory) or other optical disk storage, optical disk storage (including compressed optical disk, laser disk, optical disk, digital versatile disk, Blu-ray disk, etc.), a magnetic disk storage medium or other magnetic storage device, or any other medium that can be used to carry or store the desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited thereto.
[0192] The processor 2001 is connected to the memory 2002 via the bus 2005, and implements the corresponding functions by calling the application program stored in the memory 2002. Among them, the processor 2001 can be a CPU (Central Processing Unit), a general processor, a DSP (Digital Signal Processor), an ASIC (Application Specific Integrated Circuit), an FPGA (Field Programmable Gate Array) or other programmable logic devices, transistor logic devices, hardware components or any combination thereof, which can implement or execute various exemplary logic blocks, modules and circuits described in conjunction with the disclosure of the present invention. The processor 2001 can also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of a DSP and a microprocessor, etc.
[0193] The electronic device 2000 can be connected to the network through the communication module 2003 (which may include but is not limited to components such as a network interface) to communicate with other devices (such as a user terminal or a server, etc.) through the network to achieve data interaction, such as sending data to other devices or receiving data from other devices. Among them, the communication module 2003 may include a wired network interface and / or a wireless network interface, etc., that is, the communication module may include at least one of a wired communication module or a wireless communication module.
[0194] The electronic device 2000 can be connected to the required input / output devices, such as a keyboard, a display device, etc., through the input / output interface 2004. The electronic device 2000 itself can have a display device, and can also be connected to other display devices through the interface 2004. Optionally, a storage device, such as a hard disk, can also be connected through the interface 2004, so that data in the electronic device 2000 can be stored in the storage device, or data in the storage device can be read, and data in the storage device can also be stored in the memory 2002. It can be understood that the input / output interface 2004 can be a wired interface or a wireless interface. Depending on the actual application scenario, the device connected to the input / output interface 2004 can be a component of the electronic device 2000, or it can be an external device connected to the electronic device 2000 when needed.
[0195] The bus 2005 for connecting the components may include a path to transmit information between the above components. The bus 2005 may be a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus, etc. According to different functions, the bus 2005 may be divided into an address bus, a data bus, a control bus, etc.
[0196] Optionally, for the solution provided by the embodiment of the present invention, the memory 2002 can be used to store a computer program for executing the solution of the present invention, and run by the processor 2001. When the processor 2001 runs the computer program, the action of the method or device provided by the embodiment of the present invention is implemented.
[0197] Based on the same principle as the method provided in the embodiment of the present application, the embodiment of the present application provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the corresponding content of the aforementioned method embodiment can be implemented.
[0198] An embodiment of the present application also provides a computer program product, which includes a computer program. When the computer program is executed by a processor, the corresponding content of the aforementioned method embodiment can be implemented.
[0199] It should be noted that the terms "first", "second", "third", "fourth", "1", "2", etc. (if any) in the specification and claims of this application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the numbers used in this way can be interchangeable where appropriate, so that the embodiments of the application described herein can be implemented in an order other than that shown or described in the drawings.
[0200] It should be understood that, although each operation step is indicated by arrows in the flowchart of the embodiment of the present application, the implementation order of these steps is not limited to the order indicated by the arrows. Unless clearly stated herein, in some implementation scenarios of the embodiment of the present application, the implementation steps in each flowchart can be performed in other orders according to demand. In addition, some or all of the steps in each flowchart may include multiple sub-steps or multiple stages based on actual implementation scenarios. Some or all of these sub-steps or stages may be executed at the same time, and each sub-step or stage in these sub-steps or stages may also be executed at different times respectively. In different scenarios of execution time, the execution order of these sub-steps or stages may be flexibly configured according to demand, and the embodiment of the present application does not limit this.
[0201] The above is only an optional implementation method for some implementation scenarios of the present application. It should be pointed out that for ordinary technicians in this technical field, without departing from the technical concept of the solution of the present application, other similar implementation methods based on the technical ideas of the present application are also within the protection scope of the embodiments of the present application.
Claims
1. A communication method based on alliance blockchain, characterized in that: The alliance blockchain includes multiple blockchain nodes, the multiple blockchain nodes include a consensus node, at least one communication node and at least one node group of a level, the node group of each level includes multiple first nodes, the node group of each level is determined based on the ranking of other blockchain nodes and the number of nodes of each level, the number of nodes of each level is determined based on the total number of nodes of the alliance blockchain and the number of concurrent nodes corresponding to the alliance blockchain, and the other blockchain nodes are blockchain nodes in the alliance blockchain except the consensus node and the communication node; The method comprises: When the consensus node obtains the message to be broadcast, it establishes a connection with the at least one communication node and sends the message to the at least one communication node; When any communication node receives the message, it establishes a connection with each first node corresponding to the communication node in the first level, and sends the received message to each first node corresponding to the first level; When receiving the message, the first node of any level establishes a connection with the first nodes corresponding to the first node in the next level of the level, and sends the message to the first nodes corresponding to the next level.
2. The communication method according to claim 1, characterized in that: The plurality of blockchain nodes further include a plurality of second nodes, and the method further includes: When receiving the message, the first node of the last level sends the message to a first preset number of randomly selected second nodes, so that the second node receiving the message sends the message to other randomly selected second nodes.
3. The communication method according to claim 1, characterized in that: For each first node at any level, when the first node receives the message, establishing a connection with each first node corresponding to the first node at a next level, including: When receiving the message, the first node determines each first node corresponding to the first node in the next level, and establishes a connection with each first node corresponding to the first node in the next level; The first node determines the first nodes corresponding to the first node in the next level in the following manner: Determine the target number of first nodes of the next layer corresponding to each first node of the layer according to the number of nodes of the layer and the number of nodes of the next layer of the layer; Sort the first nodes at each level according to the node identifiers of the first nodes at each level; According to the ranking of the first node among the first nodes of the level and the ranking among the first nodes of the next level of the level, the target number of first nodes corresponding to the first node are determined from the first nodes of the next level of the level.
4. The communication method according to claim 1 or 3, characterized in that: The number of levels of the at least one level and the number of nodes in each level are determined in the following manner: Determining the total number of nodes of the consortium blockchain; If the total number of nodes is not greater than a first threshold, determining the number of levels as a first number; Determine a target number range to which the total number of nodes belongs among multiple candidate number ranges; According to the target number range, determine the number of concurrent nodes corresponding to the alliance blockchain, where the number of concurrent nodes is the number of first nodes of the next level corresponding to the first node of any level; The number of nodes at each level is determined according to the concurrent number of nodes and the total number of nodes.
5. The communication method according to claim 1, characterized in that: When any one of the communication nodes receives the message, it establishes a connection with each first node corresponding to the communication node in the first level, and sends the received message to each first node corresponding to the first level, including: When receiving the message, any one of the communication nodes determines a first broadcast mode corresponding to the message according to the first broadcast reference information, where the first broadcast reference information includes at least one of a message type of the message or a total number of nodes of the alliance blockchain; If the first broadcast mode is a target broadcast mode, a connection is established with each first node corresponding to the communication node in the first level, and the received message is sent to each first node corresponding to the first level.
6. The communication method according to claim 5, characterized in that: The determining, according to at least one of a message type of the message or a total number of nodes of the alliance blockchain, a first broadcasting mode of the message includes: The communication node determines a first broadcast mode corresponding to the message from at least two message broadcast modes based on the first broadcast reference information and a first mapping relationship, wherein the first mapping relationship includes a correspondence between each broadcast reference information in at least two broadcast reference information and the message broadcast mode.
7. The communication method according to claim 1, characterized in that: When any one of the communication nodes receives the message, it establishes a connection with each first node corresponding to the communication node in the first level, and sends the received message to each first node corresponding to the first level, including: When receiving the message, any one of the communication nodes determines second broadcast reference information of the received message, where the second broadcast reference information includes at least one of a message type of the message or a total number of nodes of the alliance blockchain; According to the second broadcast reference information and the second mapping relationship, a target broadcast hierarchical architecture corresponding to the message is determined from at least two broadcast hierarchical architectures, wherein the second mapping relationship includes a correspondence between each reference information of at least two broadcast reference information and a broadcast hierarchical architecture, and at least one of the following information corresponding to different broadcast hierarchical architectures is different: The number of levels of the at least one level; the number of nodes of the at least one level; Establish a connection with each first node corresponding to the communication node in the first level of the target broadcast hierarchy architecture, and send the received message to each first node corresponding to the first level of the target broadcast hierarchy architecture.
8. The communication method according to claim 1, characterized in that: The consensus node is obtained by electing from multiple super nodes of the alliance blockchain based on the first consensus mechanism, and the multiple super nodes are obtained by electing from multiple blockchain nodes of the alliance blockchain based on the second consensus mechanism; the communication node is obtained by electing from other super nodes in the alliance blockchain except the consensus node based on the third consensus mechanism.
9. The communication method according to claim 1, characterized in that: The first nodes of other levels except the last level in the alliance blockchain are obtained through elections from the other blockchain nodes based on the fourth consensus mechanism.
10. The communication method according to claim 1, characterized in that: For any first node at any level, the method further includes: When the first node fails to send a message to any first node corresponding to a next level of the first node, determining first nodes corresponding to the first node in the next level; The first node establishes a connection with each first node corresponding to any of the first nodes in the next layer, and sends the message to each first node corresponding to any of the first nodes in the next layer.
11. The communication method according to claim 1, characterized in that: The information to be broadcast is obtained by synchronizing the consensus node in the alliance blockchain with the consensus nodes in other alliance blockchains in the alliance blockchain network.
12. A consortium blockchain, characterized in that: The alliance blockchain includes multiple blockchain nodes, the multiple blockchain nodes include a consensus node, at least one communication node and at least one node group at a level, the node group at each level includes multiple first nodes, the node group at each level is determined based on the sorting results of other blockchain nodes and the number of nodes at each level, the sorting results at least include the sorting based on the node identifier, the number of nodes at each level is determined based on the total number of nodes of the alliance blockchain and the number of concurrent nodes corresponding to the alliance blockchain; the other blockchain nodes are blockchain nodes in the alliance blockchain except the consensus node and the communication node; in: The consensus node is used to establish a connection with the communication node when obtaining a message to be broadcast, and send the message to the at least one communication node; Any communication node is configured to, upon receiving the message, establish a connection with each first node corresponding to the communication node in the first level, and send the received message to each first node corresponding to the first level; The first node of any level is used to establish a connection with each corresponding first node in the next level of the level when receiving the message, and send the message to each corresponding first node in the next level.
13. A communication system based on alliance blockchain, characterized in that: The system comprises: A first processing module is deployed in a consensus node, and is used to establish a connection with a communication node when a message to be broadcast is obtained, and to send the message to the at least one communication node; wherein the alliance blockchain network includes multiple blockchain nodes, the multiple blockchain nodes include a consensus node, a communication node, and a node group of at least one level, each node group of each level includes multiple first nodes, the node group of each level is determined based on the sorting results of each other blockchain node and the number of nodes of each level, the sorting results at least include a sorting based on a node identifier, and the number of nodes of each level is determined based on the total number of nodes of the alliance blockchain and the number of concurrent nodes corresponding to the alliance blockchain; the other blockchain nodes are blockchain nodes in the alliance blockchain other than the consensus node and the communication node; A second processing module, deployed in the communication node, is used to establish a connection with each first node corresponding to the communication node in the first level when receiving the message, and send the received message to each first node corresponding to the first level; The third processing module is deployed in each first node of each level, and is used to establish a connection with the first nodes corresponding to the first node in the next level of the level when receiving the message, and send the message to the corresponding first nodes in the next level.
14. An electronic device, characterized in that: The electronic device comprises a memory and a processor, wherein the memory stores a computer program, and the processor executes the method according to any one of claims 1 to 11 when running the computer program.
15. A computer-readable storage medium, characterized in that: The storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 11 is implemented.