# Blockchain Based Secure Routing and Trust Management in Wireless Sensor Networks +
## 7 Attacker Model  
A variety of attacks are possible in the WSN, such as sybil and DoS attacks. In a sybil attack, the malicious nodes steal the identity of legitimate nodes or illegally create fake multiple identities and then become part of the network. The malicious nodes eavesdrop on the communication between nodes and then broadcast wrong information into the network. The attack is performed in multiple ways. One of them is direct communication between the legitimate and malicious nodes. Another way is when a malicious node steals the identity of a legitimate node and broadcasts wrong information on the behalf of legitimate nodes [49]. Finally, another attack is the DoS attack, where the malicious nodes launch an attack to exhaust the energy of legitimate nodes. This attack affects the routing and performance of the network.  
Figure 9 shows the comparison of network lifetimes of our proposed model with and without sybil and DoS attacks. The network lifetime of the proposed solution is longer than the model with DoS and sybil attacks. In a sybil attack, the malicious nodes create multiple fake identities or steal the IDs of the legitimate nodes. After this, they claim themselves as the legitimate nodes to disrupt the whole network. As the sybil attacker has multiple identities, they send multiple packets with wrong information to ANs through multiple identifiers. In a DoS attack, the malicious nodes steal the IDs of legitimate node and then forward unwanted information towards ANs. A lot of energy of ANs is consumed in discarding unwanted information, which degrades the network lifetime. Moreover, communication with the malicious nodes results in a data loss. Therefore, an authentication and trust evaluation mechanism is proposed in this model. Firstly, the nodes are authenticated through their MAC addresses. Then, the trust of each SNs is evaluated on the basis of FR, RT and DT. After this, the NCQ value of each SN is computed and nodes with a trust value lower than the thresholds are removed from the network.  
Figure 10 shows the energy consumption of the proposed model with DoS and sybil attacks. In the sybil and DoS attacks, the attackers forge information and broadcast unwanted information that consumes a lot of energy of ANs. The proposed model outperforms the model with sybil and DoS attacks. In the proposed model, each SN forwards the sensed information towards its associated AN. The ANs compute trust values of SNs on the basis of DT, FR and RT. According to the value of NCQ, the number of successful and unsuccessful communications is computed. Then, the trust value is computed, and the SNs with trust values below the threshold are removed from the network. Therefore, minimal energy is consumed in the proposed model, which indicates the maximum network lifetime.  
Figure 8: Formal analysis of smart contract using Oyente.  
Figure 11 shows PDR analysis of the model with the sybil and DoS attacks and the network without these attacks. In the presence of sybil and DoS attackers, few packets are received at the BS. The attackers selectively forward or tamper with the packets. In the proposed model, the trust values of the SNs are computed by the ANs. Then, only trusted SNs participate in forwarding the data packets. Hence, high PDR indicates minimum packet loss in the proposed model.  
Figure 11: PDR with and without attacks.  
Figure 10: Residual energy with and without attacks.  
Figure 9: Dead nodes with and without attacks.