Safe and efficient method, system and device for improving PBFT Internet of Vehicles block chain consensus and medium

Through the combination of multi-criteria decision analysis, VRF random functions, BLS signature technology and D3QN deep reinforcement learning algorithm, the problems of low consensus delay and throughput in the Internet of Vehicles blockchain consensus algorithm are solved, and a more efficient and secure consensus process is achieved.

CN120075760APending Publication Date: 2025-05-30XIDIAN UNIV
View PDF 0 Cites 3 Cited by

Patent Information

Application Number
CN202510234273.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-02-28
Publication Date
2025-05-30

AI Technical Summary

Technical Problem

The prior art has problems in the consensus algorithm of Internet of Vehicles blockchain, which has increased consensus delay, low throughput, and malicious node control master node selection, and has failed to effectively optimize multiple parameters of the entire consensus process.

Method used

The delegated consensus node is selected by using multi-criteria decision analysis method, and the leadership node can be selected through VRF through verified random functions, and the signature is aggregated based on BLS signature technology, and the throughput of blockchain consensus is optimized using D3QN deep reinforcement learning algorithm.

Benefits of technology

It improves the security and efficiency of consensus, reduces consensus latency, increases consensus throughput, and enhances the reliability and performance of the Internet of Vehicles blockchain system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120075760A_ABST
    Figure CN120075760A_ABST
Patent Text Reader

Abstract

A safe and efficient improved PBFT Internet of Vehicles block chain consensus method, system, device and medium, and the method comprises the steps: carrying out the pre-screening according to a vehicle comprehensive trust value, and obtaining an initial set of entrusting consensus nodes; performing multi-criterion decision analysis according to the trust value of the vehicle, the communication channel capacity, the data collection time and the difference value of the existing timestamp, obtaining a score ranking, and selecting the first K nodes as entrusting consensus nodes; selecting a leader node by adopting a VRF verifiable random function; entrusting the consensus node to carry out consensus, and carrying out aggregation signature in a consensus preparation stage and a consensus submission stage by adopting a BLS-based signature technology; based on a D3QN deep reinforcement learning algorithm, optimizing the throughput of the block chain consensus; consensus is completed, trust value updating is carried out based on consensus performance of the nodes, and data is stored in a block chain account book; the system, the equipment and the medium are used for implementing the method. The method can reduce the consensus delay and increase the consensus throughput, and has the advantages of safety, high efficiency and the like.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of wireless communication, and particularly relates to a secure and efficient improved PBFT blockchain consensus method, system, device and medium for vehicle-to-everything (V2X). Background Technique

[0002] As an important branch of the Internet of Things, vehicle-to-everything (V2X) realizes real-time data sharing between vehicles and road infrastructure, cloud services, etc. through wireless communication and sensor technologies, greatly improving traffic safety and efficiency. However, while promoting the development of intelligent transportation, V2X also faces problems such as low data management efficiency, poor credibility, poor transmission quality, and difficulty in constraining participants. Traditional centralized data storage faces the risk of single-point failure, and in the absence of a trusted management platform, malicious vehicles may launch attacks, endangering system security. Blockchain technology, as a decentralized distributed database, provides a solution for V2X data sharing with its advantages such as distributed storage, data immutability, and platform credibility. However, the V2X data sharing system combined with blockchain still faces problems such as malicious attacks, low consensus efficiency, and low throughput. Therefore, it is necessary to design a secure and efficient blockchain consensus algorithm to improve the security and efficiency of the V2X combined with blockchain system.

[0003] With the increasing maturity of blockchain technology, there are many blockchain consensus algorithms. For example, the Proof of Work (PoW) consensus algorithm based on the workload proof allows anyone to join and compete for the right to record transactions by calculating complex mathematical problems. It was first applied to Bitcoin, with the advantages of high decentralization and good security; the disadvantages are that it consumes a large amount of computing resources, has low throughput, and long transaction confirmation time, and is not suitable for the scenario where the vehicle computing resources in V2X are insufficient. The Delegated Proof of Stake (DPoS) consensus algorithm based on the delegated stake. Similar to a democratic voting mechanism, users delegate their rights and interests to a few nodes to complete the consensus, improving the system operation efficiency and transaction speed, but sacrificing a certain degree of decentralization, and there are problems such as too high weight of large-stake users and easy fork. The Practical Byzantine Fault Tolerance (PBFT) consensus algorithm does not perform operations and ensures fairness by polling verifiers and proposers, and can prevent Byzantine nodes within 1 / 3, but its scalability is poor and the communication complexity is high. Therefore, when designing a blockchain consensus algorithm for the V2X scenario, not only the characteristics of the blockchain need to be considered, but also the characteristics of the V2X network and vehicles need to be considered.

[0004] In the existing research (Xu, G., Bai, H., Xing, J., Luo, T., Xiong, N. N., Cheng, X., Liu, S., & Zheng, J. X. (2022). SG-PBFT: A secure and highly efficient distributed blockchain PBFT consensus algorithm for intelligent Internet of vehicles. J. Parallel Distributed Comput., 164, 1-11.), based on the improvement of the PBFT consensus algorithm, aiming at the problems faced by the Internet of Vehicles combined with blockchain technology, it is proposed to improve the traditional PBFT consensus algorithm SG-PBFT through a group scoring mechanism. Through the group scoring mechanism, the nodes are divided into multiple groups, each group conducts consensus independently, and then the results are summarized, effectively reducing the communication overhead and improving the consensus efficiency. Other research (Kumar, A., Vishwakarma, L., & Das, D. (2023). R-PBFT: A secure and intelligent consensus algorithm for Internet of vehicles. Veh. Commun., 41, 100609.) proposes to optimize the selection of the primary node and the secondary node by evaluating the reputation score of vehicle nodes for the trust value of vehicles in the Internet of Vehicles. After the consensus is completed, the reputation score is recalculated to select nodes for the next round of consensus, which is more fair and reduces the communication overhead and improves the consensus efficiency. Another research (F. Zhao, B. Yang, C. Li, C. Zhang, L. Zhu and G. Liang, "Two-Layer Consensus Based on Primary-Secondary Consortium Chain Data Sharing for Internet of Vehicles," in IEEE Transactions on Vehicular Technology, vol. 73, no. 9, pp. 13828-13838, Sept. 2024, doi: 10.1109 / TVT.2024.3397818.) proposes a two-layer PBFT consensus algorithm, which divides the blockchain into an upper-layer consensus network and a lower-layer consensus network. In the lower-layer consensus network, the nodes in the blockchain are divided into several groups, and each group conducts consensus independently within the group. The group leaders of these groups are responsible for reporting the consensus results of their own groups to the upper layer; the upper-layer consensus network is composed of the group leaders of each group, and the PBFT algorithm is used for the final consensus.In this way, through hierarchical processing, the communication overhead can be effectively reduced, and the consensus efficiency and throughput can be improved.

[0005] To sum up, (1) in the existing technology, when considering the consensus nodes for delegated consensus, only a single factor is considered, and the impacts brought by vehicle mobility and changes in node factors are not considered. The delegated consensus mainly targets a single right of the vehicle, and when malicious nodes control most of this right, they will initiate a collusion attack. (2) When considering the selection of the primary node in the existing technology, there are fixed quantization criteria and rules. If a malicious node breaks this rule, it will attack other candidate nodes to control the selection of the primary node. (3) In the existing improvements based on the PBFT consensus algorithm, only a single parameter is designed and optimized. The existing research mainly focuses on the improvement of a certain process parameter of the PBFT algorithm, ignoring the joint optimization of multiple parameters throughout the consensus process, thus restricting the increase in consensus throughput. Summary of the Invention

[0006] In order to overcome the above deficiencies of the existing technology, the purpose of the present invention is to provide a secure and efficient improved PBFT vehicle-to-everything (V2X) blockchain consensus method, system, device, and medium. By using a multi-criteria decision analysis method to select the consensus committee and a verifiable random function (VRF) to select the leader node, aggregating signatures based on the BLS signature technology, and finally optimizing the throughput based on a deep reinforcement learning algorithm, the consensus delay can be reduced, and the consensus throughput can be increased. The present invention has the advantages of security, efficiency, etc.

[0007] To achieve the above purpose, the technical solution adopted by the present invention is as follows:

[0008] A secure and efficient improved PBFT V2X blockchain consensus method includes the following steps:

[0009] Step 1: The vehicle nodes sort out the traffic data to be published, send requests to the roadside unit (RSU), and compete for the leader node. The roadside unit (RSU) pre-screens the vehicles according to the vehicle trust values of the competing leader nodes. If it exceeds the set threshold, the screening is passed, and an initial set of delegated consensus nodes is obtained.

