In this paper, a routing protocol based on energy temperature degree-low energy-adaptive clustering hierarchy (ETD-LEACH) is proposed. In the protocol, nodes consume less energy when transmitting data, which improves the network lifetime. The proposed protocol selects the cluster heads (CHs) on the bases of degree, temperature, and energy to perform routing. Moreover, for solving the issue of a single point of failure, the blockchain is utilized. The data transactions are also housed in the blockchain, which is deployed on the CHs and BSs, as, in blockchain, multiple nodes take part. Therefore, to perform a consensus between them, a proof-of-authority (PoA) consensus mechanism is used in the underlying work. In the blockchain, the secure hashing algorithm-256 (SHA-256) is used for secure hashing of data transactions. Furthermore, malicious nodes are detected during the routing using the real-time message content validation (RMCV) scheme in the ETD-LEACH protocol. The proposed model is evaluated under the denial-of-service (DoS) attack, the man-in-the-middle (MITM) attack, and the smart contract analysis performed by the Oyente tool. The performance of the proposed model is evaluated through simulations. The ETD-LEACH and energy threshold-low energy-adaptive clustering hierarchy (ETH-LEACH) protocols are compared using different parameters like number of alive nodes, energy consumption, throughput, and delay. ETD-LEACH consumes less energy and has a better network lifetime as compared to ETH-LEACH. In addition, the RMCV-ETD-LEACH network performance is better than that of both DoS-ETD-LEACH and MITM-ETD-LEACH. Moreover, PoA transaction cost is less than that of proof of work. Also, the execution time of SHA-256 is less than the execution time of SHA-512. Moreover, the value of the packet delivery ratio (PDR) is found to be 89.9% and 99.9% with and without the malicious nodes, respectively.