I develop a dynamic model of private provision of public bads allowing investments in technologies. The analysis is tractable and the MPE unique. The framework is used to derive optimal incomplete contracts in a dynamic setting. While the noncooperative equilibrium is very inefficient, short-term contracts can be worse due to hold-up problems. The optimal long-term contract is more ambitious if its length is relatively short and the technological spillover large. The optimal length increases in this externality. With renegotiation, the outcome is first best. The results have several implications for how to design a climate treaty.