A blockchain node consensus method for secure communication in Internet of Vehicles

By improving the K-means packet algorithm and introducing the voting mechanism, the consensus process of blockchain nodes is optimized, and the problems of low consensus efficiency and insufficient security in 5G vehicle network are solved, and low latency and efficient data sharing are achieved.

CN114449476BActive Publication Date: 2025-06-06BEIJING JIAOTONG UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210176217.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-02-24
Publication Date
2025-06-06
Estimated Expiration
2042-02-24

AI Technical Summary

Technical Problem

Existing blockchain consensus algorithms, such as PBFT, are difficult to meet the needs of low latency and efficient data sharing in 5G vehicle network scenarios, especially when the number of nodes increases, the consensus efficiency is low and the security is insufficient.

Method used

By improving the K-means grouping algorithm, nodes are divided into multiple groups, and a voting mechanism is introduced to select the main nodes, and rotation query and PBFT algorithm are used to make consensus, reducing the number of nodes participating in the consensus, reducing delay and communication overhead.

Benefits of technology

It has achieved a low latency and efficient blockchain node consensus in the 5G vehicle network scenario, improved the system's security and throughput, and met the strict constraints on latency by the vehicle network.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114449476B_ABST
    Figure CN114449476B_ABST
Patent Text Reader

Abstract

The present invention provides a blockchain node consensus method for secure communication in an Internet of Vehicles. The method comprises: dividing all nodes into multiple groups by improving the K-means grouping algorithm, selecting a node as the initial clustering center in the first iteration in each group; introducing a voting mechanism to score the performance of each node in each group, the better the performance of the node, the higher the score, and performing a comprehensive evaluation based on the score and distance of the node in each group to select a master node; performing a rotation query in each group, and when a certain group is queried, if there is a request in the group, each node in the group performs a consensus process through the PBFT algorithm, and nodes in other groups except the master node do not participate in the consensus process. The method of the present invention proposes an innovative consensus node grouping algorithm to ensure the dynamics of the system. By reducing the number of nodes participating in the consensus process, the delay required to generate a valid block is reduced, the throughput is improved, and the communication overhead is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of blockchain consensus technology, and in particular to a blockchain node consensus method for secure communication in an Internet of Vehicles. Background Art

[0002] With the arrival of 5G, an era of "Internet of Everything" will begin. The Internet of Vehicles (IoV) is not only an important branch of the Internet of Things in the field of transportation, but also an important typical representative application of intelligent transportation systems in the Internet of Things. IoV will make the emergence of connected and self-driving cars possible. In this mode, vehicles will be able to communicate with everything in their environment, including pedestrians, communication infrastructure, and transportation equipment. With the rapid construction and development of modern intelligent transportation and smart cities, the role played by the Internet of Vehicles is becoming increasingly important. However, the security of user information transmission in the Internet of Vehicles poses a great challenge to the development of applications such as the Internet of Vehicles and autonomous driving. First, since the information transmitted by vehicle users involves user personal privacy and key messages, if this information is manipulated and tampered with by malicious users, it will cause irreparable losses. Secondly, the difficulty in tracking and tracing important user data is also a major obstacle to the development of the Internet of Vehicles. If all activities of the vehicle can be verified, then the user who sends the information must be responsible for its behavior, which will greatly improve the security of the operating environment of the Internet of Vehicles. The emerging blockchain technology (BC) has the characteristics of decentralization, tamper-proof and traceability. It can achieve secure transmission between unfamiliar nodes without relying on trusted third parties, and can provide a solution for secure data sharing in 5G Internet of Vehicles.

