A method and system for generating and optimizing a blockchain network topology based on NDN
By setting preset constraint parameters to generate multiple network topologies, calculating synchronization time and redundancy, filtering and optimizing network topologies, and using a random forest regression model to analyze key attributes, the problem of insufficient optimization of NDN blockchain network topologies is solved, and the communication performance of the blockchain network is improved.
Patent Information
- Application Number
- CN202410526458.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-04-28
- Publication Date
- 2025-12-16
- Estimated Expiration
- 2044-04-28
AI Technical Summary
Existing NDN-based blockchain network topology optimization technologies are insufficient, and there is a lack of research and optimization of blockchain network topology, resulting in high transmission latency.
This paper presents a method for generating and optimizing blockchain network topologies based on NDN. By setting preset constraint parameters for the network topology generation module, multiple network topologies are generated. Synchronization time and redundancy are calculated using a synchronization time analysis submodule and a redundancy analysis submodule. Initial network topologies that meet the conditions are selected. The importance of key attributes is analyzed using a random forest regression model, and the optimal network topology is output.
Generate a network topology that meets user needs, improve the communication performance of the blockchain network, and optimize network configuration and performance.
Smart Images

Figure CN118540329B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of blockchain, and in particular to a method and system for generating and optimizing a blockchain network topology based on NDN. BACKGROUND
[0002] NDN refers to Named Data Networking, which is a network architecture based on data content rather than device address. In NDN, data is assigned a unique name and accessed through the name, rather than accessing data through device address as in traditional IP networks. This approach can better support content distribution, caching and security.
[0003] Traditional blockchain systems are based on TCP / IP network architecture, which has the defect that TCP / IP network is a host-centric communication architecture, and must target IP address when requesting data, and cannot search the entire network, resulting in high transmission delay. Therefore, optimization of the network layer in blockchain technology is particularly important. Using NDN as the underlying network architecture in the blockchain system can optimize the network layer in the blockchain system and provide better support for data transmission in the blockchain. Using NDN as the underlying network architecture of the blockchain system is a mainstream direction.
[0004] In the NDN-based blockchain system, existing network layer optimization techniques mainly focus on block synchronization mechanisms and data transmission strategies, and lack research and optimization of blockchain network topology. SUMMARY
[0005] In view of this, the embodiments of the present application provide a method and system for generating and optimizing a blockchain network topology based on NDN to improve the existing NDN-based blockchain network topology.
[0006] One aspect of the present application provides a method for generating and optimizing a blockchain network topology based on NDN, the method comprising the following steps:
[0007] According to the user's demand, set the preset constraint parameters of the network topology generation module, and generate a plurality of network topologies;
[0008] Input the log file generated by each network topology based on the NDN-based blockchain system into the synchronization time analysis submodule and the redundancy analysis submodule, and calculate the synchronization time and redundancy of each network topology; the synchronization time analysis submodule calculates the synchronization time according to the total number of nodes to be synchronized and the total number of nodes recorded in the log file; the redundancy analysis submodule calculates the redundancy according to the number of data packets received by the consumer node and the forwarding node respectively recorded in the log file;
[0009] The synchronization time and the redundancy of each network topology are input into the screening scoring sub-module, and upper limits and weights of the synchronization time and the redundancy are set according to user requirements to screen out initial selected network topologies meeting the conditions; each initial selected network topology is scored and sorted according to the synchronization time and the redundancy of the initial selected network topology, and a scoring result is output;
[0010] The initial selected network topologies and the corresponding scoring results are input into an attribute calculation sub-module, and a plurality of attribute values corresponding to each initial selected network topology are output; the attribute values are used to describe attributes of node and link features in each initial selected network topology;
[0011] The attribute values are input into an attribute analysis sub-module, and an analysis parameter is set; the attribute analysis sub-module uses a pre-trained random forest regression model, takes key attributes in the attributes as independent variables, and takes scores of the initial selected network topologies as dependent variables to output importance values corresponding to the key attributes;
[0012] Based on the scoring results, the key attribute values and the importance values corresponding to the key attributes of each initial selected network topology, evaluation parameters of each initial selected network topology are output, an evaluation parameter threshold value is set, and a preset number of preferred network topologies are output.
[0013] In some embodiments of the present application, the preset constraint parameters include:
[0014] The total number of nodes, the network topology type, the bandwidth, the time delay, the network topology input directory, the number of neighbor nodes, the reconnection probability, the connection probability of a plurality of types of network topologies and the number of newly added edges.
[0015] In some embodiments of the present application, the network topology type includes a WS network model, a Regular network model, an ER network model, a Waxman network model and a BA network model.
[0016] In some embodiments of the present application, the synchronization time analysis sub-module calculates the synchronization time according to all to-be-synchronized node numbers and total node numbers recorded in the log file, and the calculation formula is:
[0017]
[0018] Wherein, update_node_num is the to-be-synchronized node number, and node_num is the total node number.
[0019] In some embodiments of the present application, the redundancy analysis submodule calculates the redundancy according to the number of data packets received by the consumer nodes and the forwarding nodes respectively, as recorded in the log file, and the calculation formula is:
[0020]
[0021] wherein redundancy is the redundancy, redundancy_packet_num is the number of redundant data packets, and real_packet_num is the number of real data packets;
[0022]
[0023] wherein m is the number of the to-be-synchronized nodes, is the data packet sent by the ith to-be-synchronized node;
[0024]
[0025] wherein n is the number of the forwarding nodes, is the jth named data packet received by the ith forwarding node, m is the number of the to-be-synchronized nodes, is the jth named data packet received by the ith consumer node.
[0026] In some embodiments of the present application, the synchronization time and the redundancy of each network topology are input into the screening score submodule to score and rank each network topology, and the scoring result is output, and the calculation formula is:
[0027] score i = (time_high-time i ) × time_weight + (redundancy_high-redundancy i ) ×
[0028] redundancy_weight;
[0029] wherein score i is the score of the ith network topology, time_high is the upper limit of the synchronization time, time i is the synchronization time of the ith network topology, time_weight is the weight of the synchronization time, redundancy_high is the upper limit of the redundancy, redundancy i is the redundancy of the ith network topology, and redundancy_weight is the weight of the redundancy.
[0030] In some embodiments of the present application, the attributes include: connectivity of the network topology, network diameter of the network topology, average shortest path length of the network topology, clustering coefficient of the network topology, node density in the network topology and node degree distribution of the network topology.
[0031] The key attributes include: network diameter of the network topology, average shortest path length of the network topology, clustering coefficient of the network topology and node density in the network topology.
[0032] In some embodiments of the present application, the preset constraint parameters of the network topology generation module are set according to user requirements, and a plurality of network topologies are generated, and the output form of the network topology includes:
[0033] ndnSIM files, gml files and network topology visualization pictures.
[0034] Another aspect of the present application provides a NDN-based blockchain network topology generation and optimization system, comprising a processor, a memory and a computer program stored on the memory, characterized in that the processor is used to execute the computer program, and when the computer program is executed, the system implements the steps of the method according to any one of the above aspects.
[0035] Another aspect of the present application provides a computer program product, comprising a computer program, characterized in that when the computer program is executed by a processor, the steps of the above method are implemented.
[0036] The present application has at least the following beneficial effects:
[0037] The present application provides a NDN-based blockchain network topology generation and optimization method and system, which comprises: setting preset constraint parameters of a network topology generation module according to user requirements to generate a plurality of network topologies. Each network topology is input into a synchronization time analysis submodule and a redundancy analysis submodule to calculate synchronization time and redundancy, and according to preset upper limits of synchronization time and redundancy and weights, a preliminary selected network topology is screened out and scored and sorted. The attribute value of each preliminary selected network topology is output, and a pre-trained random forest regression model is used to output the importance value corresponding to the key attribute. Based on the score, the key attribute value and the importance value, the evaluation parameter of each preliminary selected network topology is output, and the threshold value of the evaluation parameter is set to output a preset number of preferred network topologies. The present application adjusts the network configuration by generating a network topology that meets the user's requirements, thereby improving the performance of the blockchain. The present application can generate and optimize the network topology according to the user's requirements, output quantifiable evaluation parameters for the generated network topology, obtain a blockchain network topology that meets the customer's requirements, and improve the performance of the blockchain network communication.
[0038] Additional advantages, objects, and features of the application will be set forth in part by the description that follows, and will become apparent to those skilled in the art upon examination of the following detailed description and drawings. The objects and other advantages of the present application can be realized and attained by means of the instrumentalities particularly pointed out in the description and claims hereof.
[0039] Those skilled in the art will appreciate that the objects and advantages of the application can be realized and attained by means of the instrumentalities and combinations particularly pointed out in the following detailed description. BRIEF DESCRIPTION OF DRAWINGS
[0040] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments of the application and together with the description, serve to explain the principles of the application. In the drawings:
[0041] Figure 1 Flow chart of the method for generating and optimizing the topology of the NDN-based blockchain network according to an embodiment of the present application.
[0042] Figure 2 System architecture diagram of the method for generating and optimizing the topology of the NDN-based blockchain network according to another embodiment of the present application. DETAILED DESCRIPTION
[0043] In order to make the objects, technical solutions and advantages of the present application clearer, the present application will be further described in detail below with reference to the embodiments and drawings. Herein, the illustrative embodiments of the present application and their descriptions are used to explain the present application, but are not intended to limit the present application.
[0044] It should also be noted that, in order to avoid obscuring the present application due to unnecessary details, only the structures and / or processing steps closely related to the solutions according to the present application are shown in the drawings, and other details not closely related to the present application are omitted.
[0045] It should be emphasized that the term "comprises / comprising" when used in this specification is taken to specify the presence of stated features, elements, steps or components, but does not preclude the presence or addition of one or more other features, elements, steps, components, or groups thereof.
[0046] It should also be noted that, unless otherwise specified, the term "connected" herein can not only mean direct connection, but also indirect connection in the presence of an intermediate.
[0047] Hereinafter, embodiments of the present application will be described with reference to the accompanying drawings. In the drawings, the same reference numerals represent the same or similar components, or the same or similar steps.
[0048] One embodiment of the present application provides a method for generating and optimizing the topology of a blockchain network based on NDN, as shown in Figure 1 The flow of the method includes the following steps S101-S106:
[0049] Step S101: Set the preset constraint parameters of the network topology generation module according to the user's requirements, and generate a plurality of network topologies.
[0050] The network topology generation module can generate a plurality of network topologies according to the requirements set by the preset constraint parameters using the graph generation function of the networkx library. The networkx library is a graph theory and complex network modeling tool that includes commonly used graph and complex network analysis algorithms, enabling complex network data analysis, simulation modeling, and other functions. With networkx, networks can be stored in standardized and non-standardized data formats, a variety of random networks and classic networks can be generated, network structures can be analyzed, network models can be established, new network algorithms can be designed, and network drawings can be performed.
[0051] Step S102: Input the log file generated by the blockchain system based on NDN for each network topology into the synchronization time analysis submodule and the redundancy analysis submodule, and calculate the synchronization time and redundancy of each network topology. The synchronization time analysis submodule calculates the synchronization time according to the number of all nodes to be synchronized and the total number of nodes recorded in the log file. The redundancy analysis submodule calculates the redundancy according to the number of data packets received by the consumer nodes and the forwarding nodes recorded in the log file.
[0052] Step S103: Input the synchronization time and redundancy of each network topology into the screening and scoring submodule, and set the upper limit and weight of the synchronization time and redundancy according to the user's requirements to screen out the preliminary selected network topologies that meet the conditions. According to the synchronization time and redundancy of the preliminary selected network topologies, each preliminary selected network topology is scored and sorted, and the scoring results are output.
[0053] Step S104: Input the preliminary selected network topologies and their corresponding scoring results into the attribute calculation submodule, and output a plurality of attribute values corresponding to each preliminary selected network topology. The attribute values are used to describe the attributes of the node and link characteristics in each preliminary selected network topology.
[0054] Step S105: Input the attribute values into the attribute analysis submodule, set the analysis parameters, and the attribute analysis submodule uses a pre-trained random forest regression model to output the importance values of the key attributes in the attributes, with the key attributes as the independent variables and the scores of the preliminary selected network topologies as the dependent variables.
[0055] The analysis parameters include: the parameters that can be input by the user include the total number of nodes, the number of network topologies that meet the conditions that the user hopes to output, the upper limit of synchronization time, the weight of synchronization time, the upper limit of redundancy, the weight of redundancy, the network topology output directory, and the log file directory.
[0056] The random forest regression model is a machine learning algorithm and belongs to ensemble learning. The random forest regression model establishes multiple decision trees that are not related to each other by randomly extracting samples and features. Each decision tree can obtain a prediction result by extracting the samples and features, and the regression prediction result of the entire forest is obtained by averaging the results of all trees. In the random forest, each decision tree is trained on a different random subset of the original data, which can reduce the risk of overfitting and increase the generalization ability of the model. In addition, the random forest randomly selects a subset of features when selecting a division feature, which also helps to improve the diversity of the model.
[0057] In this embodiment, the key attributes of the network topology are used as independent variables, that is, as divided features, and the random forest regression model judges the contribution of each key attribute to the score, that is, the importance value corresponding to the key attribute. The importance plays a role in that the network topology has multiple attributes, and it is difficult to consider all attributes in the network topology process. Therefore, the user selects the key attributes according to the actual demand, and divides the importance of the key attributes, so as to select to add new nodes according to the key attributes and the corresponding importance.
[0058] Step S106: Based on the score result of each preliminary network topology, the key attribute value, and the importance value corresponding to the key attribute, the evaluation parameter of each preliminary network topology is output, and the threshold of the evaluation parameter is set to output a preset number of preferred network topologies.
[0059] In some embodiments of the present application, the preset constraint parameter includes:
[0060] The total number of nodes, the network topology type, the bandwidth, the time delay, the network topology input directory, the number of neighbor nodes, the reconnection probability, the connection probability of multiple types of network topologies, and the number of new edges.
[0061] In some embodiments of the present application, the network topology type includes: a WS network model, a Regular network model, an ER network model, a Waxman network model, and a BA network model.
[0062] The WS network model, namely the Watts-Strogatz model, is a model used to describe the small-world network characteristics, and is used to explain the small-world phenomenon of many networks in the real world. The small-world network refers to a network with a relatively small average distance between nodes and a high clustering coefficient. Any two nodes in the network can reach each other through relatively few intermediate nodes, and the nodes in the network tend to form a close group.
[0063] The regular network model, namely the regular network model, is a simple and structured network model, in which each node has the same number of connections, and the connections are distributed in a fixed and regular pattern, with characteristics such as uniform distribution of connections, high clustering coefficient, etc.
[0064] The ER network model is a random graph model, which is the basis for studying the characteristics of random networks and is of great significance for understanding the formation and properties of complex networks. In the commonly used ER network model, the network is composed of multiple nodes, and any two different nodes are independently connected with a probability p. p is the probability of the existence of an edge in the network, and is the same for all node pairs.
[0065] The Waxman network model is a random graph model, mainly used to simulate long-distance connections in computer networks. It can well simulate the geographical characteristics and topological structure of actual networks, especially in the design and analysis of the Internet and other communication networks. The connection probability between nodes is based on distance, that is, the probability of establishing a connection between nodes is related to the distance between them, and the closer the distance between nodes, the higher the probability of establishing a connection between them.
[0066] The BA network model is a complex network model, mainly used to describe the structure of many networks in the real world, such as social networks, the Internet, and biological networks, etc. The network model has characteristics such as a degree distribution that obeys a power-law distribution, an efficient network growth mechanism, etc., and belongs to a scale-free network.
[0067] In some embodiments of the present application, the synchronization time analysis submodule calculates the synchronization time according to the number of all nodes to be synchronized and the total number of nodes recorded in the log file, and the calculation formula is:
[0068]
[0069] where update_node_num is the number of nodes to be synchronized, and node_num is the total number of nodes.
[0070] In some embodiments of the present application, the redundancy analysis submodule calculates the redundancy according to the number of data packets received by the consumer nodes and the forwarding nodes recorded in the log file, and the calculation formula is:
[0071]
[0072] wherein, redundancy is redundancy, redundancy_packet_num is redundancy packet number, real_packet_num is real packet number.
[0073]
[0074] wherein, m is the number of nodes to be synchronized, is the data packet sent by the i th node to be synchronized.
[0075]
[0076] wherein, n is the number of forwarding nodes, is the j th named data packet received by the i th forwarding node, m is the number of nodes to be synchronized, is the j th named data packet received by the i th consumer node.
[0077] In some embodiments of the present application, the synchronization time and redundancy of each network topology are input into the screening score sub-module to score and rank each network topology, and the scoring result is output, and the calculation formula is:
[0078] score i = (time_high-time i ) × time_weight + (redundancy_high-redundancy i ) ×
[0079] redundancy_weight;
[0080] wherein, score i is the score of the i th network topology, time_high is the upper limit of synchronization time, time i is the synchronization time of the i th network topology, time_weight is the synchronization time weight, redundancy_high is the upper limit of redundancy, redundancy i is the redundancy of the i th network topology, and redundancy_weight is the redundancy weight.
[0081] In some embodiments of the present application, the attributes include: connectivity of the network topology, network diameter of the network topology, average shortest path length of the network topology, clustering coefficient of the network topology, node density in the network topology and node degree distribution of the network topology.
[0082] The key attributes include: network diameter of the network topology, average shortest path length of the network topology, clustering coefficient of the network topology, and node density in the network topology.
[0083] In some embodiments of the present application, the preset constraint parameters of the network topology generation module are set according to user requirements, and a plurality of network topologies are generated, and the output forms of the network topologies include: ndnSIM files, gml files, and network topology visualization pictures.
[0084] The ndnSIM file is a text file applied in the ndnSIM simulation platform, and the file saves the horizontal and vertical coordinates of each node and the link information of each pair of connected nodes, such as the bandwidth, delay and queue size of the link.
[0085] The gml file is used for the attribute calculation submodule, and the information of nodes and edges in the network topology is also saved in the file. When calculating the attributes, the gml file is read to reconstruct the network topology.
[0086] The network topology visualization picture can be an svg format file (scalable vector graphics file), and the user can directly see the picture of the generated network topology through the file.
[0087] Another embodiment of the present application provides a method and system for generating and optimizing a blockchain network topology based on NDN, and the method flow includes steps S201-S206.
[0088] Step S201: According to the actual network conditions and user demand, input the related constraint parameters of the network topology, and the network topology generation module generates a plurality of network topologies meeting the constraint parameter range according to the constraint parameter range and the network topology type.
[0089] Step S202: The ndnSIM generates a log file, and the log file is input to the synchronization time analysis submodule and the redundancy analysis submodule to calculate the evaluation indexes of each network topology, i.e., the synchronization time and the redundancy.
[0090] The ndnSIM is an ndn network simulation platform, and the user can simulate the ndn-based blockchain system on the platform. The content of the log file includes: time, node name, node behavior (sending interest packet, receiving interest packet, sending data packet, receiving data packet) and node state (whether all requested data packets are received).
[0091] Step S203: According to the upper limit and weight of the two evaluation indexes, i.e., the synchronization time and the redundancy, the screening scoring submodule scores and sorts the network topologies meeting the evaluation index requirements.
[0092] wherein the weight indicates the importance of the synchronization time and the redundancy, for example, a user considers that the synchronization time of a network topology accounts for 80%, and the redundancy accounts for 20%.
[0093] Step S204: The attribute calculation sub-module calculates the attributes of all network topologies meeting the evaluation index requirements.
[0094] The calculation of the attributes can call the functions encapsulated in the networkx library. The calculation process of each attribute includes:
[0095] 1. Network connectivity: First, select a starting node, and use depth-first search or breadth-first search to traverse the entire network topology. If all nodes can be reached, the network topology structure is connected, otherwise it is not connected.
[0096] 2. Network diameter: First, traverse all node pairs in the network topology structure, and use Dijkstra's algorithm to calculate the shortest path between each pair of nodes. Finally, find the maximum path among all shortest paths, which is the network diameter.
[0097] 3. Average shortest path length: First, traverse all node pairs in the network topology structure, and use Dijkstra's algorithm to calculate the shortest path between each pair of nodes. Finally, accumulate and obtain the average value, which is the average shortest path length.
[0098] 4. Density: First, calculate the actual number of edges in the network topology structure, and then calculate the maximum number of edges (fully connected graph) in the network topology structure. Finally, the actual number of edges or the maximum number of edges is the density.
[0099] 5. Clustering coefficient: First, traverse all nodes, and calculate the actual number of edges and the maximum number of edges between the neighbor nodes of each node. The actual number of edges or the maximum number of edges is the clustering coefficient of the node. Second, accumulate and obtain the average value of the clustering coefficients of all nodes, which is the clustering coefficient of the entire network topology structure.
[0100] 6. Node degree distribution: First, calculate the degree of each node, i.e. the number of neighbors connected, and then count the frequency of the number of neighbors of all nodes, which is the node degree distribution.
[0101] Step S205: The attribute analysis sub-module determines the importance of each attribute using a random forest regression model.
[0102] The method using a random forest regression model involves inputting four attribute values (i.e., features) as independent variables and the corresponding scores as dependent variables. After training the random forest regression model, the model determines the contribution of each feature to each tree in the random forest, takes the average, and finally compares the contributions of each feature. A larger contribution indicates a more important attribute. The contribution is evaluated using the Gini coefficient.
[0103] Network topology has multiple attributes. In actual network construction, users cannot consider all attributes simultaneously; otherwise, the efficiency of adding new nodes will be very low, and it will be difficult to meet multiple attribute requirements at the same time, making it difficult to add new nodes. By classifying network topology attributes according to their importance, users can select the attribute with the greatest impact on the network topology and combine this with the range of attribute values to more efficiently add new nodes.
[0104] Step S206: Display evaluation metrics, scores, attribute values, and attribute importance based on user needs. In real-world scenarios, neighbor selection can be optimized based on attribute importance and values, ultimately achieving network optimization and performance improvement.
[0105] The embodiments of the present invention utilize the ndnSIM simulation platform to simulate an NDN network environment. The system architecture of this embodiment is as follows: Figure 2 As shown, the system includes a network topology generation module and a network topology analysis module. The network topology analysis module includes a synchronization time analysis submodule, a redundancy analysis submodule, a molecule filtering module, an attribute calculation submodule, and an attribute analysis submodule.
[0106] The constraint parameters input into the network topology generation module are as follows:
[0107]
[0108]
[0109] This module generates multiple network topologies within the corresponding parameter range based on the constraint parameters input by the user. Each network topology outputs three files: a topology file applied to ndnSIM, a gml file storing the network topology information, and a visualization of the network topology.
[0110] ndnSIM is an open-source network simulation tool for simulating and evaluating Named Data Networking (NDN). It allows researchers to test various NDN network topologies, routing strategies, and application behaviors in a simulated environment to better understand and improve the performance of NDN protocols. ndnSIM is based on the NS-3 network simulator and provides a set of APIs for simulating NDN networks, as well as implementations of NDN protocols. By using ndnSIM, researchers can conduct experiments to evaluate the performance of NDN networks in different scenarios, driving the development and application of NDN technology.
[0111] The topology file used in ndnSIM refers to a text format file used on the ndnSIM simulation platform. The file contains the horizontal and vertical coordinates of each node, as well as the link information between each pair of connected nodes. The link information includes the bandwidth, latency, and queue size of the link.
[0112] The gml file that saves the network topology structure information is the file format used by the attribute calculation submodule. The file also contains information about nodes and edges in the network topology structure. When calculating attributes, the gml file is read to reconstruct the network topology structure.
[0113] The network topology visualization picture refers to an svg (Scalable Vector Graphics) format file that users can use to visually see the generated network topology structure.
[0114] In the network topology analysis module, the user can input parameters such as the total number of nodes, the number of network topology structures that meet the conditions to be output, the upper limit of synchronization time, the weight of synchronization time, the upper limit of redundancy, the weight of redundancy, the network topology structure output directory, and the log file directory.
[0115] In this module, combined with the log file and constraint parameters, the evaluation index calculation, screening score, attribute calculation, and attribute analysis of the network topology structure are completed. There are five submodules, namely the synchronization time analysis submodule, the redundancy analysis submodule, the screening score submodule, the attribute calculation submodule, and the attribute analysis submodule. After completing the overall analysis, the evaluation index, score, attribute value, and attribute importance of the top-ranked network topology structure will be displayed according to the user's requirements.
[0116] In the synchronization time analysis submodule, the total time for all the nodes to complete block synchronization is calculated based on the log file.
[0117] In the default scenario, the relationship between the number of nodes to be synchronized and the total number of nodes is as follows:
[0118]
[0119] Wherein update_node_num is the number of nodes to be synchronized, node_num is the total number of nodes, and the formula represents the maximum number of nodes to be synchronized.
[0120] In the redundancy analysis submodule, the data packet redundancy corresponding to each network topology is calculated according to the log file. The data packet redundancy formula is defined as follows:
[0121]
[0122] Wherein redundancy is the redundancy, redundancy_packet_num is the number of redundant data packets, and real_packet_num is the number of real data packets.
[0123] In the NDN network, the data communication form is that the consumer sends an interest packet, and the producer returns a data packet, so one interest packet corresponds to one data packet. In the NDN-based blockchain system, the consumer is the node to be synchronized, and the producer is the node that has the updated block. The node to be synchronized requests the local missing block through the interest packet, and the node that has the updated block packs the block into the data packet for return. Therefore, the number of real data packets can be counted by the request block interest packet sent by all nodes to be synchronized, and the formula is as follows:
[0124]
[0125] Wherein, m is the number of nodes to be synchronized, is the interest packet sent by the ith node to be synchronized (consumer).
[0126] In NDN, one interest packet corresponds to one data packet, so when a node receives the same named data packet multiple times, data packet redundancy occurs. The number of redundant data packets can be calculated by the forwarding nodes and consumer nodes, and the formula is as follows:
[0127]
[0128]
[0129] Wherein n is the number of forwarding nodes, is the jth named data packet received by the ith forwarding node, m is the number of nodes to be synchronized, is the jth named data packet received by the ith consumer node.
[0130] In the screening scoring module, network topologies that do not meet the requirements are first excluded according to the upper limit values of the two evaluation indexes. Secondly, the network topologies are scored in combination with the evaluation index weights and the specific index values of each network topology, wherein the weights of the two indexes indicate which evaluation index is more important to the user.
[0131] The scoring formula is as follows:
[0132] score i =(time_high-time i )×time_weight+(redundancy_high-redundancy i )×
[0133] redundancy_weight;
[0134] Wherein score i is the score of the i-th network topology, time_high is the upper limit of synchronization time, time i is the synchronization time of the i-th network topology, time_weight is the synchronization time weight, redundancy_high is the upper limit of redundancy, redundancy i is the redundancy of the i-th network topology, and redundancy_weight is the redundancy weight. According to the above formula, the lower the synchronization time and the lower the redundancy of the network topology, the higher the score.
[0135] The attribute calculation submodule calculates the attributes of all network topologies that meet the requirements, including network connectivity, network diameter, average shortest path length, density, clustering coefficient, and node degree distribution. In the networking process, the selection of neighbor nodes can be optimized according to the attribute value range of each attribute.
[0136] Network connectivity refers to the characteristic of whether nodes in the network can reach each other. Network connectivity is extremely important for blockchain networks, as it directly affects the robustness of the network and the efficiency of information propagation. In a blockchain, network connectivity ensures that transactions and blocks can be effectively propagated throughout the network, thereby maintaining the consistency and security of the network.
[0137] Network diameter is an index that measures the size of a network, defined as the maximum value of the shortest paths between all pairs of nodes in the network. Network diameter can be regarded as the "worst-case" distance of information propagation in the network. In the design of a blockchain network, a smaller network diameter means that information can be propagated more quickly in the network.
[0138] The average shortest path length refers to the average value of the shortest path between any two nodes in the network topology, and a shorter average path length means that information can be transmitted faster in the network.
[0139] The density refers to the ratio of the actual number of edges to the maximum number of edges that can exist in the network, and measures the degree of connection between nodes in the network.
[0140] The clustering coefficient is used to measure the degree of aggregation of nodes in the network. A high clustering coefficient indicates that nodes in the network tend to form tightly connected groups, which is beneficial for information transmission and redundancy in the blockchain network.
[0141] The node degree distribution refers to the distribution of the number of connections each node in the network has, i.e. the frequency statistics in the range of degree, reflecting the heterogeneity or uniformity of the network.
[0142] The attribute analysis submodule comprehensively considers the key attributes of the network topology structure, i.e. network diameter, average shortest path length, density and clustering coefficient, aiming to deeply understand the influence of each attribute on network performance. This module uses a random forest regression model, taking the above four attributes as independent variables and the comprehensive score of the network topology structure as the dependent variable, for accurate training. Through model training, the contribution of each attribute to network performance is revealed, and these attributes can be ranked by importance. In the actual network construction process, the analysis results of this module provide valuable reference. Users can prioritize consideration based on the importance of attributes, especially in neighbor selection and network optimization strategy formulation, giving priority to attributes that contribute more to improving network performance. In addition, combined with the specific range value of each attribute, users can more accurately adjust and optimize network configuration to achieve more efficient and stable network communication performance.
[0143] In summary, the present application provides a method and system for generating and optimizing the topology structure of a blockchain network based on NDN. The method includes setting the preset constraint parameters of the network topology structure generation module according to user requirements to generate multiple network topology structures. Each network topology structure is input into the synchronization time analysis submodule and the redundancy analysis submodule to calculate the synchronization time and redundancy. Based on the preset upper limits of synchronization time and redundancy and the weights, the preliminary selected network topology structures are screened out and scored and ranked. The attribute values of each preliminary selected network topology structure are output, and the pre-trained random forest regression model is used to output the importance values corresponding to the key attributes. Based on the score, key attribute value and importance value, the evaluation parameters of each preliminary selected network topology structure are output, and the evaluation parameter threshold is set to output a preset number of preferred network topology structures. The present application can generate and optimize the network topology structure according to user requirements, adjust the network configuration and improve the network communication performance.
[0144] Corresponding to the above method, the application further provides a system comprising a computer device, the computer device comprising a processor and a memory, the memory storing computer instructions, and the processor being configured to execute the computer instructions stored in the memory, and the system implements the steps of the method as described above when the computer instructions are executed by the processor.
[0145] The application also provides a computer readable storage medium storing a computer program, the computer program being executed by a processor to implement the steps of the edge computing server deployment method as described above. The computer readable storage medium can be a tangible storage medium, such as a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a floppy disk, a hard disk, a removable memory disk, a CD-ROM, or any other form of storage medium known in the art.
[0146] It should be understood by those of ordinary skill in the art that the exemplary components, systems and methods described in conjunction with the embodiments disclosed herein can be implemented in hardware, software, or a combination of both. The decision to implement in hardware or software depends on the specific application and design constraints imposed on the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the application. When implemented in hardware, it can be, for example, an electronic circuit, an application specific integrated circuit (ASIC), appropriate firmware, a plug-in, a functional card, etc. When implemented in software, the elements of the application are program or code segments used to perform the required tasks. The program or code segments can be stored in a machine-readable medium or transmitted through a data signal carried in a carrier wave over a transmission medium or communication link.
[0147] It should be understood that the application is not limited to the specific configurations and processes described above and shown in the drawings. For the sake of brevity, detailed descriptions of well-known methods are omitted here. In the above embodiments, several specific steps are described and shown as examples. However, the method process of the application is not limited to the specific steps described and shown, and those skilled in the art can make various changes, modifications and additions, or change the order between steps, after understanding the spirit of the application.
[0148] In the present application, the features described and / or exemplified for one embodiment can be used in the same way or in a similar way in one or more other embodiments, and / or in combination with or instead of the features of other embodiments.
[0149] The above merely illustrates the preferred embodiments of the present application, and is not used to limit the present application. The embodiments of the present application can be variously changed and modified by those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall fall within the scope of protection of the present application.
Claims
1. A method for generating and optimizing blockchain network topology based on NDN, characterized in that, The method includes the following steps: The network topology generation module can generate multiple network topologies by setting preset constraint parameters according to user needs. The log files generated by the NDN-based blockchain system for each network topology are input into the synchronization time analysis submodule and the redundancy analysis submodule to calculate the synchronization time and redundancy of each network topology. The synchronization time analysis submodule calculates the synchronization time based on the number of all nodes to be synchronized and the total number of nodes recorded in the log file. The redundancy analysis submodule calculates the redundancy based on the number of data packets received by the consumer nodes and forwarding nodes respectively recorded in the log file. The synchronization time and redundancy of each network topology are input into the filtering and scoring submodule. The upper limit and weight of the synchronization time and redundancy are set according to user requirements to filter out the preliminary network topologies that meet the conditions. Each preliminary network topology is scored and sorted according to the synchronization time and redundancy of the preliminary network topologies, and the scoring results are output. The initial network topology and its corresponding scoring results are input into the attribute calculation submodule, which outputs multiple attribute values for each initial network topology. The attribute values are used to describe the attributes of the nodes and links in each initial network topology. The attribute values are input into the attribute analysis submodule, and the analysis parameters are set. The attribute analysis submodule uses a pre-trained random forest regression model, with the key attributes in the attributes as independent variables and the score of the initial network topology as the dependent variable, to output the importance value corresponding to the key attributes. Based on the scoring results, key attribute values, and importance values corresponding to the key attributes of each preliminary network topology, the evaluation parameters of each preliminary network topology are output, and a preset number of preferred network topologies are output by setting the evaluation parameter threshold.
2. The method for generating and optimizing blockchain network topology based on NDN according to claim 1, characterized in that, The preset constraint parameters include: Total number of nodes, network topology type, bandwidth, latency, network topology input directory, number of neighboring nodes, reconnection probability, connection probability of multiple network topology types, and number of new edges.
3. The method for generating and optimizing blockchain network topology based on NDN according to claim 1, characterized in that, The network topology types include: WS network model, Regular network model, ER network model, Waxman network model, and BA network model.
4. The method for generating and optimizing blockchain network topology based on NDN according to claim 1, characterized in that, The synchronization time analysis submodule calculates the synchronization time based on the number of all nodes to be synchronized and the total number of nodes recorded in the log file. The calculation formula is as follows: Where update_node_num is the number of nodes to be synchronized, and node_num is the total number of nodes.
5. The method for generating and optimizing blockchain network topology based on NDN according to claim 1, characterized in that, The redundancy analysis submodule calculates the redundancy based on the number of data packets received by the consumer node and the forwarding node as recorded in the log file. The calculation formula is as follows: Wherein, redundancy is the redundancy level, redundancy_packet_num is the number of redundant data packets, and real_packet_num is the number of real data packets; Where m is the number of nodes to be synchronized. It is the data packet sent by the i-th node to be synchronized; Where n is the number of forwarding nodes, It is the j-th named data packet received by the i-th forwarding node, and m is the number of nodes to be synchronized. It is the j-th named data packet received by the i-th consumer node.
6. The method for generating and optimizing blockchain network topology based on NDN according to claim 1, characterized in that, The synchronization time and redundancy of each network topology are input into the filtering and scoring submodule to score and rank each network topology, and the scoring result is output. The calculation formula is as follows: score i =(time_high-time i )×time_weight+(redundancy_high-redundancy i )×redundancy_weight Among them, score i It is the score of the i-th network topology, time_high is the upper limit of synchronization time, and time i It represents the synchronization time of the i-th network topology, where time_weight is the synchronization time weight, and redundancy_high is the upper limit of redundancy. i It represents the redundancy of the i-th network topology, and redundancy_weight is the redundancy weight.
7. The method for generating and optimizing blockchain network topology based on NDN according to claim 1, characterized in that, The attributes include: the connectivity of the network topology, the network diameter of the network topology, the average shortest path length of the network topology, the clustering coefficient of the network topology, the node density in the network topology, and the node degree distribution of the network topology; The key attributes include: the network diameter of the network topology, the average shortest path length of the network topology, the clustering coefficient of the network topology, and the node density in the network topology.
8. The method for generating and optimizing blockchain network topology based on NDN according to claim 1, characterized in that, Based on user requirements, preset constraint parameters are set for the network topology generation module to generate multiple network topologies. The output formats of the network topologies include: ndnSIM files, gml files, and network topology visualization images.
9. A blockchain network topology generation and optimization system based on NDN, comprising a processor, a memory, and a computer program stored in the memory, characterized in that, The processor is configured to execute the computer program, and when the computer program is executed, the system implements the steps of the method as described in any one of claims 1 to 8.
10. A computer program product, comprising a computer program, characterized in that, When executed by a processor, the computer program implements the steps of the method according to any one of claims 1 to 8.
Citation Information
Patent Citations
Block chain network topology dynamic establishment and data transmission optimization method
CN115314391A
Method and device for evaluating network topology data
CN116962192A