# A Proof-of-Multiple-State Consensus Mechanism for Mobile Nodes in Internet of Vehicles
## 4 Consensus Mechanism Based on Integrated State
### State-Factors Calculations  
The \(SF\) value indicates the channel state and relative position of vehicle node \(i\) at time \(t\), signifying its capability to relay messages. Nodes periodically send beacon messages to collect mutual position and velocity data. A relative condition value is calculated from this data, which serves as a crucial reference for the integrated quality factor. The prediction interval's time point is set with the current time denoted as \(t\). Vehicle nodes employ a pre-trained learning model to predict future states. Each node inputs its coordinates, speed, and direction into the model, which then calculates the state information for the moment \(t2\). The node forwards the result to the RSU for storage and management. The nodes forward the result to the RSU for storage and management. The RSU evaluates the status of the vehicle nodes at \(t2\), regroups those within its jurisdiction, and excludes nodes out of communication range. Within each blockchain network group, nodes calculate their values and record them in blocks for transmission to the mining node. The calculation is divided into three parts: (1) the difference between the current driving state of the vehicle and the predicted driving state; (2) the probability that the vehicle successfully sends a message to a neighboring node, the channel status; (3) the computing power of the integrated CPU which that their ability to process the messages and status data received. The calculation of these three factors is described below:  
(1) \(P(diff_{i})\): This value indicates the probability that the message delivery at time \(t2\) exceeds the range threshold, effectively preventing delivery errors due to longer distances caused by nonisotropic vehicle movements, which can lead to excessive separation of relay nodes. Assuming that the position of vehicle node \(i\) when in \(t2\) is \(P_{i}^{t2}=(X_{i}^{t2},Y_{i}^{t2})\), for the distance difference between node \(i\) and node \(j\) after the time interval \(\Delta t\) is expressed as:  
\[D_{i,j}^{\Delta t}=\left(\left(X_{i}^{t2}-X_{j}^{t2}\right)^{2}+\left(Y_{i}^{ t2}-Y_{j}^{t2}\right)^{2}\right)^{1/2}-D_{i,j}^{t1} \tag{2}\]  
This study focuses on short-term forecasting, particularly on predicting vehicle movement within a few seconds. Consequently, we approximate the speed change of a single vehicle node over a short period of time as a uniform acceleration, a model that is generally consistent with the scenario. By expressing the velocity of node \(i\) at the \(t2\) moment in time is denoted as \(v_{i}^{t2}\) and the velocity of node \(j\) is denoted as \(v_{j}^{t2}\), then the vehicle's relative movement in the horizontal direction during the time interval \(\Delta t\). The relative distance travelled in the horizontal direction during the time interval can be expressed as:  
\[D_{ijx}^{\Delta t}=\left(\left(v_{ix}^{t2}-v_{jx}^{t2}\right)-\left(v_{ix}^{t 1}-v_{jx}^{t1}\right)\right)\cdot\frac{\Delta t}{2} \tag{3}\]  
The longitudinal axes are similar, so by synthesising them the relative distances between vehicle \(i\) and vehicle \(j\) can be varied as follows:  
\[D_{i,j}^{\Delta t}=\sqrt{\left(D_{ijx}^{\Delta t}\right)^{2}+\left(D_{ijy}^{ \Delta t}\right)^{2}} \tag{4}\]  
However, the relative distance does not directly reflect the probability of successful communication between vehicles, and the following function is used to reflect the relative relationship between distance and communication range:  
\[P_{dis}=1-\frac{D_{i,j}^{\Delta t}}{R} \tag{5}\]  
As the proximity between two vehicles increases, \(P_{dis}\) approaches 1, suggesting a higher likelihood of successful single communication. Conversely, a greater distance results in a negative \(P_{dis}\), diminishing the competitiveness of the nodes that are further away.