The energy transition requires the deployment of risky programs in research and development, the vast majority of which being partially financed by public funding. This paper analyzes the potential benefit of using conditional subsidies. The relationship between the state and innovative firms is formalized in the principal agent framework. Investing in an innovative project requires an initial observable capital outlay. We introduce asymmetric information on the probability of success, which is known to the firm but not to the state agency. Furthermore the firm may influence this probability through an un- observable effort. The outcome of the project, if successful, delivers a private benefit to the firm and an external social benefit to the state. We prove that rewarding failure is a superior strategy in presence of pure adverse selection while rewarding success is superior in presence of pure moral hazard. We also identify conditions in which both forms of subsidies should be implemented. We discuss the benefit of conditional subsidies relative to flat subsidies as well as the remaining gap relative to the first best solution. Our analytical results are interpreted in view of a 10 B€ investment program launched in France in 2010 to promote R&D for the energy transition over the period 2010-2020.