# Reputation-Based Blockchain for Spatial Crowdsourcing in Vehicular Networks
## 4 ReBLOM-Based Crowdsourcing for EVs Routing Problem with Recharging Station
### Distance-Based Spatial Reputation for EVs Charging  
Let the budget \(B_{\pi}^{\text{Fixed}}(\pi=1,2,3,\dots)\) of the EV requester be limited/fixed, we divide the budget equally according to the distance into \(v\) segments. In each segment, the optimal reputation for miners of computing spatial crowdsourcing would be selected by the proposed reputation-based method, to ensure real-time feature and accuracy of the obtained spatial crowdsourcing. Similar to (19), the spatial crowdsourcing task of generating block becomes the execution of \(v\) sub-block tasks. Hence, each segment can be calculated by blockchain nodes to obtain \(v\) sub-blocks. Taking the mining pools as individuals to solve the crowdsourcing tasks, we then transform the revenue optimization problem of the miners into pools. Obviously, a higher reputation miner within the pool would lead to a higher probability of honest mining, and thus result in a higher probability of receiving incentives. The following incentive optimization problem is proposed. \[ \begin{array}{c}\mathbf{P1:}\max\limits_{C_{j}=\{H,D\}}u^{(i)}\\ s.t.\quad\quad T_{j}>0\\ \Delta R_{j}(n)>0\\ \kappa\geq\zeta_{\text{min}}^{c}\end{array}  \tag{27}\]  
Based on (7)-(9), the incentive optimization problem can be formulated as a non-cooperation game model and solved via the convex method (as studied in our previous work in [36]). Next, we will raise the probability of honest mining by improving the occupation of high-reputation miners, to increase the probability of being rewarded. The measurement of reputation of mining pool \(i\) is defined as in (28). It also depicts the total volume of miners joining in the pool \(i\). That is, the value of unit reputation for each segment is  
\[R_{g_{\pi}^{\text{fixed}}}^{(i)}=\xi\frac{B_{\pi}^{\text{Fixed}}}{v\sum\limits _{i\in\mathcal{L}^{(i)}}R_{j}^{(i)}(n)} \tag{28}\]  
where \(\xi\) is the coefficient parameters and \(\sum\limits_{i\in\mathcal{L}^{(i)}}R_{j}^{(i)}(n)\) represents the sum of the reputation of all the miners in pool \(i\). Next, we suggest the screening threshold \(f_{Screen}^{(i)}(n)\) of pool \(i\) illustrates the screening conditions before each mining rounds starts, where \(f_{Screen}^{(i)}(n)\geq f^{(i)}\). It follows the changes of volumes of high-reputation miners and the total expected reputation of the pool. In detail, when the \(n\)-th mining session finishes, the pool manager will randomly adjust the screening threshold \(f_{Screen}^{(i)}(n+1)\) based on the mining results \(u^{(i)}(n)\), the volume of high-reputation miners \(|\mathcal{L}^{(i)}|\), and expected reputation \(E\Big{(}R_{j}^{(i)}(n)\Big{)}\). We eventually formulate Algorithm 2 to remove the low-reputation miner from the pool, and in order to enhance the efficiency and honesty. Based on Algorithm 1, new evaluation conditions are added to exclude low-reputation miners to retain high-reputation miners in Algorithm 2, thereby increasing the integrity level of the mining pool. After screening the candidate miners who join the mining pool, first remove the miners who do not meet the access conditions. Secondly, according to the mining pool management rules, randomly set the mining pool miner reputation screening threshold, and then sort the reputation of all candidates. Next, select miners whose reputation value is higher than the threshold, and sum up the reputation of all candidates. If it is less than the expected reputation of the mining pool, the greedy strategy is utilized to increase the value of threshold, and the evaluation is made again until the expected reputation is reached. If it exceeds the expected reputation of the pool, jump out of the loop and cull the remaining miners. In summary, Algorithm 2 is utilized to optimize the pool screening threshold \(\Big{(}f_{Screen}^{(i)}\Big{)}^{*}(n+1)\), to select a set of miners with higher reputation on the premise of meeting the expected reputation, and ultimately improving mining efficiency and ensuring integrity.