Efficient routing techniques are critical in a wireless sensor network (WSN) to extend network lifetime and preserve energy, providing uninterrupted data transfer across a wide range of applications. In this research, we intend to develop a novel dynamic waterwheel plant optimization (DWPO) strategy for efficient path planning with blockchain (BC) for enhancing cybersecurity in WSN. Our proposed approach utilizes a fitness function that incorporates inter cluster distance along with other relevant parameters. This function strategically contributes to the selection of ideal routes, contributing to the efficacy of our method for improving cybersecurity in WSN contexts. The experimental validation of the DWPO model is conducted using the MATLAB program and examined in terms of the network lifetime ($93.6 \%$), packet delivery ratio ($90.2 \%$), and energy consumption ($\mathbf{1 8. 2} \mathrm{J}$). The experimental results illustrate that the proposed DWPO approach performed better than the other existing approaches for protecting the routing nodes through efficient path planning with BC-assisted DWPO in a WSN.