[0003] Blockchain can be mainly divided into: private chain, public chain and alliance chain. The three have different degrees of openness and are used in different scenarios. Private chain is open to individual individuals or entities, and only considers failures caused by the node itself and the network, without considering the existence of malicious nodes in the collection. Public chain is the most decentralized chain, the most important ones are Bitcoin, Ethereum, etc. Public chain allows each participant to view the information on the chain, and the main consensus algorithms are Proof of Work (PoW), Proof of Stake (PoS), and Delegated Proof of Stake (DPoS). The so-called alliance chain refers to a chain directly built by organizations and institutions of a certain size or number through an alliance, which is only open to specific organizations and institutions. The most common consensus calculation method in consortium chains is the Practical Byzantine Fault Tolerance (PBFT) protocol. The PBFT consensus algorithm ensures that distributed nodes maintain information consistency when transmitting information. However, in order to pursue complete decentralization, the algorithm requires all nodes in the system except client nodes to participate in the consensus process. In addition, the time complexity of one round of consensus is O(n2), where n is the number of nodes participating in the consensus. As the number of nodes increases, the time required to reach a consensus will greatly increase, so it can only be used in scenarios with a small number of nodes.

[0004] The PBFT algorithm is used to handle and solve the Byzantine Generals Problem. The Byzantine Generals Problem mainly describes how to pass messages to troops in the presence of rebels so that the various departments of the army can reach a consensus. That is, when there are some malicious nodes in the system that constantly send wrong information, PBFT has the ability to make the system still work and operate normally. The consistency problem can be said to be both the most basic and the most important problem in the distributed field. The consensus algorithm solves the problem of how to reach a consensus agreement in a distributed system. The master node, slave node and view are three important components in the operation of the PBFT algorithm. The master node and the slave node are responsible for different processes. The master node is the starting point of the algorithm operation and collects and sorts the received requests; the slave node runs the algorithm. When a request is received from the master node, it runs the algorithm to ensure the validity of the algorithm; all nodes must execute requests under the same view. When the master node fails, it will send an attempt to change the current master node. For the PBFT algorithm, in addition to supporting fault-tolerant nodes, it is also necessary to support fault-tolerant malicious nodes. For example, suppose the number of node clusters is n and the number of malicious nodes is f. Therefore, the master node needs to judge the correctness of the replies from nf nodes. The worst case is that there are f malicious nodes among these nf nodes. Then it is necessary to judge the correctness of n-2f nodes. Since the majority wins, the master node can only make a correct judgment when n-2f>f. Therefore, the total number of nodes n needs to be greater than 3f+1 for the system to reach a consensus. That is, the PBFT algorithm can tolerate the damage of up to (n-1) / 3 illegal nodes.

[0005] As a developing technology, blockchain still cannot meet the data sharing requirements of 5G Internet of Vehicles in terms of performance and security. The existing PBFT consensus algorithm has several shortcomings:

[0006] (1) Poor scalability, making it difficult to meet the large-scale data sharing needs of 5G vehicle networks;

[0007] (1) The consensus efficiency is low, which makes it difficult to meet the real-time and efficient data sharing requirements of 5G vehicle networks;

[0008] (2) Insufficient security makes it difficult to meet the privacy and security data sharing requirements of 5G vehicle networks.

[0009] As a core technology of modern blockchain, consensus algorithm determines the actual application and scenarios of blockchain. In the development trend of blockchain technology in recent years, security, privacy and performance have become important focuses of blockchain technology research. However, in the scenario of Internet of Vehicles, there are few studies on reducing consensus delay and communication overhead. At present, consensus algorithms are difficult to meet the strict constraints on delay in the scenario of Internet of Vehicles. Therefore, how to propose a blockchain consensus algorithm that meets the application scenario of Internet of Vehicles is an urgent problem to be solved. Summary of the invention

[0010] The embodiments of the present invention provide a blockchain node consensus method for secure communication in the Internet of Vehicles, which is an efficient consensus mechanism designed to ensure communication security and meet the low latency requirements of blockchain systems in Internet of Vehicles scenarios such as 5G.

[0011] In order to achieve the above object, the present invention adopts the following technical scheme.

[0012] A blockchain node consensus method for secure communication in an Internet of Vehicles, comprising:

[0013] All nodes are divided into multiple groups by improving the K-means grouping algorithm. In the first iteration of each group, a node is selected as the initial clustering center.

[0014] A voting mechanism is introduced to score the performance of each node in each group. The better the performance of the node, the higher the score. A comprehensive evaluation is performed based on the score and distance of the node in each group to select a master node.

[0015] The query is performed in rotation in each group. When a group is queried, if there is a request in the group, the nodes in the group will use the Practical Byzantine Fault Tolerance (PBFT) algorithm to perform a consensus process. The nodes in other groups except the master node do not participate in the consensus process and are in an idle period.

