# AgriSecure: A Fog Computing-Based Security Framework for Agriculture 4.0 via Blockchain
## 7 Case Studies and Experimental Results  
To test the security framework, we allowed DDoS attacks against the Blockchain Network. A distributed denial-of-service (DDoS) attack targets websites and servers by disrupting network services. A DDoS attack attempts to exhaust an application's resources.  
We provide an experimental setup configuration shown in Table 6, as well as the simulation architecture is shown in Figure 6.  
Host Machine (HM): Here we have installed an open-source based IoT framework called ThingsBoard, which make it possible to construct fog layers while seamlessly syncing with the cloud, on the host system and constructed a scenario of a smart farm with two silos, each with a different number of IoT devices. Every second, each gadget reports a pseudo-random value. We utilized a code to simulate a Blockchain client, which accepts the provided values and generates transactions. Mininet network emulation tool is then used to commit the transaction onto the Blockchain via the Open vSwitch module. We also connected the ONOS SDN controller and sFlow4 collector to the Mininet virtual network.  
\begin{table}
\begin{tabular}{c c c} \hline \hline  & **HM** & **VM** \\ \hline CPU & Intel Core i5-6300U @ 2.4 GHz & 2 vCores \\ \hline RAM & 8 GB & 2 GB \\ \hline OS & Ubuntu 18.04 \(\times\) 86 64 & Ubuntu 18.04 \(\times\) 86 64 \\ \hline Virtualization & Docker & Docker-compose \\  & Docker-compose & Docker \\ \hline \hline \end{tabular}
\begin{tabular}{c c c} \hline \hline  & ThingsBoard & \\  & Open vSwitch & \\ Applications & ONOS & Ethereum \\  & Mininet & Supply Chain \\  & Hping & \\  & sFlow & \\ \hline \hline \end{tabular}
\end{table}
Table 6: Experimental Setup Configuration.  
Virtual Machine (VM): We have installed the Ethereum Blockchain network and its Supply Chain AssetTrack application in the Virtual Machine. To keep records of their updated information, we formed a user for the host system (fog node) and various assets. Every reported value will be used by the blockchain client to update the specified asset in the Ethereum blockchain.  
To put our framework architecture to the test, we conducted three case studies.  
Case 1: We examined the platform's usual workflow, which means we did not conduct any attacks on the Ethereum blockchain.  
Case 2: Using the Hping programme on the host PC, we launched a DDoS assault on the Blockchain network. We implemented a DDoS mitigation programme on the SDN controller.  
Case 3: We launched a DDoS attack against the Blockchain network, by turning off the DDoS mitigation programme in the SDN controller.  
During the simulation, we noticed two crucial metrics in each case:  
* The number of network packets received by the Blockchain per minute.
* The number of transactions published in the Blockchain network.  
The results are shown in Figures 7 and 8, respectively. Taking the case 1 findings as ideal, with 120 published transactions in 10 min at an average of 100 Kbps; the third scenario revealed a really dismal performance with about 45 published transactions, representing a loss of more than 60% compared to the 1 st case, and an unreliable Blockchain network. To understand the outcomes of the second scenario, we must first recognize what took place in the network during the test. The Open vSwitch sends all network traffic data to the sFlow forecast system, a real-time reporting system that gives real-time notice of network assaults, involving attackers and target information, to the SDN controller security framework via commands. The SDN controller interacts with the switch to discard DDoS traffic while allowing valid traffic to continue through. The attack is stopped fast enough to prevent it from rapidly growing and resulting in 95 blocks published, which is approximately 40% more than the 3 rd case.  
Figure 6: Experimental Setup Architecture.