# Reputation-Based Blockchain for Spatial Crowdsourcing in Vehicular Networks
## 2 System Model
### Smart Contract  
Based on smart contracts [32], the formulated reputation-based blockchain motivates more miners to join pool mining driven by profits (i.e., reputation and incentive). The evaluation of comprehensive/local reputation can enhance the security of vehicle nodes selected as miners or validators [33]. Therefore, spatial crowdsourcing blockchain-based reputation mechanism can incentivize the participation of EV users as miners to assist in computing tasks. The proposed distributed reputation mechanism is mainly based on the supervision and implementation of smart contracts. Specifically, it mainly executes the publishing process and recycle of crowdsourcing tasks. The design principle of the smart contract [14] includes the following connotations: User Registration Contracts (URC), User Description Contracts (UDC), Task Relationship Contracts (TRC) and Main-Side Contracts (MSC). The definitions are given as follows:  
* URC. Once a miner or customer/requester joins the crowdsourcing platform, their individual information is first registered in URC. Note that when the requestor initiates service requests, the publishing of crowdsourcing tasks will be charged based on complexity (e.g., time delay, throughput, etc., see Section 4.2). In addition, miners in different blockchains are able to have multiple virtual addresses and corresponding public-private key pairs. * UDC. The historical behaviors and interactions, individual configuration, and corresponding task information are stored by UDC. We propose to construct multiple indicators of reputation to evaluate blockchain players. Accordingly, reputation could be evaluated and updated in real-time within mining step-by-step, so as to reflect the reputation scoring. Once requesters submit the crowdsourcing information list, the creation of a corresponding pointer can help find the crowdsourcing information that they submitted through TRC. * TRC. TRC mainly depicts the interaction between requesters and miners, including task publishing, miners' actions, incentive/reputation evaluations. In accordance with the requesters, miners are first evaluated based on their reputation. To optimize mining strategy, qualified high-reputation miners will be allocated computational tasks according to the presented the low-reputation miner screening algorithm for mining pools under the limited budget (see in Section 4.3). * MSC. Side chains are derived from the main chain which is a process driven by MSC. Being compatible with the smart contract from the main chain, the side chain is derived for functional scenarios, and the MSC is utilized to perform the conversion of cross-chain information (i.e., revenue and reputation). The assets of all chains are updated synchronously in real-time. Based on multiple virtual identities generated by URC, miners can allocate computing resources on multiple chains. For clarity, we formulate logic flow diagrams to show the operation steps of the designed system in Figure 2. As illustrated, EV customers first submit the requirements of crowdsourcing tasks and establish them to the blockchain network. The blockchain network then broadcasts to all users according to UDC and URC, and deploys to the main- or side-chains for processing based on their task attributes. According to whether the tasks are deployed to multiple chains, the local reputation and comprehensive reputation of the participating miners are calculated. Consider the scenario where rational miners join in the cooperative mining, then according to the honesty behavior reputation update algorithm (Algorithm 1), if the current mining pool access and inventory conditions are not met, then they cannot join. The distance factor and the comprehensive reputation value included in the crowdsourcing task are utilized to calculate the spatial reputation. The miners in the pool are then screened according to the low-reputation miner screening algorithm for mining pools (Algorithm 2), and the lower reputation miners are excluded.