  A decentralized blockchain is a distributed ledger that is often used as a
platform for exchanging goods and services. This ledger is maintained by a
network of nodes that obeys a set of rules, called a consensus protocol, which
helps to resolve inconsistencies among local copies of a blockchain. In this
paper, we build a mathematical framework for the consensus protocol designer,
specifying (a) the measurement of a resource which nodes strategically invest
in and compete for to win the right to build new blocks in the blockchain; and
(b) a payoff function for such efforts. Thus, the equilibrium of an associated
stochastic differential game can be implemented by selecting nodes in
proportion to this specified resource and penalizing dishonest nodes by its
loss. This associated, induced game can be further analyzed using mean field
games. The problem can be broken down into two coupled PDEs, where an
individual node's optimal control path is solved using a
Hamilton-Jacobi-Bellman equation, and where the evolution of states
distribution is characterized by a Fokker-Planck equation. We develop numerical
methods to compute the mean field equilibrium for both steady states at the
infinite time horizon and evolutionary dynamics. As an example, we show how the
mean field equilibrium can be applied to the Bitcoin blockchain mechanism
design. We demonstrate that a blockchain can be viewed as a mechanism that
operates in a decentralized setup and propagates properties of the mean field
equilibrium over time, such as the underlying security of the blockchain.
