user5841: Estimates have been thrown around a lot recently as to the year in which the last Bitcoin will be mined- where are these estimates coming from? Could someone send me to the relevant code?

user5406: Bitcoin's reward schedule is implemented in eras of 210,000 blocks. The block subsidy gets halved with the first block of each new era. The 33rd "halving" at block 6,930,000 will reduce the block subsidy limit from 1 satoshi per block to 0 satoshi per block¹ and therefore the last block creating new bitcoins will be block 6,929,999.
At block intervals of 10 minutes, 210,000 blocks translate to about 3.99 years, although blocks have been found faster in average in the past. Under the simplifying assumption that the halvings will occur about every four years, the final block that creates new bitcoins would occur approximately in 2140.
You can find a table with the respective calculations here: Bitcoin Reward Schedule
Really, the mining reward will get minuscule much earlier already. In 2036 99% of the bitcoins will be in circulation, in 2048 it will be 99.9%.

¹Actually, the limit is 0.58207661 satoshi per block at that point, but since only whole satoshis can be paid out, none may be collected by miners.

user1409: The estimate is 2140 based on the block reward halving frequency of four years. According to math and knowledge that there are 32 halving events, in 2136, the block reward will yield 0.00000168 BTC per day, which is 0.00000042 BTC per block. That's 42 satoshis. 
It's arguable that there could be one additional halving, to a block reward of 0.00000021 BTC, but that would require a major protocol modification since the number of Bitcoin would then exceed 21 million. Additionally, to go past that, there'd have to be a protocol modification to extend divisibility past eight decimal places. It is far, far to early to worry about either of these, because we're more than a century away from this problem.

5841: <p>Estimates have been thrown around a lot recently as to the year in which the last Bitcoin will be mined- where are these estimates coming from? Could someone send me to the relevant code?</p>
 5406: <p>Bitcoin's reward schedule is implemented in eras of 210,000 blocks. The block subsidy gets halved with the first block of each new era. The 33rd &quot;halving&quot; at block 6,930,000 will reduce the block subsidy limit from 1 satoshi per block to 0 satoshi per block¹ and therefore the last block creating new bitcoins will be block 6,929,999.</p>
<p>At block intervals of 10 minutes, 210,000 blocks translate to about 3.99 years, although blocks have been found faster in average in the past. Under the simplifying assumption that the halvings will occur about every four years, the final block that creates new bitcoins would occur approximately in <strong>2140</strong>.</p>
<p>You can find a table with the respective calculations here: <a href="https://docs.google.com/spreadsheets/d/12tR_9WrY0Hj4AQLoJYj9EDBzfA38XIVLQSOOOVePNm0/pubhtml?gid=0&amp;single=true" rel="nofollow noreferrer">Bitcoin Reward Schedule</a></p>
<p>Really, the mining reward will get minuscule much earlier already. In 2036 99% of the bitcoins will be in circulation, in 2048 it will be 99.9%.</p>
<hr />
<p><sup>¹Actually, the limit is 0.58207661 satoshi per block at that point, but since only whole satoshis can be paid out, none may be collected by miners.</sup></p>
 1409: <p>The estimate is <strong>2140</strong> based on the block reward halving frequency of four years. <a href="https://bitcoin.stackexchange.com/questions/8823/how-many-bitcoin-are-mined-per-day">According to math and knowledge that there are 32 halving events</a>, in 2136, the block reward will yield 0.00000168 BTC per day, which is 0.00000042 BTC per block. That's 42 <a href="https://bitcoin.stackexchange.com/questions/114/what-is-a-satoshi">satoshis</a>. </p>

<p>It's arguable that there could be one additional halving, to a block reward of 0.00000021 BTC, but that would require a major protocol modification since the number of Bitcoin would then exceed 21 million. Additionally, to go past that, there'd have to be a protocol modification to extend divisibility past eight decimal places. It is far, far to early to worry about either of these, because we're more than a century away from this problem.</p>
