NDN-based block chain network topology structure generation and optimization method and system
Generating and optimizing the blockchain network topology through NDN technology solves the problem of high blockchain network transmission delay, achieving performance improvement and meeting customer needs.
Patent Information
- Application Number
- CN202410526458.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-04-28
- Publication Date
- 2024-08-23
- Estimated Expiration
- 2044-04-28
AI Technical Summary
There is a lack of research and optimization of network topology in existing blockchain systems, resulting in high transmission delays and inability to meet the performance requirements of blockchain networks.
Through the NDN-based blockchain network topology generation and optimization method, the synchronization time and redundancy analysis module is used to generate multiple network topologies, combined with the random forest regression model, scoring and sorting, to output the optimal network topology to meet user needs. .
It realizes the generation and optimization of network topology according to user needs, improves the communication performance of blockchain networks, and provides quantitative evaluation parameters to meet customer needs.
Smart Images

Figure CN118540329A
Abstract
Description
Technical Field
[0001] The present invention relates to the field of blockchain technology, and in particular to a method and system for generating and optimizing a blockchain network topology structure based on NDN. Background Art
[0002] NDN refers to Named Data Networking, a network architecture based on data content rather than device addresses. In NDN, data is given a unique name and accessed by name, rather than by device address as in traditional IP networks. This approach can better support content distribution, caching, and security.
[0003] The traditional blockchain system is based on the TCP / IP network architecture. Its defect is that the TCP / IP network is a host-centric communication architecture. When requesting data, the IP address must be used as the target, and the entire network cannot be searched, resulting in high transmission delays. Therefore, it is particularly important to optimize the network layer in blockchain technology. 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 NDN-based blockchain systems, existing network layer optimization technologies mainly focus on block synchronization mechanisms and data transmission strategies, and lack research and optimization of blockchain network topology structures. Summary of the invention
[0005] In view of this, an embodiment of the present invention provides a method and system for generating and optimizing a blockchain network topology structure based on NDN, so as to improve the blockchain network topology structure based on NDN in the prior art.
[0006] One aspect of the present invention provides a method for generating and optimizing a blockchain network topology structure based on NDN, the method comprising the following steps:
[0007] According to user requirements, preset constraint parameters of the network topology structure generation module are set to generate multiple network topologies;
[0008] The log file generated by the NDN-based blockchain system of each network topology is 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 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 node and the forwarding node respectively recorded in the log file;
[0009] Input the synchronization time and the redundancy of each network topology structure into the screening and scoring submodule, set the upper limit and weight of the synchronization time and the redundancy according to user requirements to screen out qualified preliminary network topology structures; score and sort each preliminary network topology structure according to the synchronization time and the redundancy of the preliminary network topology structure, and output the scoring result;
[0010] Input the preliminary network topology structure and the corresponding scoring result into the attribute calculation submodule, and output a plurality of attribute values corresponding to each preliminary network topology structure; the attribute values are used to describe the attributes of the node and link features in each preliminary network topology structure;
[0011] Input the attribute value into the attribute analysis submodule, set the analysis parameters, and use the pre-trained random forest regression model to take the key attribute in the attribute as the independent variable and the score of the preliminary network topology structure as the dependent variable to output the importance value corresponding to the key attribute;
[0012] Based on the scoring result of each preliminary network topology structure, the key attribute value and the importance value corresponding to the key attribute, the evaluation parameter of each preliminary network topology structure is output, and the evaluation parameter threshold is set to output a preset number of preferred network topology structures.
[0013] In some embodiments of the present invention, the preset constraint parameters include:
[0014] The total number of nodes, network topology type, bandwidth, latency, network topology input directory, number of neighbor nodes, reconnection probability, connection probability of multiple types of network topologies, and number of newly added edges.
[0015] In some embodiments of the present invention, the network topology types include: WS network model, Regular network model, ER network model, Waxman network model and BA network model.
[0016] In some embodiments of the present invention, 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:
[0017]
[0018] Wherein, update_node_num is the number of nodes to be synchronized, and node_num is the total number of nodes.
[0019] In some embodiments of the present invention, the redundancy analysis submodule calculates the redundancy according to the number of data packets respectively received by the consumer node and the forwarding node 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 nodes to be synchronized, is the data packet sent by the i-th node to be synchronized;
[0024]
[0025] Where n is the number of forwarding nodes, is the jth named data packet received by the i-th forwarding node, m is the number of nodes to be synchronized, is the jth named data packet received by the i-th consumer node.
[0026] In some embodiments of the present invention, the synchronization time and the redundancy of each network topology structure are input into the screening and scoring submodule to score and sort each network topology structure, and the scoring result is output. The calculation formula is:
[0027] score i =(time_high-time i )×time_weight+(redundancy_high-redundancy i )×
[0028] redundancy_weight;
[0029] Among them, score i is the score of the ith network topology, time_high is the upper limit of synchronization time, and time i is the synchronization time of the ith network topology, time_weight is the synchronization time weight, redundancy_high is the upper limit of redundancy, and redundancy i is the redundancy of the ith network topology, and redundancy_weight is the redundancy weight.
[0030] In some embodiments of the present invention, 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: the network diameter of the network topology structure, the average shortest path length of the network topology structure, the clustering coefficient of the network topology structure and the node density in the network topology structure.
[0032] In some embodiments of the present invention, preset constraint parameters of the network topology structure generation module are set according to user requirements to generate multiple network topologies, and the output forms of the network topologies include:
[0033] ndnSIM files, gml files and network topology visualization pictures.
[0034] Another aspect of the present invention provides a blockchain network topology structure generation and optimization system based on NDN, including a processor, a memory, and a computer program stored in 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 any of the methods described above.
[0035] Another aspect of the present invention provides a computer program product, comprising a computer program, characterized in that the computer program implements the steps of the above method when executed by a processor.
[0036] The beneficial effects of the present invention are at least:
[0037] The present invention provides a method and system for generating and optimizing a blockchain network topology structure based on NDN, the method comprising: setting preset constraint parameters of a network topology structure generation module according to user needs to generate multiple network topologies. Input each network topology structure into a synchronization time analysis submodule and a redundancy analysis submodule, calculate the synchronization time and redundancy, and screen out a preliminary network topology structure according to the preset synchronization time and redundancy upper limit and weight, and score and sort. Output the attribute value of each preliminary network topology structure, and use a pre-trained random forest regression model to output the importance value corresponding to the key attribute. Based on the score, key attribute value and importance value, output the evaluation parameter of each preliminary network topology structure, set the evaluation parameter threshold and output a preset number of preferred network topologies. The present invention adjusts the network configuration by generating a network topology structure that meets user needs, thereby improving the performance of the blockchain. The present invention can generate and optimize the network topology structure according to user needs, generate quantifiable evaluation parameters for it, obtain a blockchain network topology structure that meets customer needs, and improve the communication performance of the blockchain network.
[0038] Additional advantages, purposes, and features of the present invention will be described in part in the following description, and will become apparent to those skilled in the art after studying the following, or may be learned from the practice of the present invention. The purposes and other advantages of the present invention may be achieved and obtained by the structures specifically indicated in the specification and the accompanying drawings.
[0039] Those skilled in the art will appreciate that the objectives and advantages that can be achieved with the present invention are not limited to the above specific description, and the above and other objectives that can be achieved by the present invention will be more clearly understood from the following detailed description. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] The drawings described herein are used to provide a further understanding of the present invention, constitute a part of the present application, and do not constitute a limitation of the present invention. In the drawings:
[0041] Figure 1 This is a flowchart of a method for generating and optimizing a blockchain network topology structure based on NDN according to an embodiment of the present invention.
[0042] Figure 2 This is a system architecture diagram for generating and optimizing the NDN-based blockchain network topology structure according to another embodiment of the present invention. DETAILED DESCRIPTION
[0043] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the embodiments and the accompanying drawings. Here, the illustrative embodiments of the present invention and their descriptions are used to explain the present invention, but are not intended to limit the present invention.
[0044] It should also be noted that, in order to avoid obscuring the present invention due to unnecessary details, only structures and / or processing steps closely related to the solutions according to the present invention are shown in the accompanying drawings, while other details that are not closely related to the present invention are omitted.
[0045] It should be emphasized that the term “include / comprises” when used herein refers to the presence of features, elements, steps or components, but does not exclude the presence or addition of one or more other features, elements, steps or components.
[0046] It should also be noted that, unless otherwise specified, the term “connection” herein may refer not only to a direct connection but also to an indirect connection involving an intermediate.
[0047] Hereinafter, embodiments of the present invention will be described with reference to the accompanying drawings. In the accompanying drawings, the same reference numerals represent the same or similar components, or the same or similar steps.
[0048] An embodiment of the present invention provides a method for generating and optimizing a blockchain network topology structure based on NDN, such as Figure 1 As shown, the process of the method includes the following steps S101 to S106:
[0049] Step S101: setting preset constraint parameters of a network topology structure generation module according to user requirements to generate multiple network topologies.
[0050] Among them, the network topology generation module can use the graph generation function of the networkx library to generate multiple network topologies according to the requirements of preset constraint parameters. The networkx library is a graph theory and complex network modeling tool with built-in commonly used graph and complex network analysis algorithms, which can perform complex network data analysis, simulation modeling, etc. Networkx can be used to store networks in standardized and non-standardized data formats, generate a variety of random networks and classical networks, analyze network structures, establish network models, design new network algorithms, and draw networks.
[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 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 node and the forwarding node respectively recorded in the log file.
[0052] Step S103: Input the synchronization time and redundancy of each network topology structure into the screening and scoring submodule, set the upper limit and weight of the synchronization time and redundancy according to user requirements to screen out the preliminary network topologies that meet the conditions. Score and sort each preliminary network topology structure according to the synchronization time and redundancy of the preliminary network topology structure, and output the scoring result.
[0053] Step S104: Input the preliminary network topology structures and their corresponding scoring results into the attribute calculation submodule, and output multiple attribute values corresponding to each preliminary network topology structure. The attribute values are used to describe the attributes of the node and link features in each preliminary network topology structure.
[0054] Step S105: Input the attribute value into the attribute analysis submodule, set the analysis parameters, and the attribute analysis submodule uses the pre-trained random forest regression model, takes the key attributes in the attributes as independent variables, takes the score of the preliminary network topology structure as the dependent variable, and outputs the importance value corresponding to the key attributes.
[0055] Among them, the analysis parameters include: the parameters that users can input include the total number of nodes, the number of qualified network topology structures to be output, the synchronization time upper limit, the synchronization time weight, the redundancy upper limit, the redundancy weight, the network topology output directory and the log file directory.
[0056] Among them, the random forest regression model is a machine learning algorithm and a type of ensemble learning. The random forest regression model randomly extracts samples and features to establish multiple unrelated decision trees. Each decision tree can obtain a prediction result through the extracted samples and features. By averaging the results of all trees, the regression prediction result of the entire forest is obtained. 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, when selecting the partitioning features, the random forest will randomly select a feature subset, 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 the divided features, and the random forest regression model determines the contribution of each key attribute to the score, that is, the importance value corresponding to the key attribute. The role of importance is that the network topology has multiple attributes, and it is difficult for the network topology to take all attributes into account during the networking process. Therefore, the user selects the key attributes according to actual needs and divides the importance of the key attributes, so as to facilitate the selection of new nodes according to the key attributes and their corresponding importance.
[0058] Step S106: Based on the scoring results, key attribute values and importance values corresponding to the key attributes of each preliminary selected network topology structure, output the evaluation parameters of each preliminary selected network topology structure, set the evaluation parameter threshold and output a preset number of preferred network topologies.
[0059] In some embodiments of the present invention, the preset constraint parameters include:
[0060] The total number of nodes, network topology type, bandwidth, latency, network topology input directory, number of neighbor nodes, reconnection probability, connection probability of multiple types of network topologies, and number of newly added edges.
[0061] In some embodiments of the present invention, the network topology types include: WS network model, Regular network model, ER network model, Waxman network model and BA network model.
[0062] The WS network model, or Watts-Strogatz model, is a model used to describe the characteristics of small-world networks and to explain the small-world phenomenon that many networks in the real world exhibit. Small-world networks specifically refer to networks in which the average distance between nodes is relatively small and has 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 tight groups.
[0063] The Regular network model is a simple and structured network model in which each node has the same number of connections, and these connections are distributed in a fixed and regular pattern. It has the characteristics of uniformly distributed connections and high clustering coefficient.
[0064] The ER network model is a random graph model that 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 consists of multiple nodes, and any two different nodes are independently connected with probability p. p is the probability of an edge existing in the network, and it is the same for all pairs of nodes.
[0065] The Waxman network model is a random graph model that is mainly used to simulate long-distance connections in computer networks. It can simulate the geographical characteristics and topological structure of actual networks well, 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. The closer the distance, the higher the probability of establishing a connection between nodes.
[0066] The BA network model is a complex network model that is mainly used to describe the structure of many networks in the real world, such as social networks, the Internet, and biological networks. This network model has the characteristics of the degree distribution of the network obeying the power law distribution and the efficient network growth mechanism, and is a scale-free network.
[0067] In some embodiments of the present invention, 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] Among them, 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 invention, 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, and the calculation formula is:
[0071]
[0072] Among them, 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.
[0073]
[0074] Where m is the number of nodes to be synchronized. It is the data packet sent by the i-th node to be synchronized.
[0075]
[0076] Where n is the number of forwarding nodes, is the jth named data packet received by the i-th forwarding node, m is the number of nodes to be synchronized, is the jth named data packet received by the i-th consumer node.
[0077] In some embodiments of the present invention, the synchronization time and redundancy of each network topology structure are input into the screening and scoring submodule to score and sort each network topology structure, and the scoring result is output. The calculation formula is:
[0078] score i =(time_high-time i )×time_weight+(redundancy_high-redundancy i )×
[0079] redundancy_weight;
[0080] Among them, score i is the score of the ith network topology, time_high is the upper limit of synchronization time, and time i is the synchronization time of the ith network topology, time_weight is the synchronization time weight, redundancy_high is the upper limit of redundancy, and redundancy i is the redundancy of the ith network topology, and redundancy_weight is the redundancy weight.
[0081] In some embodiments of the present invention, the attributes include: connectivity of the network topology structure, network diameter of the network topology structure, average shortest path length of the network topology structure, clustering coefficient of the network topology structure, node density in the network topology structure, and node degree distribution of the network topology structure.
[0082] 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.
[0083] In some embodiments of the present invention, preset constraint parameters of the network topology structure generation module are set according to user requirements to generate multiple network topologies, and the output forms of the network topology structures include: ndnSIM files, gml files and network topology structure visualization pictures.
[0084] Among them, the ndnSIM file is a text file used in the ndnSIM simulation platform. 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. The file also stores the information of nodes and edges in the network topology. When calculating the attributes, the gml file will be read to reconstruct the network topology.
[0086] The network topology structure visualization image may be an svg format file (scalable vector graphics file), through which the user can visually see the generated network topology structure image.
[0087] Another embodiment of the present invention provides a method and system for generating and optimizing a blockchain network topology structure based on NDN, the method flow comprising steps S201 to S206:
[0088] Step S201: inputting relevant constraint parameters of the network topology structure according to actual network conditions and user requirements, and the network topology structure generation module generates a plurality of network topologies that meet the constraint parameter range according to the constraint parameter range and the network topology structure type.
[0089] Step S202: ndnSIM generates a log file, inputs the log file into the synchronization time analysis submodule and the redundancy analysis submodule, and calculates the evaluation indexes of each network topology structure, namely, the synchronization time and the redundancy.
[0090] Among them, ndnSIM is a simulation platform for the ndn network, on which users can simulate the blockchain system based on ndn. The contents of the log file include: time, node name, node behavior (sending interest packets, receiving interest packets, sending data packets, receiving data packets) and node status (whether all requested data packets have been received).
[0091] Step S203: Based on the two evaluation indicators, ie, the upper limit and weight of the synchronization time and the redundancy, the screening and scoring submodule will score and sort the network topology structures that meet the evaluation indicator requirements.
[0092] The weights indicate the importance of synchronization time and redundancy. For example, a user believes that the synchronization time of a network topology accounts for 80% and the redundancy accounts for 20%.
[0093] Step S204: the attribute calculation submodule performs attribute calculation on all network topological structures that meet the evaluation index requirements.
[0094] The calculation of attributes can call the encapsulated functions 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, it means that the network topology is connected, otherwise it is disconnected.
[0096] 2. Network diameter: First, traverse all node pairs in the network topology, use the Dijkstra algorithm to calculate the shortest path between each pair of nodes, and finally find the largest path among all the shortest paths, which is the network diameter.
[0097] 3. Average shortest path length: First, traverse all node pairs in the network topology, use the Dijkstra algorithm to calculate the shortest path between each pair of nodes, and finally accumulate and calculate the average value, which is the average shortest path length.
[0098] 4. Density: First, calculate the actual number of edges in the network topology, then calculate the maximum number of edges in the network topology (fully connected graph), and 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 each node’s neighbor nodes. The actual number of edges or the maximum number of edges is the clustering coefficient of the node. Secondly, add up the clustering coefficients of all nodes and calculate the average value, which is the clustering coefficient of the entire network topology.
[0100] 6. Node degree distribution: First, calculate the degree of each node, that is, the number of connected neighbors, 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 submodule uses a random forest regression model to determine the importance of each attribute.
[0102] Among them, the method of using the random forest regression model includes: inputting 4 attribute values (i.e., features) as independent variables, and the scores corresponding to the 4 attribute values as dependent variables. After the random forest regression model is trained, the model will judge how much contribution each feature makes to each tree in the random forest, then take the average, and finally compare the contribution between the features. The greater the contribution, the more important the attribute. The contribution is evaluated using the Gini index.
[0103] The network topology has multiple attributes. In the actual networking process, users cannot take all attributes into consideration at the same time, 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. The attributes of the network topology are divided according to their importance. Users can choose the attributes that have the greatest impact on the network topology, and combine the range of attribute values to complete the addition of new nodes more efficiently.
[0104] Step S206: Display the evaluation index, score, attribute value and attribute importance according to the user's needs. In actual scenarios, the neighbor selection can be optimized according to the attribute importance and attribute value, and finally the network optimization and performance improvement can be achieved.
[0105] The embodiment of the present invention uses the ndnSIM simulation platform to simulate the NDN network environment. The system architecture of this embodiment is as follows: Figure 2 As shown, the system includes a network topology structure generation module and a network topology structure analysis module. The network topology structure analysis module includes a synchronization time analysis submodule, a redundancy analysis submodule, a screening molecule module, an attribute calculation submodule and an attribute analysis submodule.
[0106] The constraint parameters entered in the network topology generation module are as follows:
[0107]
[0108]
[0109] This module generates multiple network topologies within the corresponding parameter range according to the constraint parameters input by the user. Each network topology will output three files, namely the topology file applied in ndnSIM, the gml file that saves the network topology information, and the network topology visualization picture.
[0110] Among them, ndnSIM is an open source network simulation tool for simulating and evaluating named data networks (NDN). It allows researchers to test various NDN network topologies, routing strategies, and application behaviors in a simulation environment to better understand and improve the performance of the NDN protocol. Based on the NS-3 network simulator, ndnSIM provides a set of APIs for simulating NDN networks and includes the implementation of the NDN protocol. By using ndnSIM, researchers can conduct experiments to evaluate the performance of NDN networks in different scenarios and promote 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 stores the horizontal and vertical coordinates of each node and the link information of each pair of connected nodes. The link information includes the bandwidth, delay and queue size of the link.
[0112] The gml file that saves the network topology information is the file format used by the attribute calculation submodule. The file also saves the information of nodes and edges in the network topology. When calculating the attributes, the gml file will be read to reconstruct the network topology.
[0113] The network topology structure visualization picture refers to an svg (scalable vector graphics) format file in which users can intuitively see the generated network topology structure.
[0114] In the network topology analysis module, the parameters that users can enter include the total number of nodes, the number of qualified network topologies to be output, the synchronization time upper limit, the synchronization time weight, the redundancy upper limit, the redundancy weight, the network topology output directory, and the log file directory.
[0115] In this module, combined with log files and constraint parameters, the four major parts of network topology evaluation index calculation, screening and scoring, attribute calculation and attribute analysis are completed. There are five submodules, namely synchronization time analysis submodule, redundancy analysis submodule, screening and scoring submodule, attribute calculation submodule and attribute analysis submodule. After completing the overall analysis, the evaluation index, score, attribute value and attribute importance of the top-ranked network topology will be displayed according to user needs.
[0116] In the synchronization time analysis submodule, the total time required for all nodes to be synchronized corresponding to each network topology 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:
[0118]
[0119] Where update_node_num is the number of nodes to be synchronized, node_num is the total number of nodes, and this formula represents the case with the largest number of nodes to be synchronized.
[0120] In the redundancy analysis submodule, the data packet redundancy corresponding to each network topology is calculated based on the log file. The data packet redundancy formula is defined as follows:
[0121]
[0122] Where redundancy is the redundancy, redundancy_packet_num is the number of redundant packets, and real_packet_num is the number of real packets.
[0123] In the NDN network, the form of data communication is that consumers send interest packets and producers return data packets, so one interest packet corresponds to one data packet. In the NDN-based blockchain system, consumers are nodes to be synchronized, and producers are nodes with updated blocks. The nodes to be synchronized request the missing blocks locally through interest packets, and the nodes with updated blocks package the blocks into data packets and return them. Therefore, the actual number of data packets can be counted through the request block interest packets sent by all nodes to be synchronized, and the formula is as follows:
[0124]
[0125] Where m is the number of nodes to be synchronized. It is the interest packet sent by the i-th 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 node and the consumer node, and the formula is as follows:
[0127]
[0128]
[0129] Where n is the number of forwarding nodes, is the jth named data packet received by the i-th forwarding node, m is the number of nodes to be synchronized, is the jth named data packet received by the i-th consumer node.
[0130] In the screening and scoring submodule, the network topologies that do not meet the requirements will be excluded first according to the upper limits of the two evaluation indicators. Secondly, the network topologies will be scored based on the evaluation indicator weights and the specific indicator values of each network topology. The weights of the two indicators indicate which evaluation indicator 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] The score i is the score of the ith network topology, time_high is the upper limit of synchronization time, and time i is the synchronization time of the ith network topology, time_weight is the synchronization time weight, redundancy_high is the upper limit of redundancy, and redundancy i is the redundancy of the ith network topology, and redundancy_weight is the redundancy weight. According to the above formula, when the synchronization time and redundancy of the network topology are lower, its score will be higher.
[0135] The attribute calculation submodule will calculate 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 property of whether nodes in a network can reach each other. Network connectivity is extremely important for blockchain networks because it directly affects the robustness of the network and the efficiency of information dissemination. In 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] The network diameter is a measure of the size of the network, defined as the maximum value of the shortest paths of all pairs of nodes in the network. The network diameter can be regarded as the "worst case" distance of information propagation in the network. In blockchain network design, a smaller network diameter means that information can propagate faster 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. A shorter average path length means that information can be transmitted faster in the network.
[0139] Density refers to the ratio of the actual number of edges to the maximum number of edges that may exist in the network, which measures the degree of connection between nodes in the network.
[0140] The clustering coefficient is used to measure the degree of clustering of nodes in the network. A high clustering coefficient indicates that the nodes in the network tend to form tightly connected groups, which is beneficial for information dissemination and redundancy in the blockchain network.
[0141] Node degree distribution refers to the distribution of the number of connections each node has in the network, that is, the frequency statistics within the range of degree, reflecting the heterogeneity or uniformity of the network.
[0142] The attribute analysis submodule aims to gain a deeper understanding of the impact of each attribute on network performance by comprehensively considering the key attributes of the network topology, namely, network diameter, average shortest path length, density, and clustering coefficient. This module uses a random forest regression model, takes the above four attributes as independent variables, and the comprehensive score of the network topology as the dependent variable for precise training. Through model training, the contribution of each attribute to network performance is revealed, and these attributes can be ranked in order of importance. In the actual network formation process, the analysis results of this module provide a valuable reference. Users can prioritize attributes according to their importance, especially in neighbor selection and network optimization strategy formulation, giving priority to those 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 invention provides a method and system for generating and optimizing a blockchain network topology structure based on NDN, and the method includes: setting preset constraint parameters of a network topology structure generation module according to user needs to generate multiple network topologies. Input each network topology structure into a synchronization time analysis submodule and a redundancy analysis submodule, calculate the synchronization time and redundancy, and screen out the preliminary network topology structure according to the preset synchronization time and redundancy upper limit and weight, and perform scoring and sorting. Output the attribute value of each preliminary network topology structure, and use the pre-trained random forest regression model to output the importance value corresponding to the key attribute. Based on the score, key attribute value and importance value, output the evaluation parameter of each preliminary network topology structure, set the evaluation parameter threshold to output a preset number of preferred network topologies. The present invention can generate and optimize the network topology structure according to user needs, adjust the network configuration, and improve the network communication performance.
[0144] Corresponding to the above method, the present invention also provides a system, which includes a computer device, the computer device includes a processor and a memory, the memory stores computer instructions, the processor is used to execute the computer instructions stored in the memory, and when the computer instructions are executed by the processor, the system implements the steps of the method described above.
[0145] The embodiment of the present invention also provides a computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, the steps of the aforementioned edge computing server deployment method are implemented. 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 storage disk, a CD-ROM, or any other form of storage medium known in the technical field.
[0146] It should be understood by those skilled 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 the two. Whether it is performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention. When implemented in hardware, it can be, for example, an electronic circuit, an application specific integrated circuit (ASIC), appropriate firmware, a plug-in, a function card, etc. When implemented in software, the elements of the present invention are programs or code segments used to perform the required tasks. The program or code segment can be stored in a machine-readable medium, or transmitted on a transmission medium or a communication link via a data signal carried in a carrier.
[0147] It should be clear that the present invention is not limited to the specific configuration and processing described above and shown in the figures. For the sake of simplicity, a detailed description of the known method is omitted here. In the above embodiments, several specific steps are described and shown as examples. However, the method process of the present invention 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 the steps after understanding the spirit of the present invention.
[0148] In the present invention, features described and / or illustrated for one embodiment may be used in the same or similar manner in one or more other embodiments, and / or combined with features of other embodiments or replace features of other embodiments.
[0149] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the embodiments of the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A method for generating and optimizing blockchain network topology based on NDN. It is characterized in that The method comprises the following steps: According to user requirements, preset constraint parameters of the network topology structure generation module are set to generate multiple network topologies; The log file generated by the NDN-based blockchain system of each network topology is 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 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 node and the forwarding node respectively recorded in the log file; Input the synchronization time and the redundancy of each network topology structure into the screening and scoring submodule, set the upper limit and weight of the synchronization time and the redundancy according to user requirements to screen out qualified preliminary network topology structures; score and sort each preliminary network topology structure according to the synchronization time and the redundancy of the preliminary network topology structure, and output the scoring result; Input the preliminary network topology structure and the corresponding scoring result into the attribute calculation submodule, and output a plurality of attribute values corresponding to each preliminary network topology structure; the attribute values are used to describe the attributes of the node and link features in each preliminary network topology structure; Input the attribute value into the attribute analysis submodule, set the analysis parameters, and use the pre-trained random forest regression model to take the key attribute in the attribute as the independent variable and the score of the preliminary network topology structure as the dependent variable to output the importance value corresponding to the key attribute; Based on the scoring result of each preliminary network topology structure, the key attribute value and the importance value corresponding to the key attribute, the evaluation parameter of each preliminary network topology structure is output, and the evaluation parameter threshold is set to output a preset number of preferred network topology structures.
2. According to the NDN-based blockchain network topology generation and optimization method according to claim 1, It is characterized in that The preset constraint parameters include: The total number of nodes, network topology type, bandwidth, latency, network topology input directory, number of neighbor nodes, reconnection probability, connection probability of multiple types of network topologies, and number of newly added edges.
3. According to the NDN-based blockchain network topology generation and optimization method according to claim 1, It is 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. According to the NDN-based blockchain network topology generation and optimization method according to claim 1, It is characterized in that 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: Wherein, update_node_num is the number of nodes to be synchronized, and node_num is the total number of nodes.
5. According to the NDN-based blockchain network topology generation and optimization method according to claim 1, It is characterized in that 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, and the calculation formula is: 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; Wherein, m is the number of nodes to be synchronized, is the data packet sent by the i-th node to be synchronized; Where n is the number of forwarding nodes, is the jth named data packet received by the i-th forwarding node, m is the number of nodes to be synchronized, is the jth named data packet received by the i-th consumer node.
6. According to the NDN-based blockchain network topology generation and optimization method according to claim 1, It is characterized in that The synchronization time and the redundancy of each network topology structure are input into the screening and scoring submodule to score and sort each network topology structure, and the scoring result is output. The calculation formula is: score i =(time_high-time i )×time_weight+(redundancy_high-redundancy i )×redundancy_weight Among them, score i is the score of the ith network topology, time_high is the upper limit of synchronization time, and time i is the synchronization time of the ith network topology, time_weight is the synchronization time weight, redundancy_high is the upper limit of redundancy, and redundancy i is the redundancy of the ith network topology, and redundancy_weight is the redundancy weight.
7. According to the NDN-based blockchain network topology generation and optimization method according to claim 1, It is characterized in that The attributes include: connectivity of the network topology structure, network diameter of the network topology structure, average shortest path length of the network topology structure, clustering coefficient of the network topology structure, node density in the network topology structure and node degree distribution of the network topology structure; The key attributes include: the network diameter of the network topology structure, the average shortest path length of the network topology structure, the clustering coefficient of the network topology structure and the node density in the network topology structure.
8. According to the NDN-based blockchain network topology generation and optimization method according to claim 1, It is characterized in that The preset constraint parameters of the network topology structure generation module are set according to user requirements to generate multiple network topologies. The output forms of the network topologies include: ndnSIM files, gml files and network topology visualization pictures.
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, It is characterized in that The processor is used to execute the computer program. When the computer program is executed, the system implements the steps of the method according to any one of claims 1 to 8.
10. A computer program product comprising a computer program, It is characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 8 are implemented.
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
Network transmission optimization device for graph-type blockchain and method thereof
US20230130074A1
Cited By
Method and device for adjusting network topology structure
CN119814575A
Network topology adjustment method and apparatus
CN119814575B
Heterogeneous wireless convergence network topology control method for unmanned cluster and application
CN120751416A
Topology control method and application of heterogeneous wireless converged network for unmanned clusters
CN120751416B
Method and device for intelligent connection recommendation and dynamic networking mode switching
CN121098717A
