# IoT-Chain and Monitoring-Chain Using Multilevel Blockchain for IoT Security
## 4 Architecture
### Workflow
In the structure of this paper, verification and verification data transmission are possible in a single signature by compressing the signature using the Schnorr signature. ```
1:procedureprocedure\(Node_{export}\) :
2:if\(SizeOf(IC)\) is \(Maximum\)then
3:\(Sig\gets CreateSig(BH_{last})\)
4:\(rawRoute\gets routingTable\)
5:\(Route\gets CreateSig(rawRoute)\)
6:\(Block_{export}\leftarrow CreateBlock_{export}(BH_{Last},Sig,Route)\)
7:\(StartEmbedding(Block_{export},Cent,Route)\)
8:endif
9:endprocedure
10:
11:procedureprocedureprocedure\(Node_{ic}\) :
12:for\(Node_{ic}\) in \(Network_{ic}\)do
13:\(Block_{export}\gets receive()\)
14:\(Keys_{pub}\gets CA\)
15:\(Key_{chnor}\gets AggregatePub(Key_{chnorr},Keys_{pub})\)
16:if\(Verification(Block_{export}.Sig_{chnorr},Key_{chnorr})\) is \(true\)then
17:\(Sig\gets CreateSig(BH_{last},Key_{priv})\)
18:\(Sig_{chnorr}\gets Block_{export}.Sig_{chnorr}\)
19:\(Sig_{chnorr}\gets CreateSchnorrSig(Sig_{schnorr},Sig)\)
20:\(Block_{export}.Sig_{schnorr}\gets Sig_{schnorr}\)
21:endif
22:if\(exist(consensusRoute.Next)\) is \(true\)then
23:\(Broadcast(Block_{export},Key_{chnorr},Route)\)
24:\(exist(consensusRoute.Next)\) is \(false\)
25:\(Broadcast(Block_{export},Key_{schnorr},Node_{export})\)
26:endif
27:endfor
28:endprocedure
```  
**Algorithm 3**\(Block_{export}\) creation. Algorithm 4 is the process of transferring and saving \(Block_{export}\) from \(Network_{ic}\) to \(Network_{mc}\). In this process, after verifying the block hash value made by the nodes of the IoT chain, it is guaranteed that all nodes maintain the same blockchain. After this verification process is performed, the process of transmitting the compressed signature and hash value to the monitoring chain is performed. In addition, the process of verifying the result value delivered to the monitoring chain and storing it in the monitoring chain is performed. The resulting value of the export process is executed by the exporter node and transmitted to the monitoring chain, and the verification process is performed in the monitoring chain node. In \(Network_{mc}\), \(Sig_{schnorr}\), which is stored in \(Block_{export}\) and delivered by \(Node_{export}\), is requested by the \(CA\). The returned \(Key_{pub}\) is combined and verified, and \(Block_{export}\) is stored in the \(MC\). In \(Network_{ic}\), the \(IC\) is restarted by storing the address in the \(MC\) and embedding the \(IC\) and then performing the hash operation with the stored \(BH_{last}\) and creating the connected block. ```
1:procedureprocedure\(Node_{export}\) :
2:\(Block_{export}\gets receive()\)
3:\(Sig_{schmorr}\gets Block_{export}\_Sig_{sclnorr}\)
4:\(Keys_{pub}\gets CA\)
5:\(Key_{schmorr}\gets CreateSchmorrPub(Keys_{pub})\)
6:if\(Verification(Sig_{schmorr},Key_{schmorr})\) is true then
7:\(Address_{ic}\gets DFS(IC)\)
8:\(Block_{export}\_Address\gets Address_{ic}\)
9:\(SendBlockToMC(Block_{export})\)
10:endif
11:endprocedure
12:
13:procedureprocedureprocedure\(Node_{mc}\) :
14:for\(Node_{mc}\) in \(Network_{mc}\)do
15:\(Block_{export}\gets Rece()\)
16:\(Keys_{pub}\gets CA\)
17:\(Key_{schmorr}\gets CreateSchmorrPub(Keys_{pub})\)
18:if\(Verification(Sig_{schmorr},Key_{schmorr})\) is true then
19:\(PutState(Block_{export})\)
20:endif
21:endfor
22:endprocedure
23:
24:procedureprocedure\(Node_{ic}\) :
25:\(ResetIoTChain(Block_{export}\_BH_{last})\)
26:endprocedure
```  
**Algorithm 4**\(Block_{export}\) verification.