We study stochastic energetic exchanges in quantum heat engines. Due to microreversibility, these obey a fluctuation relation, called the heat engine fluctuation relation, which implies the Carnot bound: no machine can have an efficiency greater than Carnot's efficiency. The stochastic thermodynamics of a quantum heat engine (including the joint statistics of heat and work and the statistics of efficiency) are illustrated by means of an optimal two-qubit heat engine, where each qubit is coupled to a thermal bath and a two-qubit gate determines energy exchanges between the two qubits. We discuss possible solid-state implementations with Cooper-pair boxes and flux qubits, quantum gate operations, and fast calorimetric on-chip measurements of single stochastic events. -10], this is typically impossible in a quantum system. In the quantum scenario, the situation is greatly complicated by the invasiveness of the measurement apparatus, which can lead to collapse of the wave function. The prescription accordingly is to measure the energy of the system twice (at the beginning and end of the forcing protocol) by means of two projective measurements and obtain the work as their difference [11][12][13][14].This two-measurement scheme has, however, proved challenging from an experimental point of view [15,16], so much so that it has been carried out only very recently [17]. This occurrence has triggered the OPEN ACCESS RECEIVED 1 2 , i.e., the first subsystem is assumed to be not colder than the second at the initial time. Also we assume that at all times the Hamiltonian is time reversal symmetric [48]. We further assume that the compound system is thermally isolated and that the driving is New J. Phys. 17 (2015) 035012 M Campisi et al