[0010] Step 2: The roadside unit (RSU) performs decision analysis on the vehicle nodes in the initial set of delegated consensus nodes obtained in Step 1 based on the multi-criteria decision analysis method, considering the vehicle trust value, communication channel capacity, and the difference between the collection time of the traffic data and the existing time stamp, obtains a score ranking, and selects the top K nodes in the score ranking as the delegated consensus nodes.

[0011] Step 3: Select the primary node using the VRF verifiable random function. Based on the size of the block created in this round of consensus, the current leader node uses a pseudo-random number generator (PRNG) to generate a random number seed in the last consensus round. Other consensus nodes generate a random number L based on the random number seed, and the node with the largest output random number L is selected as the leader node;

[0012] Step 4: Use the leader node selected in Step 3 as the primary node for consensus, and use the BLS-based signature technology for aggregate signature in the preparation and commit phases of consensus;

[0013] Step 5: Based on the entire consensus process, use the deep reinforcement learning algorithm of D3QN to make decisions on the block size, block interval time in blockchain consensus, and the selection of the number ratio of the entrusted consensus nodes in Step 2 to optimize the throughput of blockchain consensus;

[0014] Step 6: After completing the consensus, evaluate and update the trust value of the nodes based on the consensus performance of the nodes. The primary node packs and uploads the traffic data to be stored in the blockchain ledger, and the roadside unit (RSU) saves a complete copy of the ledger.

[0015] Compared with the prior art, the beneficial effects of the present invention are as follows:

[0016] 1. When selecting the consensus nodes for entrusted consensus in the present invention, by combining the vehicle trust value, communication channel capacity, and the difference between the data collection time and the existing time stamp, multi-criteria decision analysis and evaluation are carried out to obtain a score ranking, and the selection of entrusted consensus nodes is made, which can make the selection of consensus nodes more reliable and perfect, and enhance the security of vehicle-to-everything blockchain consensus.

[0017] 2. When selecting the consensus leader node in the present invention, by selecting based on the VRF verifiable random function, the randomness of the primary node selection can be increased, and the problem of malicious nodes controlling the primary node selection can be effectively prevented.

[0018] 3. The present invention constructs an optimization problem constrained by performance indicators such as consensus delay, malicious node ratio, and decentralization degree based on blockchain consensus. Based on the D3QN deep reinforcement learning algorithm, joint decisions are made on the block size, block interval time of blockchain consensus, and the entrusted ratio of multi-criteria decision analysis to optimize the throughput of blockchain consensus.

[0019] 4. In the present invention, based on the BLS signature technology, aggregate signature is performed in the preparation and commit phases of consensus, which can reduce the communication complexity of consensus and reduce the consensus delay.

[0020] In summary, the present invention performs multi-criteria decision analysis by combining vehicle trust values, communication channel capacities, the difference between the data collection time and the existing timestamp, selects consensus nodes for delegated consensus, selects leader nodes based on the verifiable random function (VRF), performs aggregated signature based on the BLS signature technology, and jointly determines the block size, block interval time of blockchain consensus, and the delegation ratio of multi-criteria decision analysis based on the D3QN deep reinforcement learning algorithm, improving the security of consensus, reducing consensus latency, and optimizing the throughput of consensus. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] Figure 1 FIG. is a flowchart of a secure and efficient consensus algorithm for a vehicle-to-everything (V2X) blockchain provided by an embodiment of the present invention.

[0022] Figure 2 FIG. is a scenario diagram of V2X blockchain consensus of the present invention.

[0023] Figure 3 FIG. is a flowchart of an improved Practical Byzantine Fault Tolerance (PBFT) consensus algorithm based on the BLS signature technology of the present invention.

[0024] Figure 4 FIG. is a schematic diagram of the analysis and comparison of consensus latency and the number of nodes between the method of the present invention and other consensus algorithms.

[0025] Figure 5 FIG. is a schematic diagram of the analysis and comparison of throughput and the number of nodes between the method of the present invention and other consensus algorithms.

[0026] Figure 6 FIG. is a schematic diagram of throughput optimization convergence based on the deep reinforcement learning algorithm of the present invention.

[0027] Figure 7 FIG. is a schematic diagram of the comparison of communication overheads between the method of the present invention and other consensus algorithms. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0028] The technical solutions adopted by the present invention will be further described below in conjunction with the accompanying drawings and specific embodiments.

[0029] In view of the security and efficiency problems existing in the blockchain consensus algorithm in the vehicle networking scenario, the present invention proposes a secure and efficient improved PBFT vehicle networking blockchain consensus method to solve the following technical problems: First, for the problem that the consensus delay of traditional PBFT increases with the increase of consensus nodes, the present invention considers the trust value of vehicles in the vehicle networking, the communication channel capacity, and the data collection time, and uses multi-criteria decision analysis to select the top K vehicles to form a consensus node set for delegated consensus. After the consensus, the trust value of the node performance is continuously evaluated for the next round of consensus node selection. Second, the main node election mechanism of the traditional PBFT consensus algorithm relies on the view rotation method, which is vulnerable to attacks by malicious nodes and affects the security and fairness of the system. The present invention randomly selects among the consensus nodes based on the verifiable random function (VRF), ensuring that each node has the possibility of being selected as the main node, and malicious nodes cannot know the specific rule of the main node selection, which is more secure and reliable. Then, in the Prepare and Commit stages based on the traditional PBFT consensus algorithm, the present invention introduces the BLS-based aggregate signature technology, allowing the consensus nodes to send messages to the main node. After verification by the main node, an aggregate signature is sent to the consensus nodes, effectively reducing the communication complexity in the consensus of the PBFT algorithm. Finally, in view of the bottleneck of the existing PBFT consensus algorithm in improving throughput, the present invention is based on the deep reinforcement learning algorithm of D3QN to make decisions on the block size, block interval time, and the proportion of delegated consensus during blockchain consensus, optimizing the throughput TPS during blockchain consensus.

[0030] Further, as Figure 1 shown, a secure and efficient improved PBFT vehicle networking blockchain consensus method includes the following steps:

[0031] Step 1: The vehicle nodes sort out the traffic data to be published, send requests to the roadside unit (RSU), and compete for the leader node. The roadside unit (RSU) pre-screens the vehicles according to the trust value of the vehicles competing for the leader node. If it exceeds the set threshold, the screening is passed, and the initial set of delegated consensus nodes is obtained;

[0032] Step 2: As Figure 2 shown, the roadside unit (RSU) performs decision analysis on the vehicle nodes in the initial set of delegated consensus nodes obtained in Step 1 based on the multi-criteria decision analysis method, based on the trust value of the vehicles, the communication channel capacity, the difference between the collection time of the traffic data and the existing time stamp, obtains a score ranking, and selects the top K nodes in the score ranking as the delegated consensus nodes;

[0033] Further, the multi-criteria decision analysis method in Step 2 is specifically as follows:

[0034] Step 2.1: Determine the criteria

[0035] First, clarify the nature of each criterion. The profitability criteria include the trust value of the vehicle and the communication channel capacity of the vehicle. The larger these criteria are, the better. The cost-type criteria include the difference between the data collection time and the existing timestamp. The smaller these criteria are, the better.

[0036] Step 2.2: Perform data processing on the criteria determined in Step 2.1 to obtain the weighted normalized decision matrix V

[0037] Step 2.2.1: Use the BWM method (Best-Worst Method) to determine the criterion weights w j

[0038] Step 2.2.1.1: According to the decision maker's judgment, select one of the most important criteria, i.e., the trust value; and one of the least important criteria, i.e., the difference between the data collection time and the existing timestamp;

[0039] Step 2.2.1.2: According to the decision maker's judgment, construct a comparison vector A of the most important criterion (trust value) with the communication channel capacity of the vehicle and the difference between the data collection time and the existing timestamp B :

[0040] A B =(a 1 ,a 2 )

[0041] Each of its elements a 1 ,a 2 represents the relative importance of the most important criterion with respect to the communication channel capacity of the vehicle and the difference between the data collection time and the existing timestamp;

[0042] According to the decision maker's judgment, construct a comparison vector A of the trust value of the vehicle, the communication channel capacity of the vehicle with the least important criterion W :

[0043] A W =(b 1 ,b 2 )

[0044] Each of its elements b 1 ,b 2 represents the relative importance of the trust value of the vehicle, the communication channel capacity of the vehicle with respect to the least important criterion;

[0045] Step 2.2.1.3: By solving the linear programming problem, obtain the criterion weights. The goal is to find a set of weights that minimizes the maximum deviation, i.e.:

[0046]

[0047] If we set ξ as the minimum value of the maximum deviation, then the following linear programming problem is constructed:

[0048] min ξ

[0049] Subject to:

[0050]

[0051] w j ≥ 0

[0052] By solving the above linear programming problem, the criterion weight w j ;

[0053] Step 2.2.2: Based on the criterion weight w j obtained in Step 2.2.1, construct the weighted normalized decision matrix V

[0054] First, construct the decision matrix X according to the vehicle data:

[0055]

[0056] Then, use the normalization method to normalize the decision matrix R. For the benefit-type criterion, use the following formula:

[0057]

[0058] For the cost-type criterion, use the following formula:

[0059]

[0060] Finally, multiply the normalized decision matrix R by the criterion weight w j determined by the BWM method to obtain the weighted normalized decision matrix V:

[0061] v ij = w j × r ij

[0062] Step 2.3: Based on the weighted normalized decision matrix V obtained in Step 2.2, use the multi-criteria optimization and compromise solution method (VIKOR method) to calculate the comprehensive index Q and obtain the score ranking

[0063] Step 2.3.1: Determine the ideal solution and the negative ideal solution

[0064] First, determine the ideal solution and the negative ideal solution of the benefit-type criterion and the cost-type criterion;

[0065] A + = max(v ij ) | j ∈ J 1 , min(vij ) | j ∈ J 2

[0066] A - = min(v ij ) | j ∈ J 1 ; max(v ij ) | j ∈ J 2

[0067] where J 1 is the set of benefit criteria, and J 2 is the set of cost criteria; Ideal solution A+: For each benefit criterion, take the maximum value; for each cost criterion, take the minimum value; Negative ideal solution A-: For each benefit criterion, take the minimum value; for each cost criterion, take the maximum value;

[0068] Step 2.3.2: Calculate the distances from each vehicle criterion solution to the ideal solution and the negative ideal solution

[0069] Based on the ideal solution obtained in Step 2.3.1, calculate the deviation S i and the maximum deviation R i :

[0070]

[0071]

[0072] Deviation S i : Represents the sum of the total deviations of each vehicle criterion solution over all criteria; the smaller the value, the closer the solution is to the ideal solution as a whole; Maximum deviation R i : Represents the maximum deviation between each vehicle criterion solution and the ideal solution among all criteria; the smaller the value, the closer the solution is to the ideal solution even in the least important criterion solution;

[0073] Step 2.3.3: Calculate the comprehensive index Q

[0074] Based on the deviation S i calculated in Step 2.3.2 and the maximum deviation R i , calculate the comprehensive index Q i :

[0075]

[0076] where S * = min(S i ) represents the minimum total deviation among all solutions; S - = max(S i ) represents the maximum total deviation among all solutions; R *= min(R i ) represents the minimum maximum deviation among all scenarios; R - = max(R i ) represents the maximum maximum deviation among all scenarios; v represents the compromise coefficient; Q i value is the comprehensive result of the S value and the R value, balancing the influence of the S value and the R value through the compromise coefficient v; Q i The smaller the Q value, the better the comprehensive performance of the scenario in terms of the total deviation and the maximum deviation.

[0077] Step 2.3.4: Sorting

[0078] Based on the comprehensive index Q obtained in Step 2.3.3 i sort the vehicle criterion scenarios. The smaller the Q i value, the higher its ranking.

[0079] Step Three: Use the VRF verifiable random function to select the primary node. Based on the block size created in this round of consensus, the current leader node uses a pseudo-random number generator (PRNG) to generate a random number seed in the last consensus round. Other consensus nodes generate a random number L based on the random number seed, and select the node with the largest output random number L as the leader node;

[0080] Furthermore, in Step Three of the present invention, the VRF verifiable random function is used to select the primary node. VRF is the verifiable random function. On the one hand, it has pseudo-randomness, and on the other hand, it also has verifiability (the output includes a non-interactive zero-knowledge proof). The present invention randomly selects a leader from the consensus committee through the VRF verifiable random function. By sorting the random number L output by the VRF verifiable random function, it is stipulated that the node with the largest output random number L is the leader node. Specifically:

[0081] 1) Based on the block size created in this round of consensus, the current leader node uses a pseudo-random number generator (PRNG) to generate a random number seed seed in the last consensus round. The leader node adds the random number seed seed to the message and broadcasts it. All other nodes in the network will receive the random number seed seed;

[0082] 2) Consensus node A receives the seed, uses the VRF verifiable random function to calculate the random number L and the zero-knowledge proof proof and broadcasts them;

[0083] L = VRF(SK, seed), Proof = VRF_Proof(SK, seed)

[0084] 3) The consensus node B that receives the random number L from the consensus node A will determine whether the Proof is valid; that is, whether the random number L can be calculated through the proof. If the proof is valid, the consensus node B will continue to verify; otherwise, it will abort.

[0085]

[0086] 4) The consensus node B continues to verify the public key PK, the random number seed seed, and the zero-knowledge proof proof of the consensus node A through the verification function; if so, the consensus node B will sign and continue to broadcast this proof to other consensus nodes; if the verification fails, the zero-knowledge proof proof will be destroyed.

[0087] True / False = VRF Verify (PK, S, Proof)

[0088] 5) The roadside unit (RSU) will accept the signed random number L generated by the consensus node, add it to the local random number set, and select the node with the largest random number as the leader node Leader for this round.

[0089] LN L = max{L 1 , L 2 ..., L n}}.

[0090] Step 4: Use the leader node selected in Step 3 as the primary node for consensus. In the preparation stage and the submission stage of the consensus, use the BLS-based signature technology for aggregate signature to reduce the communication complexity of the consensus.

[0091] Furthermore, in the above Step 4, the specific process of the aggregate signature using the BLS-based signature technology includes:

[0092] Step 4.1: BLS signature technology

[0093] The BLS signature consists of four parts, and the specific process is as follows:

[0094] (1) Initialization

[0095] Set G 0 , G 1 , G 2 , G T as multiplicative groups of prime order q, and there exists a bilinear mapping e: G 0 ×G 1 →G T , g 0 and g 1 are the generators of G 0 , G 1 respectively, and the hash function H0 : M → G 0 ;

[0096] (2) Key Generation

[0097] Select a random integer α and set Output P k : = (h), S k = (α);

[0098] (3) Aggregate Signature

[0099] For a given tuple (P ki , m i , σ i ), where i = 1, …, n, through σ ← σ 1 , …, σ n ∈ G 0 Aggregate σ 1 , …, σ n ∈ G 0 into a short aggregate signature;

[0100] (4) Signature Verification

[0101] Verify the aggregate signature σ ∈ G 1 through the equation e(g k1 , σ) = e(P kn , …, P 0 , H 0 (m)), if the verification passes, output VALID, otherwise output INVALID;

[0102] Step 4.2: As Figure 3 shown, based on the BLS signature technology in Step 4.1, perform aggregate signature and improve the PBFT consensus algorithm. The process includes:

[0103] (1) Request Phase

[0104] The client vehicle C-V sends a transaction request to the primary node Primary in the following format:

[0105]

[0106] where e represents the data that the client node wants to upload; t represents the timestamp of the request; c represents the identifier of the client; sig c represents the signature of the client node for this message;

[0107] (2) Pre-Prepare Phase

[0108] The primary node receives a transaction request from the client and first performs verification to validate whether the signature of the client request message is correct. If it is incorrect, the request is an illegal transaction and is discarded; if it is correct, a view number v and a sequence number n assigned to this request are allocated for sorting the request. Then, the client request data is packaged with its own data into a transaction, and the transaction is signed using the private key and broadcast to the consensus network.

[0109] In the request, the data is uploaded to the blockchain; the specific transaction format is as follows:

[0110]

[0111] Among them, E represents the data set E = (e 1 , e 2 ,..., e i ); h represents the hash value, that is, h = Hash(E||v||n); sig l→h represents the signature of the primary node on h, which can prevent malicious nodes from tampering with the data; sig l is the signature of the leader node on this message.

[0112] (3) Preparation Phase (Prepare)

[0113] After receiving the transaction information in the pre-prepare phase, other consensus nodes first verify the correctness of the signature, view number, and sequence, then verify the correctness of the data to be uploaded to the chain in the request and verify the hash value h to prevent malicious nodes from tampering with the data. Finally, a prepare message is constructed and sent to the leader node, and the PRE-PREPARE and PREPARE messages are recorded in the local log for completing the request operations that were not completed in this round of consensus when the view is switched:

[0114]

[0115] Among them, i represents the verification result of the i-th consensus node on the leader node's message; sig i→h represents the signature of the i-th slave node on h; sig i represents the signature of the consensus node on this message;