[0016] Preferably, the improved K-means grouping algorithm is used to divide all nodes into multiple groups, and in the first iteration in each group, a node is selected as the initial clustering center, including:

[0017] Step (1) Assume that the set of all nodes is D, first provide an initial node set U, and initialize m groups;

[0018] Step (2) Randomly select a node as the cluster center C for group k (k = 1, ..., m) k ;

[0019] Step (3) Calculate the cluster center C k The average distance d from the nodes in the set U c , as the threshold radius;

[0020] Step (4) Determine the node i (i∈D / U) in set D to the cluster center C k The distance d i , determine the distance d i With threshold radius d c If d i Less than d c , then node j is assigned to the current group k;

[0021] Step (5) Update the cluster center of group k and take the centroid of the group elements as the center C of the next iteration. k ;

[0022] Step (6) traverse each group in turn and repeat the above steps (2)-(5) until the termination condition is met;

[0023] Step (7) If there are nodes in set D that are not grouped in any group, for these nodes, it is necessary to calculate the distances from these nodes to the center of each group one by one, and take the group with the smallest distance as the node grouping result.

[0024] Preferably, the method further comprises: when the number of nodes in the system changes, the nodes are automatically grouped according to the processing procedure of the improved K-means grouping algorithm without restarting the system.

[0025] Preferably, the joining or exiting of the node needs to be carried out during the idle period of the node. For a node that wants to join, it is first assigned to the group with the shortest distance through the above-mentioned improved K-means grouping algorithm, and when the group is in an idle period, it is recorded in the group node list; for a node that wants to exit, it first applies to the system. After the application is approved, it is deleted from the group node list when the group to which the node belongs is in an idle period.

[0026] Preferably, the voting mechanism is introduced to score the performance of each node in each group. The better the performance of the node, the higher the score. A comprehensive evaluation is performed based on the score and distance of the node in each group to select a master node, including:

[0027] Divide all nodes in each group into: master nodes, reserve nodes and voting nodes. The master nodes and voting nodes are elected from the reserve nodes. Assuming that there are a total of a reserve nodes in the group, b voting nodes and a master node need to be selected from a reserve nodes at the beginning of a round of consensus. The voting nodes have voting rights. The performance of the reserve nodes in the previous round of consensus is voted and scored. Multiple reserve nodes with higher scores are selected as preferred nodes. The average distance from each preferred node to each other group is calculated. The score and average distance of each preferred node are comprehensively evaluated, and the node with the best comprehensive evaluation is selected as the master node.

[0028] Production nodes are responsible for packaging transactions and generating data blocks.

[0029] Preferably, the voting mechanism is introduced to score the performance of each node in each group. The better the performance of the node, the higher the score. A comprehensive evaluation is performed based on the score and distance of the node in each group to select a master node, which specifically includes:

[0030] Step 1: According to the performance of the nodes in the previous round of consensus process, the voting nodes in each group vote and score other nodes, and select the top n (b + 1 < n < a) nodes with the highest scores as high-quality nodes;

[0031] The voting rules are as follows: ① If selected as the primary node in the previous round of consensus process, add 2 points; if it becomes the primary node and performs well and produces valid data blocks, add 1 more point, otherwise subtract 1 point; ② If it was a voting node in the previous round, add 1 point; if the consensus process performs well, add 1 point, otherwise subtract 1 point. ③ If it was a standby node in the previous round, no points are added; if the consensus process performs well, add 1 point, otherwise subtract 1 point. The node score is denoted as s;

