Lightweight distributed consensus networking technology

By adopting lightweight distributed consensus algorithms and Merkle tree storage technology in the blockchain system, the problems of high communication costs and centralized risks in traditional networking technology are solved, and efficient and uncentralized data consistency synchronization is achieved.

CN120342882APending Publication Date: 2025-07-18CHONGQING JINMEI COMM
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410072661.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-01-17
Publication Date
2025-07-18

AI Technical Summary

Technical Problem

In the existing blockchain systems, traditional networking technology has problems such as high communication costs, high resource consumption, high centralization risks, and difficult to quickly realize data consistency.

Method used

A lightweight distributed consensus algorithm is adopted to store consensus data through Merkle tree, and select the optimal master node for data synchronization to achieve efficient transmission and consensus of topological resource information on the entire network.

Benefits of technology

It reduces communication costs, improves data transmission efficiency, realizes a non-centralized network structure, and ensures the consistency of distributed node data and system flexibility.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure FT_1
    Figure FT_1
Patent Text Reader

Abstract

The patent of the invention is based on a lightweight consensus networking technology. The invention discloses a lightweight consensus algorithm based on distributed network nodes, and aims to solve the problem of data consistency of each distributed node in a system. According to the algorithm, transmission data is organized through a reasonable data structure, and consensus data is stored by adopting a Merkle tree, so that the communication cost is greatly reduced; on the basis of acquiring whole network node information by initial consensus, a node with an optimal network topology structure (shortest path to a logic neighbor node) and optimal communication performance (high bandwidth, small delay and small jitter) is selected as an optimal main node, and topology resource information consensus is changed in advance through the optimal main node; and the optimal main nodes distribute the topological resource information to the logical neighbor nodes to efficiently synchronize the changed topological resource information of the whole network, so that the distributed node data consistency is quickly realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of blockchain consensus and relates to a lightweight distributed consensus networking technology. Background Art

[0002] Blockchain is a decentralized, tamper-proof, and traceable distributed database system. The underlying network in the blockchain system uses a peer-to-peer network (P2P network) to organize each independent network node. The P2P network is a flat topology structure, and each node in the network has an equal status. There are no centralized special nodes and hierarchical structures. Therefore, the blockchain has the characteristics of decentralization. The nodes in the system are independent of each other, have the same functions, store the same information, and supervise each other. Unlike traditional distributed databases, each node independently stores complete data. No organization or individual can fully control all data, and only has control over local data. Any modification of local data by any single node will not affect the entire blockchain, so the blockchain is difficult to tamper with. The blockchain divides the data into different blocks, and each block header contains the hash summary information of the previous block, which is connected to form a chain, so the blockchain is traceable.

[0003] Traditional networking technologies include Routing Information Protocol (RIP) and Open Shortest Path First (OSPF) protocols. The main disadvantages of the RIP protocol include being limited by the network scale and having slow network convergence. Compared with the RIP protocol, OSPF is a link-state-based routing protocol, which is also a routing protocol developed specifically for IP and runs directly on the IP layer. Its advantages are that it ensures no routing loops in design, fast convergence, and improved accessibility of network nodes. However, networking using the OSPF protocol also has disadvantages such as long first run time, high resource consumption, and the protocol itself and messages are too complex. However, compared with the OSPF protocol, distributed consensus networking is a technology that uses distributed consensus algorithms for networking. The distributed consensus algorithm is the core mechanism in the blockchain system, which aims to solve the problem of data consistency among distributed nodes in the system. The lightweight distributed consensus algorithm organizes transmission data through a reasonable data structure and uses Merkletree to store consensus data, which greatly reduces the communication cost. In a distributed peer-to-peer network, different nodes reach consensus by exchanging information. However, there may be malicious nodes in the network that tamper with or forge data, or the communication network may cause errors in the transmission of information, which will affect the consensus between nodes and destroy the consistency of the distributed system. Based on the initial consensus to obtain the node information of the entire network, the distributed consensus networking algorithm selects the node with the best network topology structure (the shortest path to its logical neighbor node) and the best communication performance (high bandwidth, low latency, and low jitter) as the optimal master node, efficiently synchronizes the changes in the topology resource information of the entire network, and quickly achieves the consistency of distributed node data. Summary of the Invention

