# Securing Wireless Sensor Networks Using Machine Learning and Blockchain: A Review
## 9 BC and Cyberattack Prevention
### BC in the Literature
The experimental results of [52] indicated that the proposed trust mechanism could reduce both communication overhead and memory requirements. A different approach to protecting data integrity was proposed in [120], where the authors focused on using a cryptographic algorithm in conjunction with a private BC to protect data during transmission between nodes. The authors proposed a methodology integrating BC and Advanced Encryption Standard (AES) symmetric encryption in a WSN system, with the hash value used to encrypt data during the transaction and AES used in the data transport layer as an encryption/decryption process carried out between any two communicating nodes. This methodology reduces resources consumption while protecting the network against linking, MITM, and Distributed denial of service (DDoS) attacks. The method proposed in [120] is not scalable, however, as it is limited to the use of private BCs. The authors of [129] proposed and simulated a new model for a consensus algorithm that can reduce the time required for mining. The results presented in [129] confirmed that the proposed model can potentially protect the network against spoofing and injecting phantom devices; however, the software associated with the model cannot be updated. Protecting the network routing process using a BC was the focus of the work in [141; 144; 145]. The authors of [144] proposed a BC-based routing protocol that uses a BC to store the network's activities and broadcast the status of the nodes. In [144], the aim of the authors was to secure the route determination process by avoiding untrusted nodes and to resolve the load-balancing issues associated with routing. The authors of [141] proposed using the a BC-block approach with flow routing tables instead of converting the entire SDN-enabledWSN network to a BC network, thereby preventing tampering with flow entries. This approach reduces the energy consumption associated with traditional BC algorithms; the results obtained in [141] using a simulated Riverbed model indicate that the proposed scheme can provide security against MITM, replay, and blackhole attacks, though with increased energy consumption and end-to-end delay. A different distributed ledger-based technology was considered in [142] as an effective lightweight network to authenticate and protect routing tables against sybil attacks in addition to protecting the network against fake identities more broadly. However, the proposed network in [142] is time-consuming, not scalable, and has a centralized architecture. The authors of [145] proposed a trust model for a decentralized architecture to secure WSN routing through a dual BC model. The first model is public and implements a PoW consensus to authenticate aggregating nodes (ANs), while the second model is private and uses PoA for authenticated sensor nodes. The PoW mechanism enhances the security level of the unauthenticated public BC, which includes the BSs, though at the cost of high computational complexity. On the other hand, PoA is less computationally complex, helping to reduce the overhead of the resource-limited AN, which is included in the authenticated private BC. Node integrity is evaluated using a trust evaluation metric to determine the legitimate nodes that take part in the routing process; however, the security analysis in [145] indicated that the proposed approach could be vulnerable to smart contract-based attacks resulting from possible bugs in smart contract code, such as integer underflow, overflow, parity multisig, timestamp dependency, transaction ordering dependence, call stack depth attack, and re-entrancy. The authors of [109; 139; 146] proposed BC-based identity authentication mechanisms for sensor nodes joining the network. The authors of [109] proposed a secure identity authentication mechanism in a hierarchical architecture for a multi-WSN environment using public and private BC, where the former includes the BS and terminal users as miners, while the latter is composed of all authenticated CHs.