The broadcast nature of communication in transmission media has driven the rise of network coding's popularity in wireless networks. Numerous benefits arise from employing network coding in multihop wireless networks, including enhanced throughput, reduced energy consumption, and decreased end-toend delay. These advantages are a direct outcome of the minimized transmission count. This paper introduces a comprehensive framework to employ network coding in these networks. It refines decision-making at coding and decoding nodes simultaneously. The coding-nodes employ optimal stopping theory to find optimal moments for packet transmission. Meanwhile, the decoding-nodes dynamically decide, through SMDP (Semi Markov Decision Process) problem formulation, whether to conserve energy by deactivating radio units or to stay active for improved coding by overhearing packets. The proposed framework, named ENCODE, enables nodes to learn how and when to use network coding over time. Simulation results compare its performance with existing approaches. Our simulation results shed new light on when and how to use network coding in wireless multi-hop networks more effectively.INDEX TERMS Wireless multi-hop networks, Network coding theory, Coding gain, Optimal stopping theory, semi-Markov decision process.