[0004] The distributed consensus algorithm described in the present invention includes an initial consensus algorithm process and a global consensus algorithm process. The overall algorithm process is as follows:

[0005] Initial Consensus Algorithm Process

[0006] Input: nodeNeighborInfo and nodeLinkInfo of the current node

[0007] Output: nodeNeighborInfo and nodeLinkInfo of all nodes, i.e., the network topology

[0008] Step1 Each node initializes the adjacency list Neighbor_list, constructs the adjacency list Neighbor_list with the node's own information, nodeNeighborInfo and

[0009] nodeLinkInfo. If there is only one node and no neighbors, return the node information and exit;

[0010] Step2 Without loss of generality, starting from node A (node A has two neighbors, B and C respectively), the node itself considers itself as the root node and sends its own adjacency list neighbor_list A = [A, B, C] to all its neighbor nodes;

[0011] step3 Node B receives the adjacency list information sent by all neighbors (the adjacency list neighbor_list of node A A = [A, B, C], the adjacency list neighbor_list of node D D = [B, C, D], the adjacency list neighbor_list of node E E = [B, E, F]) and updates the adjacency list to neighbor_list AB = [A, B, C, D, E, F]. Node C receives the adjacency list information sent by all neighbors (the adjacency list neighbor_list of node A A = [A, B, C], the adjacency list neighbor_list of node D D = [B, C, D], the adjacency list neighbor_list of node H H = [C, H, I]) and updates the adjacency list to neighbor_list AC = [A, B, C, D, H, I];

[0012] Step4 Node B sends the latest adjacency list neighbor_listAB Send to neighbors A, D, and E. Node C sends the latest neighbor list neighbor_list AC Send to neighbors A, D, and H;

[0013] Step5 When the node receives the new neighbor list information sent by the neighbor and there is an update compared with the original neighbor list, it continues to spread the new neighbor list to the neighbors, otherwise it does not spread;

[0014] Step6 Node A compares the neighbor list information and no longer changes, believing that the network topology has converged, generates the whole network topology information, and exits.

[0015] According to the initial consensus algorithm, from the perspective of any node, input the neighbor information and link information of the current node, and spread the neighbor information and link information of the current node to the neighbor nodes until the whole network data is consistent, believing that the network topology has reached convergence, and output the whole network topology.

[0016] Global consensus algorithm process

[0017] Input: Whole network topology information, that is, the neighbor information nodeNeighborInfo of all nodes, the link information nodeLinkInfo, the link bandwidth information bandwidth, and the topology resource change information

[0018] Output: Updated whole network topology information (new node joins, exits the network, links are connected or disconnected, subnets are split or merged, etc.)

[0019] Step1 Construct and initialize the Merkle tree to store consensus data such as the neighbor port information of all nodes and the link resource information;

[0020] Step2 Start from the single-sided path of any node. The distance between two nodes is the weight W of the edge. If W = ∞, it means there is no connection between the two nodes. For vertices u and v, check if there exists a vertex w such that the path from u to w and then to v is shorter than the known path. If so, update;

[0021] Step3 Adjacency matrix N of the whole network topology all , if there is a reachable path from V i to V j , then N all [i][j] = d, P[i][j] represents the points that need to be passed from V i to V j . Initialize P[i][j] = j, insert each vertex into the graph, compare the distance after inserting the point with the original distance, and N all [i][j] = min(N all [i][j], N all[i][k] + N all [k][j]), if N all [i][j] becomes smaller, then P[i][j] = k. P[i][j] contains the shortest path information between two nodes;

