# Secure Cognitive Radio Vehicular Ad Hoc Networks Using Blockchain Technology in Smart Cities
## 3 Proposed Scheme  
To guarantee the authenticity of all vehicles on the road, we propose a cognitive vehicular routing protocol, deploying a smart contract on the blockchain network. Two RSUs are used in this scheme: one which deploys a smart contract and is responsible for monitoring communication, while the second acts as the PU. PU allows secondary users (vehicles) to use its channel by paying a minimal fee so that the channel remains authentic and vehicles trying to communicate on this channel are all legitimate. Any infrastructure on the side of the road can be considered an RSU. Examples include lamps, traffic lights, toll booths, motorway police offices, cameras, and more. We introduce a novel means of implementing cognitive technology, where PU is aware of secondary users who are using its channel and only allows them to access it if the channel is free and if they pay a minimal fee. When the channel was free, any secondary user could access it in a conventional cognitive scheme, which increased the likelihood of fake nodes participating in the communication. In our scheme, the payment ensures that only those nodes participate in the network who are legitimate and willing to provide benefits to other nodes in the network. However, those who participate in this blockchain network will receive a reward that is higher than the amount they spent conveying messages. The verification process starts with the registration of each node. Each node registers itself when RSU deploys a smart contract. Each vehicle receives a secure ID, which is an encrypted version of the vehicle ID, in the same way as in [17] to make communication secure. In this manner, only those nodes that are authentic can communicate using this secure ID. In the next section, we will provide a detailed explanation of the connection between vehicles and RSU, how IDs are used, and how payment is made. We assume that PU has two channels. One is exclusively for its own activities, while the other is available for secondary users on a payment basis only when it is not occupied by PU's activities. Therefore, the second channel is split into different subchannels to enable different vehicles to communicate without worrying about collisions. Despite PU announcing the available spectrum to collect payment from legitimate users, vehicles still need to sense this channel due to their dynamic nature. Since sensing results vary  
accuracy of detection. In the end, the belief of every vehicle that is moving towards a destination is calculated as  
\[b^{f}_{i,l_{c}}(H_{i,l_{c}})=w\ \sigma^{f}_{i,l_{c}}(H_{i,l_{c}})\prod_{k\in(N_{i} )}\mu^{f}_{(k,l_{c-1})(i,l_{c})}(H_{i,l_{c}}). \tag{6}\]  
These beliefs state that each vehicle makes the final decision about each subchannel in the following manner:  
\[D^{f}_{i,l_{c}}= \begin{cases}H_{0}&if\ b^{f}_{i,l_{c}}(H_{0})>b^{f}_{i,l_{c}}(H_ {1})\\ H_{1}&if\ b^{f}_{i,l_{c}}(H_{0})<b^{f}_{i,l_{c}}(H_{1})\end{cases} . \tag{7}\]  
PU executes its tasks on a regular basis. When there is no activity ongoing, which means it has a free spectrum, it announces this to all the nodes in its range. As can be seen in Figure 1, the sender \(V\) witnessed an incident at its current location and wants to share that information with a destination \(D\) that is not within the sender's communication range. Because both \(V\) and \(D\) are authentic users who have validated their authenticity by registering with RSU, they can easily exchange messages using relays. It should be noted that all vehicles that are part of this blockchain network have the ability to access the RSU and register from their respective locations. Deploying smart contract and approving the authenticity of vehicles is the only function of RSU in our scheme. Now, because \(V\) has some information to share, it requests PU to provide a subchannel from the list of free subchannels by paying a minimal fee. A control channel is used to make this request. \(V\) uses this spectrum to reach \(D\) by making an ad hoc network.