Bitcoin Forum
April 20, 2021, 01:36:19 PM *
News: Latest Bitcoin Core release: 0.21.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Bitcoin current supply and gettxoutsetinfo  (Read 121 times)
Robot1982
Newbie
*
Offline Offline

Activity: 14
Merit: 13


View Profile
January 26, 2020, 04:16:18 PM
 #1

Is it correct that the following command will give you the current supply of bitcoin?

Code:
bitcoin-cli gettxoutsetinfo
{
  "height": 614643,
  "bestblock": "0000000000000000000323e3aff59d74ab52e74f4dc5cfb9696ddb69e9857d9c",
  "transactions": 38728071,
  "txouts": 65228219,
  "bogosize": 4902482106,
  "hash_serialized_2": "a153439cccb341a5ac149562c90bca499e3a809ccf2075e2de17bc2b9d83d0ee",
  "disk_size": 3922698456,
  "total_amount": 18182867.32125828
}

I would assume that "total_amount" is the number I am looking for. However if you calculate the total theoretical amount of bitcoins mined you get this:

Blocks 0 - 209999: 210000 x 50 = 10500000
Blocks 210000 - 419999: 210000 x 25 = 5250000
Blocks 420000 - 614643: 194644 x 12.5 = 2433050
Total: 10500000 + 5250000 + 2433050 = 18183050

So where is the difference of 182.67874172 bitcoins? I know that there was a situation where the miner didn't take the whole reward but this was in the satoshi range if I remember correctly.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
1618925779
Hero Member
*
Offline Offline

Posts: 1618925779

View Profile Personal Message (Offline)

Ignore
1618925779
Reply with quote  #2

1618925779
Report to moderator
ranochigo
Legendary
*
Offline Offline

Activity: 2310
Merit: 2045

@ me if you need my response


View Profile
January 26, 2020, 04:26:36 PM
 #2

First of all, you calculated the supply that includes the reward given to the gensis block. By design, the genesis block's reward is not included in the UTXO. That is 50BTC gone alone.

IIRC, there were a few blocks that had a fork and the coins from those blocks were lost. Due to bugs in the miner's implementation, there were instances whereby the miner didn't claim the entire block reward and/or fees and that is definitely not in the satoshi range.

You have to consider that some coins were also burned by the use of OP_Return and they were removed from the UTXO of the client.

Robot1982
Newbie
*
Offline Offline

Activity: 14
Merit: 13


View Profile
January 26, 2020, 04:36:32 PM
 #3

...there were a few blocks that had a fork and the coins from those blocks were lost.
What exactly do you mean here? How can coins get lost by a fork? I get your other point though. Thanks for clarifying.
ranochigo
Legendary
*
Offline Offline

Activity: 2310
Merit: 2045

@ me if you need my response


View Profile
January 26, 2020, 04:55:09 PM
Merited by gmaxwell (1), ETFbitcoin (1)
 #4

What exactly do you mean here? How can coins get lost by a fork? I get your other point though. Thanks for clarifying.
Oops sorry. My bad.

I was referring to a bug that was present in Bitcoin quite some time ago. The bug allowed the coinbase of two different blocks to be the same. This resulted in one of the two coinbase transactions being invalidated and thus the coins are permanently lost. IIRC, this was the motivation behind BIP30.

DannyHamilton
Legendary
*
Offline Offline

Activity: 2436
Merit: 1931



View Profile
January 26, 2020, 11:00:52 PM
 #5

Here's an interesting analysis of the blockchain completed back in 2014.  It would be interesting to see someone do something similar again:

https://bitcointalk.org/index.php?topic=675321.0

In validating a UTXO parser I started looking at various outputs which are provably unspendable.  As of block #305303 2,745.22283996 BTC have been provably lost.  The total number of coins lost is higher potentially much higher but most of those losses can't be proven.   Funds sent to outputs that can never be redeemed can be provably shown to be lost.

Code:
Category       NumOutputs    AmountLost
-----------------------------------------
BugOpFalse            23   2,609.36304319
BugP2Pool            182       0.60280235
BugInvalidOpcode      14       0.04520008
BugInvalidPubKey  17,112       0.00242288
BugParseError          1       0.00040000
ZeroValue *        3,080       0.00000000
MissingFromUTXO **   ---     135.20897146
-----------------------------------------
Total             20,412   2,745.22283996 BTC

* Zero value unprunable outputs are not invalid outputs but they are undesirable.  I was surprised to see there are over three thousand in the UTXO.  In the future the creation of new zero value outputs (with the exception of the prunable OP_RETURN) could be made invalid and potentially even these outputs pruned off by a hard fork.

** As of block 305,303 the coin supply is limited to 12,882,575 BTC.   This is based on the max subsidy per block and the block height.  However the UTXO (set of all unspent outputs) is only 12,882,439.79102854 BTC.  Some of the difference may be due to OP_RETURN outputs (which are unspendable by protocol) having a value set.  This could be accidental or intentional.  Another source of lost coins is due to miners taking less than the maximum block reward which in effect "de-mines" an amount of coins equal to the difference between the allowed reward and the taken reward.


I believe you're largely looking at the "MissingFromUTXO" category in what you found.
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!