[0032] Step 2: Calculate g 1 The average distance d 2 , g 3 ,..., g m} from each preferred node in the group to all nodes in each group in the group set {g a1 , and calculate the comprehensive evaluation of node j:

[0033] R j = α 1 * s + α 2 * d a1

[0034] α 1 and α 2 are weight coefficients;

[0035] Step 3: Sort the node scores in descending order, and select the top b + 1 nodes with the highest evaluation and put them into the set D = {n 1 , n 2 , …, n b+1};

[0036] Step 4: For G = {g 1 , g 2 ,..., g m}, put the first element in D into the primary node set P as the primary node in the g 1 group, and put the other elements into the voting node set V;

[0037] Step 5: Traverse each group in the group set {g 2 , g 3 ,..., g m} in turn, and repeat the processing procedures of the above steps 1 - 4; until there are m nodes in the primary node set P, that is, m primary nodes are selected from m groups, and the selection process ends.

[0038] Preferably, the vehicle - to - everything network includes: 5G vehicle - to - everything network.

[0039] It can be seen from the technical solutions provided by the above-mentioned embodiments of the present invention that the method of the embodiments of the present invention proposes an innovative consensus node grouping algorithm. When the number of nodes in the system changes, there is no need to restart the system, and the nodes are automatically grouped to ensure the dynamic nature of the system. A voting mechanism is introduced to score the performance of consensus nodes. The better the performance of the node, the higher the score, which reduces the risk of node malicious behavior and improves the security of the system. The consensus node is composed of the main node and the group node where the request is located. By reducing the number of nodes participating in the consensus process, the delay required to generate a valid block is reduced, the throughput is improved, and the communication overhead is reduced.

[0040] Additional aspects and advantages of the present invention will be given in part in the following description, which will become obvious from the following description, or may be learned through practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS

[0041] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative work.

[0042] Figure 1 A flow chart of the GEPBFT consensus process provided by an embodiment of the present invention;

[0043] Figure 2 A processing flow chart of a grouping algorithm in an improved K-means grouping algorithm provided in an embodiment of the present invention;

[0044] Figure 3 A schematic diagram of a grouping result provided by an embodiment of the present invention;

[0045] Figure 4 A flowchart of a master node election algorithm provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0046] The embodiments of the present invention are described in detail below, examples of which are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention, and cannot be interpreted as limiting the present invention.

[0047] It will be understood by those skilled in the art that, unless expressly stated, the singular forms "one", "said", and "the" used herein may also include plural forms. It should be further understood that the term "comprising" used in the specification of the present invention refers to the presence of the features, integers, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or groups thereof. It should be understood that when we refer to an element as being "connected" or "coupled" to another element, it may be directly connected or coupled to the other element, or there may be intermediate elements. In addition, the "connection" or "coupling" used herein may include wireless connection or coupling. The term "and / or" used herein includes any unit and all combinations of one or more associated listed items.

[0048] It will be understood by those skilled in the art that, unless otherwise defined, all terms (including technical and scientific terms) used herein have the same meaning as those generally understood by those skilled in the art in the art to which the present invention belongs. It should also be understood that terms such as those defined in common dictionaries should be understood to have meanings consistent with the meanings in the context of the prior art, and will not be interpreted with idealized or overly formal meanings unless defined as herein.

[0049] To facilitate understanding of the embodiments of the present invention, several specific embodiments will be further explained below with reference to the accompanying drawings, and each embodiment does not constitute a limitation on the embodiments of the present invention.

[0050] The embodiment of the present invention improves on the traditional PBFT algorithm and proposes a blockchain node consensus method (mechanism) for secure communication in the Internet of Vehicles:

[0051] (1) By innovatively improving the K-means grouping algorithm, all original consensus nodes are divided into G groups, G nodes are selected as cluster center nodes, and then each consensus node is assigned to the cluster center closest to it by calculating the distance between each consensus node and each cluster center. Traditional PBFT is only applicable to systems with fixed nodes. When network nodes change dynamically, the system must be restarted and reconfigured to adapt to the changed system. By using the K-means clustering algorithm, when the number of nodes in the system changes, there is no need to restart the system, and node grouping is automatically performed to ensure the dynamic nature of the system.

[0052] (2) After being divided into G groups, based on the performance of the nodes in the previous round of consensus process, the voting nodes in each group will vote and score the reserve nodes based on the reputation evaluation of the members, and select the nodes with high scores as the preferred nodes. Secondly, the master node is selected from each group of preferred nodes based on the distance. The consensus process will first be carried out in the polling group, and then between the master nodes. In this way, the number of consensus processes is reduced on the basis of reducing the scale of consensus nodes, and its time complexity is changed from O(n2) to O(n), which reduces the communication delay and improves the throughput. At the same time, through the selection of the master node, the production nodes with good performance will receive certain remuneration and rewards, which will encourage the production nodes to work more honestly and reliably and reduce the risk of nodes doing evil.