[0022] Step4 The current node calculates the total minimum distance dis from this node to all nodes in the network. The relative distance value relative_value = Sum(dis) / bandwidth, broadcasts relative_value and the node identifier ID to all nodes in the network, and marks itself as the optimal master node;

[0023] Step5 When a node receives relative_value from other nodes, compare the relative_value of the node that the node originally considered as the optimal master node. If the received relative_value is less than the original relative_value, update it, otherwise do not update. When a node receives relative_value from 3 / 4 of the nodes in the network, it can vote for the currently considered optimal master node;

[0024] Step6 The node with the most votes is the final optimal master node;

[0025] Step7 When a node senses that the neighbor information has changed (newly added or decreased), based on the Merkle tree, the changed information is used as change_info and transmitted in the subsequent process. If this node is not the optimal master node, send the newly obtained neighbor information and link information to its optimal master node. If it is the optimal master node, go to Step8;

[0026] Step8 The optimal master node organizes the changed information and sends it to other optimal master nodes;

[0027] Step9 After the information among the optimal master nodes reaches a consensus, send all the changed information to all the logical neighbor nodes under the jurisdiction of this node to achieve information consistency and update the network topology information.

[0028] The present invention has the following advantages compared with the original network technology solutions:

[0029] 1. Low-cost data transmission

[0030] When initially constructing the network, it is necessary to synchronize the data of the network topology structure. This network is generated from an irregular topology structure, and the initial synchronization of the whole network structure information is particularly important for the subsequent consensus process. During the data transmission process, by cleverly designing the data structure to organize and describe the node neighbor information and link information, the consensus data is transmitted at low cost, meeting the bandwidth requirements of different transmission links.

[0031] 2. Lightweight data storage

[0032] Distributed consensus networking uses Merkle tree to store consensus data. Merkle tree stores consensus data in the form of a binary tree. Each leaf node is a hash code of the consensus, and non-leaf nodes are marked with the connection of the hash codes of the two connected child nodes. All consensus data information is ultimately stored in the block header in the form of Merkle Root, where only the block storing Merkle Root is in lightweight form to facilitate fast verification and data synchronization.

[0033] Merkle tree, also known as hash tree, is a binary tree consisting of a root node, several intermediate nodes and a group of leaf nodes. The bottom leaf nodes store data, and the nodes above them are their corresponding hash values. The intermediate nodes are the hash values of the two child nodes below them, and the root node is the hash value of the top layer and the last top layer. Merkle tree calculates hashes layer by layer, and any data changes of the bottom leaf nodes or a certain node will be transmitted to the father node, and finally to the root node. When the data of the leaf node changes, if you want to compare whether the data of the two sets are the same, you only need to compare the root nodes of the two data. If the data of the bottom leaf nodes are the same, the root nodes are the same; otherwise, the root nodes are different.

[0034] In the actual network topology, the consensus content is the adjacency relationship and status information of the nodes in the whole network, and most of the node information does not change, and only a few nodes change frequently. Therefore, most of the content in each round of consensus is the same as that in the previous round of consensus. If the transmission and consensus process is to transmit the complete data content, the communication cost is wasted, resulting in low consensus efficiency. Therefore, a change_info (change information) transmission design based on Merkle tree is designed in the present invention, so that each round of consensus only needs to transmit the change information content.

[0035] Distributed systems generally achieve consistency through the principle of state machine replication. The core idea is that all replicas in the system run the same state machine. As long as all replicas start with the same initial state and perform a series of identical operations based on the same initial state, all replicas will eventually converge to consistency.

[0036] 3. Centerless networking technology

[0037] In the traditional centralized networking method, information is too concentrated. When the host fails or goes down, it may cause the entire system to crash and the normal network construction cannot be achieved. In the distributed consensus networking technology, each node backs up and stores the same data to be consensus. Shutting down or going offline any node will not affect the node information data jointly maintained by the entire network. The distributed non-centralized networking has higher flexibility and scalability, which is beneficial to the networking management of large-scale networks. BRIEF DESCRIPTION OF THE DRAWINGS