[0116] When the leader node receives PREPARE messages from 2f consensus nodes, where f represents the number of PBFT-tolerated invalid or malicious nodes, it also first verifies the signature, view number, and sequence number, then verifies the correctness of the data to be uploaded to the chain in the request and verifies the hash value h. Finally, the leader node aggregates the signatures of the consensus nodes based on the BLS signature technology and then constructs a message for broadcasting;

[0117]

[0118] Among them:

[0119] Message = (PREPARE, v, n, h, i, E)

[0120] sig agr = sig i→h sig l→h

[0121] Using aggregate signature not only reduces the data volume of the prepare messages sent by nodes, but also reduces the verification work after nodes receive the signatures. In addition, adopting this aggregate signature scheme can also optimize the communication complexity of the consensus process.

[0122] (4) Commit phase

[0123] After receiving the message from the leader node, the follower nodes first verify the validity of the aggregate signature using the following formula:

[0124] where sk l , pk l are the private key and public key of the leader node respectively; then verify whether the number of nodes generating the aggregate signature message is greater than 2f + 1. If the aggregate signature verification fails, it is considered that the leader node has Byzantine behavior and broadcasts a view change message;

[0125] After verification, the follower nodes submit the verified information to the leader node again. The message is:

[0126]

[0127] After receiving the verification message results of 2f consensus nodes, the leader node also aggregates the signatures again, constructs a message with the aggregate signature and broadcasts it to the consensus nodes for verification, and saves the COMMIT message to the local log; the specific message format is:

[0128]

[0129] where:

[0130] Message = (COMMIT, v, n, h, i, E)

[0131] sig agr = sig i→h sig l→h

[0132] (5) Reply phase

[0133] After receiving the message with the aggregated signature sent by the leader node, the consensus node verifies its correctness and quantity. If the verification is correct, it executes the request of the client vehicle node and sends a response message to the client vehicle node. The message format is as follows:

[0134]

[0135] Among them, r i represents the result of the node executing the request. If the client receives f + 1 response messages, it means that the consensus reaches consistency.

[0136] Step Five: Based on the entire consensus process, use the deep reinforcement learning algorithm of D3QN to make decisions on the block size, block interval time, and the selection of the quantity ratio of the entrusted consensus nodes in Step Two in blockchain consensus, and optimize the throughput of blockchain consensus;

[0137] Furthermore, the specific method of Step Five includes:

[0138] First of all, the scalability of the blockchain is an indicator that determines whether the blockchain system can achieve sufficient throughput performance when the network expands. At the same time, the latency in the message exchange and verification process also needs to be considered. In addition, the performance metric should also consider decentralization and security, and these factors are related to the blockchain's trilemma (scalability, security, and decentralization). There are trade - off relationships among these blockchain performance metrics.

[0139] Step 5.1: Analyze performance metrics

[0140] In blockchain consensus, the performance metrics include scalability, consensus latency, security, and decentralization; there are certain constraints among these performance metrics when optimizing the throughput of blockchain consensus.

[0141] Step 5.1.1: Analyze and process the scalability of blockchain consensus

[0142] Scalability, that is, the throughput of blockchain consensus, represents the number of transactions that the blockchain network can process and confirm per second; the block producer generates a B - byte block to submit the block to the consensus round; in the blockchain system, the maximum throughput is calculated by the following formula:

[0143]

[0144] Among them, TI is the block interval, b is the average transaction size, and this formula means that given the block size and transaction size, the maximum number of transactions that the blockchain network can process per second;

[0145] Step 5.1.2: Analyze and process the consensus latency of blockchain consensus

[0146] Consensus latency refers to the time when a transaction enters the blockchain network and is irreversibly chained into the blockchain after being processed through consensus; the total latency T latency is:

[0147] T latency = TI + T consensus = TI + T v + T p

[0148] Among them, T consensus is the total consensus time, which consists of T v and T p and represents the message verification latency and the message propagation time respectively; by calculating these factors, the latency in the consensus process and the efficiency of the blockchain network in processing transactions can be evaluated.

[0149] Specifically, among the K delegated nodes, there is a block producer, and the other K - 1 nodes act as verifiers; the block producer generates M (batch size) blocks and then propagates the blocks to the verifiers. During the consensus process, the block producer processes M signatures and 2M + 4(K - 1) message authentication code (MAC) operations, while the verifiers verify M signatures and M + 4(K - 1) MAC operations;

[0150] Therefore, the verification latency of the block producer is calculated as:

[0151] T vpr = Mθ + [2M + 4(K - 1)]α / c pr

[0152] Among them, c pr is the computing power of the block producer;

[0153] The verification latency of the verifier is:

[0154]

[0155] Among them, c i is the computing power of the verification node i;

[0156] Since the verification processes of the delegated nodes are carried out in parallel, the message verification latency is expressed as:

[0157]

[0158] Message propagation time refers to the time it takes for a node to transmit a message and reach the target node. To prevent excessive latency in the consensus process due to node unresponsiveness, a timeout ζ is set for each consensus stage. Therefore, according to each consensus step, the message propagation time is calculated by the following formula:

[0159]

[0160] Among them, MB is the block size; R pr,i is the transmission rate between the block producer and verifier i; R i,client is the transmission rate between node i and the client, and ζ is the timeout setting used to prevent excessive delays; the above formula includes the message propagation times of the pre-prepare phase, prepare phase, commit phase, and reply phase;

[0161] Based on all the delay factors, the delay constraint is expressed as:

[0162] T latency = TI + T v + T p ≤ uTI

[0163] Among them, TI is the block interval, T v is the message verification delay, and T p is the message propagation time;

[0164] Step 5.1.3: Analyze and process the security of blockchain consensus

[0165] In the delegated PBFT consensus process based on multi-criteria decision analysis, the delegated nodes are responsible for the consensus process. In this case, the security is further analyzed:

[0166] The security in the delegated PBFT consensus process is evaluated by the trust value of the delegated nodes and the number of malicious nodes; assume that the number of malicious nodes in the consensus process satisfies the condition The system can maintain security in the presence of malicious nodes. This is because even if malicious nodes try to interfere with the consensus process by sending incorrect commit messages, the remaining honest nodes can still ensure the correctness of the consensus through the trust evaluation and voting mechanism.

[0167] In a blockchain system with N nodes, when the delegation ratio is φ, φN delegated nodes participate in the consensus. If the probability of malicious nodes is p, in the worst case, all Np malicious nodes are assigned as delegated nodes; in this case, it must be satisfied that and the maximum value of φ is 1. Therefore, the range of the delegation ratio is:

[0168]

[0169] If the probability of malicious nodes in the set of delegated nodes is p d , then the number of malicious delegated nodes participating in the consensus process of the present invention is Therefore, according to the security conditions of the PBFT consensus algorithm, it must be satisfied that Therefore, the range of the delegation ratio is:

[0170]

[0171] The roadside unit (RSU) sets the delegation ratio that meets the security constraints according to the state of the blockchain network. Even if malicious nodes participate in the consensus process, valid blocks can be generated through the consensus process.

[0172] Step 5.1.4: Use the Gini coefficient to decentralize the selection of the leader node

[0173] There are various methods to measure decentralization, including fairness, entropy value, and similarity. To evaluate the decentralization of the solution of the present invention, the present invention uses the Gini coefficient, which is an index commonly used to measure inequality; since the solution of the present invention is based on the delegation method, if the same node is continuously selected as the main node, it may lead to a decrease in the decentralization of the blockchain. Therefore, the focus of this solution is to decentralize the selection of the main node, and the specific calculation formula is:

[0174]

[0175] where δ i represents the number of times node i is selected as the main node, and δ ave represents the average number of times the consensus node set is selected as the main node. The value of the Gini coefficient ranges between 0 and 1. If the value is close to 1, it means that the variance of δ i is large and the decentralization performance decreases; to maintain the decentralization performance, the present invention constrains the Gini coefficient by setting a decentralization threshold η:

[0176] G(δ) ≤ η

[0177] If the Gini coefficient violates this constraint, the roadside unit (RSU) reduces the number of times this node is selected as the main node and allows more nodes to be selected as the main node to improve the degree of decentralization;

[0178] 5.2: Construct the state space

[0179] According to the decision time step t, it is represented by five variables:

[0180]