[0053] The traditional PBFT algorithm consensus process requires the joint participation of all consensus nodes in the network. There is a large amount of point-to-point communication, and consensus is reached through joint negotiation, which occupies too much communication resources and especially increases communication latency. Therefore, the embodiment of the present invention proposes a suitable blockchain consensus mechanism, which can reduce communication bandwidth overhead while improving node flexibility and fault tolerance, significantly improve transaction throughput, and reduce latency, especially to ensure strict latency constraints in Internet of Vehicles scenarios, which is of great significance to the development of blockchain.

[0054] The present invention proposes a PBFT (Grouping and Election Based Practical Byzantine Fault Tolerance, GEPBFT) system based on grouping and election, which includes ordinary nodes and consensus nodes, wherein ordinary nodes do not participate in the consensus process, and only consensus nodes participate in the consensus process. Compared with the traditional PBFT algorithm, the system overhead required for these nodes to reach consensus is omitted.

[0055] The flowchart of the GEPBFT consensus process based on the improved K-means algorithm proposed in the embodiment of the present invention is as follows: Figure 1 As shown, the specific implementation process is as follows:

[0056] (1) Node grouping: The initial consensus nodes are grouped according to the improved K-means algorithm.

[0057] (2) Master node election: For each group, the master node is determined using a master node election method based on reputation evaluation.

[0058] (3) Group consensus: The block production master node for this round of consensus is determined by a rotating query method. The system performs a rotating query according to the group number. When a group is queried, if there is a request in the group, the nodes in the group and the master node together constitute a consensus node and execute the PBFT algorithm for consensus until the next rotating query to find a request in another group; if a group is queried and there is no request in the group, the group is skipped and the query continues in a rotating manner according to the group number until a group with a request is found.

[0059] (4) The block production master node sends a broadcast message to other master nodes, preparing to start the master node consensus.

[0060] (5) Masternode consensus: The PBFT algorithm is further executed among the selected masternodes to reach consensus.

[0061] (6) Each master node sends a broadcast message to other nodes in its group.

[0062] (7) Verification within the group: After receiving the packaged message from the group’s master node, the nodes of each group will verify the digital signature of the packaged message. After successful verification, the request content will be executed, and then each node will update the local blockchain ledger information to ensure data consistency.

[0063] The realization of the GEPBFT consensus process lies in the implementation of two key algorithms, namely the grouping algorithm based on improved K-means and the master node selection algorithm based on reputation evaluation. The specific implementation principles of these two algorithms will be introduced below.

[0064] 1. Grouping algorithm based on improved K-means:

[0065] In the process of information propagation, delay is related to propagation distance and propagation speed. In actual networks, distance is an important factor affecting propagation delay. In practice, the positions of most nodes will not change much in a short period of time. Therefore, within a fixed period, the distance between two nodes at any time can be approximated as the distance between nodes within this fixed period. Based on the above assumptions, a grouping algorithm is designed to group nodes with similar distances within a fixed time period in the system, allowing small changes in node positions. After the master node selection algorithm, multiple groups led by multiple master nodes are formed, so that the algorithm can reduce the communication delay of information transmission between nodes by reducing the communication distance.

[0066] Assume that the set of all nodes is D. For the convenience of calculation, we need to first provide an initial node set U. Since the cost of calculating the distance matrix for a large number of nodes is huge, we need an initial node set with fewer nodes. First, we group the nodes in the initial set U to reduce the cost of calculating the distance matrix. For nodes that are not grouped or will be added in the future, we can determine which group to join based on the grouping information. Figure 2 The processing flow chart of the grouping algorithm in an improved K-means grouping algorithm provided by an embodiment of the present invention, the specific algorithm steps are as follows:

[0067] 1) Initialize m groups.

[0068] 2) Randomly select nodes as cluster centers C for group k (k = 1, ..., m) k .

[0069] 3) Calculate the cluster center C k The average distance d from the nodes in the set U c , as the threshold radius.

