Message broadcasting method and apparatus
By using a Bloom filter in an unstructured P2P network to indicate the nodes that have received the target data, the resource waste and broadcast termination problems caused by the Gossip algorithm are solved, and efficient broadcast convergence is achieved.
Patent Information
- Application Number
- CN202211740352.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-30
- Publication Date
- 2025-11-28
- Estimated Expiration
- 2042-12-30
AI Technical Summary
In unstructured P2P networks, the existing Gossip algorithm results in high resource overhead during the broadcast process, and may fail to converge due to limited buffer space in high TPS scenarios, causing the broadcast to fail to terminate.
The method involves sending a broadcast message containing a Bloom filter from the preceding node to the following node on the broadcast path. The Bloom filter indicates the node that has received the target data, thereby avoiding repeated reception by the following node, reducing redundancy, and deciding whether to continue broadcasting based on the number of available nodes.
It effectively reduces the redundancy of the broadcast process, saves resource consumption, and ensures broadcast convergence in high TPS scenarios, preventing broadcasts from failing to terminate.
Smart Images

Figure CN116032938B_ABST
Abstract
Description
Technical Field
[0001] The embodiments in this specification belong to the field of Internet technology, and in particular relate to a message broadcasting method and apparatus. Background Technology
[0002] A P2P (Peer-to-Peer) network, also known as a peer-to-peer network, is a distributed application architecture that distributes tasks and workloads among peers. It is a network form or topology of the peer-to-peer computing model at the application layer. P2P networks are widely used in distributed scenarios such as blockchain networks.
[0003] Unstructured P2P networks are an important form of P2P network. In these networks, nodes are not fixedly distributed in the algorithmic logic; nodes can frequently enter and leave the network, resulting in a relatively loose and unstable structure. When nodes in an unstructured P2P network need to broadcast, they can transmit the data to be broadcast to other nodes in the network by sending broadcast messages. The Gossip algorithm is commonly used for broadcasting. However, the broadcast process using this algorithm not only suffers from high resource overhead due to excessive redundancy, but also, because the receiver of the broadcast message needs to cache received messages, it may fail to converge in high TPS (Transactions Per Second) scenarios due to limited cache space, causing the broadcast to fail to terminate. Summary of the Invention
[0004] The purpose of this specification is to provide a message broadcasting method and apparatus.
[0005] According to a first aspect of one or more embodiments of this specification, a message broadcasting method is proposed, applied to an unstructured P2P network, wherein each node in the unstructured P2P network is connected to at least one neighbor node, and the nodes in the unstructured P2P network constitute M levels on the broadcast path of the target data, wherein the node of the i-th level is the i-th level node, and M and i are both integers, M>1, M≥i≥0; the method includes:
[0006] Any i-th level node on any broadcast path determines from its own neighboring nodes an optional node that has not yet received a broadcast message containing the target data;
[0007] in the case that the number of the optional nodes is not zero, the any i-level node selects at least one i+1-level node from the optional nodes, and sends an i+1-level broadcast message to each i+1-level node respectively, wherein the i+1-level broadcast message contains an i+1-level Bloom filter and the target data, the i+1-level Bloom filter records identity information of each node and its sibling node on the any broadcast path whose level is not higher than i+1, and is used to indicate to the i+1-level node a node that has received the broadcast message containing the target data;
[0008] in the case that the number of the optional nodes is zero, the any i-level node stops broadcasting the target data.
[0009] According to a second aspect of one or more embodiments of the present specification, a non-structured P2P network is provided, each node in the non-structured P2P network is connected to at least one neighbor node, each node in the non-structured P2P network forms M levels on a broadcast path of target data, the node at the i-th level is an i-level node, M and i are integers, M>1, M≥i≥0; wherein any i-level node on any broadcast path is used to:
[0010] determine optional nodes that have not received the broadcast message containing the target data from its neighbor nodes;
[0011] in the case that the number of the optional nodes is not zero, the any i-level node selects at least one i+1-level node from the optional nodes, and sends an i+1-level broadcast message to each i+1-level node respectively, wherein the i+1-level broadcast message contains an i+1-level Bloom filter and the target data, the i+1-level Bloom filter records identity information of each node and its sibling node on the any broadcast path whose level is not higher than i+1, and is used to indicate to the i+1-level node a node that has received the broadcast message containing the target data;
[0012] in the case that the number of the optional nodes is zero, the any i-level node stops broadcasting the target data.
[0013] According to a third aspect of one or more embodiments of the present specification, a message broadcasting device is provided, which is applied to a non-structured P2P network, each node in the non-structured P2P network is connected to at least one neighbor node, each node in the non-structured P2P network forms M levels on a broadcast path of target data, the node at the i-th level is an i-level node, M and i are integers, M>1, M≥i≥0; the device comprises:
[0014] determining, by any i-level node on any broadcast path, from neighbor nodes of the any i-level node, optional nodes that have not received a broadcast message containing the target data;
[0015] sending, by the any i-level node, to each i+1-level node, an i+1-level broadcast message containing an i+1-level Bloom filter and the target data, wherein the i+1-level Bloom filter records identity information of each node and its sibling node on the any broadcast path at a level no higher than i+1, and is used to indicate to the i+1-level node a node that has received the broadcast message containing the target data.
[0016] stopping, by the any i-level node, broadcasting the target data when the number of optional nodes is zero.
[0017] According to a fourth aspect of one or more embodiments of the present specification, an electronic device is provided, comprising:
[0018] a processor;
[0019] a memory for storing processor-executable instructions;
[0020] wherein the processor implements the method of any one of the first aspect by running the executable instructions.
[0021] According to a fifth aspect of one or more embodiments of the present specification, a computer-readable storage medium is provided, having stored thereon computer instructions that, when executed by a processor, implement the steps of the method of any one of the first aspect.
[0022] In the embodiments of the present specification, when the number of optional nodes is not zero, any i-level node on any broadcast path selects at least one i+1-level node from the optional nodes, and sends an i+1-level broadcast message containing an i+1-level Bloom filter and the target data to each i+1-level node. Wherein the i+1-level Bloom filter records identity information of each node and its sibling node on the any broadcast path at a level no higher than i+1, and is used to indicate to the i+1-level node a node that has received the broadcast message containing the target data.
[0023] It can be seen that the node at the previous stage on any broadcast path can explicitly indicate to the node at the next stage through the i+1 stage Bloom filter that the node has received the broadcast message containing the target data, thereby avoiding the node at the next stage selecting this part of nodes as the next stage node corresponding to itself, effectively avoiding the probability of the same node repeatedly receiving the broadcast message containing the target data, thereby reducing the redundancy of the broadcast process and saving the resource overhead of the broadcast process. In addition, since the node at the previous stage does not need to confirm to the node at the next stage when sending the broadcast message to the latter, and any node does not need to buffer the broadcast message received by itself for subsequent judgment, and can determine when it should stop broadcasting the target data according to the number of the optional nodes corresponding to itself (i.e., the number of the optional nodes is zero), the broadcast convergence can be guaranteed even in a high TPS scenario, thereby effectively avoiding the broadcast from being unable to terminate. BRIEF DESCRIPTION OF DRAWINGS
[0024] In order to more clearly illustrate the technical solutions in the embodiments of the present specification, the drawings required to be used in the embodiment description will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments described in the present specification, and other drawings can also be obtained according to these drawings without creative labor.
[0025] Figure 1 FIG. 1 is a schematic diagram of a topology structure of an unstructured P2P network provided by an example embodiment.
[0026] Figure 2 FIG. 2 is a flow of a message broadcast method provided by an example embodiment.
[0027] Figure 3 FIG. 3 is a schematic diagram of a broadcast process provided by an example embodiment.
[0028] Figure 4 FIG. 4 is a schematic diagram of a broadcast path provided by an example embodiment.
[0029] Figure 5 FIG. 5 is a structural schematic diagram of a device provided by an example embodiment.
[0030] Figure 6 FIG. 6 is a block diagram of a message broadcast apparatus provided by an example embodiment. DETAILED DESCRIPTION
[0031] In order for those skilled in the technical field to better understand the technical solutions in the specification, the technical solutions in the specification will be clearly and completely described below in combination with the drawings in the embodiments of the specification. Obviously, the described embodiments are only a part of the embodiments of the specification, rather than all the embodiments. Based on the embodiments in the specification, all other embodiments obtained by those skilled in the art without creative labor should belong to the protection scope of the specification.
[0032] To solve the technical problems in the foregoing related art, the present scheme proposes a message broadcast scheme, wherein a Bloom filter is contained in a broadcast message sent by a previous node to a subsequent node on a broadcast path, so as to indicate to the subsequent node through the Bloom filter that a node which has received the broadcast message containing the target data, thereby avoiding the subsequent node from repeatedly sending the broadcast message to the part of nodes. The scheme will be described in detail below in combination with the drawings.
[0033] The message broadcast method described in the embodiments of the specification is applied to an unstructured P2P network, wherein each node in the network is connected to at least one neighbor node, in other words, any node in the network establishes a network connection with at least one other node. Specifically, the unstructured P2P network described in the embodiments of the specification can be a full mesh network (at this time, each node establishes a connection with all other nodes in the network) or a non-full mesh network (at this time, each node establishes a connection with part of other nodes in the network). Wherein, for any two nodes in the unstructured P2P network, if a network connection is established between them, they are neighbor nodes of each other. In addition, it should be noted that each node in the unstructured P2P network can also maintain a neighbor node list, and the node information of each neighbor node can be recorded in the neighbor node list maintained by any node. For example, the node information of any neighbor node can include identity information such as node identifier and node public key, and address information such as IP address and port number, which will not be described here.
[0034] In an embodiment, the identity information of the node can be the node identifier thereof. Wherein, the binary length L1 of the node identifier can be a preset value, such as 160 bits, 8 bits, etc., at this time, the total number of nodes in the structured P2P network does not exceed 2 L1 , that is, the foregoing N satisfies 2 L1 ≥ N. Alternatively, the node identifier of any node can also be a decimal number from 0 to N, that is, each number is used as a node identifier to represent a node in the structured P2P network. Alternatively, the hexadecimal length L2 of the node identifier can be a preset value, such as 8 bits, 64 bits, etc., at this time, the total number of nodes in the structured P2P network does not exceed 2 L2i.e. the aforementioned N satisfies 2 L2 ≥ N. It can be understood that, compared with using a binary value with a preset length as the node identifier, using a decimal number of 0-N as the node identifier has a relatively shorter length, and using a hexadecimal value with a preset length as the node identifier has a relatively shorter length, thereby reducing the amount of data of the node identifier maintained by each node, and at the same time, reducing the size of the broadcast message sent in the broadcast process, which helps to reduce the storage resources and communication resources required in the broadcast process.
[0035] Figure 1 is a schematic diagram of a topology structure of an unstructured P2P network provided by an exemplary embodiment. As shown in the figure, the unstructured P2P network includes a plurality of nodes, and any node has a network connection with at least one other node, i.e. any node has at least one neighbor node. Figure 1
[0036] Any node in the unstructured P2P network can act as a broadcast initiator, and the target data required to be broadcast by the node is included in the broadcast message and delivered to other nodes. In the delivery process of the target data, all nodes between the broadcast initiator and any data receiver (i.e. any other node in the unstructured P2P network) form a broadcast path of the data. Assuming that there are N nodes in the unstructured P2P network, after the broadcast in the whole network is completed, N-1 broadcast paths of the target data will be formed between the broadcast initiator and the other N-1 nodes in the unstructured P2P network (where part of the broadcast paths may overlap). Among them, the N nodes will form M levels on the broadcast path of the target data, and M>1. It can be understood that the N also satisfies N≥M. In this specification, any node at the i-th level in any broadcast path is referred to as an i-level node, and M≥i≥0.
[0037] In an embodiment, the unstructured P2P network can be used to construct a blockchain network. Users can participate in related transactions of the blockchain through blockchain nodes, for example, a plurality of blockchain nodes corresponding to different users in the blockchain system can perform secure multi-party computation (SMPC) on the private data of a node based on homomorphic encryption, zero-knowledge proof and other privacy technologies.
[0038] In addition, the target data described in the embodiments of the present specification can be in any form such as text, image, audio, video, etc., and the embodiments of the present specification do not limit this. In the case where the unstructured P2P network is used to construct a blockchain network, at least part of the nodes in the unstructured P2P network can be used as blockchain nodes in the blockchain network, and at this time, the target data to be broadcasted can be a blockchain transaction in the blockchain network, consensus data to be reached, a proposal, etc. It should be noted that if the target data described in the present solution involves user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data for analysis, stored data, displayed data, etc.), the data is all information and data authorized by the user or authorized by all parties, and the collection, use and processing of related data need to comply with relevant laws, regulations and standards of relevant countries and regions, and provide corresponding operation portal for user to select authorization or rejection.
[0039] Figure 2 FIG. 1 is a flowchart of a message broadcast method according to an example embodiment. As shown in FIG. 1, the method includes steps 102-104b. Figure 2
[0040] In step 102, any i-level node on any broadcast path determines from its neighbor nodes any optional node that has not received a broadcast message containing the target data.
[0041] It can be understood that the broadcast initiator is the zero-level node, and at this time i = 0. The larger the value of i, the higher the level of the any i-level node in the broadcast path of the target data, and the farther the distance between the any i-level node and the broadcast initiator in the broadcast path (i.e., the more nodes between them on the broadcast path). Among them, when i = 0, there is only one zero-level node, i.e., the broadcast initiator corresponding to the target data, which is only used to send a broadcast message to the next-level node, i.e., to send a first-level broadcast message to each first-level node; when i > 0, there can be one or more i-level nodes on any broadcast path, and any i-level node can send a broadcast message to the next-level node after receiving an i-level broadcast message sent by its previous-level node (i.e., i-1 level node), i.e., to send an i+1 level broadcast message to each i+1 level node.
[0042] It should be noted that the broadcast process described in the present solution can ensure that the broadcast message is sent out, but does not concern whether the receiver of the broadcast message can reliably receive the broadcast message. Therefore, the reception of the broadcast message containing the target data by any node described in the embodiments of the present specification should be regarded as that the any node is taken as the receiver of the broadcast message containing the target data, that is, there is a node sending any level broadcast message containing the target data to the any node.
[0043] For any i-level node, if the node is a broadcast initiator (i.e., i=0), no other node in the unstructured P2P network has received the broadcast message containing the target data before the node sends the i+1-level broadcast message; and if the node is not a broadcast initiator (i.e., i>0), there are already some nodes in the unstructured P2P network that have received the broadcast message containing the target data before the node sends the i+1-level broadcast message. Therefore, whether the any i-level node is a broadcast initiator will affect the way the node determines the selectable nodes.
[0044] The selectable nodes corresponding to the any i-level node can be selected by the node as i+1-level nodes, i.e., can receive the i+1-level broadcast message sent by the any i-level node as a message receiver. Since the selectable nodes are used to select i+1-level nodes so as to subsequently send i+1-level broadcast messages to each i+1-level node, the network connection needs to be established between the selectable nodes and the any i-level node, in other words, the any i-level node needs to determine the selectable nodes from its neighbor nodes.
[0045] In an embodiment, if the any i-level node is a broadcast initiator, each neighbor node of the node has not received the broadcast message containing the target data, at this time, the any i-level node can determine all the neighbor nodes of the node as the selectable nodes corresponding to the any i-level node.
[0046] In another embodiment, if the any i-level node is not a broadcast initiator, the node can determine the i-level Bloom filter contained in the i-level broadcast message sent by the i-1-level node in response to the i-level broadcast message received by the node, and the i-level Bloom filter records the identity information of each node on the any broadcast path whose level is not higher than the i-level and the identity information of the sibling nodes of the node. Based on this, the any i-level node can further determine the nodes represented by the identity information recorded in the i-level Bloom filter (i.e., each node on the any broadcast path whose level is not higher than the i-level and the sibling nodes of the node are considered to have received the broadcast message containing the target data), and then determine the neighbor nodes of the node except the nodes as the selectable nodes corresponding to the any i-level node. In this way, the any i-level node can exclude the nodes that have received the broadcast message containing the target data from the neighbor nodes of the node, so as to determine the other neighbor nodes that have not received the broadcast message containing the target data as the selectable nodes, and ensure that each selectable node (before the current time) will not repeatedly receive the broadcast message containing the target data.
[0047] It is assumed that the identity information of each node is the node identifier, and the value of the node identifier is 0-N, respectively. As shown in FIG. 1, it is assumed that node0 is a broadcast initiator, and the nodes are selected as i+1-level nodes according to the any broadcast path from the node0 to the nodeN. Figure 3 As shown in FIG. 1, it is assumed that node0 is a broadcast initiator, and the nodes are selected as i+1-level nodes according to the any broadcast path from the node0 to the nodeN.Figure 3 In the order of a→b→c→d, the broadcast message containing the target data is sent to other nodes step by step, and finally the network-wide broadcast of the target data is realized.
[0048] For node0 as the broadcast initiator, it can determine all the neighbor nodes of itself as optional nodes, i.e. node1 and node2 (abbreviated as node1-2, the same below) and node11-13. Assuming that node0 selects node1 and node2 as the first-level nodes, for node2, the node identifier of node1 can be recorded in the first-level Bloom filter contained in the first-level broadcast message sent by node0, and of course, the node identifiers of node0 and node2 can also be recorded. Based on this, node2 can determine the remaining neighbor nodes (i.e. node4-5) of itself except node0 as the optional nodes corresponding to itself. Similarly, node1 can determine that the optional nodes corresponding to itself are node3, and the specific process is not described again.
[0049] The broadcast process shown in FIG. 1 is briefly described below. Figure 3 As shown in a of FIG. 1, as the broadcast initiator (i.e. the zero-level node), node0 determines two first-level nodes node1 and node2, and sends first-level broadcast messages to the two nodes respectively. Figure 3 As shown in b of FIG. 1, in response to the received first-level broadcast message, node1 determines the second-level node node3, and sends a second-level broadcast message to node3; node2 determines the second-level nodes node4 and node5, and sends second-level broadcast messages to the two nodes respectively. Figure 3 As shown in c of FIG. 1, in response to the received second-level broadcast message, node3 determines the third-level nodes node6 and node7, and sends third-level broadcast messages to the two nodes respectively; node4 determines the third-level node node8, and sends a third-level broadcast message to node8; node5 determines the third-level nodes node9 and node10, and sends third-level broadcast messages to the two nodes respectively. The broadcast process of subsequent multiple levels is similar, and is not described again. Figure 3 As shown in d of FIG. 1, when each node in the unstructured P2P network stops broadcasting the target data, each node in the network receives the broadcast message containing the target data. Figure 3
[0050] Corresponding to the above broadcast process, the broadcast paths of each node can constitute a tree structure, which can be referred to in detail in FIG. 2. Figure 4 As shown in FIG. 2, as the broadcast initiator (i.e. the zero-level node), node0 determines two first-level nodes node1 and node2, and sends first-level broadcast messages to the two nodes respectively. Figure 4 As shown, node0→node1 is a broadcast path corresponding to the first-level node node1, node0→node2→node4 is a broadcast path corresponding to the second-level node node4, node0→node1→node3→node6 is a broadcast path corresponding to the third-level node node6, and the broadcast paths corresponding to the nodes of other levels are not described one by one.
[0051] In addition, as shown in FIG. 2B, node8, node9 and node10 each have only one neighbor node, so these three third-level nodes cannot determine the optional nodes corresponding to themselves after receiving the third-level broadcast messages sent by the respective neighbor nodes (which are second-level nodes), and thus can stop broadcasting the target data. Node6 and node7 each have multiple neighbor nodes, so they can further determine the optional nodes corresponding to themselves after receiving the third-level broadcast messages sent by the respective connected second-level nodes, such as node6 having 4 optional nodes and node7 having 2 optional nodes. Based on this, node6 and node7 can further determine the fourth-level nodes and send fourth-level broadcast messages, and the specific process is not described again (as shown in FIG. 2B). Figure 3 Figure 4 As shown, node0→node1 is a broadcast path corresponding to the first-level node node1, node0→node2→node4 is a broadcast path corresponding to the second-level node node4, node0→node1→node3→node6 is a broadcast path corresponding to the third-level node node6, and the broadcast paths corresponding to the nodes of other levels are not described one by one.
[0052] Through the foregoing manner, the optional nodes can be determined or can not be determined, so the any i-level node can process according to the number of the determined optional nodes: in the case that the number of the optional nodes is not zero, go to step 204a; in the case that the number of the optional nodes is zero, go to step 204b.
[0053] In the case that the number of the optional nodes is not zero, the any i-level node selects at least one i+1-level node from the optional nodes, and sends an i+1-level broadcast message to each i+1-level node, where the i+1-level broadcast message contains an i+1-level Bloom filter and the target data, and the i+1-level Bloom filter records the identity information of each node and its sibling node at a level not higher than i+1 on the any broadcast path, and is used to indicate the nodes that have received the broadcast message containing the target data to the i+1-level node.
[0054] Since the optional nodes have not received the broadcast message containing the target data, if the number of the optional nodes is not zero, it indicates that there is a node (i.e., the optional node) that has not received the broadcast message containing the target data among the neighbor nodes of the any i-level node. At this time, the any i-level node can select at least one i+1-level node from the optional nodes, and send an i+1-level broadcast message to each i+1-level node.
[0055] In one embodiment, when the number of selectable nodes is not less than the preset number of broadcast paths, any i-level node can select a number of selectable nodes equal to the preset number of broadcast paths as i+1-level nodes; conversely, when the number of selectable nodes is less than the preset number of broadcast paths, all selectable nodes can be used as i+1-level nodes. It can be understood that for any i-level node, the number of i+1-level nodes it selects is the number of broadcast messages it needs to send, which is also the number of broadcast paths for its corresponding next-level node. Therefore, the aforementioned preset number of broadcast paths is actually an upper limit set for the actual number of broadcast paths for any i-level node.
[0056] The preset broadcast path count can be uniformly set for the unstructured P2P network, in which case the actual broadcast path count of any two nodes in the network or any two nodes at any two levels in the broadcast path will not exceed the preset broadcast path count. Alternatively, the preset broadcast path count can be set separately for each node, in which case the preset broadcast path count of any two nodes can be the same or different. Specifically, the preset broadcast path count of any i-th level node can be reasonably set according to the actual situation such as the scale of the unstructured P2P network (i.e., the total number of nodes in the network at the current time), business scenario, type of target data and latency requirements, and message forwarding capability of any i-th level node. This embodiment of the specification does not limit this.
[0057] In one embodiment, any i-level node can select at least one i+1-level node from the optional nodes in multiple ways. For example, any i-level node can randomly select at least one optional node as the i+1-level node. Using this method, the i+1-level nodes are randomly distributed among the optional nodes, which helps prevent malicious nodes from inferring the broadcast initiator based on the distribution of nodes at different levels, thus avoiding potential broadcast failures or security vulnerabilities caused by targeted attacks on the broadcast initiator.
[0058] For example, if each level node selects at most two next-level nodes (i.e., the aforementioned preset broadcast path count for each level node is set to 2), then as follows Figure 3As shown, nodeO as a zero-level node can randomly select two nodes as first-level nodes from node1~2 and node11~13. For example, node1 and node2 can be randomly selected as first-level nodes, and other nodes can also be randomly selected as first-level nodes. For the first-level node node1, since there is only one selectable node node3, node1 can select node3 as its corresponding second-level node. For the first-level node node2, since there are two selectable nodes node4 and node5, node2 can select node4 and node5 as its corresponding second-level nodes. Further, for the second-level node node5, since there are three selectable nodes node9, node10 and node14, node5 can randomly select two nodes as its corresponding third-level nodes, such as node9 and node10.
[0059] In an embodiment, a node in the unstructured P2P network can broadcast other data besides the target data. If a node selects the same next-level node when broadcasting multiple data, other nodes in the unstructured P2P network can infer the common broadcast path of the data according to the node selection result, and thus a malicious node can attack the unstructured P2P network by targeting the key nodes in the broadcast path, causing subsequent broadcast failure or even network paralysis. To solve this problem, the randomness can be enhanced, for example, besides randomly selecting i+1 level nodes from the selectable nodes, the selectable nodes that have been used or recently used can be avoided to be selected as i+1 level nodes.
[0060] For example, when selecting the i+1 level node from the optional nodes, the any i level node can determine whether the broadcast message containing other data has been sent to at least one previous optional node in the optional nodes before the current time, i.e., whether the previous optional node exists in the optional nodes. If at least one previous optional node exists, the any i level node can select at least one i+1 level node from the optional nodes other than the at least one previous optional node. Of course, in order to ensure the smooth progress of the broadcast, the previous optional node can also be set with a valid time, such as determining whether the previous optional node exists within a preset time before the current time; or the previous optional node can be set with a valid broadcast number, such as determining whether the previous optional node exists in the optional nodes which have sent the broadcast message containing other data in the last x times of broadcast (i.e., selected as the i+1 level node in the last x times of broadcast). In any broadcast message, a message sequence number unique to the content can also be contained to uniquely identify the valid content (such as the target data) of the message, so the any i level node can determine whether the previous optional node exists according to the message sequence number of the historical broadcast message cached locally. In this way, the node which has sent the broadcast message (or has sent the broadcast message recently) can be avoided to be selected as the i+1 level node as much as possible, so as to avoid the same broadcast path being adopted by the broadcast processes of different data, reduce the possibility of the broadcast path being reversely speculated, and improve the security performance of the unstructured P2P network to some extent.
[0061] As shown in Figure 3 When selecting the first level node, the node0 as the broadcast initiator can avoid selecting the node12 as the first level node if the node12 is the previous optional node. When selecting the second level node, the node5 as the second level node can avoid selecting the node14 as the second level node if the node14 is the previous optional node. Of course, the above-mentioned avoiding selecting the previous optional node as the i+1 level node is only a preferred scheme. For example, for the first level node node1, if at least the node3 is the previous optional node in the corresponding optional nodes, but since there is only one optional node node3, and no more than two second level nodes need to be selected from the optional nodes, the node3 can (and only can) be selected as the second level node. For example, for the first level node node2, if at least the node4 is the previous optional node in the corresponding optional nodes, but since there are only two optional nodes node4 and node5, and two second level nodes need to be selected from the optional nodes, the node4 and node5 can still be selected as the second level nodes respectively. Figure 4 The selection process of the lower level node is similar, and will not be described again.
[0062] It should be noted that the foregoing embodiments are only exemplary, and the number of nodes contained in any two levels in the broadcast path can be the same or different during the application of the scheme. In other words, if i≠j, the number of i-level nodes and the number of j-level nodes can be the same or different. As shown in Figure 4 node0 as the broadcast initiator determines two one-level nodes, node1 as the one-level node determines one two-level node node3, and it can be seen that in the case of i=0, j=1, the number of i-level nodes and the number of j-level nodes are different. Node3 as the two-level node determines two three-level nodes node6 and node7, and node2 as the one-level node determines two two-level nodes node4 and node5, and it can be seen that in the case of i=0, j=3, or in the case of i=2, j=3, the number of i-level nodes and the number of j-level nodes are the same.
[0063] After selecting at least one i+1-level node in the foregoing manner, each i-level node can send an i+1-level broadcast message to each i+1-level node, and the broadcast message contains an i+1-level Bloom filter and the target data. The i+1-level Bloom filter records the identity information of each node and its sibling node at a level not higher than i+1 in the any broadcast path, and is used to indicate the nodes that have received the broadcast message containing the target data to the i+1-level node. It can be understood that after receiving the i+1-level broadcast message, the i+1-level node can determine the nodes that have received the broadcast message containing the target data according to the identity information recorded in the i+1-level Bloom filter contained therein, and then can select other nodes in its neighbor nodes except for these nodes as optional nodes, and select at least one i+2-level node from these optional nodes and send an i+2-level broadcast message to it. The specific manner in which the i+1-level node selects the i+2-level node can refer to the foregoing embodiments of the i-level node selecting the i+1-level node, and the specific manner in which the i+1-level node sends the i+2-level broadcast message to the i+2-level node can refer to the foregoing embodiments of the i-level node sending the i+1-level broadcast message to the i+1-level node, which will not be described here.
[0064] The Bloom filter described in the embodiments of the present specification is essentially a long binary vector and a series of random mapping functions, which can be used to retrieve whether an element exists in a set. Specifically, considering that each identity information recorded in the i+1-level Bloom filter represents a node that has received a broadcast message containing target data in the i+1-level and lower levels, the set of nodes formed by these nodes can be regarded as the i+1-level received node set corresponding to the i+1-level Bloom filter. Based on this, in response to receiving an i+1-level broadcast message, the i+1-level node can detect whether each neighbor node of itself exists in the i+1-level received node set according to the i+1-level Bloom filter: if each neighbor node exists in the set, there is no optional node; if not all neighbor nodes exist in the set (i.e., none of them exist in the set or part of them exist in the set), the i+1-level node can determine the optional node corresponding to itself, i.e., the neighbor node that does not exist in the i+1-level received node set.
[0065] In an embodiment, any i-level node can record the identity information of the at least one i+1-level node in the i+1-level Bloom filter, construct an i+1-level broadcast message containing the i+1-level Bloom filter and the target data, and then send the constructed i+1-level broadcast message to each i+1-level node. It can be seen that the i+1-level broadcast messages sent by any i-level node to different i+1-level nodes contain the same content, specifically, both contain the i+1-level Bloom filter and the target data. In this way, any i-level node can accurately specify the nodes related to the current broadcast path (i.e., the broadcast path to which the any i-level node belongs) and that have received the broadcast message containing the target data (i.e., each node in the broadcast path and its sibling nodes, hereinafter referred to as excluded nodes) to the i+1-level nodes, so that each i+1-level node can ensure that the excluded nodes among its neighbor nodes are not determined as optional nodes, to avoid sending i+1-level broadcast messages containing target data to the excluded nodes, i.e., to avoid the excluded nodes repeatedly receiving broadcast messages containing target data, significantly reducing the redundancy of the broadcast process, and helping to reduce the required resources of the broadcast process.
[0066] As mentioned above, the any i-level node can be a broadcast initiator or not. According to the role of the node, it can record the identity information of the at least one i+1-level node in the i+1-level Bloom filter in different ways. For example, in the case that the any i-level node is a broadcast initiator, the node can add the identity information of the at least one i+1-level node to a blank Bloom filter, thereby obtaining the i+1-level Bloom filter. The blank Bloom filter is a Bloom filter that has not recorded the identity information of any node - at this time, the Bloom filter does not record the identity information of excluded nodes. In the above way, the identity information of the at least one i+1-level node (i.e. each first-level node) can be recorded in the first-level Bloom filter. Of course, the identity information of the broadcast initiator itself can also be recorded in the Bloom filter, which will not be described again.
[0067] Alternatively, in the case that the any i-level node is not a broadcast initiator, the any i-level node can extract the i-level Bloom filter from the i-level broadcast message sent by the i-1-level node received by itself, and add the identity information of the at least one i+1-level node to the i-level Bloom filter to obtain the i+1-level Bloom filter. It can be seen that the identity information recorded in the i+1-level Bloom filter is the union of the identity information recorded in the i-level Bloom filter and the identity information of each i+1-level node. Obviously, in this way, the accumulation of the identity information recorded in the Bloom filters of different levels can be realized.
[0068] In an embodiment, the i-level node can construct the i+1-level broadcast message in multiple ways. For example, the i+1-level Bloom filter can be serialized, and the serialized data after processing is recorded in the i+1-level broadcast message. Alternatively, the i+1-level Bloom filter and the target data can be recorded in the i+1-level broadcast message, and the i+1-level broadcast message is serialized to obtain the i+1-level broadcast message to be transmitted. The specific process of serializing any data can be referred to the description in the related art, and will not be described again in this specification.
[0069] In an embodiment, the i+1 level broadcast message can be constructed by using a protobuf (protocol buffers) structure. The protobuf is a high-efficiency protocol data exchange format tool library provided by Google, which is a language-independent, platform-independent and extensible method for serializing structured data, and can be used for data communication protocol and data storage, etc. The protobuf has flexible, efficient and automatic mechanism, etc. The structure has the advantages of small volume after coding, faster coding and decoding speed, higher conversion efficiency (such as time efficiency and space efficiency), etc. For example, the i+1 level broadcast message constructed by using the protobuf can be as follows:
[0070]
[0071]
[0072] The ProtoBloomFilter can also be constructed by using the protobuf, and the details are as follows:
[0073]
[0074] Of course, the content of the i+1 level broadcast message and the Bloom filter described above is only exemplary, and in the application stage, the specific content of the i+1 level broadcast message and the Bloom filter can be customized according to actual needs, and the embodiments of the present specification do not limit this.
[0075] It should be noted that the sibling nodes described in the embodiments of the present specification are nodes that have the same parent node, that is, if the parent nodes of any multiple nodes are the same, then these nodes are siblings. For example, as shown in FIG. 6, node1 and node2 are siblings, node6 and node5 are siblings, but node3 and node4 (or node5) are not siblings. Figure 4
[0076] As shown in FIG. 7, node1 and node2 are siblings, node6 and node5 are siblings, but node3 and node4 (or node5) are not siblings. Figure 4 As shown, the first-level broadcast message sent by the zero-level node nodeO to the first-level nodes nodel and node2 contains a first-level Bloom filter and target data, and the identity information (e.g., node identifier) of nodes l-2 is recorded in the first-level Bloom filter, or the identity information of nodes 0-2 can also be recorded. The following nodes are taken as an example. Further, the second-level broadcast message sent by node 1 to the second-level node node3 contains a second-level Bloom filter and target data, and the identity information of nodes 0-3 is recorded in the second-level Bloom filter. Similarly, the second-level broadcast message sent by node 2 to the second-level nodes node4 and node5 contains a second-level Bloom filter and target data, and the identity information of nodes 0-5 is recorded in the second-level Bloom filter. Further, the third-level broadcast message sent by node 3 to the third-level nodes node6 and node7 contains a third-level Bloom filter and target data, and the identity information of nodes 0-3 and nodes 6-7 is recorded in the third-level Bloom filter. Similarly, the third-level broadcast message sent by node 4 to the third-level node node8 contains a third-level Bloom filter and target data, and the identity information of nodes 0-2, nodes 4-5, and node 8 is recorded in the third-level Bloom filter. The third-level broadcast message sent by node 5 to the third-level nodes node9 and node 10 contains a third-level Bloom filter and target data, and the identity information of nodes 0-2, nodes 4-5, and nodes 9-10 is recorded in the third-level Bloom filter.
[0077] As can be seen from the identity information recorded in the Bloom filters of the above levels, for the broadcast messages sent by each node on any broadcast path, the identity information recorded in the Bloom filter of each broadcast message is accumulated layer by layer. Taking the broadcast path nodeO→node2→node5→node 10 as an example, the identity information of nodes 0-2 is recorded in the first-level Bloom filter, the identity information of nodes 0-2 and nodes 4-5 is recorded in the second-level Bloom filter, and the identity information of nodes 0-2, nodes 4-5, and nodes 9-10 is recorded in the third-level Bloom filter. In this way, the previous layer of nodes can explicitly indicate the excluded nodes to the next layer of nodes.
[0078] In step 204b, when the number of optional nodes is zero, any i-level node stops broadcasting the target data.
[0079] Since the optional nodes have not received the broadcast message containing the target data, if the number of optional nodes is zero (i.e., the identity information of all neighbor nodes of any JJ is recorded in the i-level Bloom filter contained in the i-level message received by the JJ itself), it indicates that there is no node in the neighbor nodes of any i-level node that has not received the broadcast message containing the target data, i.e., each neighbor node has received the broadcast message containing the target data. At this time, from the perspective of the local view of any i-level node, the broadcast process of the target data has been completed, and the broadcast of the target data can be stopped.
[0080] Of course, from the global perspective of the unstructured P2P network, at this time, there may still be some nodes in the network that have not received the broadcast message containing the target data, and these nodes can continue to participate in the broadcast of the target data. When the N nodes in the unstructured P2P network stop broadcasting the target data according to the above steps of the present scheme, the broadcast process of the target data in the unstructured P2P network is completed, and at this time, the N nodes will respectively obtain the target data broadcast by the broadcast initiator.
[0081] After obtaining the target data broadcast by the broadcast initiator, each node in the unstructured P2P network can perform a preset processing on the target data. For example, in the case where the network is used to construct a privacy computing network, each node can participate in a privacy computing process for the target data; in the case where the network is used to construct a blockchain network, each node can participate in a consensus process for the target data, and the embodiments of the present specification do not limit the specific processing manner of the target data.
[0082] In the embodiments of the present specification, in the case where the number of optional nodes is not zero, any i-level node on any broadcast path selects at least one i+1-level node from the optional nodes, and sends an i+1-level broadcast message containing an i+1-level Bloom filter and the target data to each i+1-level node. The identity information of each node and its sibling node at a level not higher than i+1 level on the any broadcast path is recorded in the i+1-level Bloom filter, which is used to indicate the nodes that have received the broadcast message containing the target data to the i+1-level node.
[0083] It can be seen that the previous stage node on any broadcast path can explicitly indicate to the next stage node through the i+1 stage Bloom filter that the node has received the broadcast message containing the target data, thereby avoiding the next stage node selecting this part of the node as the next stage node corresponding to itself, effectively avoiding the probability of the same node repeatedly receiving the broadcast message containing the target data, thereby reducing the redundancy of the broadcast process and saving the resource overhead of the broadcast process. In addition, since the previous stage node does not need to confirm to the next stage node when sending the broadcast message to the latter, and any node does not need to buffer the broadcast message received by itself for subsequent judgment, and can determine when it should stop broadcasting the target data according to the number of the optional node corresponding to itself (i.e., the number of the optional node is zero), the broadcast convergence can be guaranteed even in a high TPS scenario, thereby effectively avoiding the broadcast from being unable to terminate.
[0084] It can be understood that since the internal structure (i.e., the connection relationship between the nodes) of the unstructured P2P network is difficult to predict, in the present scheme, the broadcast paths starting from the broadcast initiator may intersect. Based on this, the repeated sending of the broadcast message can be further reduced by merging the Bloom filters.
[0085] For example, the any i stage node can buffer the i stage Bloom filter contained in the i stage broadcast message sent by the i-1 stage node in the local in response to receiving the i stage broadcast message. Then, in the case of receiving any broadcast message containing any Bloom filter and any data, if the any data is the target data, the any i stage node can merge the i stage Bloom filter and the any Bloom filter into the latest Bloom filter, and the identity information recorded in the latest Bloom filter is recorded in the i stage Bloom filter and / or the any Bloom filter. It can be understood that the any data being the target data indicates that the any broadcast message received by the any i stage node contains the same data as the foregoing i stage broadcast message, i.e., the node repeatedly receives different broadcast messages containing the same data, and further indicates that the two broadcast paths in the data broadcast process intersect at the node. At this time, the i stage Bloom filter and the any Bloom filter are merged to obtain the latest Bloom filter, and the identity information recorded in the latest Bloom filter is the union of the identity information recorded in the i stage Bloom filter and the any Bloom filter, i.e., the identity information of any node recorded in the latest Bloom filter may be recorded only in the i stage Bloom filter, only in the any Bloom filter, or in both the i stage Bloom filter and the any Bloom filter.
[0086] Further, any i-th node can select at least one latest (i+1)-th node from its neighbor nodes other than the nodes represented by the node identities recorded in the latest Bloom filter, and send a merge broadcast message containing the latest Bloom filter and the target data to each of the latest (i+1)-th nodes. Since the identity information recorded in the latest Bloom filter is the union of the identity information recorded in the i-th Bloom filter and the any Bloom filter, the latest (i+1)-th node does not belong to the broadcast path corresponding to the i-th Bloom filter or the broadcast path corresponding to the any Bloom filter, so the latest (i+1)-th node has a greater probability of not having received any broadcast message containing the target data. In this way, more nodes that have received broadcast messages containing the target data can be excluded in the selection of the latest (i+1)-th node, thereby further reducing the possibility of the latest (i+1)-th node receiving such broadcast messages repeatedly, which helps to reduce the redundancy of the broadcast process.
[0087] As mentioned before, for node6, it belongs to the third-level node in the broadcast path "node0→node1→node3→node6" (hereinafter referred to as trace1); assuming that node0 also selects node12 as a first-level node and node12 selects node6 as a second-level node in the broadcast process of the target data, node6 belongs to the second-level node in the broadcast path "node0→node12→node6" (hereinafter referred to as trace2). It is assumed that the time consumption of message transmission between different levels is relatively close, then node6 will first receive the second-level broadcast message sent by node12 and then receive the third-level broadcast message sent by node7.
[0088] In this regard, node6 can cache the second-level Bloom filter contained in the second-level broadcast message sent by node12 locally, wherein a first hash value can be calculated based on the message sequence number (such as the aforementioned P2PMessage.msg_id) of the second-level broadcast message and the target data (such as the aforementioned P2PMessage.msg), and the first hash value can be used as an index when storing the second-level Bloom filter. Thereafter, for any received broadcast message, node6 can calculate a second hash value according to the message sequence number and the data carried by the broadcast message, and determine whether the data carried by the broadcast message is the target data by comparing the first hash value and the second hash value. Therefore, in the case of receiving the third-level broadcast message sent by node7, node6 can determine that the message contains the target data according to the calculated second hash value being equal to the first hash value, at which time it can be determined that L1 and L2 intersect at node6.
[0089] Then, node 6 can combine the secondary broadcast message in the above-mentioned secondary broadcast message with the tertiary Bloom filter in the tertiary broadcast message to obtain a latest Bloom filter containing the identity information of node 0-2, node 3, node 6-7 and node 12. Further, node 6 can exclude node 3 and node 12 from the five neighbor nodes connected to node 6, determine the remaining three nodes as optional nodes, and then further select the latest tertiary node and send a tertiary broadcast message to the latest tertiary node. In this way, the merging of trace 1 and trace 2 is realized, which helps to further reduce the probability that a node may repeatedly receive a broadcast message containing target data, thereby reducing the redundancy of the target data broadcast process.
[0090] Corresponding to the above-mentioned embodiment of the message broadcast method, the present scheme also proposes an embodiment of an unstructured P2P network. Each node in the unstructured P2P network is connected to at least one neighbor node, and each node in the unstructured P2P network constitutes M levels on a broadcast path of target data, M>1, and the node of the i-th level is an i-level node; wherein any i-level node on any broadcast path is used to:
[0091] determine optional nodes that have not received a broadcast message containing the target data from neighbor nodes of the i-level node;
[0092] select at least one i+1-level node from the optional nodes when the number of the optional nodes is not zero; and send an i+1-level broadcast message to each i+1-level node, wherein the i+1-level broadcast message contains an i+1-level Bloom filter and the target data, and the i+1-level Bloom filter records the identity information of each node and its sibling node on the broadcast path whose level is not higher than i+1, and is used to indicate to the i+1-level node a node that has received a broadcast message containing the target data;
[0093] stop broadcasting the target data when the number of the optional nodes is zero.
[0094] The specific process of broadcasting the target data by any i-level node in the unstructured P2P network can be referred to the detailed description of the above-mentioned method embodiment, which will not be described here.
[0095] Figure 5 is a schematic structural diagram of a device provided by an example embodiment. Please refer to Figure 5At the hardware level, the device includes a processor 502, an internal bus 504, a network interface 506, a memory 508, and a non-volatile memory 510, and can also include other hardware required by the business. One or more embodiments of the present specification can be implemented in a software manner, such as reading a corresponding computer program from the non-volatile memory 510 into the memory 508 by the processor 502 and then running. Of course, in addition to the software implementation, one or more embodiments of the present specification do not exclude other implementations, such as logic devices or a combination of software and hardware, and the like, that is, the execution subject of the following processing flow is not limited to each logic unit, but can also be hardware or logic devices.
[0096] As shown in Figure 6 , Figure 6 is a block diagram of a message broadcasting device provided by an exemplary embodiment of the present specification. The device can be applied to the device as shown in Figure 5 to implement the technical solutions of the present specification. The device is applied to an unstructured P2P network, each node in the unstructured P2P network is connected to at least one neighbor node, and each node in the unstructured P2P network constitutes M levels on a broadcast path of target data, the nodes of the i-th level are i-level nodes, M and i are integers, M > 1, M ≥ i ≥ 0; the device comprises:
[0097] A determination unit 601 is configured to determine, by any i-level node on any broadcast path, from neighbor nodes of the any i-level node, optional nodes that have not received a broadcast message containing the target data;
[0098] A sending unit 602 is configured to, in a case where the number of the optional nodes is not zero, select, by the any i-level node, at least one i+1-level node from the optional nodes; and send an i+1-level broadcast message to each i+1-level node, respectively, wherein the i+1-level broadcast message contains an i+1-level Bloom filter and the target data, and the i+1-level Bloom filter records identity information of each node and its sibling node on the any broadcast path whose level is not higher than i+1, and is used to indicate, to the i+1-level node, nodes that have received the broadcast message containing the target data;
[0099] A stopping unit 603 is configured to, in a case where the number of the optional nodes is zero, stop, by the any i-level node, broadcasting the target data.
[0100] Optionally, the determination unit 601 is specifically configured to:
[0101] In a case where the any i-level node is a broadcast initiator, determine all neighbor nodes of the any i-level node as the optional nodes;
[0102] In a case where the any i-level node is not the broadcast initiator, an i-level Bloom filter contained in an i-level broadcast message sent by an i-1 level node and received by the any i-level node is determined, and other neighbor nodes of the any i-level node except for nodes represented by identity information recorded in the i-level Bloom filter are determined as the optional nodes.
[0103] Optionally, the sending unit 602 is specifically configured to:
[0104] randomly selecting at least one optional node from the optional nodes as an i+1 level node; or,
[0105] if the any i-level node has sent a broadcast message containing other data to at least one previous optional node in the optional nodes before the current time, selecting at least one i+1 level node from other optional nodes in the optional nodes except for the at least one previous optional node.
[0106] Optionally, the sending unit 602 is specifically configured to:
[0107] in a case where the number of the optional nodes is not less than a preset broadcast path number, selecting optional nodes with a number of the preset broadcast path number from the optional nodes as i+1 level nodes; or,
[0108] in a case where the number of the optional nodes is less than the preset broadcast path number, taking all the optional nodes as i+1 level nodes.
[0109] Optionally, the sending unit 602 is specifically configured to:
[0110] recording identity information of the at least one i+1 level node in an i+1 level Bloom filter, and constructing an i+1 level broadcast message containing the i+1 level Bloom filter and the target data;
[0111] sending the constructed i+1 level broadcast message to each i+1 level node respectively.
[0112] Optionally, the sending unit 602 is specifically configured to:
[0113] in a case where the any i-level node is the broadcast initiator, adding identity information of the at least one i+1 level node to a blank Bloom filter to obtain an i+1 level Bloom filter;
[0114] in a case where the any i-level node is not the broadcast initiator, extracting an i-level Bloom filter from an i-level broadcast message sent by an i-1 level node and received by the any i-level node, and adding identity information of the at least one i+1 level node to the i-level Bloom filter to obtain an i+1 level Bloom filter.
[0115] Optionally, the sending unit 602 is specifically configured to:
[0116] serializing the i+1 level Bloom filter and recording the serialized data in the i+1 level broadcast message; or,
[0117] recording the i+1 level Bloom filter and the target data in an i+1 level broadcast message, and serializing the i+1 level broadcast message to obtain the i+1 level broadcast message to be transmitted.
[0118] Optionally, in the case that the any i level node is not a broadcast initiator, the apparatus further comprises:
[0119] a caching unit 604 configured to cause the any i level node to cache an i level Bloom filter contained in an i level broadcast message sent by an i-1 level node in response to receiving the i level broadcast message;
[0120] a merging unit 605 configured to cause the any i level node to, in the case that any broadcast message containing any Bloom filter and any data is received, if the any data is the target data, merge the i level Bloom filter and the any Bloom filter into a latest Bloom filter, identity information recorded in the latest Bloom filter being recorded in the i level Bloom filter and / or the any Bloom filter, and select at least one latest i+1 level node from neighbor nodes of the any i level node except for a node represented by a node identifier recorded in the latest Bloom filter, and send a merging broadcast message containing the latest Bloom filter and the target data to each latest i+1 level node respectively.
[0121] Optionally, the unstructured P2P network is used to construct a blockchain network.
[0122] In the 1990s, it was quite obvious to distinguish whether an improvement in a technology was in hardware (e.g., improvement in circuit structures of diodes, transistors, switches, etc.) or in software (improvement in method flow). However, as technology has evolved, many improvements in method flow today can be considered as direct improvements in hardware circuit structures. Designers almost always obtain the corresponding hardware circuit structures by programming the improved method flow into hardware circuits. Therefore, it cannot be said that an improvement in a method flow cannot be implemented by hardware entity modules. For example, a programmable logic device (PLD) (e.g., a field programmable gate array (FPGA)) is an integrated circuit whose logic function is determined by user programming of the device. A digital system is "integrated" on a PLD by the designer programming it, rather than by asking a chip manufacturer to design and fabricate a custom integrated circuit chip. Moreover, instead of manually fabricating integrated circuit chips, this programming is now mostly implemented by "logic compiler" software, which is similar to software compilers used in program development, and the original code to be compiled is written in a specific programming language, which is called a hardware description language (HDL), and there are many such languages, such as ABEL (Advanced Boolean Expression Language), AHDL (Altera Hardware Description Language), Confluence, CUPL (Cornell University Programming Language), HDCal, JHDL (Java Hardware Description Language), Lava, Lola, MyHDL, PALASM, RHDL (Ruby Hardware Description Language), etc., and the most commonly used are VHDL (Very-High-Speed Integrated Circuit Hardware Description Language) and Verilog. Those skilled in the art should be aware that, as long as the method flow is logically programmed in the above-mentioned hardware description languages and programmed into an integrated circuit, a hardware circuit implementing the logical method flow can be easily obtained.
[0123] The controller can be implemented in any suitable way, for example, the controller can take the form of, for example, a microprocessor or processor and a computer readable medium storing computer readable program code, such as software or firmware, executable by the (micro)processor, logic gates, switches, an application specific integrated circuit (ASIC), a programmable logic controller and an embedded microcontroller, examples of which include but are not limited to the following microcontrollers: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20 and Silicone Labs C8051F320, the memory controller can also be implemented as part of the control logic of the memory. The skilled person will also appreciate that, in addition to implementing the controller in pure computer readable program code, it is possible to implement the controller in the form of logic gates, switches, an application specific integrated circuit, a programmable logic controller and an embedded microcontroller, etc. to perform the same functions by logically programming the method steps. Such a controller can therefore be considered to be a hardware component, and the means included therein to perform the various functions can also be considered to be structures within the hardware component. Alternatively, or even additionally, the means to perform the various functions can be considered to be both a software module implementing the method and a structure within a hardware component.
[0124] The systems, apparatuses, modules or units illustrated by the above embodiments can be specifically implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a server system. Of course, the present specification does not exclude that with the development of computer technology in the future, computers implementing the functions of the above embodiments can be personal computers, laptop computers, vehicle human-computer interaction devices, cellular phones, camera phones, smart phones, personal digital assistants, media players, navigation devices, electronic mail devices, game consoles, tablet computers, wearable devices, or combinations of any of these devices.
[0125] Although the method operations of the embodiments of the present disclosure are described in a particular, sequential order, one or more of the method operations can be omitted, or the method operations can be performed in an order other than the described order. Additionally, one or more of the method operations can be performed concurrently, or with partial concurrence. Furthermore, one or more of the method operations can be performed at different times, or can be performed in different orders than that described herein. The term "comprising," as used in the claims, should not be interpreted as being restricted to the means listed thereafter; it does not exclude other elements or steps. It is thus to be understood that not all the steps listed in the various embodiments of the present disclosure are mandatory, and that some of the steps can be omitted in some embodiments. The term "comprising" as used herein is synonymous with the term "including", "containing", or "comprising". As used herein, when the phrase "at least" is used to follow the recitation of one or more elements or options, the phrase is intended to add the meaning "one or more other non-specified elements or options". Where the phrase "at least" is used in a situation involving a "combination of elements", the phrase is intended to add the meaning "one or more of the elements" to the combination. The terms "first", "second" and the like, do not denote any order, quantity, combination or arrangement, but are used to identify one element from another. The terms "first", "second", "third", etc. are used to identify different elements, and are not necessarily used in a chronological or sequential manner, unless otherwise stated. The terms "first", "second", "third", etc. are used to identify different elements, and are not necessarily used in a chronological or sequential manner, unless otherwise stated. The term "plurality" refers to two or more elements, unless otherwise stated. The term "coupled" means directly or indirectly connected, linked or associated, whether electrically, mechanically or otherwise.
[0126] For the sake of description, the above-described apparatuses are described with various modules for convenience. Of course, when implementing one or more embodiments of the present disclosure, the functions of each module can be implemented in one or more software and / or hardware, and modules implementing the same function can be implemented by a combination of a plurality of sub-modules or sub-units, etc. The above-described apparatus embodiment is merely illustrative, for example, the division of the units is merely a logical function division, and actual implementation can have another division manner, for example, a plurality of units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between the displayed or discussed elements can be indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.
[0127] The present disclosure is described with reference to flowcharts and / or block diagrams of methods, apparatus (systems) and computer program products according to embodiments of the present disclosure. It should be understood that each flow and / or block in the flowcharts and / or block diagrams, as well as combinations of flows and / or blocks in the flowcharts and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing apparatus to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing apparatus generate a means for implementing the functions specified in the flowcharts and / or block diagrams. Figure 1 The functions of one or more flows or one or more blocks Figure 1 The functions of one or more flows or one or more blocks
[0128] These computer program instructions can also be stored in a computer- readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instructions which implement the Figure 1 function specified in the flow or flows and / or blocks Figure 1 of the block or blocks.
[0129] These computer program instructions can also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the Figure 1 function specified in the flow or flows and / or blocks Figure 1 of the block or blocks.
[0130] In a typical configuration, a computing device includes one or more processors (CPUs), input / output interfaces, network interfaces, and memory.
[0131] The memory can include non-persistent memory and / or volatile memory, such as random access memory (RAM) and / or cache memory, non-volatile memory, such as read-only memory (ROM), EPROM, and / or flash memory. The memory is an example of computer-readable media.
[0132] Computer-readable media includes permanent and non-permanent, removable and non-removable media implemented in any method or technology for storage of information such as computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disc read-only memory (CD-ROM), digital versatile disc (DVD), or other optical storage, magnetic cassettes, magnetic tapes, magnetic disk storage, graphene storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information accessible to computing devices. According to the definition herein, computer-readable media does not include transitory media, such as modulated data signals and carrier waves.
[0133] Those skilled in the art will appreciate that the one or more embodiments described herein can be provided as a method, a system or a computer program product. Accordingly, the one or more embodiments described herein can take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the one or more embodiments described herein can take the form of a computer program product on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROMs, optical storage devices, etc.) embodying computer readable code.
[0134] The one or more embodiments described herein can be described in the general context of computer-executable instructions, such as program modules, being executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, etc., that perform particular tasks or implement particular abstract data types. The one or more embodiments described herein can also be practiced in distributed computing environments where tasks are performed by remote processing devices that are linked through a communications network. In a distributed computing environment, program modules can be located in both local and remote computer storage media including memory storage devices.
[0135] The various embodiments described in this specification can be described in the general context of computer-executable instructions, such as program modules, being executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, etc., that perform particular tasks or implement particular abstract data types. The various embodiments described in this specification can also be practiced in distributed computing environments where tasks are performed by remote processing devices that are linked through a communications network. In a distributed computing environment, program modules can be located in both local and remote computer storage media including memory storage devices.
[0136] The above description is only some embodiments of the one or more embodiments described in this specification and is not intended to limit the one or more embodiments described in this specification. Those skilled in the art can make various modifications and changes to the one or more embodiments described in this specification. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principle of the one or more embodiments described in this specification shall be included in the scope of the claims.
Claims
1. A message broadcasting method applied to an unstructured P2P network, wherein each node in the unstructured P2P network is connected to at least one neighbor node, and the nodes in the unstructured P2P network form M levels on the broadcast path of the target data, wherein the node of the i-th level is the i-th level node, M and i are both integers, M>1, M≥i≥0; the method includes: Any i-th level node on any broadcast path determines optional nodes from its own neighbor nodes that have not yet received a broadcast message containing the target data, including: if any i-th level node is the broadcast initiator, determining all its own neighbor nodes as optional nodes; if any i-th level node is not the broadcast initiator, determining the i-th level Bloom filter contained in the i-th level broadcast message sent by the i-1 level node it received, and determining the other neighbor nodes in its own neighbor nodes other than the nodes represented by the identity information recorded by the i-th level Bloom filter as optional nodes. When the number of selectable nodes is not zero, any i-level node selects at least one i+1-level node from the selectable nodes; and sends an i+1-level broadcast message to each i+1-level node, wherein the i+1-level broadcast message contains an i+1-level Bloom filter and the target data, and the i+1-level Bloom filter records the identity information of each node at a level no higher than i+1 on any broadcast path and its sibling nodes, which is used to indicate to the i+1-level node that a node has received a broadcast message containing the target data; When the number of selectable nodes is zero, any i-level node stops broadcasting the target data.
2. The method according to claim 1, wherein any i-th level node selects at least one i+1-th level node from the selectable nodes, comprising: Randomly select at least one optional node from the optional nodes as a level i+1 node; or, If any i-level node has sent a broadcast message containing other data to at least one of the preceding optional nodes before the current time, then at least one i+1-level node is selected from the other optional nodes besides the at least one preceding optional node.
3. The method according to claim 1, wherein any i-level node selects at least one i+1-level node from the selectable nodes, comprising: If the number of selectable nodes is not less than the preset number of broadcast paths, select selectable nodes from the selectable nodes whose number equals the preset number of broadcast paths as level i+1 nodes; or... If the number of selectable nodes is less than the preset number of broadcast paths, all selectable nodes will be treated as i+1 level nodes.
4. The method according to claim 1, wherein any i-level node sends an i+1 level broadcast message to each i+1 level node, comprising: Record the identity information of the at least one i+1 level node in the i+1 level Bloom filter, and construct an i+1 level broadcast message containing the i+1 level Bloom filter and the target data; Send the completed i+1 level broadcast message to each i+1 level node.
5. The method according to claim 4, wherein recording the identity information of the at least one i+1 level node in the i+1 level Bloom filter comprises: If any i-level node is the broadcast initiator, the identity information of at least i+1-level node is added to the blank Bloom filter to obtain the i+1-level Bloom filter. If any i-th level node is not the broadcast initiator, an i-th level Bloom filter is extracted from the i-th level broadcast message sent by the i-th level node received by itself, and the identity information of the at least i+1 level node is added to the i-th level Bloom filter to obtain the i+1 level Bloom filter.
6. The method according to claim 4, wherein constructing an i+1 level broadcast message comprising the i+1 level Bloom filter and the target data comprises: The i+1 level Bloom filter is serialized, and the processed serialized data is recorded in the i+1 level broadcast message; or, The i+1 level Bloom filter and the target data are recorded in the i+1 level broadcast message, and the i+1 level broadcast message is serialized to obtain the i+1 level broadcast message to be transmitted.
7. The method according to claim 1, wherein if any i-level node is not a broadcast initiator, the method further comprises: In response to receiving an i-level broadcast message from an i-1 level node, any i-level node caches the i-level Bloom filter contained in the i-level broadcast message locally. When any i-level node receives any broadcast message containing any Bloom filter and any data, if the data is the target data, then the i-level Bloom filter and the any Bloom filter are merged into a latest Bloom filter, and the identity information recorded in the latest Bloom filter is recorded in the i-level Bloom filter and / or the any Bloom filter. In addition, select at least one latest i+1 level node from its own neighboring nodes, excluding the node represented by the node identifier recorded in the latest Bloom filter, and send a merged broadcast message containing the latest Bloom filter and the target data to each latest i+1 level node respectively.
8. The method according to claim 1, wherein the unstructured P2P network is used to construct a blockchain network.
9. An unstructured P2P network, wherein each node in the unstructured P2P network is connected to at least one neighboring node, and the nodes in the unstructured P2P network form M levels on the broadcast path of target data, wherein the node of the i-th level is an i-level node, M and i are both integers, M>1, M≥i≥0; wherein any i-level node on any broadcast path is used for: Determine potential nodes from among its neighboring nodes that have not yet received a broadcast message containing the target data, including: If any i-level node is the broadcast initiator, all its neighboring nodes are determined as the selectable nodes; If any i-th level node is not the broadcast initiator, determine the i-th level Bloom filter contained in the i-th level broadcast message sent by the i-1 level node that it receives, and determine the other neighboring nodes in its own neighboring nodes other than the nodes represented by the identity information recorded by the i-th level Bloom filter as the optional nodes; If the number of selectable nodes is not zero, at least one i+1 level node is selected from the selectable nodes; and an i+1 level broadcast message is sent to each i+1 level node, wherein the i+1 level broadcast message contains an i+1 level Bloom filter and the target data, and the i+1 level Bloom filter records the identity information of each node at a level no higher than i+1 on any broadcast path and its sibling nodes, which is used to indicate to the i+1 level node that a node has received a broadcast message containing the target data; If the number of available nodes is zero, stop broadcasting the target data.
10. A message broadcasting device applied to an unstructured P2P network, wherein each node in the unstructured P2P network is connected to at least one neighboring node, and the nodes in the unstructured P2P network form M levels on the broadcast path of the target data, wherein the node of the i-th level is the i-th level node, M and i are both integers, M>1, M≥i≥0; the device comprises: The determining unit is configured to enable any i-th level node on any broadcast path to determine, from its own neighbor nodes, a potential node that has not yet received a broadcast message containing the target data. Specifically, it is configured to: if any i-th level node is a broadcast initiator, determine all its own neighbor nodes as potential nodes; if any i-th level node is not a broadcast initiator, determine the i-th level Bloom filter contained in the i-th level broadcast message sent by the i-1 level node it received, and determine the other neighbor nodes besides the nodes represented by the identity information recorded by the i-th level Bloom filter as potential nodes. A sending unit is configured to, when the number of selectable nodes is not zero, enable any i-level node to select at least one i+1-level node from the selectable nodes; and to send an i+1-level broadcast message to each i+1-level node, wherein the i+1-level broadcast message contains an i+1-level Bloom filter and the target data, and the i+1-level Bloom filter records the identity information of each node at a level no higher than i+1 on any broadcast path and its sibling nodes, for indicating to the i+1-level node that a node containing the target data has been received; A stop unit is used to cause any i-level node to stop broadcasting the target data when the number of selectable nodes is zero.
11. An electronic device, comprising: processor; Memory used to store processor-executable instructions; The processor implements the method as described in any one of claims 1-8 by executing the executable instructions.
12. A computer-readable storage medium having stored thereon computer instructions that, when executed by a processor, implement the steps of the method as claimed in any one of claims 1-8.
Citation Information
Patent Citations
Routing implementation method and device for peer-to-peer network, equipment and medium
CN110324415A
Message broadcasting method for block chain network, block chain node and block chain system
CN114390063A