A lightweight blockchain network topology detection method
By using a lightweight blockchain network topology detection method, the problems of long detection time and high resource consumption in blockchain networks are solved, achieving more efficient topology acquisition and real-time performance.
Patent Information
- Application Number
- CN202211045346.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-08-30
- Publication Date
- 2026-02-10
- Estimated Expiration
- 2042-08-30
AI Technical Summary
Existing network probing methods are mainly designed for traditional networks. Topology probing methods for blockchain networks suffer from problems such as long probing time and high network resource consumption.
A lightweight blockchain network topology detection method is provided. By initializing the node list, initiating connection requests to the nodes to be detected, and obtaining connection information requests, a stable node set is generated, reducing the resource consumption and detection time of the blockchain network.
It effectively reduces the number of connection requests sent to blockchain network nodes, lowers network resource consumption, and improves the real-time performance of the blockchain network topology.
Smart Images

Figure CN116471280B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of network topology technology, and specifically relates to a lightweight blockchain network topology detection method. Background Technology
[0002] As the internet becomes increasingly integrated into people's lives, it has become an indispensable infrastructure in society. Accurate network topology information is crucial not only for network management and application performance prediction but also for national cybersecurity. To obtain network topology information, scholars both domestically and internationally have achieved significant research results in network detection methods and network topology identification. However, existing network detection methods are mainly aimed at traditional networks, with very few methods specifically for blockchain networks. Furthermore, these few existing blockchain network topology detection methods suffer from problems such as long detection times and high network resource consumption.
[0003] Traditional network topology probing methods can be divided into the following two categories based on whether probe packets are sent to the network under test:
[0004] (1) Active topology probing methods, which detect the network topology by sending probe messages into the network and recording relevant information in the network. Active probing is the mainstream technology for network topology probing, and it can be further divided into Traceroute-like network probing methods and network tomography techniques.
[0005] (2) Passive detection methods capture real packets in the network or query information in network devices through eavesdropping, and extract relevant topology information to identify the network topology. Their implementation typically relies on network-specific protocols, the most important of which include SNMP and routing protocols.
[0006] In short, most traditional network topology detection algorithms are designed for the IP layer, rather than for P2P networks like blockchain. Summary of the Invention
[0007] To address the aforementioned problems, the present invention aims to provide a lightweight blockchain network topology detection method.
[0008] To achieve the above objectives, the lightweight blockchain network topology detection method provided by the present invention includes the following steps performed in sequence:
[0009] 1) Initialize the node list: Blockchain network topology probing starts with seed nodes (seeders). Seed nodes are obtained from DNSseeders and used as the nodes to be probed (P). d Generate an initial node list S;
[0010] 2) Initiate a connection request to the probed node: Probe node P sends a connection request to the stable node set M obtained through the previous round of blockchain network topology probing. i,i+1 Filtered node list S m One of the probed nodes P d Initiate a connection request; if the probed node P d If the connection to the probe node P is established, then the connection is successful, and the probe node P and the probed node P are connected. d A connection is established between them, and the probed node P is connected. d Store the connection list S from which you can request to retrieve the connection list. c In the middle; if the probed node P d If a connection to probe node P is refused, the connection fails, and probe node P will send a notification to the node list S. m The next node to be probed in d Initiate a request to establish a connection;
[0011] 3) Initiate a request to obtain connection information from the probed node: Probe node P sends a request to the aforementioned connection list S. c One of the probed nodes P d Initiate a request to obtain its connection information; if the probed node P d In response to this request, extract and organize the required information from the response message to generate a record of the network topology nodes and their connected nodes P. c file f i And generate the connection node P c After deduplication and other processing, the nodes are stored in the initial node list S; if the probed node P... d If this request is not responded to, the probed node P will also be removed. d Save in the appropriate format in file f i In the middle; continue to the next probed node P d Initiate a request to obtain its connection information and generate file f. i+1 Then, it sends connection information requests to each of the other probed nodes one by one.
[0012] 4) Generate a stable set of nodes: Use the two most recently generated records of the network topology nodes and their connected nodes P. c file f i f i+1 The intersection is used to generate a stable set of nodes M. i,i+1 Then repeat this step to start a new round of blockchain network topology exploration.
[0013] In step 2), the probe node P and the probed node P d The method for establishing a connection between them is as follows:
[0014] 201) Probe node P moves towards the stable node set M obtained from the previous round of blockchain network topology probing. i,i+1 Filtered node list S m One of the probed nodes P d Initiate a connection request;
[0015] 202) Set t1 to receive the probed node P d Maximum response wait time;
[0016] 203) Determine the node P being probed d Whether to agree to the connection request of probe node P within the time t≤t1;
[0017] 204) If t≤t1, it indicates that the probed node P d Agree to the connection request from probe node P, and the probed node P d Store in connection list S c Otherwise, the connection will fail.
[0018] 205) Return to step 201), probe node P against node list S m The next node to be probed in d Initiate a connection request until node list S m Empty.
[0019] In step 201), the node list S is obtained. m The method is as follows:
[0020] 20101) If the number of topological rounds in the network is l < 2, the node list S m Let S be the initial list of nodes;
[0021] 20102) If the number of topological rounds of network nodes l≥2, the node list S m M is the set of stable nodes generated in the previous round of blockchain network topology probing. i,i+1 The difference between the set of nodes and the network node list S is:
[0022] S m =SM i,i+1 .
[0023] In step 3), the method by which the probe node P initiates a request to the probed node to obtain connection information is as follows:
[0024] 301) Probe node P to connect list S c One of the probed nodes P d Initiate a request to obtain its connection information;
[0025] 302) Determine the node being probed, Pd Whether to agree to the probe node P's request to obtain its connection information within the time t≤t1;
[0026] 303) If t≤t1, it indicates that the probed node P d The probed node P agrees to the probe node P's request to obtain its connection information. d Send its connection information to the probe node P, and the probed node P will be detected. d and its connecting node P c ,Right now
[0027] P d :[P c1 P c2 , ..., P cn ]
[0028] Write to file f i In the list of nodes i = {1, 2, ..., n}, connect the nodes in the list [P] c1 P c2 , ..., P cn After deduplication and other processing, the data is stored in the network node list S; where file f... i The data is stored in dictionary format, where the key of the dictionary is the connected node of the probe node P, and the value of the dictionary is the connected node of the aforementioned connected node.
[0029] d i ={P d1 :[P c11 P c12 , ..., P c1n ], P d2 :[P c21 P c22 , ..., P c2n ], ..., P dm :[P cm1 P cm2 , ..., P cmn ]}
[0030] For ease of description, let's call file f i The key in the Chinese dictionary is k i The value is v i ;
[0031] 304) Otherwise, the node P to be probed d and its connecting nodes, i.e.
[0032] P d : []
[0033] Write to file f i ,i={1,2,...,n};
[0034] 305) Return to step 301), probe node P to connect to list S c The next node to be probed in d Initiate a request to obtain its connection information and get file f i+1 until the connection list S c Empty.
[0035] In step 4), the stable node set M is generated. i,i+1 The method is as follows:
[0036] 401) Read the number of elements n in the current file;
[0037] 402) If n≥2, for the latest generated file f i f i+1 Generate a stable set of nodes M by performing intersection operations. i,i+1 ;
[0038] 403) If n < 2, no stable node set is generated, and the stable node set is denoted as empty;
[0039] 404) Return to step 401) to start a new round of blockchain network topology detection.
[0040] In step 402), the latest generated file f is... i f i+1 Generate a stable set of nodes M by performing intersection operations. i,i+1 The method is as follows:
[0041] 40201) Extract file f respectively i f i+1 The dictionary d i d i+1 ;
[0042] 40202) Find the two dictionaries d above. i d i+1 key value k i k i+1 The intersection of k i,i+1 =k i ∩k i+1 ;
[0043] 40203) Find two dictionaries d i d i+1 At the intersection of keys k i,i+1 The corresponding value v i =d i [k i,i+1 ]、v i+1 =d i+1 [k i,i+1 The same part v i,i+1 ,Right now
[0044] v i,i+1 =d i [k i,i+1 ]=d i+1 [k i,i+1 ];
[0045] 40204) Find this part v i,i+1 In two dictionaries d i d i+1 The corresponding key k = d i .v i,i+1 =d i+1 ·v i,i+1 ;
[0046] 40205) Finally, the key k mentioned above is stored in the stable node set M. i,i+1 ={k|k∈k i,i+1}middle.
[0047] The beneficial effects of the lightweight blockchain network topology detection method provided by this invention are:
[0048] (1) When obtaining the blockchain network topology, the number of requests to connect to nodes in the blockchain network is greatly reduced by effectively filtering stable nodes, thus reducing the consumption of network resources; (2) When obtaining the node connection information of the connected nodes in the blockchain network, the number of requests to initiate this request is greatly reduced, thus reducing the consumption of network resources to a certain extent; (3) In the blockchain network with high real-time requirements, the number of requests to send connection nodes and obtain connection node information is reduced, which also reduces the time to build the entire blockchain network topology and improves the real-time performance of the final obtained blockchain network topology to a certain extent. Attached Figure Description
[0049] Figure 1 A flowchart of the lightweight blockchain network topology detection method provided by the present invention.
[0050] Figure 2 Flowchart of the method for establishing a connection between the probe node and the probed node.
[0051] Figure 3 Flowchart of the method for a probe node to obtain connection information of the probed node.
[0052] Figure 4 Flowchart for generating a stable set of nodes. Detailed Implementation
[0053] The present invention will now be described in detail with reference to the accompanying drawings.
[0054] like Figure 1As shown, the lightweight blockchain network topology detection method provided by the present invention includes the following steps performed in sequence:
[0055] 1) Initialize the node list: Blockchain network topology probing starts with seed nodes (seeders). Seed nodes are obtained from DNSseeders and used as the nodes to be probed (P). d Generate an initial node list S;
[0056] 2) Initiate a connection request to the probed node: Probe node P sends a connection request to the stable node set M obtained through the previous round of blockchain network topology probing. i,i+1 Filtered node list S m One of the probed nodes P d Initiate a connection request; if the probed node P d If the connection to the probe node P is established, then the connection is successful, and the probe node P and the probed node P are connected. d A connection is established between them, and the probed node P is connected. d Store the connection list S from which you can request to retrieve the connection list. c In the middle; if the probed node P d If a connection to probe node P is refused, the connection fails, and probe node P will send a notification to the node list S. m The next node to be probed in d Initiate a request to establish a connection;
[0057] like Figure 2 As shown, the probe node P and the probed node P d The method for establishing a connection between them is as follows:
[0058] 201) Probe node P moves towards the stable node set M obtained from the previous round of blockchain network topology probing. i,i+1 Filtered node list S m One of the probed nodes P d Initiate a connection request;
[0059] 202) Set t1 to receive the probed node P d Maximum response wait time;
[0060] 203) Determine the node P being probed d Whether to agree to the connection request of probe node P within the time t≤t1;
[0061] 204) If t≤t1, it indicates that the probed node P d Agree to the connection request from probe node P, and the probed node P d Store in connection list S cOtherwise, the connection will fail.
[0062] 205) Return to step 201), probe node P against node list S m The next node to be probed in d Initiate a connection request until node list S m Empty.
[0063] In step 201), the node list S is obtained. m The method is as follows:
[0064] 20101) If the number of network node topology rounds l < 2, the node list S m Let S be the initial list of nodes;
[0065] 20102) If the number of topological rounds of network nodes l≥2, the node list S m M is the set of stable nodes generated in the previous round of blockchain network topology probing. i,i+1 The difference between the set of nodes and the network node list S is:
[0066] S m =SM i,i+1 .
[0067] 3) Initiate a request to obtain connection information from the probed node: Probe node P sends a request to the aforementioned connection list S. c One of the probed nodes P d Initiate a request to obtain its connection information; if the probed node P d In response to this request, extract and organize the required information from the response message to generate a record of the network topology nodes and their connected nodes P. c file f i And generate the connection node P c After deduplication and other processing, the nodes are stored in the initial node list S; if the probed node P... d If this request is not responded to, the probed node P will also be removed. d Save in the appropriate format in file f i In the middle; continue to the next probed node P d Initiate a request to obtain its connection information and generate file f. i+1 Then, it sends connection information requests to each of the other probed nodes one by one.
[0068] like Figure 3 As shown, the method by which the probe node P initiates a request to the probed node to obtain connection information is as follows:
[0069] 301) Probe node P to connect list S c One of the probed nodes P dInitiate a request to obtain its connection information;
[0070] 302) Determine the node being probed, P d Whether to agree to the probe node P's request to obtain its connection information within the time t≤t1;
[0071] 303) If t≤t1, it indicates that the probed node P d The probed node P agrees to the probe node P's request to obtain its connection information. d Send its connection information to the probe node P, and the probed node P will be detected. d and its connecting node P c ,Right now
[0072] P d :[P c1 P c2 , ..., P cn ]
[0073] Write to file f i In the list of nodes i = {1, 2, ..., n}, connect the nodes in the list [P] c1 P c2 , ..., P cn After deduplication and other processing, the data is stored in the network node list S; where file f... i The data is stored in dictionary format, where the key of the dictionary is the connected node of the probe node P, and the value of the dictionary is the connected node of the aforementioned connected node.
[0074] d i ={P d1 :[P c11 P c12 , ..., P c1n ], P d2 :[P c21 P c22 , ..., P c2n ], ..., P dm :[P cm1 P cm2 , ..., P cmn ]}
[0075] For ease of description, let's call file f i The key in the Chinese dictionary is k i The value is v i ;
[0076] 304) Otherwise, the node P to be probed d and its connecting nodes, i.e.
[0077] P d : []
[0078] Write to file f i ,i={1,2,...,n};
[0079] 305) Return to step 301), probe node P to connect to list S c The next node to be probed in d Initiate a request to obtain its connection information and get the file fi +1 until the connection list S c Empty.
[0080] 4) Generate a stable set of nodes: Use the two most recently generated records of the network topology nodes and their connected nodes P. c file f i f i+1 The intersection is used to generate a stable set of nodes M. i,i+1 Then repeat this step to start a new round of blockchain network topology exploration.
[0081] like Figure 4 As shown, the generation of a stable node set M i,i+1 The method is as follows:
[0082] 401) Read the number of elements n in the current file;
[0083] 402) If n≥2, for the currently generated files fi and f i+1 Generate a stable set of nodes M by performing intersection operations. i,i+1 ;
[0084] 403) If n < 2, no stable node set is generated, and the stable node set is denoted as empty;
[0085] 404) Return to step 401) to start a new round of blockchain network topology detection.
[0086] In step 402), the process for the most recently generated file f... i f i+1 Generate a stable set of nodes M by performing intersection operations. i,i+1 The method is as follows:
[0087] 40201) Extract file f respectively i f i+1 The dictionary d i d i+1 ;
[0088] 40202) Find the two dictionaries d above. i d i+1 key value k i k i+1 The intersection of k i,i+1 =k i ∩k i+1;
[0089] 40203) Find two dictionaries d i d i+1 At the intersection of keys k i,i+1 The corresponding value v i =d i [k i,i+1 ]、v i+1 =d i+1 [k i,i+1 The same part v i,i+1 ,Right now
[0090] v i,i+1 =d i [k i,i+1 ]=d i+1 [k i,i+1 ];
[0091] 40204) Find this part v i,i+1 In two dictionaries d i d i+1 The corresponding key k = d i ·v i,i+1 =d i+1 ·v i,i+1 ;
[0092] 40205) Finally, the key k mentioned above is stored in the stable node set M. i,i+1 ={k|k∈k i,i+1}middle.
Claims
1. A lightweight blockchain network topology detection method, characterized in that: The lightweight blockchain network topology detection method includes the following steps performed in sequence: 1) Initialize the node list: Blockchain network topology probing begins with seed nodes (seeders). Seed nodes are obtained from the DNS seeders and used as the nodes to be probed (P). d Generate an initial node list S; 2) Initiate a connection request to the probed node: Probe node P sends a connection request to the stable node set M obtained through the previous round of blockchain network topology probing. i,i+1 Filtered node list S m One of the probed nodes P d Initiate a connection request; if the probed node P d If the connection to the probe node P is established, then the connection is successful, and the probe node P and the probed node P are connected. d A connection is established between them, and the probed node P is connected. d Store the connection list S from which you can request to retrieve the connection list. c In the middle; if the probed node P d If a connection to probe node P is refused, the connection fails, and probe node P will send a notification to the node list S. m The next node to be probed in d Initiate a request to establish a connection; 3) Initiate a request to obtain connection information from the probed node: Probe node P sends a request to the aforementioned connection list S. c One of the probed nodes P d Initiate a request to obtain its connection information; if the probed node P d In response to this request, extract and organize the required information from the response message to generate a record of the network topology nodes and their connected nodes P. c file f i And generate the connection node P c After deduplication and other processing, the data is stored in the initial node list S. If the probed node P d If this request is not responded to, the probed node P will also be removed. d Save in the appropriate format in file f i In the middle; continue to the next probed node P d Initiate a request to obtain its connection information and generate file f. i+1 Then, it sends connection information requests to each of the other probed nodes one by one. 4) Generate a stable set of nodes: Use the two most recently generated records of the network topology nodes and their connected nodes P. c file f i f i+1 The intersection is used to generate a stable set of nodes M. i,i+1 Then repeat this step to start a new round of blockchain network topology exploration.
2. The lightweight blockchain network topology detection method according to claim 1, characterized in that: In step 2), the probe node P and the probed node P d The method for establishing a connection between them is as follows: 201) Probe node P moves towards the stable node set M obtained from the previous round of blockchain network topology probing. i,i+1 Filtered node list S m One of the probed nodes P d Initiate a connection request; 202) Set t1 to receive the probed node P d Maximum response wait time; 203) Determine the node P being probed d Whether to agree to the connection request of probe node P within the time t≤t1; 204) If t≤t1, it indicates that the probed node P d Agree to the connection request from probe node P, and the probed node P d Store in connection list S c Otherwise, the connection will fail. 205) Return to step 201), probe node P against node list S m The next node to be probed in d Initiate a connection request until node list S m Empty.
3. The lightweight blockchain network topology detection method according to claim 2, characterized in that: In step 201), the node list S is obtained. m The method is as follows: 20101) If the number of network node topology rounds l < 2, the node list S m Let S be the initial list of nodes; 20102) If the number of topological rounds of network nodes l≥2, the node list S m M is the set of stable nodes generated in the previous round of blockchain network topology probing. i,i+1 The difference between the set of nodes and the list of network nodes S is: S m =S-M i,i+1 。 4. The lightweight blockchain network topology detection method according to claim 1, characterized in that: In step 3), the method by which the probe node P initiates a request to the probed node to obtain connection information is as follows: 301) Probe node P to connect list S c One of the probed nodes P d Initiate a request to obtain its connection information; 302) Determine the node being probed, P d Whether to agree to the probe node P's request to obtain its connection information within the time t≤t1; 303) If t≤t1, it indicates that the probed node P d The probed node P agrees to the probe node P's request to obtain its connection information. d Send its connection information to the probe node P, and the probed node P will be detected. d and its connecting node P c ,Right now P d :[P c1 ,P c2 ,...,P cn ] Write to file f i In the list of nodes i = {1, 2, ..., n}, connect the nodes in the list [P] c1 P c2 , ..., P cn After deduplication and other processing, the data is stored in the network node list S; where file f... i The data is stored in dictionary format, where the key of the dictionary is the connected node of the probe node P, and the value of the dictionary is the connected node of the aforementioned connected node. d i ={P d1 :[P c11 ,P c12 ,...,P c1n ],P d2 :[P c21 ,P c22 ,...,P c2n ],..., P dm :[P cm1 ,P cm2 ,...,P cmn ]} For ease of description, let's call file f i The key in the Chinese dictionary is k i The value is v i ; 304) Otherwise, the node P to be probed d and its connecting nodes, i.e. P d :[] Write to file f i ,i={1,2,...,n}; 305) Return to step 301), probe node P to connect to list S c The next node to be probed in d Initiate a request to obtain its connection information and get the file fi +1 until the connection list S c Empty.
5. The lightweight blockchain network topology detection method according to claim 1, characterized in that: In step 4), the stable node set M is generated. i,i+1 The method is as follows: 401) Read the number of elements n in the current file; 402) If n≥2, for the latest generated file f i f i+1 Generate a stable set of nodes M by performing intersection operations. i,i+1 ; 403) If n < 2, no stable node set is generated, and the stable node set is denoted as empty; 404) Return to step 401) to start a new round of blockchain network topology detection.
6. The lightweight blockchain network topology detection method according to claim 5, characterized in that: In step 402), the process for the most recently generated file f... i f i+1 Generate a stable set of nodes M by performing intersection operations. i,i+1 The method is as follows: 40201) Extract file f respectively i f i+1 The dictionary d i d i+1 ; 40202) Find the two dictionaries d above. i d i+1 The key value k i k i+1 The intersection of k i,i+1 =k i ∩k i+1 ; 40203) Find two dictionaries d i d i+1 At the intersection of keys k i,i+1 The corresponding value v i =d i [k i,i+1 ]、v i+1 =d i+1 [k i,i+1 The same part v i,i+1 ,Right now v i,i+1 =d i [k i,i+1 ]=d i+1 [k i,i+1 ]; 40204) Find this part v i,i+1 In two dictionaries d i d i+1 The corresponding key k = d i .v i,i+1 =d i+1 ·v i,i+1 ; 40205) Finally, the key k mentioned above is stored in the stable node set M. i,i+1 ={k|k∈k i,i+1 }middle.