[0070] 4) Determine the distance d from node i (i∈D / U) in set D to cluster center C i With threshold radius d c If d i Less than d c , then node j is classified as the current group.

[0071] 5) Update the cluster center of the group and take the centroid of the group elements as the center C of the next iteration k .

[0072] 6) Traverse each group in turn and repeat steps 3-5 above until the termination condition (maximum number of iterations, minimum error change) is met.

[0073] 7) If there are nodes in set D that are not grouped in any group, for these nodes, it is necessary to calculate the distances from these nodes to the center of each group one by one, and take the group with the smallest distance as the node grouping result.

[0074] The idea of ​​this grouping algorithm is to put all nodes in a two-dimensional plane, take each central node as the center of a circle, and draw a circle with the threshold radius as the radius of the circle, that is, draw m circles in the entire two-dimensional plane, and there is no overlapping between the m circles, and divide the nodes in the circle into a unified group, so that the grouping of m groups is completed. Since the m circles do not overlap with each other, there are nodes in the two-dimensional plane that are not included in any circle. For these unincluded nodes, to group them, it is necessary to calculate the distance from these nodes to each central node one by one, calculate the minimum distance, and classify the nodes into the corresponding group. Figure 3 A schematic diagram of a grouping result provided by an embodiment of the present invention.

[0075] Considering the dynamics of the system, this algorithm allows nodes to dynamically join or exit. Since the consensus nodes participating in the consensus process are jointly composed of the master node and the nodes in the group where the current request node is located, the nodes other than the master node in other groups do not participate in the consensus process and are in an idle period during the previous round of consensus process. The change of nodes during the idle period does not affect the consensus process, so the addition or deletion of nodes needs to be carried out during the idle period. For a node that wants to join, it is first assigned to the group with the shortest distance through the grouping algorithm, and then waits for the group to be in the idle period and records it in the group node list; for a node that wants to exit, it first submits an application to the system. After the application is approved, it waits for the group where the node is located to be in the idle period and deletes it from the group node list; if the exited node wants to rejoin, it needs to repeat the above node addition process, recalculate the distance from the node to each central node, select the minimum value, and rejoin the group node list.

[0076] 2. Master node selection algorithm based on reputation evaluation:

[0077] After the initial nodes are processed by the above grouping, m groups are obtained. The master node selection algorithm selects m nodes with similar distances and excellent performance from these m groups as the master nodes. In this way, the message propagation delay in the consensus stage of the master nodes can be reduced. At the same time, considering the security of the system and the performance of the node consensus process, the situation of master node failure or the master node being a Byzantine node can be effectively avoided.

[0078] There are three types of nodes in each group: master node (production node), standby node, and voting node. Among them, the production node and the voting node are elected from the standby nodes. Suppose there are a total of a nodes (standby nodes) in the group. At the beginning of a round of consensus, b (b < a) voting nodes and a master node need to be selected from them. The voting nodes have the right to vote and vote on the performance of the standby nodes in the previous round of consensus process, and select the ones with higher scores as the preferred nodes. Then, calculate the average distance from each preferred node to other groups, and select the node with the best comprehensive evaluation (consensus process performance, average distance) as the production node. The production node is responsible for packing transactions and generating data blocks. Well-behaved production nodes will receive corresponding rewards, which will help the production nodes work more honestly and reliably.

[0079] Figure 4 A flowchart of a master node election algorithm provided by an embodiment of the present invention, and the specific implementation process is as follows:

[0080] 1) According to the performance of the nodes in the previous round of consensus process, the voting nodes in each group vote and score other nodes, and select the top n (b + 1 < n < a) nodes with the highest scores as high-quality nodes. The voting rules are as follows: ① If selected as a production node in the previous round of consensus process, add two points; if it becomes a production node and performs well, producing valid data blocks, add one more point, otherwise subtract one point. ② If it was a voting node in the previous round, add one point; if the consensus process performs well (without malicious operations such as data tampering and deletion), add one point, otherwise subtract one point. ③ If it was a preparatory node (non-production node) in the previous round, no points are added; if the consensus process performs well, add one point, otherwise subtract one point. The node score is denoted as s.