[0038] Figure 1 Full network topology diagram DETAILED DESCRIPTION OF THE EMBODIMENTS

[0039] In order to make the objectives, technical solutions and advantages of the present invention clearer and more understandable, the present invention will be further described in detail below in conjunction with embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.

[0040] Aiming at the problems existing in the prior art, the present invention provides a lightweight distributed consensus networking technical solution. The algorithm proposed by the present invention is significantly different from any previous algorithms for networking technology research and can more efficiently achieve distributed networking. The present invention will be described in detail below with reference to the drawings.

[0041] The lightweight distributed consensus networking technology provided by the embodiments of the present invention specifically includes the following steps:

[0042] Step1 Initialize the adjacency list for each node, and construct the adjacency list Neighbor_list with information such as the neighbors, links, and ports of the current node. The specific implementation process is as follows:

[0043] Taking node 101 as an example, the input neighbor port information is

[0044] {

[0045] "0165":"020100010166020102070066100102000101670201020700671001"

[0046] }

[0047] The input link resource information is:

[0048] {

[0049] "0165":"060401010000000000003D0900003D0900000000000005DC0401020000000000003D0900003D0900000000000005DC0401030000000000003D0900003D0900000000000005DC0401040000000000003D0900003D0900000000000005DC0401050000000000003D0900003D0900000000000005DC0401060000000000003D0900003D0900000000000005DC"

[0050] }

[0051] The input format is in the form of <key, value>. The ID of this input node is represented in hexadecimal (for example, 101 is converted to hexadecimal 65, and the preceding 01 is the domain number). It can be read from the neighbor port information that node 0165 (101) has 2 neighbors, which are node 0166 (102) connected to port 1 and node 0167 (103) connected to port 2. The link resource information mainly stores information such as link bandwidth and remaining capacity.

[0052] In Step2, starting from node 0165 (101), the node itself considers itself as the root node and sends its adjacency list neighbor_list to all its neighbor nodes 0166 (102) and 0167 (103). The specific implementation process is as follows:

[0053] Node 0165(101) believes that this node is the root node and sends the neighbor port information of this node {"0165":"020100010166020102070066100102000101670201020700671001"} and the link resource information {"0165":"060401010000000000003D0900003D0900000000000005DC0401020000000000003D0900003D0900000000000005DC0401030000000000003D0900003D0900000000000005DC0401040000000000003D0900003D0900000000000005DC0401050000000000003D0900003D0900000000000005DC0401060000000000003D0900003D0900000000000005DC"} to neighbor nodes 0166(102) and 0167(103).

[0054] Step3 Node 0166(102) receives the adjacency list information sent by all neighbors (Neighbor_list of node 0165(101), Neighbor_list of node 0168(104), Neighbor_list of node 0169(105)) and updates Neighbor_list. Node 0167(103) receives the adjacency list information sent by all neighbors (Neighbor_list of node 0165(101), Neighbor_list of node 0168(104), Neighbor_list of node 016C(108)) and updates Neighbor_list. The specific implementation process is as follows:

[0055] Node 0166(102) receives the neighbor port information sent by all neighbors and obtains its new neighbor port information as:

[0056] {

[0057] "0166":"03010001016502010207006510010200010168020102070068100103000101690201020700691001",

[0058] "0165":"020100010166020102070066100102000101670201020700671001",

[0059] "0168":"020100010166020202070066100102000101670202020700671001",

[0060] "0169":"0201000101660203020700661001020001016A02010207006A1001"

[0061] }

[0062] The link resource information is as follows:

