## 3 Multi-Layer Security Approach Based on Vulnerability Indices
### The Blockchain Architecture-Based Public Defense  
This part tries to express the first layer of the proposed security mechanism designed concerning the blockchain-structure-based data exchanging within the smart grid. In this regard, it is necessary to first describe the performance of the blockchain architecture aiming to get a secured effective scheme within the modern electrical grid. In recent years, some investigations have advocated that the applications of blockchain technology have embraced much attention [40]. The blockchain structure is executed for different stages including the distributed and fault-tolerant systems wherein every node is allowed to share its data without a specific control system. However, there are some communication restrictions for broadcasting data that obey the network graph based on the graph theory. In this way, each node has a channel with its neighbors in a bidirectional manner that Figure 2 shows. In the same vein, the two below constraints (36, 37) must be satisfied. Performing this theory gives rise to disproving the virtual nodes; therefore, each node is active in its specific location. \[\lambda_{x}(x,y)=\lambda_{x}(y,x) \tag{36}\]  
\[N(x)=N_{in}(x)=N_{out}(x) \tag{37}\]  
The constraint (36) is representative of the bidirectional network, and (36) is the set of neighbors of \(x\). This framework can be useful to prevent the penetration of hackers who aim to manipulate the network data. This means that the blockchain system is aimed at deactivating adversarial strategies related to attackers with the use of honest nodes, which are capable of making high computational attempts [41]. In the rest, the fundamental structure of the blockchain network is explained to elaborate on validating the security behavior of such systems to overcome the malicious targets of attackers. Figure 1: The multi-layer security process. Figure 2: Bidirectional channel among nodes: (**a**) bidirectional form. (**b**) neighbors set. The one of main features pertaining to the blockchain mechanism is to exchange data among nodes in a decentralized situation. Such systems can align to provide the needed conditions for agents that desire to participate in the transactions within the trustless system. On the other hand, the decentralized blockchain platform will basically let the nodes communicate with each other to validate the legitimacy of new transactions within the consensus algorithm. Besides this, note that the information released by nodes needs to be crypto graphed in such a security process. In view of these facts, the blockchain system has some significant advantages compared to the centralization-based security systems as follows: 1- Validating trades related to each node performed by a consensus algorithm. 2- Organizing nodes in form of the peer-to-peer (P2P) structure, as indicated in Figure 1, without any architecture to connect them in the network [42]. Regarding the above argument, the structure of the blockchain system is basically designed using three main sections, consisting of the decentralized network, consensus algorithm, and cryptographic process. The basic construction of the decentralized network is to improve the message exchange among nodes for keeping the distributed ledgers assigned to any node. Generally, such a structure is based on a P2P construction in order to leave/join from/to the network independently. It is axiomatic that the decentralization-based network architecture is able to reduce the failures of the nodes and connection [43]. As a second part, the blockchain process needs to have an effective consensus protocol organized through P2P-based construction to validate transactions related to every node. According to the consensus procedure, the messages given from the P2P structure should be registered in the ledgers. In addition, the consensus protocol according to the received blocks is aimed to get an appropriate agreement with regard to the association of them.