# Energy-Efficient Edge Optimization Embedded System Using Graph Theory with 2-Tiered Security
## 4 Energy-Efficient Enabled Reliable Edge-SDN Protocol with Graph Theory
### IoT-Security with SDN Architecture  
The proposed system provides the security for a two-tier architecture. In the first phase, nodes establish secure sessions with gateway nodes, and in the second phase gateway nodes communicate securely with SDN using the collaboration of edge devices. The main security measurements and computing costs are performed in the SDN controller. In the beginning, the sensor nodes are requested by edge nodes so their information can be registered in the SDN controller. The registration packet \(RQ\) is composed of node identity \(Nid\), energy \(Nenergy\), and time stamp \(TS\) fields, as given in Equation (9).  
\[RQ=(Nid,\;Nenergy,\;TS) \tag{9}\]  
Inside the table, the SDN controller also stores the neighbor identities. In the proposed system, the SDN controller acts as a key distribution center (KDC) and also has global knowledge of the entire network. Once the SDN controller receives the request of the nodes,  
Figure 1: States of the proposed system with their interactions.  
Figure 2: Flowchart of the proposed system for optimized subgraphs using graph theory.  
it verifies their identities using its table. If they are authentic, the SDN controller generates secret keys _s_k_ for \(ni\) nodes that are digitally signed by its master key \(MK\), as given below.  
\[SDN\to ni\colon\ E\_MK(s\_k) \tag{10}\]  
Upon receiving the keys, nodes verify them, and once the outcome is positive, the node registers itself in the blockchain. The blockchain is the combination of the hash values in the form of a chain, and this technology is executed until the entire route is fully secured against privacy and integrity attacks. The chain comprises various data blocks, and each block is separately encrypted with digital signs to ensure its authentication. Each device uses the principle of blockchain in a distributed manner and provides the system with the highest degree of reliability. The encryption of each block is performed with a one-time pad and data bits key by using the xor operation. The digital hashes offer the integrity of the devices. Any third-party or intermediate device is not permitted to access the IoT data until it has permission. The data-originating node can control its data and in which way it can be accessed by other devices. Figure 3 illustrates the working principle of the proposed system for ensuring security with the support of SDN controllers. On receiving the IoT data, the gateways further forward it to the edge layer for reducing the response time. Moreover, the data are also verified at edge devices, and, accordingly, the information regarding the data and the network is sent to the SDN controller. In this way, the SDN controller keeps the updated information about the network, and, if in any case, the performance is unsatisfactory, the SDN controller sends the warning message to the edge device to reformulate the routing process. After completing the routing phase and authentication processes, the proposed system explores blockchain technology, and nodes register themselves in the chain to ensure integrity with privacy.