[0063] {

[0064] "0166":"060401010000000000003D0900003D0900000000000005DC0401020000000000003D0900003D0900000000000005DC0401030000000000003D0900003D0900000000000005DC0401040000000000003D0900003D0900000000000005DC0401050000000000003D0900003D0900000000000005DC0401060000000000003D0900003D0900000000000005DC",

[0065] "0165":"060401010000000000003D0900003D0900000000000005DC0401020000000000003D0900003D0900000000000005DC0401030000000000003D0900003D0900000000000005DC0401040000000000003D0900003D0900000000000005DC0401050000000000003D0900003D0900000000000005DC0401060000000000003D0900003D0900000000000005DC",

[0066] "0168":"060401010000000000003D0900003D0900000000000005DC0401020000000000003D0900003D0900000000000005DC0401030000000000003D0900003D0900000000000005DC0401040000000000003D0900003D0900000000000005DC0401050000000000003D0900003D0900000000000005DC0401060000000000003D0900003D0900000000000005DC",

[0067] "0169":"060401010000000000003D0900003D0900000000000005DC0401020000000000003D0900003D0900000000000005DC0401030000000000003D0900003D0900000000000005DC0401040000000000003D0900003D0900000000000005DC0401050000000000003D0900003D0900000000000005DC0401060000000000003D0900003D0900000000000005DC"

[0068] }

[0069] Node 0167 (103) received neighbor port information sent by all its neighbors and obtained its new neighbor port information as follows:

[0070] {

[0071] "0167":"030100010165020202070065100102000101680202020700681001030001016C02010207006C1001",

[0072] "0165":"020100010166020102070066100102000101670201020700671001",

[0073] "0168":"020100010166020202070066100102000101670202020700671001",

[0074] "016C":"0201000101670203020700671001020001016D02010207006D1001"

[0075] }

[0076] The link resource information is as follows:

[0077] {

[0078] "0167":"060401010000000000003D0900003D0900000000000005DC0401020000000000003D0900003D0900000000000005DC0401030000000000003D0900003D0900000000000005DC0401040000000000003D0900003D0900000000000005DC0401050000000000003D0900003D0900000000000005DC0401060000000000003D0900003D0900000000000005DC",

[0079] "0165":"060401010000000000003D0900003D0900000000000005DC0401020000000000003D0900003D0900000000000005DC0401030000000000003D0900003D0900000000000005DC0401040000000000003D0900003D0900000000000005DC0401050000000000003D0900003D0900000000000005DC0401060000000000003D0900003D0900000000000005DC",

[0080] "0168":"060401010000000000003D0900003D0900000000000005DC0401020000000000003D0900003D0900000000000005DC0401030000000000003D0900003D0900000000000005DC0401040000000000003D0900003D0900000000000005DC0401050000000000003D0900003D0900000000000005DC0401060000000000003D0900003D0900000000000005DC",

[0081] "016C":"060401010000000000003D0900003D0900000000000005DC0401020000000000003D0900003D0900000000000005DC0401030000000000003D0900003D0900000000000005DC0401040000000000003D0900003D0900000000000005DC0401050000000000003D0900003D0900000000000005DC0401060000000000003D0900003D0900000000000005DC"

[0082] }

[0083] In Step 4, node 0166(102) sends the latest neighbor_list to neighbors 0165(101), 0168(104), and 0169(105), and node 0167(103) sends the latest neighbor_list to neighbors 0165(101), 0168(104), and 016C(108).

[0084] In Step 5, if node 0165(101) receives new neighbor_list information sent by neighbors and there are updates compared with the original neighbor_list, it continues to spread the new neighbor_list to neighbors.

[0085] In Step 6, until the comparison of neighbor_list information at node 0165(101) no longer changes, it is considered that the network topology has converged, and the whole network topology information is generated, that is, the whole network neighbor port information and the link resource information are as follows:

[0086] Full network neighbor port information:

[0087] {

[0088] "0167": "030100010165020202070065100102000101680202020700681001030001016C02010207006C1001",

[0089] "0166": "03010001016502010207006510010200010168020102070068100103000101690201020700691001",

[0090] "0165": "020100010166020102070066100102000101670201020700671001",

[0091] "0168": "020100010166020202070066100102000101670202020700671001",

[0092] "0169": "0201000101660203020700661001020001016A02010207006A1001",

[0093] "016C": "0201000101670203020700671001020001016D02010207006D1001",

[0094] "016D": "02010001016C02020207006C1001020001016E02010207006E1001",

[0095] "016A": "0201000101690202020700691001020001016B02010207006B1001",

[0096] "016B": "01010001016A02020207006A1001",

[0097] "016E": "01010001016D02020207006D1001"

[0098] }

