# Secure Cognitive Radio Vehicular Ad Hoc Networks Using Blockchain Technology in Smart Cities
## 4 Performance Evaluation  
To design our proposed idea, we used solidity as a contract compiler. Remix-Ethereum is the integrated development environment (IDE) that enables contracts using solidity language. The testing blockchain provider is Ganache. We used 0.5 MHz from DSRC as the control channel and \(M=2\) MHz as a service channel. Out of this 2 MHz, one is dedicated to PU activity so that it cannot be disturbed, and the remaining one, which is divided into subchannels \(S=5\), can be used for secondary users by implementing an exponential on/off PU activity pattern with a rate parameter of 0.5. The communication range of RSU was 500 m, \(\eta=0.9\), and a vehicular range of 200 m was used. All vehicles moved at a constant speed of 10 m/s. Our results were generated by analyzing \(P(H_{0})=0.9\) as a higher likelihood of PU being idle. We analyzed 10 accounts to examine \(L=8\) vehicles, 1 RSU, and 1 PU, each of which has 100 ethers as an initial amount. However, the RSU account has fewer ethers, as shown in Figure 2a, because a minimal amount is taken out when the contract is deployed, and the PU has a higher amount than 100 ethers (110) because it provided a free channel. An amount is deducted from any account that deploys the contract. Since, in our scheme, RSU does so, an amount equivalent to the gas fee is deducted from it. As an extension of our work, we plan to increase these accounts in the near future. Figure 2: (**a**) Enabling the contract on ten Ethereum accounts (**b**). Setting up an account (**c**). Verification of all registered users. (**d**) A message sent by the source vehicle (**e**). Representation of unverified messages sent by any sender (**f**). The receiver has paid for the message (**g**). The sender and miner have received their rewards (**h**). The receiver finally reads the message. By entering the third account and using the 'createAccount' functionality, we created the sender account, as shown in Figure 2b. After the sender account was created, we created the receiver account by entering the fourth blockchain account and then did the same for the remaining six accounts. Every time a vehicle registers itself on the blockchain, a small registration fee is deducted from the blockchain wallet. Therefore, by using the 'getAllUsers' feature, we can verify all registered users as depicted in Figure 2c. It can be inferred that all users have now been registered on our blockchain network. Hence, we can send messages to anyone who registers on our network. So far, according to our scheme, the sender, miners, and destination have been registered on the blockchain, and PU has provided a free channel to the sender. To verify our example scenario where a source vehicle \(V\) wants to share a message to a specific destination \(D\) node, as shown in Figure 2d, the source vehicle copies the destination's address from the 'AllUsers' functionality and sends the message using the'sendMessage' function. Although the source vehicle knows the location and destination address of the destination node through a location reactive protocol used in [3], it cannot communicate with it directly, so it needs relays, which are miners in the proposed scheme. To successfully deliver the message to \(D\), the message should be verified by at least one miner who must be the witness of the incident to authenticate that the \(V\) is not misguiding other vehicles. Hence, Figure 2e indicates that the message stays in the 'getAllUnverifiedMessages' feature until verified by a close miner account capable of verifying the situation described in the sent message. If no miner verifies this message, \(D\) will not be able to read it and it will stay in the unverified messages folder. Neither the source nor the destination can verify messages on their own. Verification of the message by the miner ensures that there will be no unverified messages in the folder. Although there are no unverified messages in the folder, \(D\) cannot read this message until it pays for it.