Wednesday, September 10, 2014

Bitcoin Money Supply

I sometimes get the question of what is the money supply of Bitcoin. The answer is, of course, that the total monetary supply is fixed at something over 21 million bitcoins, and also that the path of monetary supply is predetermined. But, wait a second, if miners are mining new bitcoins into existence how can the path of monetary supply be fixed?

The path of monetary supply

I like this kind of question, because it has a simple, closed answer: it is written in the source code. To understand the path of monetary supply we have to look at several parts of the Bitcoin source code.

But first, lets clear out a common misconception. Bitcoin mining differs from, say, gold mining in an important aspect: in gold mining if all miners in the world decide to mine harder (i.e. invest more in mining equipment, hire more workers, start new exploration, and so on) then gold will be mined faster. Not so in Bitcoin: if all Bitcoin miners decide to mine harder (i.e. invest more in ASICs), the number of bitcoins awarded to the miners stays the same. In other words, the difficulty of the mining problem increases, so that each individual miner is rewarded less bitcoins for solving the same mining (partial hash inversion) problem. This decrease in the reward exactly offsets the increase in total network hash rate (mining power), so that the total reward to miners stays the same.

Let's see where all this is written in the code. First, lets look at the function GetBlockValue in main.cpp:

int64_t GetBlockValue(int nHeight, int64_t nFees)
{
    int64_t nSubsidy = 50 * COIN;
    int halvings = nHeight / Params().SubsidyHalvingInterval();

    // Force block reward to zero when right shift is undefined.
    if (halvings >= 64)
        return nFees;

    // Subsidy is cut in half every 210,000 blocks which will occur approximately every 4 years.
    nSubsidy >>= halvings;

    return nSubsidy + nFees;
}

The first bold line fixes the reward to miners (called nSubsidy) to 50 bitcoins. This is the initial reward to miners, during the first 4 years of existence of Bitcoin. The second line defines the variable halvings which will have the reward to miners. As the comment indicates, this halving occurs every 210,000 blocks or roughly every 4 years. But where in the code is it indicated that the halving occurs every 210,000 blocks? In  chainparams.cpp:

class CMainParams : public CChainParams {
public:
    CMainParams() {
        ...
        bnProofOfWorkLimit = ~uint256(0) >> 32;
        nSubsidyHalvingInterval = 210000;
        nEnforceBlockUpgradeMajority = 750;
        ...

The variable nSubsidyHalvingInterval controls the number of blocks that have to lapse before the reward to miners is halved. Thus, every 4 years the reward awarded to miners for each mined block is halved. This allows us to compute the number of bitcoins created:

Year 1: 50*52,560 = 2,628,000
Year 2: 50*52,560 = 2,628,000
Year 3: 50*52,560 = 2,628,000
Year 4: 50*52,560 = 2,628,000
Year 5: 25*52,560 = 1,314,000
Year 6: 25*52,560 = 1,314,000
Year 7: 25*52,560 = 1,314,000
Year 8: 25*52,560 = 1,314,000
Year 9: 12.5*52,560 = 657,000
Year 10: 12.5*52,560 = 657,000
...

Where 52,560 = 6 * 24 * 365 is the number of 10 minute periods in a year (let's pretend that there are no leap years). This series sums to 21,052,464, which is the total money supply of bitcoins.

But surely it is not that simple...

It turns out it is not. The path of monetary creation, and thus the total monetary supply is written in the code. So it could potentially be changed. This is where it gets complicated... and interesting.

According to the Bitcoin wiki the total monetary supply and its path of creation cannot be subject to change, or the end result should not be called Bitcoin. But changed it can be. So what would happen if it was changed?

As with all changes there would be winners and losers. For instance, if the money supply of Bitcoin where increased, the current holders of bitcoins would likely be losers, as their bitcoins would be worth less. On the other hand, miners benefiting from an increased block reward would be winners.

The losers would oppose the change and the winners would favor it. Would they vote on the outcome? Perhaps. But a likely outcome is that both groups would part ways: there would be a fork in the code, creating two different versions of Bitcoin.

Chaos would ensue, and this will likely harm both groups. This is the reason why many argue that such a change would in the end harm everyone, even the supposedly "winners."

In a sense forking Bitcoin in such a way is not that different from creating an alt-coin with the new money supply rules: the difference mostly lies in semantics and what project keeps the Bitcoin name and "brand value."

Future proponents of a change to the monetary supply rules know that the outcome of a direct fork would be harmful, and thus would likely try to gather enough support from all parties involved before executing the change.

And this is the key: whether changes in Bitcoin are accepted or not ultimately depends on the mind-share of the proposed changes among all parties involved: developers, businesses, miners, users, ...

No comments:

Post a Comment