[0181] where R = {R i,h ∣1 ≤ i, j ≤ K} represents the data transmission rate from node i to node j; c = {c i ∣1 ≤ i ≤ K} represents the computing power of node i; δ = {δ i ∣1 ≤ i ≤ K} represents the number of times each node is selected as the main node; r = {ri {1 ≤ i ≤ K} represents the trust value of the nodes; represents the probability of malicious delegated nodes;

[0182] 5.3: Construct the action space, that is, make decisions on the block size, block interval time in blockchain consensus, and the selection of the proportion of the number of delegated consensus nodes in step 2

[0183] The DRL agent selects actions based on the state of the blockchain environment to maximize the long-term reward. The action space at decision time step t includes the block size B, the block interval time TI, and the proportion φ of the number of delegated consensus nodes in step 2, expressed as:

[0184] A t = [B, TI, φ] t

[0185] where the block size B ∈ {1, 2, …, B max}, and the maximum block size is B max ; the block interval time TI ∈ {0.5, 1, …, TI max}, and the maximum block interval is TI max ; the proportion φ of the number of delegated consensus nodes in step 2 ∈ {0.1, 0.2, …, 1}, and the set of delegated nodes K is selected according to the multi-criteria analysis ranking of the nodes;

[0186] 5.4: Based on the constraint conditions of the performance metrics in step 5.1, construct a joint optimization problem, that is, optimize the throughput of blockchain consensus

[0187] The reward of the DRL agent is set to maximize the throughput of the blockchain system while satisfying the constraints of consensus latency, security, and decentralization; the objective function and constraints of the reward are expressed as:

[0188]

[0189] where is the state-action value function;

[0190] 5.5: Design the reward function

[0191] According to the reward function R at time step t t is:

[0192]

[0193] The reward is valid only when all constraint conditions are met; if any constraint condition is not met, the value of the reward function is zero; therefore, the DRL agent selects the best action according to the state of the blockchain network to maximize the long-term reward while satisfying the constraints of security, latency, decentralization, etc.

[0194] 5.6: Deep Reinforcement Learning Algorithm for Designing D3QN

[0195] The D3QN algorithm uses a deep neural network to approximate the Q-function. The state s is used as the input to the deep neural network, and the deep neural network outputs the estimated Q-values for all actions. Then, the ∈-greedy method is used for action selection to balance action exploration and exploitation. Specifically, the ∈-greedy method randomly selects an action with a probability of ∈ among all actions for exploration, or selects the action a with the maximum estimated value output from the D3QN algorithm with a probability of 1 - ∈ for exploitation. Therefore, the action of the DRL agent is:

[0196]

[0197] where, is the action-state value function, and U(A (V) ) is the discrete uniform distribution function from action A (V) . ε ∈ [0, 1] is a hyperparameter used to adjust the balance between action exploration and exploitation. The D3QN algorithm can select actions with high feedback rewards or explore actions that may have higher rewards but have not been selected yet, thereby exploring the entire action space and updating the Q-values. Ω represents the weights of the training network and is continuously updated using the experience replay mechanism;

[0198] The agent based on the D3QN algorithm finds the optimal policy to maximize the long-term cumulative reward, and its expression is: where γ ∈ [0, 1) is the discount rate of the reward. When is bounded, set γ = 1. When is unbounded, set γ < 0;

[0199] The optimal policy can be solved through the Bellman equation, and its elements include: the discrete state set S (V) , the discrete action set A (V) and the state transition probability Therefore, for time slot t, the state-action function (Q-function) of the agent is:

[0200]

[0201] where π is the policy of the agent at time slot t. Correspondingly, the update expression of the Q-function is:

[0202]

[0203] The D3QN algorithm uses a deep neural network to approximate the Q-function, which consists of a training network and a target network. The training network is used for the selection of actions in the current model, and the network parameters are Ω t; The target network is used for the evaluation of actions, and its network parameters are The goal of training the network is:

[0204]

[0205] Step 6: After reaching a consensus, based on the consensus performance of the nodes, evaluate and update the trust values of the nodes. The master node packs and uploads the traffic data and stores it in the blockchain ledger, and the roadside unit (RSU) saves a complete copy of the ledger.

[0206] Furthermore, in Step 6, based on the consensus performance of the nodes, evaluate and update the trust values of the nodes as follows:

[0207] R total = ω 1 *R own + ω 2 *P i

[0208] where R own is the reputation value of the vehicle before this round of consensus, and P i is the consensus participation rate after this round of consensus, which measures the consensus participation of the nodes;

[0209]

[0210] where m is the number of times the node has successfully participated in this round of consensus, and M is the total number of participations;

[0211] If the master node fails or becomes a Byzantine node, first kick this Byzantine master node out of the consensus committee and directly halve the trust value of this Byzantine master node, then select new consensus nodes from the remaining node set to fill the missing consensus nodes. At the same time, select a new leader node and complete the view conversion.

[0212] In view of the security and throughput problems in the consensus algorithm of the Internet of Vehicles combined with blockchain, a secure and efficient consensus scheme based on multi-criteria decision analysis and deep reinforcement learning algorithm is designed. This scheme considers the scenario of data sharing in the Internet of Vehicles, and there is a roadside unit (RSU) that stores the block ledger of the vehicle blockchain, which serves as the basis and source for vehicle data sharing and data storage. Based on multi-criteria decision analysis, considering the trust value of vehicle nodes, communication channel capacity, and data collection time, a multi-criteria analysis model is built to analyze the top K vehicle nodes as consensus nodes. By jointly deciding on the block size of the blockchain, block interval time, and the selection of the delegation ratio of multi-criteria decision analysis, the throughput of the blockchain consensus algorithm is optimized. At the same time, a corresponding trust value update algorithm is designed to incentivize and punish the consensus behavior of vehicle consensus nodes for subsequent rounds of consensus decision-making. In addition, based on the PBFT consensus algorithm, the selection of the primary node based on the VRF verifiable random function is designed. The block hash created in this round of consensus is used as the random number seed seed and broadcast to other consensus nodes to create random numbers to select the primary node, which is more random and effectively guards against attacks from malicious nodes. And in the preparation stage and submission stage of the traditional PBFT consensus algorithm, the BLS-based aggregation signature technology is adopted to effectively reduce the communication complexity of the consensus algorithm and improve the throughput of the consensus algorithm.

[0213] Experimental Analysis

[0214] It can be seen from Figure 4 that as the number of nodes increases, the latency of the traditional PBFT algorithm increases significantly, and the latency increase of the present invention and the SG-PBFT method is not large. At the same time, because the present invention uses the BLS signature technology for aggregation signature to reduce the communication complexity, the latency of the present invention is lower than that of the SG-PBFT method.

[0215] Figure 5 Figure is a schematic diagram of the analysis and comparison of the throughput and the number of nodes between the method of the present invention and other consensus algorithms. It can be seen from Figure 5 that as the number of nodes increases, the throughput of the traditional PBFT algorithm decreases significantly. This is because as the number of nodes increases, the communication complexity of the PBFT algorithm increases, the consensus latency increases, and the throughput decreases. And because the present invention uses the BLS signature technology for aggregation signature to reduce the communication complexity and reduce the consensus latency, the throughput of the present invention is higher than that of the SG-PBFT method.

[0216] Figure 6 Figure is a schematic diagram of the throughput optimization convergence of the present invention based on the deep reinforcement learning algorithm. It can be seen from Figure 6It can be seen that during the training process of the model, it gradually converges. The reward steadily increases as the training progresses and finally reaches a relatively stable state, indicating that the trained model can effectively optimize the throughput of the consensus algorithm. At the same time, it can be seen from Figure 6 that the throughput reward of the present invention based on the D3QN algorithm at the final convergence is higher than that based on the DDQN and DQN algorithms, and the optimization effect is much better than that based on the DDQN and DQN algorithms.

[0217] Figure 7 Fig. is a schematic diagram comparing the communication overheads of the method of the present invention with other consensus algorithms. It can be known from Figure 7 that as the number of nodes increases, the communication overhead of the method of the present invention is smaller than that of the traditional PBFT and SG-PBFT methods, and the growth is slower than that of the traditional PBFT and SG-PBFT methods.

[0218] In the existing improved consensus algorithms based on PBFT, only a single factor is considered in the selection of the entrusted consensus nodes, ignoring the changes and dynamics of the nodes. Secondly, the throughput optimization of the traditional PBFT consensus algorithm is statically designed and easily reaches a bottleneck. The optimization design of the relevant performance of the consensus algorithm is not considered, and the throughput of the blockchain consensus is dynamically optimized. Finally, regarding the selection of the primary node in PBFT consensus, the randomness of the selection is not considered. If the selection rule is cracked by malicious nodes, the malicious nodes will control the selection of the primary node. Therefore, there is no other alternative solution that can fully achieve the purpose of the present invention.

[0219] The key points and protection points of the present invention include:

[0220] 1. Through the joint vehicle trust value, communication channel capacity, and data collection time, multi-criteria decision-making analysis and evaluation of vehicles are carried out to obtain a score ranking for the selection of entrusted consensus nodes, which is the content of step two.

[0221] 2. Based on the BLS signature technology, the preparation stage and submission stage in the traditional PBFT consensus are improved, and the signatures of the nodes are aggregated to reduce the problem of the increase in communication complexity caused by the increase in the number of nodes in PBFT, which is the content of step three.

[0222] 3. Based on the D3QN deep reinforcement learning algorithm, joint decision-making is carried out on the number ratio of entrusted consensus nodes, block size, and block interval time to optimize the throughput of the blockchain consensus, which is the content of step four.

[0223] 4. Using the VRF verifiable random function, a random number is generated based on the block size created by the previous consensus, and the consensus primary node is selected based on the random number, which is the content of step five.

[0224] The present invention also provides a secure and efficient improved PBFT vehicle networking blockchain consensus system, including:

[0225] An initial set acquisition module, which is used to organize the traffic data to be published by vehicle nodes in step 1, send a request to a roadside unit (RSU), compete for a leader node, and the roadside unit (RSU) pre-screens vehicles according to the vehicle trust value for competing for the leader node. If it exceeds the set threshold, the screening is passed to obtain an initial set of entrusted consensus nodes;

[0226] A score ranking acquisition module, which is used to implement step 2. The roadside unit (RSU) performs decision analysis on vehicle nodes in the initial set of entrusted consensus nodes obtained in step 1 based on the multi-criteria decision analysis method, based on the trust value of the vehicle, the communication channel capacity, the difference between the collection time of traffic data and the existing timestamp, obtains a score ranking, and selects the top K nodes in the score ranking as entrusted consensus nodes;

[0227] A leader node selection module, which is used to implement step 3. The verifiable random function (VRF) is used to select the main node. Based on the block size created in this round of consensus, the current leader node uses a pseudo-random number generator (PRNG) to generate a random number seed in the last consensus round, and other consensus nodes generate a random number L based on the random number seed. The node with the largest output random number L is selected as the leader node;

[0228] An aggregated signature module, which is used to implement step 4. The leader node selected in step 3 is used as the main node for consensus, and the aggregated signature technology based on BLS is used for aggregated signature in the preparation stage and submission stage of consensus;

[0229] A throughput optimization module for blockchain consensus, which is used to implement step 5. Based on the entire consensus process, the deep reinforcement learning algorithm of D3QN is used to make decisions on the block size, block interval time in blockchain consensus, and the selection of the number ratio of entrusted consensus nodes in step 2, so as to optimize the throughput of blockchain consensus;

[0230] A trust value evaluation and update module, which is used to implement step 6. After the consensus is completed, based on the consensus performance of the node, the trust value of the node is evaluated and updated. The main node packs and uploads the traffic data, stores it in the blockchain ledger, and the roadside unit (RSU) saves a complete copy of the ledger.

[0231] The present invention also provides a secure and efficient improved PBFT vehicle networking blockchain consensus device, including:

[0232] A memory: storing a computer program of the above-mentioned secure and efficient improved PBFT vehicle networking blockchain consensus method, which is a computer-readable device;

[0233] Processor: When executing the computer program, it is used to implement the described secure and efficient improved PBFT vehicle networking blockchain consensus method.

[0234] The present invention also provides a computer-readable storage medium. The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, it can implement the described secure and efficient improved PBFT vehicle networking blockchain consensus method.

Claims

1. A safe and efficient improved PBFT Internet of Vehicles blockchain consensus method, characterized by: The following steps are involved: Step 1: The vehicle node organizes the traffic data to be released and sends a request to the roadside unit (RSU) to compete for the leader node. The roadside unit (RSU) pre-screens the vehicle according to the vehicle trust value of the competing leader node. If it exceeds the set threshold, the screening passes and the initial set of delegated consensus nodes is obtained; Step 2: The roadside unit (RSU) performs decision analysis on the vehicle nodes in the initial set of delegate consensus nodes obtained in step 1 based on the trust value of the vehicle, the capacity of the communication channel, and the difference between the collection time of the traffic data and the existing timestamp according to the multi-criteria decision analysis method, and obtains the score ranking. The top K nodes in the score ranking are selected as delegate consensus nodes. Step 3: Use the VRF verifiable random function to select the master node. Based on the block size created in this round of consensus, the current leader node uses a pseudo-random number generator (PRNG) to generate a random number seed in the last consensus round. Other consensus nodes generate a random number L based on the random number seed, and select the node with the largest output random number L as the leader node. Step 4: The leader node selected in step 3 is used as the master node for consensus, and the BLS-based signature technology is used for aggregate signature in the preparation and submission stages of the consensus; Step 5: Based on the entire consensus process, the D3QN deep reinforcement learning algorithm is used to make decisions on the block size, block interval time, and the number of delegated consensus nodes in step 2 in the blockchain consensus to optimize the throughput of the blockchain consensus; Step 6: After consensus is reached, the trust value of the node is evaluated and updated based on the consensus performance of the node. The master node packages and uploads the traffic data to the blockchain ledger, and the roadside unit (RSU) saves a complete copy of the ledger.

2. A safe and efficient improved PBFT Internet of Vehicles blockchain consensus method according to claim 1, characterized in that: The multi-criteria decision analysis method of step 2 is specifically as follows: Step 2.1: Determine the criteria First, the nature of each criterion is clarified. The profitability criterion includes the trust value of the vehicle and the communication channel capacity of the vehicle. The cost criterion includes the difference between the data collection time and the existing timestamp. Step 2.2: Process the criteria determined in step 2.1 to obtain the weighted standardized decision matrix V Step 2.2.1: Using the BWM method, determine the criterion weight w j Step 2.2.1.1: Based on the decision maker’s judgment, select the most important criterion, i.e., the trust value; and the least important criterion, i.e., the difference between the data collection time and the existing timestamp; Step 2.2.1.2: Based on the decision maker’s judgment, construct a comparison vector A of the most important criteria and the communication channel capacity of the vehicle, the difference between the data collection time and the existing timestamp B : <h2 style=";text-align:left;direction:ltr">A<h2 style=";text-align:left;direction:ltr"> B <h2 style=";text-align:left;direction:ltr"> (a1,a2) Each of its elements a1, a2 represents the relative importance of the most important criterion with respect to the capacity of the vehicle's communication channel and the difference between the data collection time and the existing timestamp; According to the decision maker’s judgment, a comparison vector A of the vehicle’s trust value, the vehicle’s communication channel capacity, and the least important criterion is constructed W : <h2 style=";text-align:left;direction:ltr">A<h2 style=";text-align:left;direction:ltr"> W <h2 style=";text-align:left;direction:ltr"> (b1,b2) Each of its elements b1, b2 represents the relative importance of the trust value of the vehicle and the communication channel capacity of the vehicle with respect to the least important criterion; Step 2.2.1.3: By solving the linear programming problem, the criterion weights are obtained, namely: If ξ is set as the minimum value of the maximum deviation, the following linear programming problem is constructed: minξ satisfies: w j ≥0 By solving the above linear programming problem, we can obtain the criterion weight w j ; Step 2.2.2: Based on the criterion weight w obtained in step 2.2.1 j , construct the weighted standardized decision matrix V First, construct the decision matrix X based on the vehicle data: Then use the normalization method to standardize the decision matrix R. For the benefit criterion, use the following formula: For cost-based criteria, the following formula is used: Finally, the standardized decision matrix R is combined with the criterion weight w determined by the BWM method. j Multiply them together to get the weighted standardized decision matrix V: v ij =w j ×r ij Step 2.3: Based on the weighted standardized decision matrix V obtained in step 2.2, use the multi-criteria optimization and compromise solution method to calculate the comprehensive index Q and obtain the score ranking: Step 2.3.1: Determine the ideal solution and negative ideal solution Firstly, the ideal solution and negative ideal solution of profitability criterion and cost criterion are determined; A + =max(v ij )∣j∈J1,min(v ij )∣j∈J2 A - =min(v ij )∣j∈J1;max(v ij )∣j∈J2 Among them, J1 is the set of benefit criteria, J2 is the set of cost criteria; ideal solution A+: for each benefit criterion, take the maximum value; for each cost criterion, take the minimum value; negative ideal solution A-: for each benefit criterion, take the minimum value; for each cost criterion, take the maximum value; Step 2.3.2: Calculate the distance of each vehicle criterion solution to the ideal solution and the negative ideal solution: According to the ideal solution obtained in step 2.3.1, calculate the deviation S of each vehicle criterion solution i and the maximum deviation R i : Deviation S i : represents the sum of the total deviations of each vehicle criterion scheme on all criteria; the smaller the value, the closer the scheme is to the ideal solution as a whole; the maximum deviation R i : represents the maximum deviation between each vehicle criterion scheme and the ideal solution among all criteria; the smaller the value, the closer the scheme is to the ideal solution on the least important criterion scheme; Step 2.3.3: Calculate the comprehensive index Q The deviation S calculated according to step 2.3.2 i The maximum deviation R i , calculate the comprehensive index Q of each vehicle criterion scheme i : Among them, S * =min(S i ) represents the minimum total deviation among all solutions; S - =max(S i ) represents the maximum total deviation among all solutions; R * =min(R i ) represents the smallest maximum deviation among all solutions; R - =max(R i ) represents the largest maximum deviation among all solutions; v represents the compromise coefficient; Q i The value is the comprehensive result of S value and R value, and the influence of S value and R value is balanced by the compromise coefficient v; Q i The smaller the value, the better the overall performance of the scheme in terms of total deviation and maximum deviation; Step 2.3.4: Sorting The comprehensive index Q obtained from step 2.3.3 i Sort the vehicle criteria solutions, Q i The smaller the value, the higher its ranking.

3. A safe and efficient improved PBFT Internet of Vehicles blockchain consensus method according to claim 1, characterized in that: The specific method of step three includes: 1) Based on the block size created in this round of consensus, the current leader node uses a pseudo-random number generator (PRNG) to generate a random seed in the final consensus round. The leader node adds the random seed to the message and broadcasts it. All other nodes in the network will receive the random seed. 2) Consensus node A receives the seed, uses the VRF verifiable random function to calculate the random number L and the zero-knowledge proof and broadcasts them; L=VRF(SK,seed),Proof=VRF_Proof(SK,seed) 3) Consensus node B, which receives the random number L from consensus node A, will determine whether the Proof is valid; that is, whether the random number L can be calculated through the proof. If the proof is valid, consensus node B will continue to verify; otherwise, it will terminate; 4) Consensus node B continues to verify the public key PK, random number seed and zero-knowledge proof of consensus node A through the verification function; if yes, consensus node B signs and continues to broadcast the proof to other consensus nodes; if the verification fails, the zero-knowledge proof is destroyed; True / False=VRF Verify (PK,S,Proof) 5) The roadside unit (RSU) will accept the signed random number L generated by the consensus node, add it to the local random number set, and select the node with the largest random number as the leader node of this round; LN L =max{L1,L2...,L n }。 4. A safe and efficient improved PBFT Internet of Vehicles blockchain consensus method according to claim 1, characterized in that: In step 4, the specific process of performing aggregate signature based on BLS signature technology includes: Step 4.1: BLS Signature Technology The BLS signature consists of four parts, the specific process is as follows: (1) Initialization Set G0, G1, G2, G T is a multiplicative group of prime order q, and there exists a bilinear map e:G0×G1→G T ,g0 and g1 become the generators of G0 and G1 respectively, and the hash function H0:M→G0; (2) Key Generation Choose a random integer α and set Output P k :=(h),S k =(α); (3) Aggregate Signature For a given tuple (P ki ,m i ,σ i ), where i = 1,…,n, by σ←σ1,…,σ n ∈G0 will σ1,…,σ n ∈G0 is aggregated into a short aggregate signature; (4) Signature Verification Through the formula e(g1,σ)=e(P k1 ,…,P kn ,H0(m)), verify the aggregate signature σ∈G0, the verification is valid VALID, otherwise it outputs invalid INVALID; Step 4.2: Perform aggregate signature based on the BLS signature technology in step 4.1 and improve the PBFT consensus algorithm. The process includes: (1) Request phase The client vehicle CV sends a transaction request to the primary node Primary in the following format: Among them, e represents the data that the client node wants to upload; t represents the timestamp of the request; c represents the client's identifier; sig c Indicates the signature of the client node on this message; (2) Pre-Prepare When the master node receives a transaction request from a client, it first checks whether the signature of the client request message is correct. If not, the request is discarded as an illegal transaction. If correct, it assigns a view number v and a sequence number n to the request to sort the requests. Then, it packages the client request data and its own data into a transaction, signs the transaction with a private key, broadcasts it to the consensus network, and requests that the data be uploaded to the blockchain. The specific transaction format is: Where E represents the data set E = (e1, e2, ..., e i ); h represents the hash value, that is, h = Hash (E||v||n); sig l→h Indicates the signature of the master node on h, which can prevent malicious nodes from tampering with the data; sig l The signature of the leader node for this message; (3) Preparation After receiving the transaction information in the pre-preparation phase, other consensus nodes first verify the correctness of the signature, view number, and sequence, then verify the correctness of the requested on-chain data and the hash value h to prevent malicious nodes from tampering with the data. Finally, they construct a preparation message and send it to the leader node, and record the PRE-PREPARE and PREPARE messages in the local log so that the unfinished request operations of this round of consensus can be completed when the view is switched: Where i represents the verification result of the i-th consensus node on the leader node message; sig i→h Represents the signature of h by the i-th slave node; sig i Indicates the consensus node’s signature on this message; When the leader node receives PREPARE messages from 2f consensus nodes, where f represents the number of invalid or malicious nodes that PBFT tolerates, it also verifies the signature, view number, and sequence number first, then verifies the correctness of the requested on-chain data and the hash value h. Finally, the leader node aggregates the signatures of the consensus nodes based on the BLS signature technology, and then constructs a message for broadcast; in: Message = (PREPARE, v, n, h, i, E) say agr =say i→ hsig l→h (4) Commit After receiving the message from the master node, the slave node first verifies the validity of the aggregate signature using the following formula: Among them, sk l ,pk l They are the private key and public key of the leader node respectively; then verify whether the number of nodes that generate the aggregate signature message is greater than 2f+1. If the aggregate signature verification fails, it is considered that the leader node has Byzantine behavior and broadcasts the view switching message; After verification, the slave node submits the verified information to the master node again, and the message is: After receiving the verification message results from 2f consensus nodes, the leader node also aggregates the signatures again, builds a message with the aggregated signature and broadcasts it to the consensus nodes for verification, and saves the COMMIT message to the local log; the specific message format is: in: Message = (COMMIT, v, n, h, i, E) say agr =say i→ hsig l→h (5) Reply After receiving the message with the aggregate signature sent by the leader node, the consensus node verifies its correctness and quantity. If the verification is correct, it executes the request of the client vehicle node and sends a response message to the client vehicle node. The message format is: Among them, r i Indicates the result of the node executing the request. If the client receives f+1 response messages, it means that the consensus has been reached.

