A cryptocurrency system such as Bitcoin relies on a decentralized network of anonymous validators to maintain and update copies of the ledger in a process called mining. In such a permissionless system, someone can cheat by spending a coin twice, which leads to the so-called double-spending problem. A well-functioning cryptocurrency system must ensure that users do not have an incentive to double spend.

We develop a general-equilibrium model of a cryptocurrency. We use the model to obtain a condition that rules out double spending and study the optimal design of cryptocurrencies. We also quantify the welfare costs of using a cryptocurrency as a payment instrument.

We find that it is better to use the revenue from currency creation rather than transaction fees to finance the costly mining process. We estimate that Bitcoin generates a large welfare loss that is about 500 times bigger than the welfare loss in a monetary economy with 2 percent inflation. This welfare loss can be lowered in an optimal design to the equivalent of that in a monetary economy with moderate inflation of about 45 percent.