# Blockchain Based Secure Routing and Trust Management in Wireless Sensor Networks +
## 4 System Model
### Trust Evaluation Mechanism
#### 4.4.4 Node Communication Quality  
NCQ helps in calculating the number of successful and unsuccessful communications on the basis of DT, FR and RT. It is computed by the following equation [19]:  
\[NCQ=\gamma*DT+\lambda*(I\_FR)+\sigma*RT, \tag{4}\]  
where the weights for \(DT\), \(FR\) and \(RT\) are \(\gamma\), \(\lambda\) and \(\sigma\), respectively [19].  
\[\gamma+\lambda+\sigma=1. \tag{5}\]  
The weights are adjusted for the proposed model that shows the importance of \(DT\), \(FR\) and \(RT\). The weights considered for the trust evaluation are \(\gamma\) = 0.33, \(\lambda\) = 0.34 and \(\sigma\) = 0.33, which are taken from [19].  
The threshold \(\kappa\) is set as per the following scenario. When NCQ \(>\kappa\), the number of unsuccessful communications \(N_{F}\) of the SNs is increased. Otherwise, the number of successful communications \(N_{S}\) of the SNs is increased. The trust values of the SNs are computed using the successful and unsuccessful communications by the following equation [19]:  
\[\eta=\frac{N_{S}+1}{N_{S}+N_{F}+2}. \tag{6}\]  
After the calculation of the trust values, the trust value of each node is compared with a predefined threshold. The nodes with a trust value higher than threshold are considered as legitimate nodes, otherwise they are considered as malicious nodes. In Table 2, the mapping between identified limitations, proposed solutions and validations is shown. The first limitation (L1) is the presence of malicious nodes, which degrades the network's performance. To solve this issue, the trust value of each node is computed that depends on DT, FR and RT and it is used to differentiate between the malicious and legitimate nodes. The FPR, FNR and DA are used to evaluate the proposed model. The second and third limitations (L2 and L3) are low PDR and high energy consumption. After the trust evaluation, the SNs with high trust values take part in the packet transmission, which increases the PDR. The ANs collect data from the corresponding SNs and forward them to the BSs. The performance parameters, i.e., PDR, network lifetime and residual energy, are used to check the validity of the proposed model. The fourth limitation (L4) is a key exchange problem. To deal with this limitation, RSA is used for packet encryption and decryption.  
\begin{table}
\begin{tabular}{p{113.8 pt} p{113.8 pt} p{113.8 pt}} \hline \hline
**Identified Limitations** & **Proposed Solutions** & **Validation Done** \\ \hline L1: Presence of malicious nodes & S1: Trust evaluation considering NCQ value to remove malicious nodes from the network & V1: Trust values of the SNs, FNR, FFR and DA. The results are depicted in Figures 2b and 3a,b \\ \hline L2: Low PDR due to the involvement of malicious nodes & S2, S3: The trusted SNs perform routing, SNs send their packets to the ANs, who forward the packets to BSs. Through this process, little energy is consumed by the SNs & V2, V3: PDR, network lifetime and residual energy. The results are depicted in Figures 2a and 4a,b \\ \hline L4: Key exchange problem & S4: RSA is used for the secure transmission of data considering key generation, encryption and decryption & V4: Direct validation is not shown explicitly \\ \hline \hline \end{tabular}
\end{table}
Table 2: Mapping table of limitations, their solutions and the validation parameters.