In the consensus algorithm, selecting primary nodes is an important problem. In this section, we list a series of models we used to select a primary node, including the Integral model and the Classification model. The overall execution flow of the system model is shown in
Figure 1. In the context of a public chain consisting of blockchain nodes for each vehicle, the vehicles are scored by the Integral model, with the number of each vehicle representing its score. Vehicles are then further selected through the Classification model, and it is worth noting that offline vehicles are demoted. Eventually, vehicles eligible to participate in bookkeeping will be polled and become master nodes.
3.1. Integral Model
In this paper, we use the integral model to evaluate the performance of vehicles in the consensus process [
27]. Vehicles with higher scores are more likely to get the accounting right [
28]. The vehicle score is mainly affected by the following four types of features: vehicle attribute, vehicle wealth, vehicle integrity, and vehicle performance. Each primary indicator is also subdivided into sub-indicators, with a total of 10 reference criteria that together determine the node’s score, as shown in
Table 2.
The vehicle attribute is the relevant parameter information of the vehicle itself, including the running frequency of the vehicle memory and the running power. The higher the frequency of the vehicle, the better the performance; the lower the power of the vehicle, the lower the energy consumption. So the frequency is positively correlated with the integral, and the power is negatively correlated with the integral.
Vehicle wealth is based on the index generated by the PoS algorithm, specifically according to the currency age of the vehicle, the older the currency is, the more you do not want the blockchain system to be attacked, so it is positively related to the score.
Vehicle integrity is related to the performance of vehicles after several rounds of consensus, including the number of forked blocks, the number of error/invalid or wrong blocks, traffic offense points, and last round integral. Providing forked blocks, providing error/invalid, or wrong blocks represents that the vehicle is providing wrong information; the more times, the more likely they are malicious nodes. Traffic offense points reflect the extent to which drivers abide by the rules, and vehicles that do not abide by the rules can easily become malicious nodes. So the first two secondary indicators are positively correlated with credits. the last two items are negatively related to the score.
Vehicle performance is related to the network, including the duration of participation in the network, network delay, and vehicle offline times. These indicators reflect the communication efficiency of the vehicle. So the first secondary index is positively related to the integral, and the latter two are negatively related to the integral. The vehicle attribute index aims to select vehicles with high computational efficiency, vehicle wealth and vehicle integrity aim to improve the fault tolerance rate of communication, and vehicle performance aims to select vehicles with low delay communication.
These indicators can guide us to choose a terminal with high efficiency, high fault tolerance, and low delay. In asymmetric IoV, terminals with good performance can share some tasks of the server, thus reducing the negative impact brought by asymmetric network structure. We use these metrics to score the vehicle by training a model through a BP neural network, which is described in detail in
Section 4.1.
3.2. Classification Model
According to the previous subsection, we obtain a training model. The vehicle score can be obtained by inputting various index parameters. In this subsection, based on the vehicle scores derived from the model in
Section 3.1, we use the classification model to further classify the vehicles so as to select the vehicles suitable as master nodes. Vehicle levels are first divided into three levels:
A,
B, and
C.
is defined as the integral of a vehicle and is derived from the Integral model. Two constants,
and
, are used to classify the vehicle to different levels. If
>
, the node is assigned to Level
A; If
<
<
, the node is assigned to Level
B. If the
<
, nodes are classified as Level
C. This process is shown in
Figure 2.
Vehicles at different levels have different permissions, among which vehicles at Level A can obtain the bookkeeping right by polling; In Level B, vehicles have alternate bookkeeping rights. They can be used as excellent terminals to undertake some computing tasks, which is more advantageous than asymmetric centralized communication structure. Although there are no bookkeeping rights can still store information and verify other consensus vehicle bookkeeping is correct, as long as the active participation in the consensus is likely to rise to A; Level C vehicles are most likely Byzantine vehicles, which deprived them of the right to participate in the consensus. This practice can greatly improve the enthusiasm of vehicles, prevent Byzantine vehicles from obtaining accounting rights caused by bad effects, and even prohibit their participation in the consensus.
In the initial stage, the vehicles have not gone through the consensus process, so there will be no negative score. Whether they can enter Level A is largely determined by vehicle performance and network conditions. Therefore, most vehicles are in Level A or Level B, and there may even be no vehicles entering Level A, so the accounting consensus vehicles are temporarily selected from Level B. After several rounds of consensus, the number of points of vehicles with good performance will increase and be upgraded, while the number of points of vehicles with poor performance will decrease and be downgraded.
For Level
A vehicles, we want them to be online, so we need to predict their online status. This can further improve the fault tolerance rate of communication. This is a time series prediction problem because we are applying it to vehicles. The online status of a vehicle is mainly affected by the following features: time, public transport conditions, air temperature, rainfall, and vehicle life as shown in
Table 3.
Time is the period for collecting relevant information, and time series are used to predict the online status of vehicles. The public transportation situation is a rating of the public transportation in the city where the vehicle is located. The convenience of public transportation has a significant impact on the use of vehicles. When local public transportation can meet people’s travel needs, they will reduce the use of vehicles. Climate is also an important factor affecting vehicle use. When the temperature is too high or too low, or when it is raining, people tend to choose vehicles for travel due to comfort considerations. Therefore, we selected the air temperature and rainfall of the city where the vehicle is located as indicators. Considering human usage patterns, the longer the vehicle is used, the more dependent people are on using the vehicle. Therefore, vehicle life is also an important indicator.
Considering the limitations of vehicle performance and delay, we not only need to improve the online accuracy of the predicted vehicles but also need to consider the predicted time and the length of the model running time [
29]. Therefore, we used the Informer model for prediction, which is described in detail in
Section 4.2. When the prediction result of a Level
A vehicle is offline for too long, it will be downgraded.