## 5 Algorithm
### Intra-Cluster Block Allocation  
In Algorithm 1, the clustering of RSUs into collaborative storage clusters has been completed. Since each RSU cluster must collaboratively store at least one complete copy of the blockchain, it is necessary to determine the specific block allocation within the cluster, i.e., which blocks each RSU in the cluster should store. When addressing the block allocation problem, in addition to considering the block access probabilities of the vehicles served by each RSU, it is also important to take into account the priority of the vehicles being served. As shown in Figure 2, we consider a vehicle \(v_{m}\) located within the coverage area of RSU \(r_{i}\), with a required block set \(B_{m}\). The states of \(v_{m}\) during the block allocation process can be categorized into three cases:  
* State 1: Vehicle \(v_{m1}\) has just entered the coverage area of \(r_{i}\) and will remain for a relatively long dwell time \(t_{m1}^{d}\) before leaving. * State 2: Vehicle \(v_{m2}\) has a shorter dwell time \(t_{m2}^{d}\) compared to \(t_{m1}^{d}\). * State 3: Vehicle \(v_{m3}\) is about to leave the coverage area of \(r_{i}\) with a very short dwell time \(t_{m3}^{d}\). At the same time, different block allocation strategies will result in RSU \(r_{i}\) storing different block sets. The entire block set \(B_{m}\) may be fully deployed in \(r_{i}\), or only a subset of \(B_{m}\) may be stored. When \(r_{i}\) does not fully store all the blocks in \(B_{m}\), it has to request the missing blocks from other RSUs in the cluster, which will introduce additional access latency. Since excessive access latency may force a vehicle to switch to the remote cloud server for data retrieval, resulting in extra access costs, the system must carefully balance the acceptable access latency for vehicles with the expected access latency of the deployment strategy to enhance its effectiveness. Based on the above scenario, we define \(\tau_{0}\) as the transmission delay required to transfer a standard-sized block from an RSU to a vehicle. For a vehicle \(v_{m3}\) that is about to leave the RSU coverage area, if \(t_{m3}^{d}<\tau_{0}\), then regardless of whether \(r_{i}\) stores the blocks required by \(v_{m3}\), the vehicle will not be able to complete the block access process within the coverage area of \(r_{i}\). Therefore, in this case, the service priority of the RSU for \(v_{m3}\) is very low. When \(t_{m}^{d}>\tau_{0}\), vehicles with smaller dwell times require lower transmission latency, meaning that from the perspective of the RSU, these vehicles should be given higher priority. As a result, the service priority for vehicle \(v_{m2}\) is higher than that for \(v_{m1}\). Within the coverage area of a single RSU, the service priority of \(r_{i}\) for vehicle \(v_{m}\), denoted as \(PR(t_{m}^{d})\), can be expressed as follows:  
\[PR(t_{m}^{d})=\sigma(t_{m}^{d}-\tau_{0})\cdot\left(1+\mu e^{-\omega(t_{m}^{d} -\tau_{0})}\right) \tag{21}\]  
where \(\sigma(t_{m}^{d}-\tau_{0})\) is the Sigmoid function, defined as follows: \(\sigma(t_{m}^{d}-\tau_{0})=1/\left(1+e^{-\theta(t_{m}^{d}-\tau_{0})}\right)\). When the vehicle dwell time \(t_{m}^{d}\) approaches the threshold \(\tau_{0}\), the rapid saturation property effectively filters out vehicle requests with extremely short dwell times, thereby preventing resource wastage. Conversely, when \(t_{m}^{d}>\tau_{0}\), the service priority gradually decreases with increasing dwell time, thus prioritizing vehicles with shorter dwell times. These vehicles not only have a sufficient time window for data transmission but are also more sensitive to latency. The adjustment factor \(\mu\) controls the global scaling of the interest value, while \(\omega\)  
Figure 2: Illustration of vehicle access within an RSU. determines the smoothness of the exponential decay. Together, these parameters optimize the shape of the priority curve, making it adaptable to various application scenarios.