Harvesting energy from the environment is an emerging technology for future networks and specially wireless sensor networks (WSNs) to power them and prolong the overall lifetime. The amount of available energy at the sensor nodes play a key role in the level of the network reliability, connectivity, and Quality of Service(QoS). In this project, a new stochastic framework for energy and lifetime distributions of energy harvesting sensor networks (EHWSNs) is developed, which accounts for the various parameters such as wireless communication channel, renewable energy source, harvesting policy, MAC protocol, error control, duty-cycle, and traffic generation model. More specifically, an energy transient analysis technique is introduced which employs the stochastic semi-markov process to derive the residual energy distribution for each harvesting node with a rechargeable battery. By using the energy distribution, the analytical solutions for node and network lifetime distributions are computed such that the effect of various network and protocol parameters are captured. Simulation results are computed to verify the accuracy of the proposed analytical models. They provide insight into the performance of rechargeable nodes as well as the effect of different hardware and harvesting parameters on the lifetime.