[0099] Full-network link resource information:

[0100] {

[0101] "0167": "060401010000000000003D0900003D0900000000000005DC0401020000000000003D0900003D0900000000000005DC0401030000000000003D0900003D0900000000000005DC0401040000000000003D0900003D0900000000000005DC0401050000000000003D0900003D0900000000000005DC0401060000000000003D0900003D0900000000000005DC",

[0102] "0166": "060401010000000000003D0900003D0900000000000005DC0401020000000000003D0900003D0900000000000005DC0401030000000000003D0900003D0900000000000005DC0401040000000000003D0900003D0900000000000005DC0401050000000000003D0900003D0900000000000005DC0401060000000000003D0900003D0900000000000005DC",

[0103] "0165": "060401010000000000003D0900003D0900000000000005DC0401020000000000003D0900003D0900000000000005DC0401030000000000003D0900003D0900000000000005DC0401040000000000003D0900003D0900000000000005DC0401050000000000003D0900003D0900000000000005DC0401060000000000003D0900003D0900000000000005DC",

[0104] "0168":"060401010000000000003D0900003D0900000000000005DC0401020000000000003D0900003D0900000000000005DC0401030000000000003D0900003D0900000000000005DC0401040000000000003D0900003D0900000000000005DC0401050000000000003D0900003D0900000000000005DC0401060000000000003D0900003D0900000000000005DC",

[0105] "0169":"060401010000000000003D0900003D0900000000000005DC0401020000000000003D0900003D0900000000000005DC0401030000000000003D0900003D0900000000000005DC0401040000000000003D0900003D0900000000000005DC0401050000000000003D0900003D0900000000000005DC0401060000000000003D0900003D0900000000000005DC",

[0106] "016C":"060401010000000000003D0900003D0900000000000005DC0401020000000000003D0900003D0900000000000005DC0401030000000000003D0900003D0900000000000005DC0401040000000000003D0900003D0900000000000005DC0401050000000000003D0900003D0900000000000005DC0401060000000000003D0900003D0900000000000005DC",

[0107] "016D":"060401010000000000003D0900003D0900000000000005DC0401020000000000003D0900003D0900000000000005DC0401030000000000003D0900003D0900000000000005DC0401040000000000003D0900003D0900000000000005DC0401050000000000003D0900003D0900000000000005DC0401060000000000003D0900003D0900000000000005DC",

[0108] "016A":"060401010000000000003D0900003D0900000000000005DC0401020000000000003D0900003D0900000000000005DC0401030000000000003D0900003D0900000000000005DC0401040000000000003D0900003D0900000000000005DC0401050000000000003D0900003D0900000000000005DC0401060000000000003D0900003D0900000000000005DC",

[0109] "016B":"060401010000000000003D0900003D0900000000000005DC0401020000000000003D0900003D0900000000000005DC0401030000000000003D0900003D0900000000000005DC0401040000000000003D0900003D0900000000000005DC0401050000000000003D0900003D0900000000000005DC0401060000000000003D0900003D0900000000000005DC",

[0110] "016E":"060401010000000000003D0900003D0900000000000005DC040102000000000 0003D0900003D0900000000000005DC0401030000000000003D0900003D0900000000000 005DC0401040000000000003D0900003D0900000000000005DC0401050000000000003D0 900003D0900000000000005DC0401060000000000003D0900003D0900000000000005DC"

[0111] }

[0112] From the above output results, it can be seen that the current node 0165 (101) contains all neighbor port information and link resource information of the entire network, and believes that the topology resource information of the entire network has reached a consensus, and then the topology information of the entire network is used as input to enter the global consensus algorithm process.