[0081] 2) Calculate g 1 The average distance d 2 , g 3 ,..., g m} from each selected preparatory node in the group to all nodes in each group a1 , and calculate the comprehensive evaluation of node j:

[0082] R j = α 1 * s + α 2 * d a1

[0083] α 1 and α 2 are weight coefficients.

[0084] 3) Sort the node scores in descending order, and select the top b + 1 nodes with the highest evaluations and put them into the set D = {n 1 , n 2 , …, n b+1}.

[0085] 4) For G = {g 1 , g 2 ,..., g m}, put the first element in D into the main node set P as the production node in the g 1 group. Put the other elements into the voting node set V.

[0086] 5) For g 2 , repeat step 1 to obtain the selected preparatory nodes, calculate the distances from each selected node in the group to the main node set P, and calculate the average distance d a2 .

[0087] 6) Calculate the node score:

[0088] R 2 = β 1 * s + β 2 * d a2

[0089] β 1 and β 2 Also the weight coefficient.

[0090] 7) Repeat steps 3-4. Thus, we can get g 2 Production nodes and voting nodes.

[0091] 8) The steps for selecting the master node for other groups are the same as g. 2 The process continues until there are m nodes in the master node set, that is, m master nodes are selected from the m small groups, and the selection process ends.

[0092] In summary, the advantages and positive effects of the embodiments of the present invention are as follows:

[0093] 1) Based on the idea of ​​K-means algorithm, an innovative consensus node grouping algorithm is proposed. When the number of nodes in the system changes, there is no need to restart the system, and the nodes are automatically grouped to ensure the dynamic nature of the system.

[0094] 2) Introduce a voting mechanism to score the performance of consensus nodes. The better the performance of the node, the higher the score, and the greater the probability of becoming a production node (master node) in the next round of consensus. In addition, production nodes with good performance will receive certain remuneration and rewards, which will encourage production nodes to work more honestly and reliably, reduce the risk of nodes doing evil, and improve the security of the system.

[0095] 3) In each group, a master node is selected based on consensus performance and distance. These master nodes and the nodes of the requesting group together constitute the consensus node. By reducing the number of nodes involved in the consensus process, the delay required to generate a valid block is reduced, the throughput is improved, the communication overhead is reduced, and the low-latency requirements of the blockchain system in 5G and other Internet of Vehicles scenarios are met.

[0096] Those skilled in the art can understand that the accompanying drawings are only schematic diagrams of an embodiment, and the modules or processes in the accompanying drawings are not necessarily required to implement the present invention.

[0097] It can be known from the description of the above implementation methods that those skilled in the art can clearly understand that the present invention can be implemented by means of software plus a necessary general hardware platform. Based on such an understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which can be stored in a storage medium such as ROM / RAM, a magnetic disk, an optical disk, etc., and includes a number of instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in the various embodiments of the present invention or certain parts of the embodiments.

[0098] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device or system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment. The device and system embodiments described above are merely schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.

[0099] The above is only a preferred specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any changes or substitutions that can be easily thought of by a person skilled in the art within the technical scope disclosed by the present invention should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.

Claims

