# A Blockchain Solution for the Internet of Vehicles with Better Filtering and Adaptive Capabilities
## 6 Theoretical Analysis
### Security Analysis  
AE-PBFT is an enhancement of PBFT that introduces a novel credit model and a consensus group mechanism. It determines the selection of consensus groups and master nodes based on the credit points accumulated through historical behavior. This approach mitigates the risk of the master node and the consensus process being controlled by malicious nodes. The security analysis of the system is as follows:  
Assume that the number of vehicle nodes participating in the IoV system is \(N\), the number of consensus group nodes is \(N_{c}\), and the number of malicious Byzantine nodes is \(f\). According to the group division rules of the AE-PBFT algorithm, the relationship between these variables is approximately \(N\approx 2N_{c}/5\) and \(N_{c}\geq 3f+1\). Rearranging these equations, we derive \(N\geq(6f+2)/5\). Given that there is at least one Byzantine node in the system(\(f\geq 1\)), it follows that \(N\geq 8/5\). Rounding up, we find that \(N\geq 10\), meaning that the security of the consensus process can only be assured when the number of participating vehicles in the IoV system is at least 10. This condition is easily met in real-world environments with large traffic volumes, ensuring the security of the algorithm.  
Next, we analyze the security of the consensus process. Continuing with the assumption that the number of vehicle nodes in the IoV system is \(N\) (where \(N\geq 10\)), the list of participating nodes is denoted as \(N_{Nodeid}=[n_{0},\,n_{1},\,n_{2},\,\ldots,\,n_{N-1}]\), and the number of malicious Byzantine nodes is \(f\). In this analysis, we use simplified stage names to represent the messages received by the nodes.  
In the request phase, the master node \(n_{0}\) broadcasts a \(\langle request\rangle\) message to the replica nodes.  
In the pre-prepare phase, each replica node verifies the received message. Based on the known condition \(N\geq 3f+1\), we can derive the following:  
\[\sum_{i=1}^{N-1}\left\langle pre-prepared\right\rangle_{i}\geq 2f. \tag{4}\]  
In the prepare phase, each participating node not only sends its own message but also receives messages from other nodes. For each node \(i\), the prepared message set can be represented as follows: \(\left\langle{prepared}\right\rangle_{i}=\left\langle{prepared}\right\rangle_{0}+ \left\langle{prepared}\right\rangle_{1}+...+\left\langle{prepared}\right\rangle_{i -1}+\left\langle{prepared}\right\rangle_{i+1}+...+\left\langle{prepared}\right \rangle_{N-1}\). Finally, we can derive the following:  
\[\left\langle{prepared}\right\rangle_{i}\geq 2f. \tag{5}\]  
In the reply phase, it is established that \(\left\langle{prepared}\right\rangle_{i}\geq 2f\), indicating that at least \(2f\) nodes can correctly process the message and respond. Consequently, the total number of messages that the master node \(n_{0}\) can receive during the reply phase is as follows:  
\[\left\langle{response}\right\rangle_{i}\geq 2f+1. \tag{6}\]  
At this point, it can be concluded that a security consensus has been achieved.  
The AE-PBFT consensus process simplifies the commit broadcast phase compared to PBFT, resulting in a significantly reduced time to reach consensus. In IoV, this allows for the rapid updating of credit scores, enabling the system to effectively distinguish between honest and malicious vehicles. This adaptability is particularly advantageous in dynamic real-time environments where situations change rapidly.