[0113] The global consensus algorithm process mainly includes the election of the best master node and the synchronization of the changed topological resource information across the network. By executing the global consensus algorithm process Step 1 to Step 6, the best master node can be elected; by executing the global consensus algorithm process Step 7 to Step 9, the changed topological resource information can be achieved in the whole network.

[0114] The network topology described in this embodiment undergoes the global consensus algorithm process Step 1 to Step 6, and three optimal master nodes are selected, which are ['0165', '0168', '0167'], that is, ['101', '104', '103']. The remaining nodes are divided into logical neighbor nodes of the three optimal master nodes, and the division is as follows: {'0165': ['0166', '0169', '016A', '016B'], '0168': [], '0167': ['016C', '016D', '016E']}.

[0115] The topology resource information is changed to disconnect the link between port 2 of node 016D (109) and port 1 of node 016E (110). When this change occurs, node 016E (110) becomes an isolated node.

[0116] According to Step 7 of the global consensus algorithm process, node 016D(109) first perceives that the neighbor port information has changed. Therefore, node 016D(109) sends the neighbor port change information to its optimal master node 0167(103). The global network topology information of the optimal master node 0167(103) changes first: delete the neighbor port information of node 016E(110), and delete the information of node 016E(110) connected to port 2 of node 016D(109).

[0117] According to Step 8 of the global consensus algorithm process, the optimal master node 0167(103) reaches a consensus on the neighbor port change information between node 0165(101) and node 0168(104). The optimal master nodes 0165(101) and 0168(104) complete the neighbor port information change.

[0118] According to Step 9 of the global consensus algorithm process, after the 3 optimal master nodes synchronize the changed topology resource information with each other, they respectively send the changed topology resource information to the logical neighbor nodes under their jurisdiction. Finally, all nodes complete the synchronization of the changed topology resource information.

[0119] Viewing the global neighbor port information from node 0165(101):

[0120] {

[0121] "0167":"030100010165020202070065100102000101680202020700681001030001016C02010207006C1001",

[0122] "0166":"03010001016502010207006510010200010168020102070068100103000101690201020700691001",

[0123] "0165":"020100010166020102070066100102000101670201020700671001",

[0124] "0168":"020100010166020202070066100102000101670202020700671001",

[0125] "0169":"0201000101660203020700661001020001016A02010207006A1001",

[0126] "016C": "0201000101670203020700671001020001016D02010207006D1001",

[0127] "016D": "02010001016C02020207006C1001020000",

[0128] "016A": "0201000101690202020700691001020001016B02010207006B1001",

[0129] "016B": "01010001016A02020207006A1001"

[0130] }

[0131] Similarly, for the isolated node 016E(110), after executing the global consensus algorithm process, all other node neighbor port information and the port connection information between this node and other nodes will be deleted.

[0132] Viewing the whole network neighbor port information on node 016E(110):

[0133] {

[0134] "016E": ""

[0135] }

[0136] It can be seen from the output result of node 0165(101) that after disconnecting the link between port 2 of node 016D(109) and port 1 of node 016E(110), the node information of 016E(110) does not exist in the whole network topology information of node 0165(101), and the node 016E(110) does not exist in the neighbor port information of node 016D(109); it can be seen from the output result of node 016E(110) that as an isolated node, its whole network topology information does not contain any other node information and only includes the ID of this node.

[0137] The above are only the preferred embodiments of the present invention and cannot be used to limit the present invention. Any modifications, equivalent replacements, and improvements made within the spirit and principle of the present invention should be included within the protection scope of the present invention.

Claims

1. A lightweight-based distributed consensus networking technology, characterized in that, The lightweight-based distributed consensus networking technology includes the following steps: Step 1: Construct the whole network topology through the initial consensus algorithm based on the neighbor port information and node link information of each distributed network node; Step 2: Based on the whole network topology information constructed by the initial consensus, when considering changes in topology resource information (new nodes joining, nodes leaving the network, links being connected or disconnected, subnets being split or merged, etc.), quickly change the whole network topology information and quickly achieve consensus in the whole network.

