  We present an analysis of the Proof-of-Work consensus algorithm, used on the
Bitcoin blockchain, using a Mean Field Game framework. Using a master equation,
we provide an equilibrium characterization of the total computational power
devoted to mining the blockchain (hashrate). From a simple setting we show how
the master equation approach allows us to enrich the model by relaxing most of
the simplifying assumptions. The essential structure of the game is preserved
across all the enrichments. In deterministic settings, the hashrate ultimately
reaches a steady state in which it increases at the rate of technological
progress. In stochastic settings, there exists a target for the hashrate for
every possible random state. As a consequence, we show that in equilibrium the
security of the underlying blockchain is either $i)$ constant, or $ii)$
increases with the demand for the underlying cryptocurrency.
