Why there will only ever be 21m bitcoins

Bitcoin’s scarcity is a frequently advertised benefit of the network and the asset’s future price potential but how can we be sure there will only ever be 21m bitcoins? In this piece I will break down how the Bitcoin network caps its supply, when the last bitcoins (or parts thereof) will be created and why the finite nature of the asset is so important.

Firstly let’s start with topic of where new bitcoins even come from, I dug into this in depth within my piece How does new cryptocurrency come into existence but a recap of this is that every c.10 minutes a new block is added to the blockchain and the miner who successfully adds it is rewarded with some newly mined bitcoins (as well as claiming the transactions fees for all the transactions within the block).

However it’s important to note that this supply of bitcoins is not sat in a pool waiting to be distributed, nor is some ethereal being sending the new bitcoins out with each block, instead when a block is successfully mined the new bitcoins are sprung into existence within what’s called the coinbase transaction. I also have an in-depth write up about this transaction type in my piece What is a coinbase transaction? but this is essentially a special transaction type where there are no inputs and instead just outputs bringing these new bitcoins to life.

The bitcoin code specifies that the block reward given in the coinbase transaction should start at 50 BTC and then halve every 210,000 blocks — roughly every 4 years. This event is referred to as a “Halving” and there’s always a notable amount of price speculation around these dates. Perhaps unsurprisingly I also have a piece about this too …. What is a halving?. The most recent halving was 11th May 2020 and the next halving is expected to occur in May 2024 with the final one predicted to be in May 2140. You might note that no set date is given, and this is because although blocks are found on average every 10 minutes they can be found much quicker or slower and so although an estimate of the next halving day can be made, it becomes more precise as the 210,000 block epoch progresses.

Knowing that the block reward started at 50BTC in the genesis block (3rd January 2009) and halves every 210,000 blocks is almost enough to compute the rate at which new bitcoins will enter the ecosystem and the final number of bitcoins which will every be created. However we need one more key piece of information… the number of decimal places a bitcoin has. The answer is 8 with the smallest unit being called a Satoshi after the pseudonymous founder of the network (who’s not Craig Wright :P) Cryptocurrency Base Units. This means a bitcoin can be divided into 100,000,000 units and we therefore see a bitcoin creation schedule as per the below table:

But the beady eyed among you will have noticed that we don’t have a supply of exactly 21m bitcoins, we in fact have just 20,999, 999.9769 . The reasons for this are due to rounding errors which means that where the reward at block 2,100,000 ‘should’ be 0.048828125 BTC, because this is to 9 decimal places and bitcoin is limited to 8 then the extra 0.000000005 is discarded. This continues for all halvings thereafter and shaves off a portion of the total supply. In addition to this, there are numerous examples where miners have actually underpaid the block rewards and therefore reduced the total supply. One example of this is in block 124,724 where a user called midnightmagic mined a block and set the reward to 49.99999999 rather than the maximum value allowed of 50 BTC. This was likely the result of a bug but as reported by Amberdata there are 1,123 instances of this which puts the actual maximum bitcoin supply likely at 20,999,971.02187096.

With over 18.7m bitcoins already mined, the next c.120 years will see the remaining bitcoin mined in increasingly smaller volumes.

Whilst all this sounds programatic and deterministic, couldn’t a miner just create a coinbase transaction which has more than the allowed new bitcoins in, or could they have two coinbase transaction in a block, or could a consensus in the network just decide to increase the total supply?

Let’s dig into these very important questions by looking at the technicals …

What’s stopping a miner creating a coinbase transaction with more than the allowed block reward for the epoch?

To calculate the block reward the miner must call a function in the bitcoin code called `GetBlockSubsidy`. This function is essentially checking the current block height and comparing this to the rule that the block reward should start at 50BTC and halve every 210,000 blocks. As such this provides them with the maximum block reward they can claim in the block.

Therefore, if the block the miner is creating is height 439,528 then the calculation will be (n.b this is heavily simplified but paints the picture!)

439,528 / 210,000 which results in 2.09. This is rounded to the lowest value integer which is 2 and therefore the block reward to be given is 50 halved twice so 12.5 BTC.

Similarly if the miner was creating block with height 1,857,375 then the calculation would be

1,857,375 / 120,000 which results in 8.84 so requires 8 halving from the initial 50BTC reward value. The miner would therefore receive 0.1953125 BTC for successfully mining the block.

The output of the function is therefore easily verifiable by other nodes on the network and ensures that the miner cannot award themselves more than the maximum block reward. However as noted above in the block 124,724 example, a miner is completely free to reward themselves a value below this maximum.

Could a miner double their earnings by putting two (or more) coinbase transactions in their block?

Alas Satoshi though of this too! For every new block which is created and propagated through the system, all the full nodes on the network (who are keeping a complete history of all transactions and blocks) run a few validation checks as stated in the `CheckBlock` function. One of these checks is to ensure that there is one and only one coinbase transaction. This is simple to check as a coinbase transaction should be the only transaction in the block with no inputs. If there is more than one transaction of this type the whole block will be rejected and the miner will have expended all the energy to mine the block with no reward.

Could the network decide to create more bitcoins after 2140?

The Bitcoin network is software and can therefore be upgraded and evolved — in fact the bitcoin network has had 21 major upgrades and numerous minor changes (with v0.21.1 being released just last week). As such it’s not technically infeasible that, with consensus, the community could decide to increase the bitcoin supply- however the key question is cui bono — who benefits?

Bitcoin is deflationary by its very nature due to a fixed supply and with (what’s hoped to be) rising demand, therefore the price should increase [this is not financial advice!!]. As such for any bitcoin hodlers the idea to add more supply into the market would be unappealing since this could have a negative effect on the price.

However what about people who missed the boat and want some bitcoin post 2140? In the same way the majority of new bitcoin owners do now, they would need to use an exchange or service to buy bitcoin from someone else. However whilst bitcoin transactions now are on average 2 BTC, if the USD value continues to increase [this is also not investment advice] then the amount of bitcoin someone may need/want to purchase could be considerably smaller and have the same or higher value. Therefore with c21m bitcoins and 8 decimal places of value there are 2.1 quadrillion satoshis that could be owned and distributed, enough for every person on the planet to own 300,000 satoshis.

Finally, what about the miners, after all whilst they are currently receiving 6.25 newly mined bitcoins plus transaction fees, after 2140 they will only receive the transaction fees per block. However as noted above, the expected increase [still not investment advice] in BTC value should ensure that mining stays profitable even with the removal of the block reward. This was predicted by Satoshi and has held true through the last 3 halving, despite some miner burn off following each event:

“Once a predetermined number of coins have entered circulation, the incentive can transition entirely to transaction fees and be completely inflation free.” (bitcoin.org/bitcoin-paper)

In the next piece I’ll take a look at these c.21m bitcoins to explain what the spendable supply is.



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store