#### 3.1. ROA for Clustering in VANET

First, data is generated randomly based on parameters like node count, communication range, and grid size. After this, a network is developed from nodes in the grid. Clustering is performed according to the features of nodes, including speed, navigation, position, and so forth. To develop effective clustering, a node has to be in a single cluster. At the same time, one node can become a member in only one cluster. Each cluster has a CH, which can manage the entire cluster, and the CMs. The CH identifies the notes entering and exiting the cluster.

At the initial stage, the vehicles are placed randomly on the highway in a 2D or 3D direction. The vehicles begin moving at a certain speed. Then the fitness of rainfall is calculated and used for cluster development. Once the iteration is completed, the location of the vehicles is updated, and new fitness measures are done to identify the effective results. Consequently, the merit order list provides optimized clusters. In this study, the ROAC technique is used to construct clusters of vehicles and to select CHs.

The natural-based models mimic the natural biological and social nature of species. The rain drop optimization (RFO) algorithm is inspired by the raindrop hierarchy [

27]. Raindrops flow over a slope and form a river that finally reaches the lowest point or flows into the sea. Initially, the river is formed as a tiny stream that flows down a mountain slope. It goes around curves and folds in the land, flowing downhill. Several tiny streams emerging from raindrops meet each other and combine into the sea, which becomes higher and higher until it can be called a river. The raindrop chooses the path with the steeper slope; RFO accelerates the tendency and uses the gradient of the objective function, which calculates the solution that has to be optimized.

The locations of neighbor points of each drop are related to the drop’s location prior to moving toward the neighbor point through the lowest position. This path is followed until the drop reaches a valley. When the drops are flowing high to low, overcoming massive hurdles on their way to the valley, rain drop flows and ran from puddles to maintain the valley by the proper model has been executed by the RFO algorithm. The accessibility of RFO is not a major problem, as it is a population-dependent optimization method that uses a minimization of objective function measures to compute a qualified solution from the next iteration. The proposed optimization method begins with arbitrarily produced solutions and continues successive random exploration from the preceding point for alterations of the present value until a termination condition is reached. The RFO strategy is autonomous and converges on the most optimal solution by a form of guessing. It begins with a primary solution and enhances it to identify the best solution with the maximum probability.

Figure 3 depicts the flowchart of the proposed method. Using the evolutionary models, RFO is initiated using the initial population [

27].

Raindrop: A particle that is present in a population with variables of optimization issues, and which satisfies the problem. When the population size is

$m$, the value of the drop

$i$ is represented in Equation (1).

where

$n$ is the count of optimization variables;

${x}_{i,k}:{k}^{th}$ defines the attribute of the optimization issue;

${D}^{i}$ is the drop number

$i$.

Notably,

${D}^{i}$ is considered a point in

$N$-dimensional axes, where it is defined as an

$N$-element vector. Rainfall deals with raindrops at the time of the optimization process. It is produced based on an even random distribution function, and the limitations are shown in Equation (2).

where

$\mathrm{l}o{w}_{k}$ and

$u{p}_{k}$ are the lower and upper limits of

${x}_{k};U$ is the uniform distribution function.

Neighborhood: As raindrop $D$ contains $N$ elements and represents a point in $N$-dimensional axes, the radius vector of $r$ is called a neighborhood. A small modification in raindrop value changes the neighborhood value.

Neighbor point: A point in a drop’s neighborhood is produced randomly at the time of the optimization, and neighbor point

$j$ of drop

$i$ is represented by

$N{P}_{j}^{i}$ as per the following equation:

where

$r$ represents the real positive vector that determines the neighborhood size in

$N$-dimensional space, and the elements are greater the greater the neighborhood size;

${r}_{initial}$ is the initial neighborhood size;

$f$ is the function that applies the step size, selecting the neighborhood size in specific iterations;

NP is the count of neighbor points that is produced while determining the values, and

$\widehat{u}$ is the unit vector of the

${k}^{th}$ dimension.

Dominant drop: Out of the neighbor points of drop

${D}^{i}$, the dominant neighbor point

$N{P}_{d}^{i}$ refers to a point that satisfies (4). The objective function is represented by. Hence, the functions for the drop and the neighbor points are represented by

$F\left({D}^{i}\right)$ and

$F\left(N{P}_{j}^{i}\right)$, respectively.

Active drop: A drop that contains a dominant neighbor point.

Inactive drop: A drop without a dominant neighbor point.

Explosion process: This happens during optimization without a dominant neighbor point, when the raindrop’s condition is unstable, because there are not enough neighbor points to produce a local or global minimum. After the explosion has been performed and the drop goes out of the limit, it is considered to be Ne times. The neighbor points are produced through the explosion process

