The recent emergence of blockchain-based cryptocurrencies has received a considerable attention. The growing acceptance of cryptocurrencies has led many to speculate that the blockchain technology can surpass a traditional centralized monetary system. However, no monetary model has yet been developed to study the economics of the blockchain. This paper builds a model of the economy with a single generally acepted blockchain-based currency. In the spirit of the search and matching literature I use a matching function to model the operation of the blockchain. The formulation of the money demand is taken from a workhorse of monetary economics - Lagos and Wright (2005). I show that in a blockchain-based monetary system money demand features a precautionary motive which is absent in the standard Lagos-Wright model. Due to this precautionary money demand the monetary equilibrium can be stable for some calibrations. I also used the developed model to study how the equilibrium return on money is dependent on the blockchain parameters such as mining costs and rewards.