1. A blockchain node consensus method for secure communication in the vehicle networking, characterized in that, it includes: Dividing all nodes into multiple groups by improving the grouping algorithm of K-means. In the first iteration of each group, select a node as the initial clustering center and update the clustering center in subsequent iterations; Introducing a voting mechanism to score the performance of each node in each group. The better the performance of a node, the higher its score. Conduct a comprehensive evaluation based on the score and distance of the nodes in each group to select a primary node; Conducting a rotation query among each group. When a certain group is queried, if there is a request in this group, each node in this group conducts a consensus process through the Practical Byzantine Fault Tolerance protocol PBFT algorithm. Nodes other than the primary nodes in other groups do not participate in the consensus process and are in the idle period; The dividing all nodes into multiple groups by improving the grouping algorithm of K-means and selecting a node as the initial clustering center in the first iteration of each group includes: Step (1) Assume that the set composed of all nodes is D. First, provide an initial node set U and initialize m groups; Step (2) Randomly select a node as the cluster center C for group k (k = 1, ..., m) k ; Step (3) Calculate the cluster center C k The average distance d from the nodes in the set U c , as the threshold radius; Step (4) Determine the node i (i∈D / U) in set D to the cluster center C k The distance d i , determine the distance d i With threshold radius d c If d i Less than d c , then node j is assigned to the current group k; Step (5) Update the cluster center of group k and take the centroid of the group elements as the center C of the next iteration. k ; Step (6) Traverse each group in turn and repeat the above steps (3)-(5) until the termination condition is met; Step (7) If there are nodes in set D that are not assigned to any group, for these nodes, it is necessary to calculate the distances from these nodes to the centers of each group one by one, and select the group with the smallest distance as the node grouping result; The introducing a voting mechanism to score the performance of each node in each group, where the better the performance of a node, the higher its score, and conducting a comprehensive evaluation based on the score and distance of the nodes in each group to select a primary node includes: Dividing all nodes in each group into: primary node, standby node, and voting node. The primary node and voting node are elected from the standby nodes. Assume that there are a total of a standby nodes in the group. At the beginning of a round of consensus, b voting nodes and one primary node need to be selected from the a standby nodes. The voting nodes have the right to vote and vote on the performance of the standby nodes in the previous round of consensus process. Select multiple standby nodes with higher scores as the preferred nodes, calculate the average distance from each preferred node to each other group, and conduct a comprehensive evaluation of the score and average distance of each preferred node to select the node with the best comprehensive evaluation as the primary node; The primary node is responsible for packing transactions and generating data blocks; The introducing a voting mechanism to score the performance of each node in each group, where the better the performance of a node, the higher its score, and conducting a comprehensive evaluation based on the score and distance of the nodes in each group to select a primary node specifically includes: Step 1. According to the performance of the nodes in the previous round of consensus process, the voting nodes in each group vote and score other nodes, and select the top n (b + 1 < n < a) nodes with the highest scores as the preferred nodes; The voting rules are as follows: ① If you were selected as the master node in the previous round of consensus, you will get two points; if you perform well as the master node and produce valid data blocks, you will get another point, otherwise you will lose one point; ② If you were a voting node in the previous round, you will get one point; if you performed well in the consensus process, you will get one point; otherwise you will lose one point; ③ If you were a reserve node in the previous round, you will not get any points; if you performed well in the consensus process, you will get one point; otherwise you will lose one point. The node score is recorded as s; Step 2: Calculate g 1 Each preferred node in the group to the group set {g 2 ,g 3 ,...,g m The average distance d of all nodes in each group a1 , calculate the comprehensive evaluation of node j: R j =a 1 *s+a 2 *d a1 α 1 and α 2 is the weight coefficient; Step 3: Sort the node scores in descending order, select the first b+1 nodes with the highest evaluation and put them into the set D={n 1 ,n 2 ,…,n b+1 }; Step 4: For G = {g 1 ,g 2 ,...,g m }, put the first element in D into the main node set P as g 1 The master node in the group, and other elements are put into the voting node set V; Step 5: Traverse the group set {g 2 ,g 3 ,...,g m }, repeat the above steps 1 to 4 for each group in the master node set P; until there are m nodes in the master node set P, that is, m master nodes are selected from the m groups, and the selection process ends.

2. The method according to claim 1, It is characterized in that The method further includes: when the number of nodes in the system changes, the nodes are automatically grouped according to the processing process of the improved K-means grouping algorithm without restarting the system.

3. The method according to claim 1, It is characterized in that The joining or exiting of the node needs to be carried out during the idle period of the node. For a node that wants to join, it is first assigned to the group with the shortest distance through the above-mentioned improved K-means grouping algorithm, and when the group is in an idle period, it is recorded in the group node list; for a node that wants to exit, it first applies to the system. After the application is approved, it is deleted from the group node list when the group to which the node belongs is in an idle period.

4. The method according to claim 1, It is characterized in that The Internet of Vehicles includes: 5G Internet of Vehicles.

Citation Information

Patent Citations

  • Dynamically layered efficient PBFT algorithm

    CN113570357A

  • Medical data storage method and system based on alliance chain

    CN113889203A