<p>Neither. The reward eventually ceases, but not at 21 million Bitcoins.</p>
<p>Here's the code (edited for clarity and brevity):</p>
<pre><code>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 &gt;&gt; halvings;
</code></pre>
<p><a href="https://github.com/bitcoin/bitcoin/blob/a0625b8085aa379ac5f7bdca6f2cbf3cbb4a5d0a/src/main.cpp#L1093" rel="nofollow noreferrer">(Source.)</a></p>
<p>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?</p>
<p>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.)</p>
<p>Then there are the various Bitcoins that aren't spendable due to various quirks of the Bitcoin protocol, like the <a href="https://bitcoin.stackexchange.com/questions/10009/why-can-t-the-genesis-block-coinbase-be-spent">genesis block coinbase</a>, or the <a href="https://web.archive.org/web/20150511232412/http://blockexplorer.com/block/00000000000743f190a18c5577a3c2d2a1f610ae9601ac046a38084ccb7cd721" rel="nofollow noreferrer">duplicated coinbase</a>. [Edit: Or the many other instances of unspendable Bitcoins that Pieter mentions in his answer.]</p>

CC BY-SA 3.0
2015-08-07T00:26:18.220Z
Upvoting, as my own answer does not actually link to the code!
Pieter Wuille
CC BY-SA 3.0
2016-07-08T01:08:47.727Z
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
CC BY-SA 4.0
2018-09-15T16:33:51.770Z
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
CC BY-SA 4.0
2015-08-06T23:33:35.623Z
2022-05-19T18:51:00.163Z
2022-05-19T18:51:00.163Z
Nick ODell
<p>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 <a href="https://bitcoinwhoswho.com/blog/2017/12/30/8-97-bitcoins-burned-in-2017/" rel="nofollow noreferrer">8.97 BTC</a></p>

CC BY-SA 4.0
2018-10-03T03:08:59.090Z
2018-10-03T03:45:51.917Z
2018-10-03T03:45:51.917Z
Andy Duggan
<p>People say the total will be <strong>21000000</strong> BTC.</p>
<p>... however:</p>
<ul>
<li><p>The 1st 210000 blocks each allow creating 50 BTC.</p>
</li>
<li><p>The 2nd 210000 blocks each allow creating 25 BTC.</p>
</li>
<li><p>The 3rd 210000 blocks each allow creating 12.5 BTC.</p>
</li>
<li><p>...</p>
</li>
<li><p>The 10th 210000 blocks each allow creating 0.09765625 BTC.</p>
</li>
<li><p>The 11th 210000 blocks each allow creating 0.04882812 BTC, and not 0.048828125 BTC, because only 8 decimals of precision are supported.</p>
</li>
<li><p>...</p>
</li>
<li><p>The 33rd 210000 blocks each allow creating 0.00000001 BTC.</p>
</li>
</ul>
<p>After that, the reward is 0.</p>
<p>If you sum all these numbers together, you get <strong>20999999.9769</strong> BTC.</p>
<p>... however, either due to an oversight or intentionally, the coins created in the genesis block cannot be spent.</p>
<p>This leaves us with <strong>20999949.9769</strong> BTC.</p>
<p>... 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 &quot;overwritten&quot;. 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.</p>
<p>This leaves us with <strong>20999849.9769</strong> BTC.</p>
<p>... however, the protocol rules allow creating <em>up to</em> 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.</p>
<ul>
<li>Block <a href="https://bitcointalk.org/index.php?topic=7253.msg184414#msg184414" rel="noreferrer">124724</a> tried to intentionally claim 0.00000001 BTC less than allowed, but accidentally also failed to claim the fees, losing 0.01000001 BTC.</li>
<li>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.</li>
<li>Between block 180324 and block 249185, another 836 blocks claimed less than allowed, resulting in a total loss of 0.52584193 BTC.</li>
<li>Block 501726 had no transaction outputs (except a 0-value commitment), losing the entire 12.5 BTC subsidy.</li>
<li>Block 526591 didn't claim half of the block reward, losing 6.25 BTC.</li>
</ul>
<p>This leaves us with <strong>20999821.02921183</strong> BTC.</p>
<p>... however, since recently there is a concept of provably unspendable coins. Coins can be sent to an &quot;address&quot; 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.</p>
<p>This leaves us with <strong>20999817.31308491</strong> BTC (taking everything up to block 528333 into account)</p>
<p>... 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 <a href="https://bitcointalk.org/index.php?topic=7253.0" rel="noreferrer">here</a>.</p>
<p><a href="https://bitcoin-supply.com/" rel="noreferrer">https://bitcoin-supply.com/</a> tracks provably lost bitcoin through publicly available logic.</p>
<p>As of 15 March 2022 they tracked <strong>2,823.43062071</strong> BTC lost</p>
<p>This leaves us with: <strong>???</strong> BTC.</p>

