## 9 Experimentation
### Simulation Environment  
In the course of the research, a CPS network comprising thirty nodes in the device layer, one sink/root node, and one edge server in the fog layer was used. This network architecture, which reflected a typical configuration for CPS networks, made it possible to evaluate the GBG-RPL technique in a practical setting. Various communication factors were taken into consideration to assess the blackhole and greyhole attack detection and mitigation. For the purpose of calculating and analyzing trust, these parameters, including energy consumption, packet drop, end-to-end delay, and message overhead, were gathered from the device layer and sent through the root node to the fog layer. The GBG-RPL methodology used the web3.js framework to combine blockchain technology and the Gini index calculation in the fog layer.  
In contrast, the Gini index functions as a gauge of trustworthiness based on communication metrics. Energy consumption, packet drop rate, end-to-end delay, message overhead, and attack-detection rate were among the performance parameters that were measured and studied during the trials. These measurements revealed how well the GBG-RPL methodology worked to identify and stop blackhole and greyhole assaults.  
The elaborate experimental setup incorporated the use of the Cooja simulator to apply and assess the GBG-RPL approach within a CPS network and the results were compared to a reference technique named BCPS-RPL. A number of simulation settings were taken into account throughout the setup, including the attacker-to-malicious-node ratio, receive-to  
\begin{table}
\begin{tabular}{l l l} \hline \hline
**Node Type** & \multicolumn{2}{l}{**Assigned Role**} \\ \hline \multirow{6}{*}{Full Node} & 1. & Fog servers \\  & 2. & Has multiple functions \\  & 3. & Registers and maintains records of devices \\  & 4. & Calculates trust values \\  & 5. & Reviews, generates, and distributes global trust list \\  & 6. & Stores and maintains trust values in the blockchain \\ \hline \multirow{3}{*}{Root Node} & 1. & Acts as a link between the device layer and fog layer \\  & 2. & Receives trust parameters from lower nodes \\  & 3. & Distributes updated trust list to lower nodes for the \\  & & elimination of malicious nodes \\ \hline \multirow{2}{*}{Resource-Constrained Node} & 1. & Resource-constrained device \\  & 2. & Performs only assigned tasks \\ \hline \hline \end{tabular}
\end{table}
Table 8: Node types and roles.  
transmit ratios, interference-to-transmission distances, and use of the RPL routing protocol. The 60-minute simulation time frame allowed for a full evaluation of the trust mechanisms' effectiveness over a lengthy period. The effectiveness of the GBG-RPL methodology in identifying and mitigating blackhole and greyhole attacks was assessed by collecting and examining performance indicators. The incorporation of the Gini index and blockchain technology improved the system's reliability and security. In order to increase the overall dependability and trustworthiness of the healthcare CPS, the experimental setting aimed to contribute to the development of secure and reliable trust-based procedures.