$\left(n{p}_{\left(ex\right)}\right)$, which is computed through Equation (5).

where

$np$ is the count of neighbor points under ordinary conditions;

$eb$ represents the explosion base that determines the range, and

$ec$ is the explosion count.

Raindrop rank: For all iterations of the optimization process, the range of the raindrops is determined based on Equation (6) for the application of the merit order list.

where

$C{1}_{t}^{i}$ is the accurate modification of the objective function from initial iteration

$t$ for raindrop

${D}^{i}$;

$C{2}_{t}^{i}$ is the measure of the objective function for raindrop

${D}^{i}$ at iteration

$t$;

order $\left(C{1}_{t}^{i}\right)$ and

order $\left(C{2}_{t}^{i}\right)$ are the orders of C1 and C2 at iteration

$t$ if it is arranged in increasing order;

${\omega}_{1}$ and

${\omega}_{2}$ are the weighting coefficients estimated as 0.5;

$Ran{k}_{t}^{i}$ is the range of raindrop

${D}^{i}$ at iteration

$t.$Merit order list: This is a list with raindrops in all iterations, arranged in ascending order, eliminated from the population for optimization.

Initially, raindrops are produced randomly and exceed the cost function. The proposed model is operated with possible solutions over the optimized iterations, and the possible solutions are produced through a search mechanism of this model. During the optimization process, the neighbor point overflows the search-space and restricts the outcomes of the RFO searching strategy. The neighbor point produced in the search-space is maximized with the help of the following equation:

The measure attained for a raindrop is related to the measure of neighbor points needed to identify the dominant neighbor point. When a new number of neighbor points is produced, sufficient to resolve the issues, this is called an explosion.

The primary iteration of the RFO model is completed while similar strategies are used for raindrops. This is repeated until a large number of drops reach minimum points during the iteration. The main features of this model are the number of neighbor points, the neighborhood size, the population count, and the value of neighbor points in the explosion. Once the CH is selected, the nearby vehicles join the CH and become CMs. Thereby the cluster is constructed.

#### 3.2. Blockchain-Based Secure Transmission

A blockchain is a set of blocks. Every block contains four segments: data regarding the transaction (bitcoin, ethereum), hash value of the previous block, the current block, and the timestamp. A blockchain is also defined as a distributed common electronic ledger that is used to save the transaction information using diverse points. Transactions can be recorded using a cryptographic hash value that is verified by all miners. It is held with similar values in the complete ledger, and is composed of blocks of all the transactions, as depicted in

Figure 4. The blockchain provides the ability to share ledger details in a secured format [

28]. Decentralized storage is a source in a blockchain, and maximum data can be recorded and transferred from the current block to the previous block using an intelligent contract code. In Swarm, LitecoinDB, MoneroDB, SiacoinDB, Interplanetary File System (IPFS), and BigchainDB, different factors are used for the decentralized database.

It should be assumed that vehicles interact with one another through V2V and vehicle-to-everything (V2X) communication, and that vehicles can connect to the Internet effectively. Consider also that all vehicles are essential such as OBUs, sensors, and GPS. Moreover, the number of legitimate RSUs is higher than that of suspicious RSUs. It is assumed that crucial event messages are disseminated inside a region of interest. The message count is also essential to ensuring that the event and the message are identified as correct.

A new type of blockchain is needed, as typical blockchains cannot be used for our purpose. A traditional blockchain used is cryptocurrency, while we need a blockchain that deals with secured event messages without using crypto-coins. Therefore, it uses a safety event message as an event message. The blockchain is necessary for the trustworthiness of safety messages in a VANET. It is a single blockchain that has been balanced and supervised autonomously to record the transport details. All vehicles telecast their positions with beacon messages. Location certificate (LC) is used as a digital proof, which represents a vehicle that is at a specified distance and within the period.

All vehicles require an LC to approve their position simultaneously. An LC is offered by a legitimate RSU. It acts as a proof of location (PoL) for vehicles, which helps to find the event messages in a given geographical area. The problems of scalability and timeliness in the previous blockchain become insurmountable for real-time VANET applications. Here, the events are local, and event messages are confined to vehicles found within a specific geographical area. In the classical blockchain, the newly minted block is broadcast universally. But the VANET messages do not cross the boundary of a specific location, since the traffic and accident details of a location are unknown to vehicles found in another location. Therefore, a new blockchain mechanism is required. From this independent blockchain, all miners mine fresh blocks according to the event messages, and forward every newly minted block to the local blockchain network. Then a vehicle can query its security level, whenever required, through the blockchain. Once the generation is completed, the new block is broadcast, and vehicles in the network validate and upgrade the blockchain.