# IoT-Chain and Monitoring-Chain Using Multilevel Blockchain for IoT Security
## 4 Architecture
### Workflow  
This section describes the operation process of the proposed \(Network_{ic}\) and \(Network_{mc}\). The processes of registering \(BH_{genesis}\) to \(Network_{mc}\), creating \(TX\) and \(Block_{ic}\), embedding \(IC\) from \(Network_{ic}\) to \(Network_{mc}\), verifying \(Block_{export}\) in \(Network_{mc}\), and starting over from \(Block_{genesis}\) in \(Network_{ic}\) are explained in order. Algorithm 1 is the process of saving the information of \(Node_{ic}\) to register \(IC\) in \(Network_{mc}\). All \(Node_{ic}\) sends \(BH_{genesis}\) of the same IoT-Chain to \(MC\) and stores it through \(SC\). The operation process consists of a process of generating a signature and requesting to register a node, and a process of registering node information by verifying the signature. In the case of signature generation, it runs on the nodes of the IoT chain, and in the case of verification, it operates on the nodes constituting the monitoring chain. To register \(Network_{ic}\) in \(Network_{mc}\), it is necessary to verify that all \(BH_{genesis}\) owned by the node are the same. \(Node_{ic}\) encrypts \(BH_{genesis}\) through \(Key_{priv}\) to create \(Sig\), and creates \(TX\) containing \(Sig\) and \(BH_{genesis}\) to send to \(Network_{mc}\). \(Node_{mc}\) requests \(Key_{pub}\) from \(CA\) for \(Sig\) included in \(TX\), and all \(Sig\) included in \(TX\) are sent from \(Network_{ic}\). If the decrypted value of \(BH_{genesis}\) is the same, the corresponding \(BH_{genesis}\) is stored in the \(MC\). Multiple \(Network_{ic}\) can be distinguished through the saved \(BH_{genesis}\), and \(Key_{pub}\) of \(Node_{ic}\) can be requested from the \(CA\). ```
1:procedureprocedure\(Node_{ic}\) :
2:for\(Node_{iot}\) in \(Network_{ic}\)do
3:\(Sig\leftarrow CreateSig(BH_{genesis},Key_{Priv})\)
4:\(TX\leftarrow CreateTx(GenesisBH,Sig)\)
5:\(SendTXtoMC(TX)\)
6:endfor
7:endprocedure
8:
9:procedureprocedure\(Node_{mc}\) :
10:for\(Node_{mc}\) in \(Network_{mc}\)do
11:\(Sig,BH_{last}\gets GetTX()\)
12:\(Key_{pub}\gets CA\)
13:if\(VerifySig(Sig,BH_{last},Key_{pub})\) is true then
14:\(SetState(BH_{last})\)
15:endif
16:endfor
17:endprocedure
```  
**Algorithm 1**\(Network_{ic}\) enrollment. Algorithm 2 is the process of creating blocks and transactions in the IoT-Chain. The operation process consists of the process of creating a transaction, including the data collected from the IoT device through the sensor, and the process of creating a block by including the transaction in the block after verification. In the case of transaction creation, it operates on the nodes of the IoT chain. In the case of block generation after transaction verification, it is operated by a leader node randomly selected from among the nodes of the IoT chain every block generation round. \(Node_{ic}\) generates sensor data and encrypts the sensor data using \(Key_{priv}\) for \(TX\) generation. The \(VRF\) is executed to return \(Val_{rand}\) and to transmit \(TX\), including sensor data, \(Sig\), and \(Val_{rand}\), to \(Node_{teader}\) recorded in the last block. \(Node_{teader}\) verifies the values stored in \(TX\) with \(Key_{pub}\) and has the largest value of \(Val_{rand}\). After selecting \(Node_{ic}\) as the next \(Node_{teader}\), it is recorded in \(Block_{ic}\), distributed to \(Network_{ic}\), and added to the \(IC\). Unlike \(O(n^{2})\), which is the communication amount of the PBFT-based algorithm that achieves consensus through network communication, a leader node is selected through a random function, and the block is verified with the communication amount of \(O(n)\). Through the consensus algorithm with a reduced number of messages compared to the PBFT-based consensus algorithm, consensus is possible evenin IoT devices with low computational power without using the PoW-based consensus algorithm that requires more computational power.