Blockchain technology breathes new life into the classical analysis of money as a substitute for a ledger of all past transactions. While it involves updating the ledger through a decentralized consensus on the unique truth, the robustness of the equilibrium that supports this consensus depends on who has access to the ledger and how it can be updated. Using a global game analysis of an exchange economy with credit, we solve for the optimal ledger design that balances security, scalability and decentralization. When intertemporal incentives are strong, a centralized ledger is always optimal. Otherwise, decentralization may be optimal.