5. According to a safe and efficient improved PBFT Internet of Vehicles blockchain consensus method according to claim 1, it is characterized in that: The specific method of step five includes: Step 5.1: Analyze performance metrics In blockchain consensus, performance metrics include scalability, consensus latency, security, and decentralization; Step 5.1.1: Analyze the scalability of blockchain consensus Scalability, or the throughput of blockchain consensus, refers to the number of transactions that a blockchain network can process and confirm per second. A block producer generates a B-byte block to submit the block to a consensus round. In a blockchain system, the maximum throughput is calculated by the following formula: Where TI is the block interval and b is the average transaction size. This formula represents the maximum number of transactions that a blockchain network can process per second given the block size and transaction size. Step 5.1.2: Analyze and process the consensus delay of blockchain consensus Consensus delay refers to the time it takes for a transaction to enter the blockchain network and be irreversibly linked to the blockchain after consensus processing; the total delay T latency for: T latency =TI+T consensus =TI+T v +T p Among them, T consensus is the total consensus time, given by T v and T p Composition, respectively represents the message verification delay and message propagation time; Among the K delegate nodes, there is one block producer and the other K-1 nodes act as verifiers. The block producer generates M blocks and then propagates the blocks to the verifiers. During the consensus process, the block producer processes M signatures and 2M+4(K-1) message authentication code (MAC) operations, while the verifier verifies M signatures and M+4(K-1) MAC operations. The validation delay for a block producer is calculated as: Among them, c pr is the computing power of the block producers; The verification delay of the validator is: Among them, c i is the computing power of verification node i; The message verification delay is expressed as: The message propagation time refers to the time it takes for a node to transmit a message and reach the target node. A timeout ζ is set for each consensus stage. According to each consensus step, the message propagation time is calculated according to the following formula: Where, MB is the block size; R pr,i is the transmission rate between the block producer and the validator i; R i,client is the transmission rate between node i and the client, ζ is the timeout setting to prevent excessive delays; the above formula includes the message propagation time of the pre-prepare phase, the prepare phase, the commit phase, and the reply phase; Based on all the delay factors, the delay constraint is expressed as: T latency =TI+T v +T p ≤uTI Where TI is the block interval, T v is the message verification delay, T p is the time it takes for the message to spread; Step 5.1.3: Analyze the security of blockchain consensus In the delegated PBFT consensus process based on multi-criteria decision analysis, the delegated node is responsible for the consensus process and further analyzes security: The security of the delegated PBFT consensus process is evaluated by the trust value of the delegated node and the number of malicious nodes; the number of malicious nodes in the consensus process meets the condition Then the consensus process remains secure; In a blockchain system with N nodes, when the delegation ratio is φ, φN delegate nodes participate in the consensus. If the probability of a malicious node is p, in the worst case, all Np malicious nodes are assigned as delegate nodes; satisfying The maximum value of φ is 1, and the range of the entrustment ratio is: If the probability of malicious nodes in the delegate node set is p d , then the number of malicious delegate nodes participating in the consensus process is According to the security conditions of the PBFT consensus algorithm, The range of entrustment ratio is: Step 5.1.4: Decentralize the selection of leader nodes using the Gini coefficient The specific calculation formula is: Among them, δ i represents the number of times node i is selected as the primary node, δ ave It represents the average number of times the consensus node set is selected as the master node. The value of the Gini coefficient is between 0 and 1. If the value is close to 1, it means that the δ i The variance is large and the decentralization performance is reduced; the decentralization threshold η is set to constrain the Gini coefficient: G(δ)≤η If the Gini coefficient violates this constraint, the roadside unit (RSU) reduces the number of times this node is selected as the master node, allowing more nodes to be selected as the master node to improve the degree of decentralization; 5.2: Constructing the state space According to the decision time step t, it is expressed as five variables: Where R = {R i,h |1≤i,j≤K} represents the data transmission rate from node i to node j; c = {c i |1≤i≤K} represents the computing power of node i; δ={δ i |1≤i≤K} represents the number of times each node is selected as the primary node; r = {r i ∣1≤i≤K} represents the trust value of the node; represents the probability of a malicious delegate node; 5.3: Constructing the action space, i.e. making decisions on the block size, block interval time and the number of delegated consensus nodes in step 2 in the blockchain consensus The DRL agent selects actions based on the state of the blockchain environment to maximize long-term rewards. The action space at decision time step t includes the block size B, the block interval time TI, and the number ratio φ of the delegated consensus nodes in step 2, expressed as: AND t =[B,TI,φ] t Among them, the block size B∈{1,2,…,B max }, the maximum block size is B max ; Block interval TI∈{0.5,1,…,TI max }, the maximum block interval is TI max ; The number ratio of the delegated consensus nodes in step 2 φ∈{0.1,0.2,…,1}, selects the delegate node set K according to the multi-criteria analysis ranking of the nodes; 5.4: Based on the constraints of the performance indicators in step 5.1, construct a joint optimization problem, that is, optimize the throughput of blockchain consensus The reward of the DRL agent is set to maximize the throughput of the blockchain system while satisfying the consensus delay, security, and decentralization constraints; the objective function and constraints of the reward are expressed as: C1.T latency =TI+T v +T p o≤uTI C3.G(δ)≤η in, is the state-action value function; 5.5: Designing Reward Functions According to the reward function R at time step t t for: The reward is valid only when all constraints are met; if any constraint is not met, the value of the reward function is zero; 5.6: Designing a Deep Reinforcement Learning Algorithm for D3QN The D3QN algorithm uses a deep neural network to fit the Q function, with the state s as the input of the deep neural network, and the deep neural network outputs the estimated Q value of all actions; then, the ∈-greedy method is used to select actions to balance the exploration and utilization of actions; specifically, the ∈-greedy method randomly selects an action from all actions with a probability of ∈ for exploration, or outputs the action a with the maximum estimated value from the D3QN algorithm with a probability of 1-∈ for utilization; therefore, the actions of the DRL agent are: in, is the action-state value function, U(A (V) ) is from action A (V) The discrete uniform distribution function, ∈∈[0,1] is a hyperparameter used to adjust the balance between action exploration and utilization. The D3QN algorithm selects actions with high feedback rewards, or explores actions that may have higher rewards but have not yet been selected, explores the entire action space and updates the Q value; Ω represents the weight of the training network, which is continuously updated using the experience replay mechanism; The D3QN algorithm-based agent seeks the optimal strategy to maximize the long-term cumulative reward, which is expressed as: where γ∈[0,1) is the discount rate of the reward, when When bounded, set γ = 1, when When unbounded, set γ < 0; The optimal strategy is solved by the Bellman equation, which includes the following elements: discrete state set S (V) , a discrete action set A (V) and state transition probability a,a t ∈A; For time slot t, the state-action function (Q function) of the agent is: Where π is the strategy of the agent in time slot t; accordingly, the update expression of the Q function is: The D3QN algorithm uses a deep neural network to fit the Q function. It consists of a training network and a target network. The training network is used to select the current model action. The network parameter is Ω. t ; The target network is used to evaluate the action, and its network parameters are The goals of training the network are:

