Decentralized Markets and Endogenous Institutions