Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: homogenousj on January 14, 2017, 04:41:30 PM



Title: Is there a non-trivial way to get the total number of coins in circulation?
Post by: homogenousj on January 14, 2017, 04:41:30 PM
Speaking in regards to the current bitcoin-qt client (or litecoin-qt, or both would be even better.)

Looking through the code base I do not see a way to do this other than to manually add the value of each block + fees.

Am I overlooking something?

Thank you for the help.


Title: Re: Is there a non-trivial way to get the total number of coins in circulation?
Post by: achow101 on January 14, 2017, 04:52:33 PM
You cannot add the value of the fees when doing this calculation, you can only add the block subsidies.

This is fairly easy to calculate since there is a fixed block subsidy schedule. The total number of Bitcoins created is 50*210000+25*210000+12.5*28167=16102087.5 BTC. Then subtract the 0.01000001 that were burned in block 124724 and the total is 16102087.48999999 BTC.

Those burned Bitcoin were from the miner (midnightmagic) not paying out the full amount he was entitled to from the block reward. The fees of that block (0.01 BTC) and one satoshi were burned and are now permanently out of circulation.


Title: Re: Is there a non-trivial way to get the total number of coins in circulation?
Post by: arubi on January 14, 2017, 05:02:02 PM
How about:

Code:
bitcoin-cli gettxoutsetinfo
And look for 'total_amount'


Title: Re: Is there a non-trivial way to get the total number of coins in circulation?
Post by: homogenousj on January 14, 2017, 05:23:21 PM
You cannot add the value of the fees when doing this calculation, you can only add the block subsidies.

This is fairly easy to calculate since there is a fixed block subsidy schedule. The total number of Bitcoins created is 50*210000+25*210000+12.5*28167=16102087.5 BTC. Then subtract the 0.01000001 that were burned in block 124724 and the total is 16102087.48999999 BTC.

Those burned Bitcoin were from the miner (midnightmagic) not paying out the full amount he was entitled to from the block reward. The fees of that block (0.01 BTC) and one satoshi were burned and are now permanently out of circulation.
Sorry about that, I misspoke on fees. I should have said subsidy :)

I'm trying to do this in a way that doesn't rely on understanding the fee structure ahead of time. It's a long story, happy to explain at a later time if interested.

Thank you for the information!


Title: Re: Is there a non-trivial way to get the total number of coins in circulation?
Post by: homogenousj on January 14, 2017, 05:38:36 PM
How about:

Code:
bitcoin-cli gettxoutsetinfo
And look for 'total_amount'
That's wonderful. Thank you for the help!!!!!!  ;D


Title: Re: Is there a non-trivial way to get the total number of coins in circulation?
Post by: Quickseller on January 16, 2017, 04:51:07 AM
You cannot add the value of the fees when doing this calculation, you can only add the block subsidies.

This is fairly easy to calculate since there is a fixed block subsidy schedule. The total number of Bitcoins created is 50*210000+25*210000+12.5*28167=16102087.5 BTC. Then subtract the 0.01000001 that were burned in block 124724 and the total is 16102087.48999999 BTC.

Those burned Bitcoin were from the miner (midnightmagic) not paying out the full amount he was entitled to from the block reward. The fees of that block (0.01 BTC) and one satoshi were burned and are now permanently out of circulation.
There are also OP_RETURN outputs that should be subtracted from the number of bitcoin in circulation, as these outputs are provably unspendable, and there is no mechanism in the current protocol to return these outputs to circulation. I am not sure how much bitcoin has been destroyed this way.