6. A safe and efficient improved PBFT Internet of Vehicles blockchain consensus method according to claim 1, characterized in that: In step 6, based on the consensus performance of the node, the trust value of the node is evaluated and updated, as follows: R total =ω1*R own +ω2*P i Among them, R own is the reputation value of the vehicle before this round of consensus, P i This is the consensus participation rate after the consensus in this round is completed, which measures the consensus participation of the nodes; Among them, m is the number of times the node successfully participated in this round of consensus, and M is the total number of participations; If the master node goes down or becomes a Byzantine node, first kick this Byzantine master node out of the consensus committee and directly halve the trust value of this Byzantine master node, then select a new consensus node from the remaining node set to make up for the missing consensus node, and at the same time, select a new leader node and complete the view conversion.

7. A safe and efficient improved PBFT Internet of Vehicles blockchain consensus system based on the method described in any one of claims 1 to 6, characterized in that: include: The initial set acquisition module is used to organize the traffic data to be released by the vehicle node, send a request to the roadside unit (RSU), and compete for the leader node. The roadside unit (RSU) pre-screens the vehicle according to the vehicle trust value of the competing leader node. If it exceeds the set threshold, the screening passes and the initial set of delegated consensus nodes is obtained; The score ranking acquisition module is used to implement the roadside unit (RSU) to perform decision analysis on the vehicle nodes in the initial set of delegate consensus nodes obtained in step 1 based on the trust value of the vehicle, the capacity of the communication channel, and the difference between the collection time of the traffic data and the existing timestamp according to the multi-criteria decision analysis method, and obtain the score ranking, and select the top K nodes in the score ranking as the delegate consensus nodes; The leader node selection module is used to select the master node using the VRF verifiable random function. Based on the block size created in this round of consensus, the current leader node uses a pseudo-random number generator (PRNG) to generate a random number seed in the last consensus round. Other consensus nodes generate a random number L based on the random number seed, and select the node with the largest output random number L as the leader node. Aggregate signature module, used to select the leader node as the master node for consensus, and use BLS-based signature technology for aggregate signature in the preparation and submission stages of consensus; The throughput optimization module of blockchain consensus is used to implement the whole consensus process, using D3QN's deep reinforcement learning algorithm to make decisions on the block size, block interval time, and the number of delegated consensus nodes in the blockchain consensus, so as to optimize the throughput of blockchain consensus; The trust value evaluation and update module is used to evaluate and update the trust value of the node based on the consensus performance of the node after consensus is completed. The master node packages and uploads the traffic data and stores it in the blockchain ledger, and the roadside unit (RSU) saves a complete copy of the ledger.

8. A safe and efficient improved PBFT Internet of Vehicles blockchain consensus device, characterized by: include: Memory: a computer program storing a safe and efficient improved PBFT vehicle networking blockchain consensus method as described in any one of claims 1 to 6, which is a computer-readable device; Processor: used to implement a safe and efficient improved PBFT Internet of Vehicles blockchain consensus method as described in any one of claims 1-6 when executing the computer program.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, which, when executed by a processor, can implement a safe and efficient improved PBFT Internet of Vehicles blockchain consensus method as described in any one of claims 1 to 6.

Citation Information

Cited By

  • Vehicle transportation data storage method and system based on block chain

    CN120675694A

  • Multi-party cooperative vehicle-road communication security guarantee system and method based on block chain

    CN121150965A

  • Blockchain-based multi-party cooperative vehicle-to-road communication security guarantee system and method

    CN121150965B