We use the tools of mechanism design combined with the theory of risk measures to analyze how a cash-constrained owner of an asset with known, stochastic returns raises capital from a population of investors who differ in their risk aversion and budget constraints. The issuer partitions the asset’s cash flow into several asset-backed securities, one for each type of investor. The optimal partition conforms to the commonly observed practice of tranching into senior debt, junior debt, and equity. Tranching arises endogenously due to the differences in risk appetites among agents and in the budget constraints they face. (JEL D81, D82, G12, G41, G51)