62

Every x blocks the mining reward is halved. Will the reward be halved forever such that we never quite reach 21 million bitcoins, or will we reach 21 million bitcoins at some point and will the reward cease to exist altogether?

Extra points for pointing to the relevant code!

Murch
  • 71,155
  • 33
  • 180
  • 600
erikvold
  • 873
  • 1
  • 8
  • 15
  • 1
    possible duplicate of [How many bitcoins will there eventually be?](http://bitcoin.stackexchange.com/q/161/5406). Related: [What will happen to mining after the 20 999 999th Bitcoin?](http://bitcoin.stackexchange.com/q/5275/5406) – Murch Aug 10 '15 at 14:31

3 Answers3

152

People say the total will be 21000000 BTC.

... however:

  • The 1st 210000 blocks each allow creating 50 BTC.

  • The 2nd 210000 blocks each allow creating 25 BTC.

  • The 3rd 210000 blocks each allow creating 12.5 BTC.

  • ...

  • The 10th 210000 blocks each allow creating 0.09765625 BTC.

  • The 11th 210000 blocks each allow creating 0.04882812 BTC, and not 0.048828125 BTC, because only 8 decimals of precision are supported.

  • ...

  • The 33rd 210000 blocks each allow creating 0.00000001 BTC.

After that, the reward is 0.

If you sum all these numbers together, you get 20999999.9769 BTC.

... however, either due to an oversight or intentionally, the coins created in the genesis block cannot be spent.

This leaves us with 20999949.9769 BTC.

... however, due to an early problem in Bitcoin, fixed by BIP30, it was possible to create a coinbase transaction identical to a previous coinbase. This caused the coins created by that older coinbase to be irreversibly "overwritten". This happened in block 91842 (overwriting the coinbase of block 91812) and 91880 (overwriting the coinbase of block 91722). Each time, 50 BTC was lost.

This leaves us with 20999849.9769 BTC.

... however, the protocol rules allow creating up to the amounts listed above. Due to various bugs and miners experimenting with code, some blocks claim less than allowed. Those coins can never be recovered.

  • Block 124724 tried to intentionally claim 0.00000001 BTC less than allowed, but accidentally also failed to claim the fees, losing 0.01000001 BTC.
  • Between block 162705 and block 169899, 193 blocks claimed less than allowed due to a bug, resulting in a total loss of 9.66184623 BTC.
  • Between block 180324 and block 249185, another 836 blocks claimed less than allowed, resulting in a total loss of 0.52584193 BTC.
  • Block 501726 had no transaction outputs (except a 0-value commitment), losing the entire 12.5 BTC subsidy.
  • Block 526591 didn't claim half of the block reward, losing 6.25 BTC.

This leaves us with 20999821.02921183 BTC.

... however, since recently there is a concept of provably unspendable coins. Coins can be sent to an "address" which provably burns them (using OP_RETURN). Bitcoin Core tracks these and removes them from its database, so they are easily accounted for. At least 3.71612692 BTC were burned this way.

This leaves us with 20999817.31308491 BTC (taking everything up to block 528333 into account)

... However, various wallets have been lost or stolen, transactions have been sent to the wrong address, people forgot they owned bitcoin. The totals of this may well be millions. People have tried to tally known losses up here.

https://bitcoin-supply.com/ tracks provably lost bitcoin through publicly available logic.

As of 15 March 2022 they tracked 2,823.43062071 BTC lost

This leaves us with: ??? BTC.

Pieter Wuille
  • 98,249
  • 9
  • 183
  • 287
  • 3
    What were the bugs that caused the 9.66184623 and 0.52584193 bitcoins to be lost? – morsecoder Aug 07 '15 at 00:42
  • 3
    Those were bugs in the (customized) software that the miners were running, so you'd have to ask the miners themselves. – Jannes Aug 07 '15 at 11:15
  • 2
    I thought that `OP_RETURN` gave the money back to the miners. – Arturo Torres Sánchez Aug 07 '15 at 13:06
  • 4
    Arturo: no. You can just create a transaction with a higher fee though, if you want to give money to miners. – Pieter Wuille Aug 07 '15 at 13:09
  • 3
    Arturo: to clarify, typically an OP_RETURN output would have value 0, so it won't burn anything. It still increases the transaction size, so it increases the necessary fee for relay and mining. – Pieter Wuille Aug 07 '15 at 19:23
  • 1
    [The thread Pieter linked](https://bitcointalk.org/index.php?topic=7253.0) tallies up more than 130.000 bitcoins or about 0.6% of all lost. I wouldn't be surprised if it were a lot more than 1%. – Murch Aug 11 '15 at 17:08
  • 1
    @Murch I wouldn't be surprised if it's more than 10%. – Pieter Wuille Aug 08 '17 at 23:46
  • 1
    Time to add Block 501726 bugged to not claim the 12.5 BTC block reward - https://bitcoin.stackexchange.com/questions/67009/can-someone-explain-this-weird-mining-activity/67012#67012 – shad0w_wa1k3r Dec 30 '17 at 19:28
  • 1
    @AshishNitinPatil Done! – Pieter Wuille Dec 31 '17 at 06:07
  • 1
    This related Reddit thread claims that 2700 BTC have been burned: https://www.reddit.com/r/Bitcoin/comments/7n3kzg/as_of_today_nearly_2700_bitcoin_have_been/ – Murch Dec 31 '17 at 07:25
  • "This leaves us with: ??? BTC." Wouldn't be more precise to say "This leaves us with: <20999817.31308491 BTC."? – Anderson Oct 19 '19 at 15:04
  • block explorer shows block 501726 as having fee reward of 184467440724.59550000 BTC but having no transactions. How can this be? – Prince M Mar 19 '21 at 04:47
  • @PrinceM That sounds like a bug in whatever software/explorer you're using to look at that block. It's a block with 1 transaction (the coinbase), and that coinbase accidentally(?) claims 0.00000000 BTC subsidy. This explorer shows it correctly: https://blockstream.info/block/0000000000000000004b27f9ee7ba33d6f048f684aaeb0eea4befd80f1701126?expand – Pieter Wuille Mar 19 '21 at 04:55
  • Thanks Pieter. I was looking here https://www.blockchain.com/btc/block/501726 . Likely a bug. Would like to get my own node running so I can see these things more concretely! – Prince M Mar 19 '21 at 05:02
  • The general advice you will receive on this site: ignore blockchain.com/blockchain.info at all costs. – Pieter Wuille Mar 19 '21 at 05:03
  • [dunno if what these claim to have done makes it to this list](https://suredbits.com/taproot-funds-burned-on-the-bitcoin-blockchain/) – Mercedes Jan 20 '22 at 16:03
  • @Mercedes Yeah, that'd result in a tiny amount of additional unspendable outputs. I'll incorporate those if I update this answer again. – Pieter Wuille Jan 24 '22 at 20:50
25

Neither. The reward eventually ceases, but not at 21 million Bitcoins.

Here's the code (edited for clarity and brevity):

int halvings = nHeight / 210000;
CAmount nSubsidy = 50 * COIN; // COIN is one Bitcoin
// Subsidy is cut in half every 210,000 blocks which will occur approximately every 4 years.
return nSubsidy >> halvings;

(Source.)

Note that it cuts the reward in half using the bit-shift operator, which means that eventually it won't be able to reduce the block reward by exactly half. So how many Bitcoins does it end up making in total?

20,999,999.9769 BTC, or 2,310,000 satoshis short of 21 million. (If you want to be a lot of fun at parties, bring this up whenever someone says that the maximum number of Bitcoins is 21 million.)

Then there are the various Bitcoins that aren't spendable due to various quirks of the Bitcoin protocol, like the genesis block coinbase, or the duplicated coinbase. [Edit: Or the many other instances of unspendable Bitcoins that Pieter mentions in his answer.]

Mercedes
  • 731
  • 4
  • 24
Nick ODell
  • 29,184
  • 11
  • 69
  • 129
  • 5
    Upvoting, as my own answer does not actually link to the code! – Pieter Wuille Aug 07 '15 at 00:26
  • 3
    Note that the right-shift operator's behavior isn't defined for shifts of 64 or more bits. So block 13,440,000 will set 'halvings' to 64, and most compilers currently treat ">> 64" the same as ">> 0", so the reward goes back to 50 BTC per block after 64 halvings (in around 2272). Except that this bug was already fixed, hard-coding the reward to be 0 after 63 halvings. – Chris Moore Jul 08 '16 at 01:08
  • Yes, it was replaced by [this](https://github.com/bitcoin/bitcoin/blob/b9ed2fd026926cafe38a1ee23d47eb891a94ddb1/src/validation.cpp#L1156) in 2014. Here's the [pull request](https://github.com/bitcoin/bitcoin/pull/3842). – MCCCS Sep 15 '18 at 16:33
1

20997107.88801356 once you remove the 2709.42507135 BTC “burn addresses” i.e. the bitcoin addresses with almost assuredly no earthly known private keys and therefore unspent lost forever. There are ~400 burn addresses with a total balance of 2759.42507135 as of Dec 2017 (2709.42507135 excluding the genesis block). Last year the burn addresses balance grew by 8.97 BTC