Legal institutions affect economic outcomes, but how much? This paper documents how costly supplier contract enforcement shapes firm boundaries, and quantifies the impact of this transaction cost on aggregate productivity and welfare. I embed a contracting game between a buyer and a supplier in a general-equilibrium macro-model. Contract enforcement costs lead suppliers to underproduce. Thus, firms will perform more of the production process in-house instead of outsourcing it. On a macroeconomic scale, in countries with slow and costly courts, firms should buy relatively less inputs from sectors whose products are more specific to the buyer-seller relationship. I first present reduced-form evidence for this hypothesis using cross-country regressions. I use microdata on case law from the United States to construct a new measure of relationship-specificity by sector-pairs. This allows me to control for productivity differences across countries and sectors and to identify the effect of contracting frictions on industry structure. I then proceed to structurally estimate the key parameters of my macro-model. Using a set of counterfactual experiments, I investigate the role of contracting frictions in shap- ing productivity and income per capita across countries. Setting enforcement costs to US levels (alternative: zero) would increase real income by an average of 3.6 percent (7 percent) across all countries, and by an average of 10 percent (13.3 percent) across low-income countries. Hence, transaction costs and firm boundaries are important on a macroeconomic scale.