  For chemical reaction networks described by a master equation, we define
energy and entropy on a stochastic trajectory and develop a consistent
nonequilibrium thermodynamic description along a single stochastic trajectory
of reaction events. A first-law like energy balance relates internal energy,
applied (chemical) work and dissipated heat for every single reaction. Entropy
production along a single trajectory involves a sum over changes in the entropy
of the network itself and the entropy of the medium. The latter is given by the
exchanged heat identified through the first law. Total entropy production is
constrained by an integral fluctuation theorem for networks arbitrarily driven
by time-dependent rates and a detailed fluctuation theorem for networks in the
steady state. Further exact relations like a generalized Jarzynski relation and
a generalized Clausius inequality are discussed. We illustrate these results
for a three-species cyclic reaction network which exhibits nonequilibrium
steady states as well as transitions between different steady states.
