Research Article

Exploiting Blockchain and RMCV-Based Malicious Node Detection in ETD-LEACH for Wireless Sensor Networks

Algorithm 2

RMCV-ETD-LEACH protocol.
1: Deployment of nodes and BS
2: Degree of nodes
3: Fordo
4: Fordo
5:  Ifthen
6:   Find distance of the nodes
7:   Ifthen
8:    Add index of the nodes
9:   End if
10:  End if
11: End for
12: End for
13: Fordo
14: Fordo
15:  Check the nodes’ neighbors
16:  Ifthen
17:   
18:  Else
19:   
20:  End if
21: End for
22: End for
23: Fordo
24: Fordo
25:  Ifthen
26:   All nodes will die
27:  End if
28:  Ifthen
29:   First node dies
30:  End if
31:  Ifthen
32:   Half nodes die
33:  End if
34:  Ifthen
35:   Full nodes die
36:  End if
37: End for
38: Fordo
39:  On the basis of nodes’ degree, CHs are selected
40:  If
then
41:   Ifthen
42:    
43:    Ifthen
44:     Perform CHs’ selection
45:     Send data packets
46:    End if
47:   End if
48:  End if
49: End for
50: Calculate content similarity of data packets using Equation (2)
51: Calculate content conflict using Equation (3)
52: Calculate path similarity using Equation (3)
53: Calculate final trust using Equation (3)
54: End for