A multi-level peer-to-peer network generation method
By forming a multi-level structure in a point-to-point network, and using the division of inlet nodes and sub-networks, the problems of node type division and message delay in traditional networks are solved, and efficient communication and resource utilization are achieved.
Patent Information
- Application Number
- CN202210511638.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-10
- Publication Date
- 2024-12-31
- Estimated Expiration
- 2042-05-10
AI Technical Summary
Due to the single hierarchy of traditional point-to-point networks, they cannot effectively divide different types of nodes, resulting in wasted network bandwidth and node performance, and high message latency.
The connection information of the initial nodes is hardcoded by several inlet nodes to form a root network. The nodes in the root network form different subnets according to business needs, realizing a multi-level point-to-point network structure, improving network utilization, reducing message delay and broadcast redundancy Remain.
It realizes efficient single-point communication, reduces message delay and network bandwidth waste, and improves network utilization.
Smart Images

Figure CN114866559B_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of peer-to-peer network technology, and more specifically, the present application relates to a multi-level peer-to-peer network generation method. Background Art
[0002] All nodes in the traditional point-to-point network are equal. Each node connects to some nodes according to certain rules to achieve interconnection of all nodes. Messages are continuously forwarded to neighboring nodes to achieve full network coverage. The current technical solution has the following defects:
[0003] First, based on the complex business needs of blockchain, different nodes often need different business data, and a single network structure cannot separate different types of nodes. Second, for messages that are only needed by some nodes, traditional point-to-point networks also need to broadcast the entire network to ensure that the nodes that need this message are covered, resulting in a waste of network bandwidth and node performance. Third, nodes often receive messages after multiple forwardings, so timeliness cannot be guaranteed and message latency is high. Summary of the invention
[0004] The purpose of the present application is to provide a multi-level point-to-point network generation method to solve the technical problem of a single level of point-to-point network in the above-mentioned prior art.
[0005] In order to achieve the above technical objectives, the technical solutions adopted in this application are as follows:
[0006] A multi-level point-to-point network generation method, characterized by comprising the following steps:
[0007] Hard-coding the connection information of the initial node through a plurality of entry nodes so that the entry nodes and the initial node are connected to form a root network;
[0008] Each node in the root network is provided with a unique root network ID according to the account information of the node, and any node performs a query and / or a network-wide broadcast of a target node based on the root network ID;
[0009] Some nodes in the root network form different sub-networks based on different business requirements, and the root network and several different sub-networks form a multi-level point-to-point network.
[0010] Preferably, the method further comprises the steps of:
[0011] The new node sends a connection request to the entry node through the entry address of the entry node to request to join the root network;
[0012] The entry node receives and verifies the connection request of the new node. After the verification is passed, the entry node and the new node establish a connection, and the new node joins the root network.
[0013] Preferably, any node performs query and / or network-wide broadcast of a target node based on the root network ID, specifically including the following steps:
[0014] Any node calculates the root network ID of the target node through the account information of the target node, and searches for the target node in the root network according to the root network ID;
[0015] Recursively query the neighbor node closest to the target node through the Kademlia protocol until the neighbor node replies with the connection information of the target node;
[0016] The node and the target node establish a connection after mutual authentication based on the connection information.
[0017] Preferably, establishing a connection after the node and the target node mutually authenticate each other based on the connection information specifically includes the following steps:
[0018] Based on the connection information, the node verifies the target node through a preset verification rule, and based on the connection information, the target node verifies the node through a preset verification rule;
[0019] The node and the target node establish a connection after mutual verification, wherein the preset verification rule includes at least one of a registration system and an invitation system.
[0020] Preferably, any node performs query and / or network-wide broadcast of a target node based on the root network ID, specifically including the following steps:
[0021] Any node randomly selects several neighbor nodes and sends the message that needs to be broadcasted throughout the network to the neighbor nodes;
[0022] After receiving the message, the neighboring node repeats the above steps of any node randomly selecting a number of neighboring nodes and sending the message to be broadcasted to the neighboring node until the message is broadcasted to all nodes under the root network;
[0023] The node converges the messages that need to be broadcasted throughout the network based on a preset convergence rule.
[0024] Preferably, the node converges the message that needs to be broadcasted throughout the network based on a preset convergence rule, specifically including the following steps:
[0025] The preset convergence rule includes at least one of setting a Bloom filter, setting a maximum forwarding number, and setting a maximum forwarding hop number;
[0026] The node converges the message that needs to be broadcasted throughout the network through the Bloom filter, the maximum forwarding times and the maximum forwarding hops.
[0027] Preferably, some nodes in the root network form different sub-networks based on different service requirements, which specifically include the following steps:
[0028] The node information that needs to form a sub-network is transmitted to any other node through the whole network broadcast. Any node that needs to form a sub-network creates a sub-network routing table, and the sub-network routing table stores all the node information that needs to form a sub-network;
[0029] By comparing the subnet routing table with the root network routing table, querying other nodes that are currently not connected and need to form a subnet, or querying other nodes that are currently not connected and need to form a subnet through the root network;
[0030] The node is connected to other nodes that are currently not connected and need to form a sub-network to form the sub-network.
[0031] Preferably, the method further comprises the steps of:
[0032] The first node of the first sub-network calculates the root network ID of the entry node belonging to the second sub-network, searches for the entry node in the root network according to the root network ID, and establishes a connection with the entry node;
[0033] After the first node establishes a connection with the entry node, the message to be transmitted is delivered to the entry node, and the entry node receives and broadcasts the message in the second sub-network.
[0034] Preferably, the method further comprises the steps of:
[0035] Broadcasting a message that any sub-network has stopped service to the entire network, and after receiving the message, any node belonging to the sub-network disconnects from other nodes belonging to the sub-network and deletes the sub-network routing table;
[0036] After receiving the message, any node that does not belong to the sub-network clears the node information belonging to the sub-network in the cache.
[0037] A computer-readable storage medium stores computer instructions, which implement the steps of the above method when executed by a processor.
[0038] The beneficial effects provided by this application are:
[0039] 1. This application hard-codes the connection information of the initial node through several entry nodes, so that the entry node and the initial node are connected to form a root network. Some nodes in the root network form different sub-networks based on different business needs. The root network and several different sub-networks form a multi-level point-to-point network. The root network is only responsible for querying neighbor nodes and forwarding messages that need to be broadcast throughout the network. By creating a multi-level point-to-point network, network utilization is improved, message latency is reduced, and message broadcast redundancy is reduced.
[0040] 2. This application queries other nodes that are not currently connected and need to form a subnetwork by comparing the subnetwork routing table with the root network routing table, or queries other nodes that are not currently connected and need to form a subnetwork through the root network. The node is connected to other nodes that are not currently connected and need to form a subnetwork to form a subnetwork. All nodes in the subnetwork will be connected to other nodes one by one, and the single-point message sending between any two nodes does not require forwarding by other nodes, which can achieve efficient single-point communication between nodes in the subnetwork. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0042] Figure 1 It is a flow chart of the method for generating a point-to-point network. DETAILED DESCRIPTION
[0043] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. The components of the embodiments of the present application described and shown in the drawings here can be arranged and designed in various different configurations.
[0044] Therefore, the following detailed description of the embodiments of the present application provided in the accompanying drawings is not intended to limit the scope of the present application for which protection is sought, but merely represents selected embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without creative work are within the scope of protection of the present application.
[0045] Embodiment 1:
[0046] like Figure 1As shown, this embodiment includes a multi-level point-to-point network generation method, including the following steps: hard-coding the connection information of the initial node through a number of entry nodes, so that the entry node and the initial node are connected to form a root network. Each node in the root network is set with a unique root network ID according to the account information of the node, and any node queries the target node and / or broadcasts the entire network based on the root network ID. Some nodes in the root network form different sub-networks based on different business needs, and the root network and several different sub-networks form a multi-level point-to-point network.
[0047] In this embodiment, multiple seed nodes hard-code the connection information of other initial nodes, and the seed nodes and the initial nodes are connected to each other to form an initial root network. The seed nodes are the entry nodes when new nodes join.
[0048] The method also includes the following steps: the new node sends a connection request to the entry node through the entry address of the entry node to request to join the root network. The entry node receives and verifies the connection request of the new node, and after the verification is passed, the entry node and the new node establish a connection, and the new node joins the root network.
[0049] In this embodiment, a new node needs at least one entry address to join the root network. The new node sends a connection request to the entry address, and the entry node establishes a connection with the new node after verification. The new node further queries other neighbor node information through the entry node to strengthen the connection with the peer-to-peer network.
[0050] Any node queries and / or broadcasts the target node to the entire network based on the root network ID, specifically including the following steps: Any node calculates the root network ID of the target node through the account information of the target node, and searches for the target node in the root network according to the root network ID. Recursively query the neighbor node closest to the target node through the Kademlia protocol until the neighbor node replies with the connection information of the target node. Based on the connection information, the node and the target node establish a connection after mutual verification.
[0051] In this embodiment, the total number of nodes in the point-to-point network is large, and each node cannot be directly connected to all other nodes. Each node is connected to a small number of other nodes through the Kademlia protocol, so that all nodes are indirectly connected. When each node saves neighbor nodes, it calculates the logical distance with other nodes according to a certain algorithm, and saves a certain number of nodes for each distance. It can be understood that several neighbor nodes are saved in the neighbors with a closer distance, several neighbor nodes are saved in the neighbors with a medium distance, and several neighbor nodes are saved in the neighbors with a longer distance. When the source node queries the target node, if there is no target node in the neighbor node directly connected to it, it will query the neighbor node closest to the target. If the neighbor node has the information of the target node, it will return to the source node, otherwise it will recurse further. The technical solution of the present application can realize the rapid convergence query of the target node.
[0052] The connection is established after the connection information node and the target node verify each other, specifically including the following steps: the target node is verified by the connection information node according to the preset verification rules, and the target node verifies the node according to the preset verification rules based on the connection information. The node and the target node are connected after mutual verification, wherein the preset verification rules include at least one of a registration system and an invitation system.
[0053] In this embodiment, a node in the root network verifies whether there is registration information of the target node in the peer-to-peer network in the local data based on the connection information. The target node verifies whether there is registration information of a node in the root network in the peer-to-peer network in the local data based on the connection information. The node and the target node establish a connection after mutual verification.
[0054] Any node queries the target node and / or broadcasts the entire network based on the root network ID, specifically including the following steps: Any node randomly selects several neighbor nodes and sends the message that needs to be broadcasted throughout the network to the neighbor node. After the neighbor node receives the message, it repeats the above steps of any node randomly selecting several neighbor nodes and sending the message that needs to be broadcasted throughout the network to the neighbor node until the message is broadcast to all nodes under the root network. The node converges the message that needs to be broadcasted throughout the network based on the preset convergence rules.
[0055] The node converges the message that needs to be broadcasted throughout the network based on the preset convergence rule, which specifically includes the following steps: the preset convergence rule includes at least one of setting a Bloom filter, setting a maximum forwarding number, and setting a maximum forwarding hop number. The node converges the message that needs to be broadcasted throughout the network through the Bloom filter, the maximum forwarding number, and the maximum forwarding hop number.
[0056] In this embodiment, the node adds the nodes that have received the message to the Bloom filter to converge the message that needs to be broadcasted throughout the network. The nodes that have received the message include the node that transmits the message to itself, the node that transmits the message itself, and the node that writes other nodes in the message body into the Bloom filter.
[0057] As another implementation method, the maximum number of forwarding times is used to converge messages that need to be broadcasted across the entire network. Each node locally caches the hash of messages it has received to ensure that it only forwards the same message N times at most, and does not forward more repeated messages.
[0058] As another implementation method, the maximum forwarding hop count is used to converge messages that need to be broadcast throughout the network. When each node forwards a message, it will save the hop count of the current message in a field of the message. When it is sent from the source node, it is 1, and it increases by 1 each time it is forwarded. When a node receives a message with a hop count greater than the upper limit set locally, it will ignore the message.
[0059] Some nodes in the root network form different sub-networks based on different business needs, which specifically include the following steps: Transmit the node information that needs to form a sub-network to any other node through the whole network broadcast, and any node that needs to form a sub-network creates a sub-network routing table, which stores all the node information that needs to form a sub-network. Query other nodes that are not currently connected to form a sub-network by comparing the sub-network routing table with the root network routing table, or query other nodes that are not currently connected to form a sub-network through the root network. The node is connected to other nodes that are not currently connected and need to form a sub-network to form a sub-network.
[0060] In this embodiment, each node has several different role types. Nodes of the same role type are interconnected to form a separate sub-network. Nodes generate different virtual addresses based on different role types. Each virtual address of the node corresponds to a subnet routing table, which stores information about other nodes of the same role type.
[0061] By comparing the connected nodes in the local root network routing table and querying the unconnected node information through the root network, the connection information of all other nodes in the sub-network can be obtained. Nodes that do not belong to the sub-network only cache the node information belonging to the sub-network and do not actively connect to the nodes belonging to the sub-network immediately. When the network is stable, the node is free, or the message needs to be delivered between sub-networks, the node will query the information of the entry node of the target sub-network.
[0062] After the node information belonging to the sub-network is broadcast to the entire network, all nodes in the sub-network will be connected to other nodes one by one. In this state, the single-point message sending between any two nodes does not require forwarding by other nodes, and efficient single-point communication between nodes in the sub-network can be achieved.
[0063] A subnet represents a business requirement. Once the node scale and node information of the entire subnet are determined, they will not change. There will be no new nodes entering or old nodes exiting. In this case, the full network broadcast within the subnet can take advantage of the fixed node information and implement a more efficient broadcast algorithm than the full network broadcast of the root network.
[0064] The method further includes the following steps: the first node of the first subnetwork calculates the root network ID of the entry node belonging to the second subnetwork, searches for the entry node in the root network according to the root network ID, and establishes a connection with the entry node. After the first node and the entry node are connected, the message to be transmitted is delivered to the entry node, and the entry node receives and broadcasts the message in the second subnetwork.
[0065] In this embodiment, in addition to the need for message communication within the subnet, there is also a need for communication between different subnets based on business needs. It can be understood that after the business reaches a certain stage in the current subnet, it needs to be handed over to another subnet to continue. This type of communication behavior needs to be completed through cross-subnet message delivery.
[0066] The first node is in the first subnet and needs to deliver messages across subnets to transfer the message to the second subnet. The first node randomly selects the entry node belonging to the second subnet through the node account information of the second subnet cached at the beginning, calculates the root network ID of the entry node, queries the connection information of the entry node in the root network through the root network ID and establishes a connection. After the connection is successfully established, the first node sends the message to the node belonging to the second subnet. The node belonging to the second subnet further broadcasts within the second subnet. After completing the cross-subnet message delivery, the first node will also cache the entry node information of the second subnet for a period of time to facilitate the next cross-subnet message delivery.
[0067] Also includes the steps:
[0068] The entire network broadcasts the message that any sub-network has stopped service. After receiving the message, any node belonging to the sub-network disconnects from other nodes belonging to the sub-network and deletes the sub-network routing table. After receiving the message, any node not belonging to the sub-network clears the node information belonging to the sub-network in the cache.
[0069] In this embodiment, each sub-network serves a specific business need. After the business need is met, the sub-network does not need to be saved. The whole network is informed of the termination of a sub-network service through a network-wide broadcast message. After receiving the message, any node belonging to the sub-network disconnects from other nodes belonging to the sub-network and deletes the sub-network routing table. After receiving the message, any node not belonging to the sub-network clears the node information belonging to the sub-network in the cache.
[0070] Embodiment 2:
[0071] A computer-readable storage medium stores computer instructions, which implement the steps of the method in Example 1 when executed by a processor.
[0072] It will be appreciated by those skilled in the art that embodiments of the present invention may be provided as methods, devices, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0073] The present invention is described with reference to the flowcharts and / or block diagrams of the method, terminal device (system), and computer program product according to the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of the processes and / or blocks in the flowchart and / or block diagram, 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 terminal device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing terminal device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0074] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing terminal device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured product including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0075] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal device so that a series of operating steps are executed on the computer or other programmable terminal device to produce a computer-implemented process, thereby providing instructions for executing on the computer or other programmable terminal device to implement the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0076] It should be noted that:
[0077] The phrases "one embodiment" or "embodiment" mentioned in the specification mean that a particular feature, structure or characteristic described in conjunction with the embodiment is included in at least one embodiment of the present application. Therefore, the phrases "one embodiment" or "embodiment" appearing in various places throughout the specification do not necessarily refer to the same embodiment.
[0078] Although the preferred embodiments of the present application have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications falling within the scope of the present application.
[0079] In addition, it should be noted that the shapes and names of the parts and components of the specific embodiments described in this specification may be different. Any equivalent or simple changes made based on the structure, features and principles described in the patent concept of this application are included in the protection scope of the patent of this application. The technicians in the technical field of this application can make various modifications or supplements to the specific embodiments described or replace them in a similar way, as long as they do not deviate from the structure of this application or exceed the scope defined by the claims, they should all fall within the protection scope of this application.
Claims
1. A multi-level point-to-point network generation method, characterized in that: The following steps are involved: Hard-coding the connection information of the initial node through a plurality of entry nodes so that the entry nodes and the initial node are connected to form a root network; Each node in the root network is provided with a unique root network ID according to the account information of the node, and any node performs a query and / or a network-wide broadcast of a target node based on the root network ID; Some nodes in the root network form different sub-networks based on different business requirements, and the root network and several different sub-networks form a multi-level point-to-point network; The method further comprises: Each node has several different role types. Nodes of the same role type are interconnected to form a separate sub-network. Nodes generate different virtual addresses based on different role types. Each virtual address of the node corresponds to a subnet routing table, which stores information about other nodes of the same role type.
2. A multi-level point-to-point network generation method as claimed in claim 1, characterized in that: Also includes the steps: The new node sends a connection request to the entry node through the entry address of the entry node to request to join the root network; The entry node receives and verifies the connection request of the new node. After the verification is passed, the entry node and the new node establish a connection, and the new node joins the root network.
3. A multi-level point-to-point network generation method as claimed in claim 1, characterized in that: Any node performs a query and / or a network-wide broadcast of a target node based on the root network ID, specifically including the following steps: Any node calculates the root network ID of the target node through the account information of the target node, and searches for the target node in the root network according to the root network ID; Recursively query the neighbor node closest to the target node through the Kademlia protocol until the neighbor node replies with the connection information of the target node; The node and the target node establish a connection after mutual authentication based on the connection information.
4. A multi-level point-to-point network generation method as claimed in claim 3, characterized in that: The node and the target node establish a connection after mutual authentication based on the connection information, specifically including the following steps: Based on the connection information, the node verifies the target node through a preset verification rule, and based on the connection information, the target node verifies the node through a preset verification rule; The node and the target node establish a connection after mutual verification, wherein the preset verification rule includes at least one of a registration system and an invitation system.
5. A multi-level point-to-point network generation method as claimed in claim 1, characterized in that: Any node performs a query and / or a network-wide broadcast of a target node based on the root network ID, specifically including the following steps: Any node randomly selects several neighbor nodes and sends the message that needs to be broadcasted throughout the network to the neighbor nodes; After receiving the message, the neighboring node repeats the above steps of any node randomly selecting a number of neighboring nodes and sending the message to be broadcasted to the neighboring node until the message is broadcasted to all nodes under the root network; The node converges the messages that need to be broadcasted throughout the network based on a preset convergence rule.
6. A multi-level point-to-point network generation method as claimed in claim 5, characterized in that: The node converges the messages that need to be broadcasted across the entire network based on a preset convergence rule, specifically including the following steps: The preset convergence rule includes at least one of setting a Bloom filter, setting a maximum forwarding number, and setting a maximum forwarding hop number; The node converges the message that needs to be broadcasted throughout the network through the Bloom filter, the maximum forwarding times and the maximum forwarding hops.
7. A multi-level point-to-point network generation method as claimed in claim 1, characterized in that: Some nodes in the root network form different sub-networks based on different business requirements, which specifically includes the following steps: The node information that needs to form a sub-network is transmitted to any other node through the whole network broadcast. Any node that needs to form a sub-network creates a sub-network routing table, and the sub-network routing table stores all the node information that needs to form a sub-network; By comparing the subnet routing table with the root network routing table, querying other nodes that are currently not connected and need to form a subnet, or querying other nodes that are currently not connected and need to form a subnet through the root network; The node is connected to other nodes that are currently not connected and need to form a sub-network to form the sub-network.
8. A multi-level point-to-point network generation method as claimed in claim 1, characterized in that: Also includes the steps: The first node of the first sub-network calculates the root network ID of the entry node belonging to the second sub-network, searches for the entry node in the root network according to the root network ID, and establishes a connection with the entry node; After the first node establishes a connection with the entry node, the message to be transmitted is delivered to the entry node, and the entry node receives and broadcasts the message in the second sub-network.
9. A method for generating a multi-level point-to-point network as claimed in claim 1, characterized in that: Also includes the steps: Broadcasting a message that any sub-network has stopped service to the entire network, and after receiving the message, any node belonging to the sub-network disconnects from other nodes belonging to the sub-network and deletes the sub-network routing table; After receiving the message, any node that does not belong to the sub-network clears the node information belonging to the sub-network in the cache.
10. A readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 9 are implemented.