CC BY-SA 3.0
2015-08-07T00:42:22.190Z
What were the bugs that caused the 9.66184623 and 0.52584193 bitcoins to be lost?
morsecoder
CC BY-SA 3.0
2015-08-07T11:15:06.800Z
Those were bugs in the (customized) software that the miners were running, so you'd have to ask the miners themselves.
Jannes
CC BY-SA 3.0
2015-08-07T13:06:48.373Z
I thought that `OP_RETURN` gave the money back to the miners.
Arturo Torres Sánchez
CC BY-SA 3.0
2015-08-07T13:09:09.663Z
Arturo: no. You can just create a transaction with a higher fee though, if you want to give money to miners.
Pieter Wuille
CC BY-SA 3.0
2015-08-07T19:23:54.583Z
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
CC BY-SA 3.0
2015-08-11T17:08:35.477Z
[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
CC BY-SA 3.0
2017-08-08T23:46:09.063Z
@Murch I wouldn't be surprised if it's more than 10%.
Pieter Wuille
CC BY-SA 3.0
2017-12-30T19:28:52.583Z
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
CC BY-SA 3.0
2017-12-31T06:07:39.887Z
@AshishNitinPatil Done!
Pieter Wuille
CC BY-SA 3.0
2017-12-31T07:25:10.057Z
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
CC BY-SA 4.0
2019-10-19T15:04:30.033Z
"This leaves us with: ??? BTC." Wouldn't be more precise to say "This leaves us with: <20999817.31308491 BTC."?
Anderson
CC BY-SA 4.0
2021-03-19T04:47:22.190Z
block explorer shows block 501726 as having fee reward of 184467440724.59550000 BTC but having no transactions. How can this be?
Prince M
CC BY-SA 4.0
2021-03-19T04:55:43.613Z
@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
CC BY-SA 4.0
2021-03-19T05:02:22.557Z
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
CC BY-SA 4.0
2021-03-19T05:03:02.140Z
The general advice you will receive on this site: ignore blockchain.com/blockchain.info at all costs.
Pieter Wuille
CC BY-SA 4.0
2022-01-20T16:03:18.347Z
[dunno if what these claim to have done makes it to this list](https://suredbits.com/taproot-funds-burned-on-the-bitcoin-blockchain/)
Mercedes
CC BY-SA 4.0
2022-01-24T20:50:37.583Z
@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
CC BY-SA 4.0
2015-08-07T00:00:43.413Z
2022-05-27T19:41:16.030Z
2022-05-27T19:41:16.030Z
Pieter Wuille
<p>Every <code>x</code> 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?</p>

<p>Extra points for pointing to the relevant code!</p>

CC BY-SA 3.0
2015-08-10T14:31:17.287Z
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
<reward-schedule>
Will there be 21 million bitcoins eventually?
erikvold
# Will there be 21 million bitcoins eventually?

(Asked by: username_0 on 2015-08-06)

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!

**Tags:** reward-schedule

> **Comments:**
> **username_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)  

---

## 3 answers

### Answer by username_3 on 2015-08-07. Score: 158 | Accepted answer

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](https://bitcointalk.org/index.php?topic=7253.msg184414#msg184414) 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://bitcointalk.org/index.php?topic=7253.0).

<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.

> **Comments:**
> **username_7**: What were the bugs that caused the 9.66184623 and 0.52584193 bitcoins to be lost?  
> **username_8**: Those were bugs in the (customized) software that the miners were running, so you'd have to ask the miners themselves.  
> **username_9**: I thought that `OP_RETURN` gave the money back to the miners.  
> **username_3**: username_9: no. You can just create a transaction with a higher fee though, if you want to give money to miners.  
> **username_3**: username_9: 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.  
> **username_1**: [The thread username_3 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%.  
> **username_3**: @username_1 I wouldn't be surprised if it's more than 10%.  
> **username_10**: 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  
> **username_3**: @AshishNitinPatil Done!  
> **username_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/  
> **username_11**: "This leaves us with: ??? BTC." Wouldn't be more precise to say "This leaves us with: <20999817.31308491 BTC."?  
> **username_12**: block explorer shows block 501726 as having fee reward of 184467440724.59550000 BTC but having no transactions. How can this be?  
> **username_3**: @username_12 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  
> **username_12**: Thanks username_3. 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!  
> **username_3**: The general advice you will receive on this site: ignore blockchain.com/blockchain.info at all costs.  
> **username_13**: [dunno if what these claim to have done makes it to this list](https://suredbits.com/taproot-funds-burned-on-the-bitcoin-blockchain/)  
> **username_3**: @username_13 Yeah, that'd result in a tiny amount of additional unspendable outputs. I'll incorporate those if I update this answer again.  

---

### Answer by username_2 on 2015-08-06. Score: 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.)](https://github.com/bitcoin/bitcoin/blob/a0625b8085aa379ac5f7bdca6f2cbf3cbb4a5d0a/src/main.cpp#L1093)

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](https://bitcoin.stackexchange.com/questions/10009/why-can-t-the-genesis-block-coinbase-be-spent), or the [duplicated coinbase](https://web.archive.org/web/20150511232412/http://blockexplorer.com/block/00000000000743f190a18c5577a3c2d2a1f610ae9601ac046a38084ccb7cd721). [Edit: Or the many other instances of unspendable Bitcoins that username_3 mentions in his answer.]

> **Comments:**
> **username_3**: Upvoting, as my own answer does not actually link to the code!  
> **username_4**: 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.  
> **username_5**: 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).  

---

### Answer by username_6 on 2018-10-03. Score: 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](https://bitcoinwhoswho.com/blog/2017/12/30/8-97-bitcoins-burned-in-2017/)


---