2. The lightweight-based distributed consensus networking technology according to claim 1, wherein, The specific implementation process of Step 1 includes: (1) Each node initializes the adjacency list Neighbor_list, constructs the adjacency list Neighbor_list with the node's own information, nodeNeighborInfo, and nodeLinkInfo. If there is only one node and no neighbors, return the node information and exit; (2) Let's start from node A (node A has two neighbors, B and C). The node itself considers itself to be the root node and adds the neighbor list of this node to the neighbor list. A =[A,B,C] is sent to all its neighboring nodes; (3) Node B receives the adjacency list information sent by all its neighbors (adjacency list of Node A, neighbor_list A = [A, B, C], adjacency list of Node D, neighbor_list D = [B, C, D], adjacency list of Node E, neighbor_list E = [B, E, F]) and updates the adjacency list to neighbor_list AB = [A, B, C, D, E, F]. Node C receives the adjacency list information sent by all its neighbors (adjacency list of Node A, neighbor_list A = [A, B, C], adjacency list of Node D, neighbor_list D = [B, C, D], adjacency list of Node H, neighbor_list H = [C, H, I]) and updates the adjacency list to neighbor_list AC = [A, B, C, D, H, I]; (4) Node B sends the latest adjacency list neighbor_list AB to neighbors A, D, and E. Node C sends the latest adjacency list neighbor_list AC to neighbors A, D, and H; (5) When a node receives new adjacency list information sent by a neighbor and there is an update compared to the original adjacency list, continue to spread the new adjacency list to neighbors, otherwise do not spread; (6) Node A compares the adjacency list information and determines that the network topology has converged, generates the whole network topology information, and exits.

3. The lightweight-based distributed consensus networking technology according to claim 1, wherein The specific implementation process of Step 2 includes: (1) Construct and initialize a Merkle tree to store consensus data such as the neighbor port information and link resource information of all nodes; (2) Starting from the single-sided path of any node, the distance between two nodes is the weight W of the edge. If W = ∞, it means there is no connection between the two nodes. For vertices u and v, check if there exists a vertex w such that the path from u to w and then to v is shorter than the known path. If so, update; (3) The adjacency matrix N of the whole network topology all , if there is a reachable path from V i to V j , then N all [i][j] = d, and P[i][j] represents the points that need to be passed from V i to V j . Initialize P[i][j] = j, insert each vertex into the graph, compare the distance after inserting the point with the original distance, and N all [i][j] = min(N all [i][j], N all [i][k] + N all [k][j]). If the value of N all [i][j] becomes smaller, then P[i][j] = k, and the shortest path information between two nodes is included in P[i][j]; (4) The current node calculates the sum of the minimum distances dis from this node to each node in the network. The relative distance value relative_value = Sum(dis) / bandwidth, broadcasts relative_value and the node identifier ID to all nodes in the network, and marks itself as the optimal master node; (5) When a node receives relative_value from other nodes, compare it with the relative_value of the node that the current node originally considered as the optimal master node. If the received relative_value is less than the original relative_value, update, otherwise do not update. When a node receives relative_value from 3 / 4 of the nodes in the whole network, it can vote for the currently considered optimal master node; (6) The node with the most votes is the final optimal master node; (7) When a certain node senses a change in neighbor information (new addition or reduction), based on the Merkle tree, transmit the change information as change_info in the subsequent process. If this node is not the optimal master node, send the obtained new neighbor information and link information to its optimal master node. If it is the optimal master node, enter Step 8; (8) The optimal master node organizes the change information and sends it to other optimal master nodes; After the information reaches a consensus among the optimal master nodes, all the change information is sent to all the logical neighbor nodes under the jurisdiction of this node to achieve information consistency and update the network topology information.

4. A lightweight-based distributed consensus networking technology according to any one of claims 1-3.