A blockchain data synchronization method and computer-readable storage medium
By optimizing the blockchain network topology diagram and the bearer network topology diagram, determining candidate logical neighbor nodes and optimizing message synchronization strategies, the problems of long overall propagation time and low throughput when the blockchain system propagates blocks are solved, achieving more efficient block transfer and verification.
Patent Information
- Application Number
- CN202410620135.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-20
- Publication Date
- 2025-02-07
- Estimated Expiration
- 2044-05-20
AI Technical Summary
The existing blockchain system fails to effectively combine the blockchain system with its bearer network when spreading blocks, resulting in an increase in overall propagation time and low throughput.
By obtaining the blockchain network topology diagram and the bearer network topology diagram, the blockchain network extension topology diagram is optimized to obtain the blockchain network expansion topology diagram, node clustering and scoring, cluster head nodes are determined, candidate logical neighbor node collection is generated, and message synchronization strategy is optimized to improve transmission efficiency.
It improves the overall transmission rate of blocks in the blockchain network, improves the throughput of blockchain systems, and solves the problems of long propagation time and low throughput.
Smart Images

Figure CN118353908B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of blockchain technology, and in particular to a blockchain data synchronization method and a computer-readable storage medium. Background Art
[0002] Existing blockchain systems usually use a P2P network (a point-to-point network structure), in which each node in the network is equal and connected to each other equally. There is no centralized node for management. Each node stores all transaction data of the entire network and can verify and exchange data independently and securely. These data are stored in a data structure called a block. All blocks are created by some special nodes in the system called miners. After creation, they are randomly selected to propagate to all nodes in the entire network. Blocks are verified by most nodes in the blockchain network and can be put on the chain after consensus is reached. This method of broadcasting blocks to the entire network and putting them on the chain after most nodes verify them does not closely cooperate with the blockchain system and its carrier network. It may increase the overall propagation time of the blockchain network due to the poor network status of some nodes, resulting in low throughput problems in blockchain applications.
[0003] "BlockP2P: Enabling Fast Blockchain Broadcast with Scalable Peer-to-Peer Network Topology" proposes that BlockP2P first performs geographic proximity-aware clustering and uses the K-Means algorithm to cluster neighboring peer nodes into clusters. Then, the hierarchical topology based on node attribute classification ensures strong connectivity and small diameter between nodes. Finally, the article proposes a parallel spanning tree broadcast algorithm to achieve fast data broadcast between nodes within and between clusters. Using geographically adjacent nodes has lower transmission latency, but selecting geographically adjacent nodes as neighbors can be easily predicted by malicious nodes, causing the blockchain system to be attacked by eclipse. The node selection strategy based on geographical proximity does not take into account the security and robustness of the blockchain system; and the more important problem is that it does not take into account the network status of different nodes.
[0004] "Research on Neighbor Node Selection Algorithm for Bitcoin Blockchain" takes into account the network status of neighbor nodes, updates the neighbor node scores in each round of block propagation, dynamically adjusts the neighbor nodes of each node according to the scores, and randomly explores other nodes in the network to establish new connections after disconnection. This method takes into account the network status of each node and the security of the network, but lacks a global perspective. After each node disconnects from the neighbor node, randomly selecting a new node cannot guarantee the network status of the newly connected node, which may cause some inefficient nodes to be selected as neighbor nodes, affecting the verification and propagation time of the block.
[0005] Therefore, it is necessary to improve the deficiencies in the prior art. Summary of the invention
[0006] The main technical problem solved by the present invention is to provide a blockchain data synchronization method and a computer-readable storage medium, which closely integrates the blockchain system with the blockchain bearer network, thereby improving the overall transmission rate of blocks in the blockchain network and improving the throughput of the blockchain system.
[0007] According to the first aspect, an embodiment provides a blockchain data synchronization method, including:
[0008] Obtain the blockchain network topology map and generate the bearer network topology map;
[0009] The blockchain network topology diagram is used to characterize the first connection relationship between the nodes in the blockchain network; the bearer network topology diagram is used to characterize the second connection relationship between the nodes in the blockchain bearer network; the blockchain bearer network is a network composed of the network infrastructure supporting the blockchain system;
[0010] The blockchain network topology map is optimized by using the bearer network topology map to obtain a blockchain network extension topology map; wherein the blockchain network extension topology map is used to characterize the third connection relationship between each of the nodes;
[0011] All the nodes in the blockchain network extension topology diagram are clustered to obtain a plurality of clusters; a cluster head node of the cluster is determined from the nodes in the cluster whose scores are higher than a preset threshold; wherein the scores are obtained by evaluating the blockchain system information and blockchain bearer network information of the node; the blockchain system information includes: the number of blocks generated by the node; the blockchain bearer network information includes the network bandwidth of the node; wherein the number of blocks generated is the number of blocks generated by the node;
[0012] Each of the nodes is used as the current node respectively; a candidate logical neighbor node set of each of the current nodes is generated using the blockchain network extended topology graph; wherein the candidate logical neighbor node set includes a plurality of candidate logical neighbor nodes; the logical neighbor node refers to a node used by the current node in the blockchain network to propagate the block;
[0013] The cluster head node is used to perform message synchronization between the clusters; and the candidate logical neighbor nodes are used to perform message synchronization within the clusters.
[0014] In one embodiment, generating a bearer network topology diagram includes:
[0015] Acquire the second connection relationship and the blockchain bearer network information;
[0016] The bearer network topology map is constructed using the second connection relationship and the blockchain bearer network information.
[0017] In one embodiment, the blockchain network topology map is optimized by using the bearer network topology map to obtain a blockchain network extension topology map, including:
[0018] The nodes in the blockchain network topology map are matched one-to-one with the nodes in the bearer network topology map through the IP addresses of the nodes;
[0019] If the two nodes have the first connection relationship in the blockchain network topology diagram but do not have the second connection relationship in the bearer network topology diagram, the first connection relationship between the two nodes is used as the third connection relationship between the two nodes in the blockchain network extension topology diagram;
[0020] If the first connection relationship between the two nodes does not exist in the blockchain network topology diagram but the second connection relationship exists in the bearer network topology diagram, the second connection relationship between the two nodes is used as the third connection relationship between the two nodes in the blockchain network extension topology diagram;
[0021] If the first connection relationship exists between two nodes in the blockchain network topology diagram and the second connection relationship also exists in the bearer network topology diagram, the first connection relationship or the second connection relationship between the two nodes shall be used as the third connection relationship between the two nodes in the blockchain network extension topology diagram.
[0022] In one embodiment, the step of generating a set of candidate logical neighbor nodes of each current node using the blockchain network extended topology graph includes:
[0023] Generate a recommended neighbor node set of each current node using the blockchain network extended topology graph; wherein the recommended neighbor node set includes a plurality of recommended neighbor nodes; the recommended neighbor node is a node in the same cluster node set whose strength of the third connection relationship with the current node is not less than a preset strength threshold; the same cluster node set includes all the nodes belonging to the same cluster as the current node; the strength of the third connection relationship is determined based on the first connection relationship and the second connection relationship;
[0024] Taking the recommended neighbor node set as a candidate logical neighbor node set;
[0025] Alternatively, determining a set of candidate logical neighbor nodes of the current node from the set of nodes in the same cluster by using the weights corresponding to the current node and the recommended neighbor nodes;
[0026] Among them, the weight is obtained based on the communication delay of the blockchain link between the current node and the recommended neighbor node and / or the network delay of the network link between the current node and the recommended neighbor node; the blockchain link refers to the logical path for communication between the nodes in the blockchain network; the network link refers to the physical connection path for communication between different network infrastructures corresponding to each node.
[0027] In one embodiment, if the two nodes have the first connection relationship in the blockchain network topology graph but do not have the second connection relationship in the bearer network topology graph, the strength of the third connection relationship between the two nodes is low;
[0028] If the two nodes do not have the first connection relationship in the blockchain network topology diagram but have the second connection relationship in the bearer network topology diagram, the strength of the third connection relationship between the two nodes is medium;
[0029] If the first connection relationship exists between two nodes in the blockchain network topology diagram and the second connection relationship also exists in the bearer network topology diagram, the strength of the third connection relationship between the two nodes is high.
[0030] In one embodiment, if the two nodes have the first connection relationship in the blockchain network topology graph but do not have the second connection relationship in the bearer network topology graph, the expression of the weights corresponding to the two nodes is:
[0031]
[0032] Wherein, A is the communication delay between the two nodes; a is the first weight coefficient;
[0033] If the two nodes do not have the first connection relationship in the blockchain network topology graph but have the second connection relationship in the bearer network topology graph, the expression of the weights corresponding to the two nodes is:
[0034]
[0035] Wherein, B is the network delay between the two nodes; b is the second weight coefficient;
[0036] If the two nodes have the first connection relationship in the blockchain network topology graph and the second connection relationship in the bearer network topology graph, the expression of the weights corresponding to the two nodes is:
[0037]
[0038] Wherein, C is the average value of the communication delay and the network delay between the two nodes; and c is the third weight coefficient.
[0039] In one embodiment, the determining of a set of candidate logical neighbor nodes of the current node from the set of nodes in the same cluster by using the weights corresponding to the current node and the recommended neighbor nodes includes:
[0040] If the number of neighbor nodes actually required by the current node is less than or equal to the number of the recommended neighbor nodes in the recommended neighbor node set, then selecting a plurality of the recommended neighbor nodes with the largest corresponding weights from the recommended neighbor node set as the candidate logical neighbor nodes;
[0041] If the number of neighbor nodes actually required by the current node is greater than the number of recommended neighbor nodes in the recommended neighbor node set, in addition to taking all the recommended neighbor nodes in the recommended neighbor node set as the candidate logical neighbor nodes, the remaining required candidate logical neighbor nodes are determined from the same cluster node set.
[0042] In one embodiment, the recommended neighbor node set also includes one or more recommended random nodes; the recommended random nodes are nodes that have the same / similar status level as the current node and do not belong to the same cluster as the current node.
[0043] In one embodiment, the scoring expression is:
[0044] S = α × G + θ × B;
[0045] Wherein, α and θ are the first scoring coefficient and the second scoring coefficient respectively; G is the block generation number, and B is the network bandwidth of the node.
[0046] In one embodiment, the blockchain system information further includes: the online time of the node; the blockchain bearer network information further includes the CPU processing performance of the node and the memory of the node; wherein the scoring expression is:
[0047]
[0048] Wherein, G is the number of blocks generated, B is the network bandwidth of the node, and β, and λ are the third scoring coefficient, the fourth scoring coefficient and the fifth scoring coefficient respectively, U is the online time, C is the CPU processing performance, and M is the memory.
[0049] In one embodiment, the message synchronization between the clusters is performed before the message synchronization within the clusters; wherein the using the candidate logical neighbor nodes to perform message synchronization within the cluster includes:
[0050] The current node preferentially performs message synchronization within the cluster through the candidate logical neighbor nodes having the same status level as the current node; wherein the status levels of the nodes are determined based on the scores of the nodes respectively.
[0051] In one embodiment, the current node cannot perform message synchronization within the cluster through the candidate logical neighbor node with a higher status level than the current node.
[0052] In one embodiment, if the candidate logical neighbor node with a score lower than a preset score threshold generates a block, the status level of the candidate logical neighbor node is increased.
[0053] According to a second aspect, an embodiment provides a computer-readable storage medium, wherein the computer-readable storage medium includes a program, wherein the program can be executed by a processor to implement a method as described in any embodiment of the present invention.
[0054] The beneficial effects of this application are:
[0055] The blockchain data synchronization method of the present application includes: obtaining a blockchain network topology map and generating a bearer network topology map; optimizing the blockchain network topology map using the bearer network topology map to obtain a blockchain network extension topology map; clustering all nodes in the blockchain network extension topology map to obtain multiple clusters; determining a cluster head node of a cluster from nodes in the cluster whose scores are higher than a preset threshold; taking each node as a current node respectively; generating a candidate logical neighbor node set of each current node using the blockchain network extension topology map; performing message synchronization between clusters using the cluster head node; performing message synchronization within each cluster using the candidate logical neighbor node, wherein the score is obtained by evaluating the blockchain system information and blockchain bearer network information of the node; and finally achieving the improvement of the overall transmission rate of blocks in the blockchain network and the improvement of the throughput of the blockchain system. BRIEF DESCRIPTION OF THE DRAWINGS
[0056] Figure 1 A flowchart of a blockchain data synchronization method according to an embodiment of the present invention;
[0057] Figure 2 A schematic diagram of a blockchain network topology diagram of an embodiment;
[0058] Figure 3 A schematic diagram of a bearer network topology diagram of an embodiment;
[0059] Figure 4 A schematic diagram of a blockchain network expansion topology diagram according to an embodiment;
[0060] Figure 5 A schematic diagram of a process for generating a bearer network topology diagram according to an embodiment;
[0061] Figure 6 A flowchart of obtaining a blockchain network expansion topology diagram according to an embodiment;
[0062] Figure 7 A flowchart of an embodiment of generating a set of candidate logical neighbor nodes for each current node using a blockchain network extended topology graph;
[0063] Figure 8 A schematic diagram of candidate logical neighbor nodes of a current node in an embodiment;
[0064] Fig. 9 A schematic diagram of reducing data redundancy by using a specific message synchronization rule according to an embodiment;
[0065] Fig.10 A schematic diagram of blocks corresponding to an epoch according to an embodiment. DETAILED DESCRIPTION
[0066] The present invention is further described in detail below by specific embodiments in conjunction with the accompanying drawings. Wherein similar elements in different embodiments adopt associated similar element numbers. In the following embodiments, many detailed descriptions are for making the present application better understood. However, those skilled in the art can easily recognize that some features can be omitted in different situations, or can be replaced by other elements, materials, methods. In some cases, some operations related to the present application are not shown or described in the specification, this is to avoid the core part of the present application being overwhelmed by too much description, and for those skilled in the art, it is not necessary to describe these related operations in detail, and they can fully understand the related operations according to the description in the specification and the general technical knowledge in the art.
[0067] In addition, the features, operations or characteristics described in the specification can be combined in any appropriate manner to form various implementations. At the same time, the steps or actions in the method description can also be interchanged or adjusted in a manner that is obvious to those skilled in the art. Therefore, the various sequences in the specification and the drawings are only for the purpose of clearly describing a certain embodiment and are not meant to be a required sequence, unless otherwise specified that a certain sequence must be followed.
[0068] The serial numbers of the components in this document, such as "first", "second", etc., are only used to distinguish the objects described and do not have any order or technical meaning. The "connection" and "coupling" mentioned in this application, unless otherwise specified, include direct and indirect connections (couplings).
[0069] As mentioned above, the above-mentioned working mode of broadcasting the block to the whole network and putting it on the chain after most nodes have passed the verification does not closely integrate the blockchain system with its carrying network. It may increase the overall propagation time of the blockchain network due to the poor network status of some nodes, resulting in the problem of low throughput of the blockchain system. The network status of the above-mentioned nodes affects the speed of node verification and propagation of blocks. In order to improve the overall propagation time and node verification time of blocks in the blockchain network, it is necessary to optimize the block propagation and verification speed of each node. However, in the above-mentioned P2P network, there are differences in the processing power, storage capacity, storage space and network bandwidth of each node. The block propagation time and verification time of each node are closely related to its node capacity (i.e. the carrying network status). Therefore, it is very important to consider the network status of each node in the process of block propagation to ensure that nodes with good network status can contribute more effectively to the entire network. However, the neighbor node selection algorithm proposed by the existing research does not closely integrate the blockchain system with its carrying network, and even if the network status of the node is considered, it only locally adjusts the neighbor nodes and lacks a global perspective, and thus cannot guarantee that the network topology after each adjustment of the blockchain network will be better than the effect before the adjustment. Therefore, if we want to further improve the throughput of the blockchain system, we need to closely integrate the blockchain system with its carrier network, thereby improving the overall propagation efficiency of blocks in the blockchain network, and ultimately solving the performance problems faced by large-scale data synchronization in the blockchain system. There is no problem of coordinated regulation capability between the blockchain system and its carrier network.
[0070] The technical concept of the present application is to use the network topology of the blockchain system (i.e., the blockchain network topology below) and the bearer network topology of the bearer network of the blockchain system to form a composite topology with a unified representation (i.e., the blockchain network extended topology below); design a corresponding neighbor node selection strategy according to the blockchain network extended topology, that is, the SDN controller periodically performs meso-level recommendations (i.e., the process of determining the recommended neighbor node set below) to determine the neighbor nodes of the node, or further combines the micro-level self-determination of each node in each blockchain network (i.e., the process of determining the candidate logical neighbor node set below) on the basis of the above meso-level recommendations to independently select the neighbor nodes of the node, and finally provide a neighbor node set of each node in the blockchain network, and the synchronized neighbor set includes all neighbor nodes of the node; in short, it is to achieve global efficient broadcast through local optimization (for example, after receiving a message, a node in the blockchain network will randomly broadcast the message to its own neighbor nodes. If each node uses a node with a better network status as its own neighbor node, it can achieve efficient transmission of the entire network through local efficient transmission), improve the overall performance of the blockchain network, improve the overall transmission rate of blocks in the blockchain network, and improve the throughput of the blockchain system.
[0071] The technical solution of the present application will be described in detail below in conjunction with embodiments.
[0072] This application provides a blockchain data synchronization method. Please refer to Figure 1 , the blockchain data synchronization method includes:
[0073] Step S100: Obtain a blockchain network topology map and generate a bearer network topology map;
[0074] Among them, the blockchain network topology diagram is used to characterize the first connection relationship between each node in the blockchain network; the bearer network topology diagram is used to characterize the second connection relationship between each node in the blockchain bearer network; the blockchain bearer network is a network composed of network infrastructure supporting the blockchain system;
[0075] Step S200: Optimizing the blockchain network topology map using the bearer network topology map to obtain a blockchain network extension topology map; wherein the blockchain network extension topology map is used to characterize the third connection relationship between the nodes;
[0076] Step S300: clustering all nodes in the blockchain network extension topology diagram to obtain multiple clusters; determining the cluster head node of the cluster from the nodes in the cluster whose scores are higher than a preset threshold; wherein the score is obtained by evaluating the blockchain system information and blockchain bearer network information of the node; the blockchain system information includes: the block generation number of the node; the blockchain bearer network information includes the network bandwidth of the node; wherein the block generation number is the number of blocks generated by the node;
[0077] Step S400: taking each node as the current node respectively; generating a candidate logical neighbor node set of each current node using the blockchain network extended topology graph; the candidate logical neighbor node set includes a plurality of candidate logical neighbor nodes; the logical neighbor node refers to a node used by the current node in the blockchain network to propagate blocks;
[0078] Step S500: using the cluster head node to synchronize messages between clusters; using the candidate logical neighbor nodes to synchronize messages within each cluster.
[0079] It should be noted that in step S100, the blockchain network is a basic component of the blockchain system. The blockchain network refers to a distributed network composed of multiple nodes in the blockchain system, which are interconnected and jointly maintain and manage the data of the blockchain system. The above-mentioned blockchain system can be one of various existing blockchain systems. Since the above-mentioned blockchain system belongs to the common knowledge in the field, the specific composition of the above-mentioned blockchain system will not be described here.
[0080] It should be noted that, in step S100, the above-mentioned blockchain system can adopt Intelligent Eco Networking (IEN) as the system architecture framework.
[0081] In some embodiments, in the above step S100, obtaining the blockchain network topology diagram includes:
[0082] Collect the first connection relationship and blockchain system information of all nodes in the blockchain network;
[0083] A blockchain network topology diagram is constructed using the first connection relationship and blockchain system information.
[0084] In some embodiments, in the above step S100, a node deployed in the SDN controller may collect the first connection relationship and blockchain system information of all nodes in the blockchain network; or, all nodes in the blockchain network may actively submit the first connection relationship and blockchain system information of each node to the SDN controller.
[0085] In some embodiments, in the above step S100, the SDN controller can use the first connection relationship and the blockchain system information to construct a blockchain network topology map.
[0086] In some embodiments, the information collected by the node (such as the first connection relationship and blockchain system information) can be sent to the SDN controller by calling the RESTful API (RESTful API is an architecture style of an application program interface (API) that uses HTTP requests to access or use data), and the SDN controller reconstructs the topology map based on the relevant information to obtain the blockchain network topology map. Alternatively, each node can send a request to the SDN controller through the Http protocol (a transmission protocol used to transmit hypertext from a server to a local browser), and each node actively submits other nodes to which it is connected, and finally the SDN controller constructs the topology map to obtain the blockchain network topology map.
[0087] Among them, the SDN controller is an application in software-defined networking (SDN) that is responsible for traffic control to ensure an intelligent network. The SDN controller is based on protocols such as OpenFlow (a network communication protocol) that allow servers to tell switches where to send data packets.
[0088] In some embodiments, in the above step S100, other existing technologies can also be directly used to directly obtain the blockchain network topology map. The specific method of obtaining the blockchain network topology map is not limited here.
[0089] For some examples, please refer to Figure 2 , Figure 2 What is shown is the blockchain network topology diagram of the blockchain network; among them, A 链 , B 链 , C 链 , D 链 、E 链 、F 链 , G 链 , H 链 and I 链 Represents a node in the blockchain network. The solid or dotted lines in the blockchain network topology diagram (such as I 链 and D 链 The solid line between 链 and B 链 The dotted line between 链 and C 链 The dotted line between ) indicates that there is a first connection relationship between the corresponding node pairs.
[0090] For some examples, please refer to Figure 5 In step S100: generating a bearer network topology diagram, including:
[0091] Step S110: Obtain the second connection relationship and blockchain bearer network information;
[0092] Step S120: construct a bearer network topology map using the second connection relationship and the blockchain bearer network information.
[0093] In some embodiments, in the above step S100, the second connection relationship and blockchain bearer network information can be obtained through the SDN controller; the SDN controller then uses the second connection relationship and blockchain bearer network information to build a bearer network topology map. For example, the SDN controller can use the LLDP protocol (Link Layer Discovery Protocol, a data link layer protocol) to discover the devices (or nodes) in the bearer network and the second connection relationship and blockchain bearer network information between them, and then build a bearer network topology map based on the second connection relationship and blockchain bearer network information.
[0094] It should be noted that, in the case of the second connection relationship between each node and the blockchain bearer network information (such as only including the network delay between the node pairs with the second connection relationship), those skilled in the art can refer to the specific process of “SDN controller using the first connection relationship and blockchain system information to construct a blockchain network topology map” to construct the bearer network topology map, so the specific process of constructing the bearer network topology map will not be repeated here.
[0095] For some examples, please refer to Figure 3 , Figure 3 The figure shows the topology of the bearer network of the blockchain system; 网 , B 网 , C 网 , D 网 、E 网 、F 网 , G 网 , H 网 and I 网 They are the symbols for nodes in the blockchain network in the blockchain bearer network; the switches (such as SDN switches) in the bearer network topology diagram are network devices that support the OpenFlow protocol; the solid lines (such as I 网 and C 网 The solid line between them indicates the corresponding node pair (such as I 网 and C 网 ) There is a second connection relationship between the two. The network infrastructure in the blockchain bearer network includes the above-mentioned SDN switch.
[0096] It should be noted that in the above step S200, the third connection relationship includes both the above logical connection relationship between nodes and the physical connection relationship of the above network infrastructure. In other words, the third connection relationship more specifically refers to the potential logical connection relationship between nodes. The present application hopes that the nodes with the above physical connection relationship can also establish the above logical connection relationship and then transmit messages.
[0097] In the above step S200, the essence of "optimizing the blockchain network topology map using the bearer network topology map to obtain the blockchain network extension topology map" is to superimpose the state of each node in the bearer network topology map (such as the second connection relationship) onto the blockchain network topology map. The blockchain network topology map is an undirected authorized graph.
[0098] For some examples, please refer to Figure 6 In step S200: optimizing the blockchain network topology map using the bearer network topology map to obtain a blockchain network extension topology map, including:
[0099] Step S210: Use the IP address of the node (IP address is a unified address format provided by the IP protocol, which assigns a logical address to each network and each host on the Internet to shield the difference in physical addresses) to match the nodes in the blockchain network topology map with the nodes of the network topology map (please refer to Figure 2 and Figure 3 , such as node I 链 and node D 链 Respectively with node I 网 and node D 网 One-to-one correspondence);
[0100] Step S220: If two nodes have a first connection relationship in the blockchain network topology diagram but do not have a second connection relationship in the bearer network topology diagram, the first connection relationship between the two nodes is used as the third connection relationship between the two nodes in the blockchain network extension topology diagram;
[0101] If two nodes do not have a first connection relationship in the blockchain network topology diagram but have a second connection relationship in the bearer network topology diagram, the second connection relationship between the two nodes is used as the third connection relationship between the two nodes in the blockchain network extension topology diagram;
[0102] If two nodes have a first connection relationship in the blockchain network topology diagram and a second connection relationship in the bearer network topology diagram, the first connection relationship or the second connection relationship between the two nodes shall be used as the third connection relationship between the two nodes in the blockchain network extension topology diagram.
[0103] In some embodiments, the first connection relationship, the second connection relationship and the third connection relationship may be represented by solid lines, dotted lines, etc. according to actual needs. The existence of the first connection relationship, the second connection relationship or the third connection relationship between two nodes indicates that there is a connection between the two nodes.
[0104] It should be noted that the specific process of the above step S210 belongs to common knowledge or conventional means in the art, so it will not be described in detail here.
[0105] In some embodiments, the number of nodes in the blockchain network extension topology diagram is the same as the number of nodes in the blockchain network topology diagram. In other words, the nodes in the blockchain network extension topology diagram correspond one-to-one to the nodes in the blockchain network topology diagram.
[0106] The purpose of "clustering all nodes in the blockchain network extension topology map to obtain multiple clusters" in the above step S300 is: due to the large number of nodes in the blockchain network, the above clustering (i.e. clustering) is to cluster adjacent nodes into clusters, so that nodes in the same cluster are more likely to communicate directly (because the closer the adjacent nodes are, the faster the message propagation speed between the adjacent nodes will be), thereby reducing the amount of data transmission in the entire blockchain system network and improving network efficiency. "Clustering all nodes in the blockchain network extension topology map to obtain multiple clusters" can be regarded as dividing the blockchain network extension topology map into multiple network extension topology subgraphs, so that multiple clusters synchronize messages in parallel, etc., and the distance between each node in the cluster is shorter, so that synchronization information is obtained faster, reducing the synchronization delay of the blockchain. Among them, the above clusters are obtained by clustering using a clustering algorithm.
[0107] It should be noted that the process of "clustering all nodes in the blockchain network extension topology map to obtain multiple clusters" in step S300 above only utilizes the existing clustering algorithm. The clustering algorithm is used on the basis of the blockchain network extension topology map, and the blockchain network extension topology map has combined the blockchain system information and the bearer network information.
[0108] The purpose of "determining the cluster head node of the cluster" in the above step S300 is to facilitate communication between different clusters.
[0109] In some embodiments, a cluster head node may manage the nodes in the cluster.
[0110] In some embodiments, the "clustering all nodes in the blockchain network extension topology diagram to obtain multiple clusters" in the above step S300 can adopt existing clustering / clustering algorithms (such as K-means algorithm, etc.). The above clustering (i.e. clustering) is to gather nodes with similar distances in the blockchain network extension topology diagram together. Nodes in the same cluster as the current node are in-cluster nodes; nodes in different clusters from the current node are out-of-cluster nodes.
[0111] In some embodiments, in step S300, those skilled in the art may determine the preset threshold in "determining the cluster head node from the nodes in the cluster with scores higher than the preset threshold" according to actual needs. For example, the preset threshold may be 95% of the highest score in the cluster.
[0112] In some embodiments, in the above step S300, the node with the highest score in the cluster may be determined as the cluster head node of each cluster.
[0113] It should be noted that those skilled in the art can determine the cluster head node of each cluster according to actual needs (such as randomly selecting one from several nodes with the highest scores in the cluster, etc.), and the specific method of "determining the cluster head node of the cluster" is not limited here.
[0114] In some embodiments, in the above step S300, the score can be obtained by evaluating the blockchain system information and the blockchain-bearing network information through an existing node status evaluation algorithm (such as a weighted sum method after simple normalization).
[0115] In some embodiments, when the number of blocks corresponding to the current epoch of the blockchain system is equal to the average number of blocks corresponding to the historical epochs, the blockchain network extended topology diagram is used to generate a set of candidate logical neighbor nodes for each current node. The above historical epoch refers to a preset number of epochs before the current epoch. Those skilled in the art can determine the number of epochs included in the above historical epochs.
[0116] In some embodiments, in the above step S400, when the number of blocks corresponding to the current epoch of the monitored blockchain system changes (for example, becomes larger), a set of candidate logical neighbor nodes of each current node is generated using the blockchain network extended topology graph.
[0117] The above epoch represents the time from when the main chain of the blockchain system completes the generation of the previous block to when the generation of the new block is completed. Please refer to Fig.10 , Fig.10 Epoch represents an era; X represents the first block in the blockchain (i.e., the genesis block); A, B, C, D, E, F, G, H, I, J, and K all represent blocks; Fig.10The solid arrows in the middle represent the parent edge, and the dotted arrows represent the reference edge; Epochs are divided according to the blocks on the pivot chain, i.e. the main chain. Each block in the pivot chain corresponds to an Epoch, and the pivot block is the last block in each Epoch. The parent edge, reference edge, and pivot chain (i.e. the main chain) together can split all blocks in the directed acyclic graph, i.e. DAG (a distributed ledger technology different from the mainstream blockchain that can upgrade synchronous accounting to asynchronous accounting) into Epochs. Each block in the pivot chain corresponds to an Epoch. In addition to the blocks on the pivot chain, each Epoch also contains the following blocks: 1) blocks that can be reached from the corresponding blocks in the pivot chain through the combination of parent edges and reference edges; and 2) blocks that are not included in the previous Epoch. Among them, "1) blocks that can be reached from the corresponding blocks in the pivot chain through the combination of parent edges and reference edges; and 2) blocks that are not included in the previous Epoch" here can be understood as blocks generated from the interval between two blocks on the pivot chain, i.e. the main chain. For example, please refer to Fig.10 , block J belongs to the epoch of block H, because block J can be reached from block H, but not from the previous pivot block E. Epoch can represent the time from the pivot link (main chain) in the tree graph blockchain to the completion of the generation of the previous block to the completion of the generation of the new block. The number of blocks corresponding to the epoch, that is, the number of blocks contained in each Epoch. For example, there are three blocks in the epoch corresponding to E, and there are four blocks in the epoch corresponding to H, that is, the number of blocks corresponding to the current epoch H becomes larger. For another example, E and H are blocks on the main chain, but when block E is generated, blocks D and F will be generated, and when block H is generated, blocks G, I, and J will be generated. At this time, the number of blocks corresponding to the current epoch H becomes larger. In short, Epoch is a time period (such as the time from the hub link E block to the H block), which corresponds to a certain number of blocks, and three blocks G, J, and I are also generated during this period). If an Epoch is too large, it may be caused by the block in the Epoch being too large. A block that is too large is easily affected by various interferences and congestion in the network, resulting in an increase in packet loss rate. The number of blocks corresponding to the above epoch can be used as a blockchain system semaphore indicator. The blockchain system semaphore indicator is used to determine whether the blockchain network topology needs to be optimized.
[0118] In some embodiments, the fork rate can also be used as the blockchain system signal indicator. The fork rate refers to the fact that different miners or nodes have different blocks at the same time in the blockchain network, resulting in a fork in the blockchain. The higher the fork rate, the greater the inconsistency in the blockchain network, which will also affect the security and stability of the blockchain.
[0119] For some examples, please refer to Figure 7In step S400: using the blockchain network extended topology graph to generate a set of candidate logical neighbor nodes for each current node, including:
[0120] Step S410: Generate a recommended neighbor node set of each current node using the blockchain network extension topology graph; wherein the recommended neighbor node set includes a plurality of recommended neighbor nodes; the recommended neighbor node is a node in the same cluster node set whose third connection strength with the current node is not less than a preset strength threshold; the same cluster node set includes all nodes belonging to the same cluster as the current node; the strength of the third connection relationship is determined based on the first connection relationship and the second connection relationship;
[0121] Step S420: taking the recommended neighbor node set as a candidate logical neighbor node set; or, determining a candidate logical neighbor node set of the current node from the same cluster node set using the weights corresponding to the current node and the recommended neighbor nodes.
[0122] In some embodiments, in the above step S410, the SDN controller may periodically recommend neighbor nodes of each node at the meso level (i.e., the control plane) (i.e., the process of generating a set of recommended neighbor nodes for each current node). For example, in selecting the recommended neighbor nodes, nodes having a high or medium strength of the third connection relationship with the current node may be preferentially recommended based on the connection relationship between the nodes.
[0123] In some embodiments, in the above step S410, when the recommended neighbor node set includes recommended random nodes, the SDN controller can recommend nodes with the same or similar scores as each current node in other clusters of the current node based on the node scores, and use them as recommended random nodes in the recommended neighbor node set.
[0124] It should be noted that "periodically recommending" here means that the recommendation is made only when the number of blocks corresponding to the above epoch becomes larger (i.e., meso-level recommendation). "Other clusters" here refer to nodes that are not in the same cluster as the current node.
[0125] In some embodiments, in the above step S410, those skilled in the art may determine the preset intensity threshold according to actual needs. For example, the preset intensity threshold may be the above medium intensity.
[0126] In some embodiments, candidate logical neighbor nodes for each node in the blockchain system may be provided directly by "using the recommended neighbor node set as a candidate logical neighbor node set" in the above step S420.
[0127] In some embodiments, the candidate logical neighbor nodes can be determined by coordinating the meso-level with the micro-level (i.e., "using the weights corresponding to the current node and the recommended neighbor nodes to determine the candidate logical neighbor node set of the current node from the same cluster node set" in step S420). The SDN controller can perform periodic neighbor node recommendations at the meso-level (i.e., the process of determining the recommended neighbor node set), and then each blockchain node performs real-time micro-self-selection to determine the candidate logical neighbor node set of the current node from the same cluster node set, and then the current node establishes a connection with the candidate logical neighbor node in the candidate logical neighbor node set. By combining the meso-level with the micro-level, candidate logical neighbor nodes are provided for each node of the blockchain system, and global efficient broadcast is achieved through local optimization, thereby improving the overall network performance.
[0128] In some embodiments, the candidate logical neighbor node may be directly used as the actual neighbor node, that is, the current node may directly use the candidate logical neighbor node to propagate messages / transmit blocks.
[0129] In some embodiments, each node may perform real-time micro self-selection of its own neighbor nodes after each round of block broadcasting (i.e., the process of determining the set of candidate logical neighbor nodes of the current node in step S420).
[0130] In some embodiments, step S410: the recommended neighbor node set also includes one or more recommended random nodes; the recommended random nodes are nodes that have the same / similar status level as the current node and do not belong to the same cluster as the current node.
[0131] In some embodiments, the number of recommended random nodes in the recommended neighbor node set is less than the number of recommended neighbor nodes. For example, in the recommended neighbor node set, the ratio of the number of recommended random nodes to the number of recommended neighbor nodes may be 1:3.
[0132] It should be noted that if only the neighbor node selection strategy is adopted (that is, the recommended neighbor node set only includes recommended neighbor nodes), the neighbor nodes of each node can be easily predicted by malicious nodes, resulting in Eclipse attacks. Therefore, in some of the above embodiments, a random plus neighbor node selection strategy is adopted (that is, the recommended neighbor node set includes recommended neighbor nodes and recommended random nodes). In addition to the recommended neighbor nodes, the neighbor nodes of each node also include a part of nodes from outside the cluster (that is, recommended random nodes), thereby ensuring the security of the blockchain system.
[0133] It should be noted that the reason for "recommending nodes with the same or similar scores as each current node in other clusters of the current node" is that the newly generated blocks of the nodes of the blockchain network need to be quickly synchronized to most nodes in the entire network. If the recommended random node of the node is a node with a poor state level, then the synchronization message of the node to the node with a poor state level will cause a long delay; and the technical idea of the present application is to make the global optimization of the synchronization message by making the local optimality of the current node (that is, determining the neighboring node actually selected by the current node). Therefore, in other clusters of the current node, nodes with a score or state level lower than the current node cannot be used as the recommended random nodes of the current node. And nodes with a score or state level higher than the current node cannot be used as the recommended random nodes of the current node. Among them, the reason for "nodes with a score or state level higher than the current node cannot be used as the recommended random nodes of the current node" is that if a node with a score or state level higher than the current node is used as the recommended random node of the current node, data redundancy will be generated when the current node broadcasts / synchronizes messages through the node with a score or state level higher than the current node. In addition, if a node with a higher score or status level than the current node is used as a recommended random node for the current node, it will conflict with the message synchronization rules specified below (such as nodes with a low score or status level cannot forward to nodes with a high score or status level). Therefore, a node with a higher score or status level than the current node cannot be used as a recommended random node for the current node.
[0134] In some embodiments, in the above step S410, if two nodes have a first connection relationship in the blockchain network topology diagram but do not have a second connection relationship in the bearer network topology diagram, the two nodes (please refer to Figure 2 and Figure 3 Node I and node D in, node I 链 and node D 链 There is a first connection relationship between nodes I 网 and node D 网 The strength of the third connection relationship between the two nodes is low; if the two nodes do not have a first connection relationship in the blockchain network topology diagram but have a second connection relationship in the bearer network topology diagram, the two nodes (please refer to Figure 2 and Figure 3 Node I and Node C in the 链 and node C 链 There is no first connection relationship between them, and node I 网 and node C 网 The strength of the third connection relationship between two nodes is medium; if two nodes have a first connection relationship in the blockchain network topology diagram and a second connection relationship in the bearer network topology diagram, the two nodes (please refer to Figure 2 and Figure 3 The strength of the third connection relationship between the nodes I, node B and node C, such as the node pair of node I and node B, and the node pair of node I and node C, is high.
[0135] In some embodiments, in the above step S420, if the two nodes have the first connection relationship in the blockchain network topology graph but do not have the second connection relationship in the bearer network topology graph, the expression of the weights corresponding to the two nodes is:
[0136]
[0137] Wherein, A is the communication delay between the two nodes; a is the first weight coefficient;
[0138] If the two nodes do not have the first connection relationship in the blockchain network topology graph but have the second connection relationship in the bearer network topology graph, the expression of the weights corresponding to the two nodes is:
[0139]
[0140] Wherein, B is the network delay between the two nodes; b is the second weight coefficient;
[0141] If the two nodes have the first connection relationship in the blockchain network topology graph and the second connection relationship in the bearer network topology graph, the expression of the weights corresponding to the two nodes is:
[0142]
[0143] Wherein, C is the average value of the communication delay and the network delay between the two nodes, that is, C=(A+B) / 2; and c is the third weight coefficient.
[0144] It should be noted that the above communication delay refers to the total time delay experienced by data during the transmission process from the sender to the receiver. Among them, the above communication delay includes the transmission delay in the network and the processing delay of data at the sending and receiving ends. The above network delay is a component of communication delay, which refers to the time delay experienced when data is transmitted in a computer network. Blockchain link refers to the logical path for communication between nodes in the blockchain network; network link refers to the physical connection path for communication between different network infrastructures corresponding to each node in the blockchain system.
[0145] In some embodiments, the distance between two nodes having a first connection relationship in the blockchain network topology graph is proportional to the communication delay between the two nodes.
[0146] In some embodiments, the distance between two nodes having a second connection relationship in the bearer network topology graph is proportional to the network delay between the two nodes.
[0147] In some embodiments, in the above step S420, those skilled in the art may determine the specific values of the first weight coefficient a, the second weight coefficient b, and the third weight coefficient c according to actual needs. For example, the first weight coefficient a may be 1, the second weight coefficient b may be 0.1, and the third weight coefficient c may be 0.01. Figure 4 , A in the blockchain network expansion topology diagram 融 , B 融 , C 融 , D 融 、E 融 、F 融 , G 融 , H 融 and I 融 are the symbols representing the nodes in the blockchain network in the blockchain network extension topology diagram; 融 Respectively with A 链 and A 网 One-to-one correspondence, I 融 Respectively with I 链 and I 网 One to one correspondence, and so on.
[0148] In some embodiments, in the above step S420, determining a set of candidate logical neighbor nodes of the current node from a set of nodes in the same cluster using weights corresponding to the current node and the recommended neighbor nodes includes:
[0149] If the number of neighbor nodes actually required by the current node is less than or equal to the number of recommended neighbor nodes in the recommended neighbor node set, multiple recommended neighbor nodes with the largest corresponding weights are selected from the recommended neighbor node set as candidate logical neighbor nodes;
[0150] If the number of neighbor nodes actually required by the current node is greater than the number of recommended neighbor nodes in the recommended neighbor node set, in addition to taking all recommended neighbor nodes in the recommended neighbor node set as candidate logical neighbor nodes, the remaining required candidate logical neighbor nodes are determined from the same cluster node set.
[0151] It should be noted that the determination of the "number of neighbor nodes actually required by the current node" belongs to the prior art in this field. For example, the "number of neighbor nodes actually required by the current node" can be obtained through the conclusion of the existing paper "A Theoretical Model for Block Propagation Analysis in Bitcoin Network", which points out that the optimal number of neighbor nodes actually required by the current node is 32, and this conclusion is obtained through simulation experiments on a simulation platform. In some embodiments, the "number of neighbor nodes actually required by the current node" can also be a number preset by people in this field, such as 8.
[0152] For some examples, please refer to Figure 8 , nodes B, C and D are nodes of the same status level as the current node A, and are in different clusters from the current node A. Nodes E, F, G and H are nodes with high strength of the third connection relationship with the current node A, nodes a, b, c and d are nodes with medium strength of the third connection relationship with the current node A, and the remaining other nodes (such as i) are nodes with low strength of the third connection relationship with the current node A. In the selection of recommended neighbor nodes, the SDN controller recommends the above eight nodes E, F, G, H, a, b, c and d to the current node A, that is, these eight nodes are used as recommended neighbor nodes. If the number of neighbor nodes required by the current node A (e.g., 6 neighbor nodes are required) is less than 8, then the 6 recommended neighbor nodes with the largest corresponding weights are selected from the recommended neighbor node set as candidate logical neighbor nodes; if the number of neighbor nodes required by the current node A (e.g., 10 neighbor nodes are required) is greater than 8, then in addition to using all the recommended neighbor nodes in the recommended neighbor node set as candidate logical neighbor nodes, the remaining 2 candidate logical neighbor nodes can be determined from the same cluster node set according to the existing method of establishing connections with other nodes in the blockchain network. Among them, the existing method of establishing connections with other nodes is: when a node (such as the current node) establishes a connection with an adjacent node, it will ask the adjacent node for a list of IP addresses of nodes known to the adjacent node. When the current node obtains the above IP address list, the current node can actively establish connections with these nodes known to the adjacent node.
[0153] In some embodiments, in the above step S420, when the recommended neighbor node set also includes recommended random nodes, each node randomly selects a corresponding number of recommended random nodes from the recommended random nodes in the recommended neighbor node set (for example, when the ratio of the number of recommended random nodes to the number of recommended neighbor nodes is known, the corresponding number can be determined) as candidate logical neighbor nodes in the candidate logical neighbor node set. For example, if the recommended neighbor node set also includes recommended random nodes, the SDN controller can select a corresponding number of nodes from nodes B, C, and D that have the same / similar scores as the current node A and do not belong to the same cluster as the current node A as the recommended random nodes.
[0154] In some embodiments, the blockchain system information includes: the block generation number of the node; the blockchain bearer network information includes the network bandwidth of the node; wherein the block generation number is the number of blocks generated by the node; the scoring expression is:
[0155] S = α × G + θ × B;
[0156] Among them, α and θ are the first scoring coefficient and the second scoring coefficient respectively; G is the number of blocks generated, and B is the network bandwidth of the node.
[0157] In some embodiments, the blockchain system information includes: the number of blocks generated by the node, the online time of the node; the blockchain bearer network information includes the network bandwidth of the node, the CPU (central processing unit) processing performance of the node and the memory of the node; wherein the scoring expression is:
[0158]
[0159] Among them, β, and λ are the third, fourth and fifth scoring coefficients respectively, U is the online time, C is the CPU processing performance, and M is the above-mentioned memory.
[0160] In some embodiments, the above-mentioned scoring expression can be combined with other information (such as connectivity, latency, etc.) for comprehensive evaluation based on the blockchain system information of the node and the blockchain carrying network information. Among them, the above-mentioned "connectivity" refers to the number of nodes connected to the current node; "connectivity" is collected in the blockchain network; the above-mentioned "latency" is the above-mentioned network latency. Those skilled in the art can determine the specific form of the scoring expression at this time according to actual needs, and the specific form of the scoring expression is not specifically limited here.
[0161] Since blockchain systems generally use the Gossip protocol (a protocol for information exchange between nodes or processes based on the way epidemics spread), a common problem with the Gossip protocol is data redundancy. The working principle of the above Gossip protocol is that when a node has new data that needs to be distributed to other nodes in the network, it will first randomly select several nodes connected to itself to send the message out; then other nodes that receive the message will update the message locally, and then continue to distribute the message to several random neighboring nodes in the same way as the previous node, and keep distributing it in this way. Eventually, all nodes in the network will receive the message. Since the message distribution of the Gossip protocol reaches all nodes in the entire network through a continuous and repeated distribution process, and is random, the message delay of some nodes will be relatively high. The repeated propagation of the above Gossip protocol will also cause a large amount of message redundancy. Therefore, in some embodiments, in the Gossip protocol (i.e., the priority Gossip broadcast operation) after the set of candidate logical neighbor nodes is determined, the actual broadcast object (i.e., the actual neighbor node) is selected according to the status level of the candidate logical neighbor node, and each node (such as the current node) preferentially broadcasts to the candidate logical neighbor nodes with the same status level, and the candidate logical neighbor nodes with a low status level cannot broadcast to the candidate logical neighbor nodes with a high status level. In turn, by optimizing or optimizing the local blockchain network, the global blockchain network can be efficiently broadcasted, thereby improving the overall performance of the blockchain system, thereby avoiding data redundancy in nodes with high status levels (i.e., reducing data redundancy generated by broadcast protocols (such as the Gossip protocol)).
[0162] In some embodiments, in the above-mentioned priority Gossip broadcast operation, it can also be set that the candidate logical neighbor nodes with low scores cannot propagate blocks to the candidate logical neighbor nodes with high scores according to the scores of the candidate logical neighbor nodes; the current node can only propagate messages to the candidate logical neighbor nodes with the same or lower status levels, thereby reducing the partial redundancy of the candidate logical neighbor nodes with high scores (i.e., avoiding the data redundancy caused by the low-scoring candidate logical neighbor nodes propagating to the high-scoring candidate logical neighbor nodes); if the block is generated by a candidate logical neighbor node with a score lower than a preset score threshold, the level of the low-scoring candidate logical neighbor node is increased to avoid the high-scoring candidate logical neighbor node not being able to receive the block.
[0163] It should be noted that the cluster division is completed before the block is generated, and the cluster head node is also determined before the block is generated. In other words, the cluster division and the determination of the cluster head node are completed before the message synchronization. If a node generates a block (and the node is not a cluster head node), then: (1) the node needs to determine whether its neighboring nodes include the cluster head node; if not, the node needs to establish a connection with the cluster head node, and synchronize messages to the cluster head node first. While synchronizing to the cluster head node, it also synchronizes messages within the cluster; (2) the cluster head node then synchronizes messages with the cluster head nodes of other clusters. Among them, the neighboring nodes of the cluster head node include not only the cluster head nodes of other clusters, but also the nodes in the same cluster as the cluster head node (i.e., nodes within the cluster), so it is possible to synchronize messages within the cluster through the cluster head node.
[0164] In order to facilitate understanding of the role of determining the above-mentioned "candidate logical neighbor nodes" and "actual neighbor nodes", the following explanation is given: Assuming that the central government has a document issued, the document will first be issued to the governors of each province, and the governors will then issue it downwards. Each cluster is similar to each province, and the cluster head node is similar to the governor. The provinces and governors have been divided before the document is issued. If a new event occurs in the province (similar to a node generating a block), it needs to be made known to the whole country (similar to block synchronization), then this event needs to be notified to the governor first, and at the same time as the governor is notified, the vicinity of the new event will also receive a corresponding report; after receiving the new event, the governor will synchronize it with the governors of other provinces, and the governors of other provinces will then issue it within the province. Assuming that the above-mentioned issuance process is governor-mayor-county governor-villagers, etc., this is analogous to the different status levels of the above-mentioned nodes. If the mayor issues the document to the county governor, because the county governor is dismissed or demoted for some reason, then a new county governor needs to be found. The role of selecting neighbor nodes of the current node (eg, determining the above-mentioned "candidate logical neighbor nodes" and "actual neighbor nodes") is equivalent to finding a new county head.
[0165] In some embodiments, in the above step S500, message synchronization between clusters precedes message synchronization within each cluster; wherein, message synchronization within the cluster is performed using candidate logical neighbor nodes, including: the current node preferentially performs message synchronization within the cluster through candidate logical neighbor nodes with the same status level as the current node; wherein the status level of the node is determined based on the score of the node respectively.
[0166] In some embodiments, when the score of each node has been obtained, each node can be graded according to the score of each node. The specific method of grading is not limited here, and those skilled in the art can perform the above grading according to actual needs, for example, they can determine the specific range of the score of high / medium / low status level by themselves.
[0167] In some embodiments, the current node cannot perform message synchronization within the cluster through candidate logical neighbor nodes with a higher status level than the current node.
[0168] It should be noted that the specific implementation process of "using the cluster head node to synchronize messages between the clusters" in the above step S500 belongs to the prior art in the art, so it will not be described in detail here.
[0169] It should be noted that the “cluster head node” in the above step S500 may be the same node as the “candidate logical neighbor node”.
[0170] It should be noted that the cluster head node can perform message synchronization between clusters through cluster head nodes with a higher status level than the cluster head node.
[0171] It can be seen that in some embodiments, after the status level of each node is obtained according to the score of each node, a specific message synchronization rule is formulated, that is, a candidate logical neighbor node with a low status level cannot transmit blocks to a candidate logical neighbor node with a high status level, that is, a node (such as the current node) can only transmit blocks to a candidate logical neighbor node with the same status level or a candidate logical neighbor node with a lower status level, so as to avoid data redundancy caused by the transmission of data from a node with a lower status level to a node with a higher status level.
[0172] In some embodiments, if a candidate logical neighbor node with a score lower than a preset score threshold generates a block, the state level of the candidate logical neighbor node is increased. Those skilled in the art can determine the preset score threshold according to actual needs.
[0173] In some embodiments, if a node with a low status level generates a block, the status level of the node with a low status level can be increased (for example, by a distributed rule unit) (for example, to the highest status level), so that the block generated by the node still transmits messages according to the above-mentioned specific message synchronization rules, thereby preventing nodes with high scores or high status levels from not receiving blocks generated by nodes with low status levels.
[0174] It should be noted that in the blockchain network, the blocks generated by each node need to be broadcast to the entire network. Although this application takes into account the number of blocks generated by each node when scoring each node, and nodes with high scores are more likely to generate blocks, low-scoring nodes still have a certain possibility of generating blocks; if a node with a low status level generates a block, the status level of the node is not improved. According to the above-mentioned specific message synchronization rules, the node with a low status level can only broadcast to nodes with the same or lower status level, then the node with a high status level cannot receive the block generated by the node with a low status level, and all nodes in the blockchain network cannot receive the new block. In other words, there are certain loopholes in the above-mentioned specific message synchronization rules. Therefore, if a node with a low status level generates a block, the status level of the node with a low status level is improved, so that the block generated by the node still transmits messages according to the above-mentioned specific message synchronization rules, and finally all nodes in the blockchain network receive new blocks. The reason for "raising the status level of the node with a low status level" here is to make up for the loopholes in the above-mentioned specific message synchronization rules, that is, to avoid the situation where the node with a low status level generates a block and the node with a high status level cannot receive the block generated by the node with a low status level.
[0175] It should be noted that the cluster head node may perform message synchronization between the clusters through the cluster head node of a higher status level than the cluster head node.
[0176] For some examples, please refer to Fig. 9 ,Should Fig. 9 The different sizes of the circles where the nodes are located represent the different status levels of the nodes. For example, the larger the circle where the node is located, the higher the status level of the node. Since the Gossip protocol randomly selects nodes to send, it is possible that a node will receive the same message multiple times, which will cause data redundancy. For example, node g and node e receive blocks transmitted by node a respectively. According to the Gossip protocol, node g randomly selects nodes to send after receiving the block. It may select node e to send, but node e has already received the block sent by node a, so node e is redundant. After setting the above-mentioned specific message synchronization rules, node g cannot send blocks to node e, thereby avoiding data redundancy caused by node g sending blocks to node e, that is, reducing the data redundancy generated by broadcast protocols (such as Gossip protocols). If node h with a low status level generates a new block, according to the above-mentioned specific message synchronization rules, node h cannot forward messages (such as blocks) to nodes with two status levels of nodes d and b. In order to avoid this situation, when the SDN controller finds that node h with a low status level generates a block, it raises node h to the highest status level.
[0177] It can be seen that in some embodiments, the blockchain data synchronization method of the present application uses the bearer network topology map to optimize the blockchain network topology map to obtain a blockchain network extension topology map, while the traditional method used by the existing blockchain data synchronization method mainly relies on blockchain system information for clustering and neighbor node selection, but does not use the blockchain bearer network information and the bearer network topology map obtained based on the blockchain bearer network information to select neighbor nodes.
[0178] It can be seen that in some embodiments, the neighbor nodes of each node are periodically recommended through the above-mentioned meso-level (such as the process of generating a recommended neighbor node set of each current node) for global planning, and the recommended neighbor node set is directly used as a candidate logical neighbor node set, and then the current node uses the candidate logical neighbor nodes in the candidate logical neighbor node set to transmit blocks, etc., to improve the overall transmission rate of blocks in the blockchain network and improve the throughput of the blockchain system. However, the traditional blockchain data synchronization method only performs local selection and lacks a global perspective.
[0179] It can be seen that in some embodiments, different coarse and fine granularities (i.e., the above-mentioned meso-level and micro-level) are taken into account in the selection of neighbor nodes. That is, the neighbor nodes of each node are periodically recommended at the above-mentioned meso-level (such as the process of generating a recommended neighbor node set for each current node) for global planning, and the flexible selection ability of local nodes is guaranteed (such as determining a candidate logical neighbor node set from the recommended neighbor node set), and then the current node uses the candidate logical neighbor nodes in the candidate logical neighbor node set to transmit blocks, etc., and finally improves the overall transmission rate of blocks in the blockchain network and improves the throughput of the blockchain system. However, the traditional blockchain data synchronization method only performs local selection and lacks a global perspective.
[0180] It can be seen that in some embodiments, each node is scored by using the blockchain of each node to carry network information (such as network delay) and the corresponding status level is determined based on the score, and it is stipulated that the current node cannot synchronize messages within the cluster through the candidate logical neighbor node with a higher status level than the current node, thereby avoiding the frequency of repeated transmission to nodes with good network status, thereby reducing unnecessary bandwidth occupation of nodes with good network status and avoiding extreme network congestion.
[0181] The above is some description of a blockchain data synchronization method. In some embodiments of the present application, a computer-readable storage medium is also disclosed, including a program, which can be executed by a processor to implement a method as in any embodiment of the present application.
[0182] This document is described with reference to various exemplary embodiments. However, those skilled in the art will recognize that changes and modifications may be made to the exemplary embodiments without departing from the scope of this document. For example, various operating steps and components for performing the operating steps may be implemented in different ways (e.g., one or more steps may be deleted, modified, or incorporated into other steps) depending on the specific application or considering any number of cost functions associated with the operation of the system.
[0183] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. In addition, as understood by those skilled in the art, the principles of this article can be reflected in a computer program product on a computer-readable storage medium, which is pre-installed with a computer-readable program code. Any tangible, non-temporary computer-readable storage medium can be used, including magnetic storage devices (hard disks, floppy disks, etc.), optical storage devices (CD (compact laser disk) to ROM, DVD read-only memory), Blu Ray disk (Blu-ray disc) etc.), flash memory and / or the like. These computer program instructions can be loaded onto a general-purpose computer, a special-purpose computer or other programmable data processing device to form a machine, so that these instructions executed on a computer or other programmable data processing device can generate a device that implements a specified function. These computer program instructions can also be stored in a computer-readable memory, which can instruct a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory can form a manufactured product, including an implementation device that implements a specified function. Computer program instructions may also be loaded onto a computer or other programmable data processing device so that a series of operational steps are performed on the computer or other programmable device to produce a computer-implemented process, so that the instructions executed on the computer or other programmable device may provide steps for implementing specified functions.
[0184] Although the principles of this invention have been shown in various embodiments, many modifications of structures, arrangements, proportions, elements, materials and components particularly suitable for specific environments and operational requirements can be used without departing from the principles and scope of this invention. The above modifications and other changes or amendments will be included in the scope of this invention.
[0185] The foregoing specific description has been described with reference to various embodiments. However, those skilled in the art will recognize that various modifications and changes can be made without departing from the scope of the present disclosure. Therefore, the consideration of the present disclosure will be illustrative rather than restrictive, and all these modifications will be included in its scope. Similarly, the advantages, other advantages and solutions to the problems of various embodiments have been described above. However, the benefits, advantages, solutions to the problems and any elements that can produce these, or make them more clear, should not be interpreted as critical, necessary or necessary. The term "include" and any other variants used in this article are all non-exclusive inclusions, so that the process, method, article or device including the list of elements not only includes these elements, but also includes other elements that are not explicitly listed or do not belong to the process, method, system, article or device. In addition, the term "coupled" and any other variants used in this article refer to physical connections, electrical connections, magnetic connections, optical connections, communication connections, functional connections and / or any other connections.
[0186] Those skilled in the art will appreciate that many changes may be made to the details of the above-described embodiments without departing from the basic principles of the invention. Therefore, the scope of the present invention should be determined solely by the claims.
Claims
1. A blockchain data synchronization method, characterized in that: include: Obtain the blockchain network topology map and generate the bearer network topology map; The blockchain network topology diagram is used to characterize the first connection relationship between the nodes in the blockchain network, and the first connection relationship represents the logical connection relationship for message transmission between the nodes; the bearer network topology diagram is used to characterize the second connection relationship of each of the nodes in the blockchain bearer network; the blockchain bearer network is a network composed of network infrastructure supporting the blockchain system, and the second connection relationship represents the physical connection relationship between the network infrastructure corresponding to the nodes; The blockchain network topology map is optimized by using the bearer network topology map to obtain a blockchain network extension topology map; wherein the blockchain network extension topology map is used to characterize the third connection relationship between each of the nodes, and the third connection relationship includes the above-mentioned logical connection relationship and the above-mentioned physical connection relationship; All the nodes in the blockchain network extension topology diagram are clustered to obtain a plurality of clusters; a cluster head node of the cluster is determined from the nodes in the cluster whose scores are higher than a preset threshold; wherein the scores are obtained by evaluating the blockchain system information and blockchain bearer network information of the node; the blockchain system information includes: the number of blocks generated by the node; the blockchain bearer network information includes the network bandwidth of the node; wherein the number of blocks generated is the number of blocks generated by the node; Each of the nodes is used as the current node respectively; a candidate logical neighbor node set of each of the current nodes is generated using the blockchain network extended topology graph; wherein the candidate logical neighbor node set includes a plurality of candidate logical neighbor nodes; the logical neighbor node refers to a node used by the current node in the blockchain network to propagate the block; Using the cluster head node to synchronize messages between the clusters; using the candidate logical neighbor nodes to synchronize messages within the clusters; Wherein, the generating of a set of candidate logical neighbor nodes of each current node by using the blockchain network extended topology graph includes: Generate a recommended neighbor node set of each current node using the blockchain network extended topology graph; wherein the recommended neighbor node set includes a plurality of recommended neighbor nodes; the recommended neighbor node is a node in the same cluster node set whose strength of the third connection relationship with the current node is not less than a preset strength threshold; the same cluster node set includes all the nodes belonging to the same cluster as the current node; the strength of the third connection relationship is determined based on the first connection relationship and the second connection relationship; The recommended neighbor node set is used as a candidate logical neighbor node set; or, the candidate logical neighbor node set of the current node is determined from the same cluster node set using the weights corresponding to the current node and the recommended neighbor nodes; wherein the weights are obtained based on the communication delay of the blockchain link between the current node and the recommended neighbor nodes and / or the network delay of the network link between the current node and the recommended neighbor nodes; the blockchain link refers to the logical path for communication between the nodes in the blockchain system; the network link refers to the physical connection path for communication between different network infrastructures corresponding to the nodes.
2. The method according to claim 1, characterized in that The generating of the bearer network topology diagram includes: Acquire the second connection relationship and the blockchain bearer network information; The bearer network topology map is constructed using the second connection relationship and the blockchain bearer network information.
3. The method according to claim 1, characterized in that The method of optimizing the blockchain network topology map by using the bearer network topology map to obtain a blockchain network extension topology map includes: The nodes in the blockchain network topology map are matched one-to-one with the nodes in the bearer network topology map through the IP addresses of the nodes; If the two nodes have the first connection relationship in the blockchain network topology diagram but do not have the second connection relationship in the bearer network topology diagram, the first connection relationship between the two nodes is used as the third connection relationship between the two nodes in the blockchain network extension topology diagram; If the first connection relationship between the two nodes does not exist in the blockchain network topology diagram but the second connection relationship exists in the bearer network topology diagram, the second connection relationship between the two nodes is used as the third connection relationship between the two nodes in the blockchain network extension topology diagram; If the first connection relationship exists between two nodes in the blockchain network topology diagram and the second connection relationship also exists in the bearer network topology diagram, the first connection relationship or the second connection relationship between the two nodes shall be used as the third connection relationship between the two nodes in the blockchain network extension topology diagram.
4. The method according to claim 1, characterized in that If the two nodes have the first connection relationship in the blockchain network topology diagram but do not have the second connection relationship in the bearer network topology diagram, the strength of the third connection relationship between the two nodes is low; If the two nodes do not have the first connection relationship in the blockchain network topology diagram but have the second connection relationship in the bearer network topology diagram, the strength of the third connection relationship between the two nodes is medium; If the first connection relationship exists between two nodes in the blockchain network topology diagram and the second connection relationship also exists in the bearer network topology diagram, the strength of the third connection relationship between the two nodes is high.
5. The method according to claim 1, characterized in that If the two nodes have the first connection relationship in the blockchain network topology graph but do not have the second connection relationship in the bearer network topology graph, the expression of the weights corresponding to the two nodes is: Wherein, A is the communication delay between the two nodes; a is the first weight coefficient; If the two nodes do not have the first connection relationship in the blockchain network topology graph but have the second connection relationship in the bearer network topology graph, the expression of the weights corresponding to the two nodes is: Wherein, B is the network delay between the two nodes; b is the second weight coefficient; If the two nodes have the first connection relationship in the blockchain network topology graph and the second connection relationship in the bearer network topology graph, the expression of the weights corresponding to the two nodes is: Wherein, C is the average value of the communication delay and the network delay between the two nodes; and c is the third weight coefficient.
6. The method according to claim 1, characterized in that The determining of a set of candidate logical neighbor nodes of the current node from the set of nodes in the same cluster by using the weights corresponding to the current node and the recommended neighbor nodes includes: If the number of neighbor nodes actually required by the current node is less than or equal to the number of the recommended neighbor nodes in the recommended neighbor node set, then selecting a plurality of the recommended neighbor nodes with the largest corresponding weights from the recommended neighbor node set as the candidate logical neighbor nodes; If the number of neighbor nodes actually required by the current node is greater than the number of recommended neighbor nodes in the recommended neighbor node set, in addition to taking all the recommended neighbor nodes in the recommended neighbor node set as the candidate logical neighbor nodes, the remaining required candidate logical neighbor nodes are determined from the same cluster node set.
7. The method according to claim 1, characterized in that The recommended neighbor node set also includes one or more recommended random nodes; the recommended random nodes are nodes that have the same or similar status level as the current node and do not belong to the same cluster as the current node; wherein the status level of the node is determined based on the score of the node.
8. The method according to claim 1, characterized in that The scoring expression is: S = α × G + θ × B; Wherein, α and θ are the first scoring coefficient and the second scoring coefficient respectively; G is the block generation number, and B is the network bandwidth of the node.
9. The method according to claim 1, characterized in that The blockchain system information also includes: the online time of the node; the blockchain bearer network information also includes the CPU processing performance of the node and the memory of the node; The scoring expression is: Wherein, α and θ are the first scoring coefficient and the second scoring coefficient respectively, G is the number of blocks generated, B is the network bandwidth of the node, β, and λ are the third scoring coefficient, the fourth scoring coefficient and the fifth scoring coefficient respectively, U is the online time, C is the CPU processing performance, and M is the memory.
10. The method according to claim 1, characterized in that The message synchronization between the clusters precedes the message synchronization within the clusters; The step of using the candidate logical neighbor node to perform message synchronization within the cluster includes: The current node preferentially performs message synchronization within the cluster through the candidate logical neighbor nodes having the same status level as the current node.
11. The method according to claim 10, characterized in that The current node cannot perform message synchronization within the cluster through the candidate logical neighbor node with a status level higher than that of the current node.
12. The method according to claim 10, characterized in that If the candidate logical neighbor node with the score lower than the preset score threshold generates a block, the state level of the candidate logical neighbor node is increased.
13. A computer-readable storage medium, characterized in that: The method comprises a program which can be executed by a processor to implement the method according to any one of claims 1 to 12.
Citation Information
Patent Citations
Network transmission optimization device and method for graph type block chain
CN113973021A
Block chain-based power transaction method, apparatus and device, and storage medium
CN114202398A