Author

Topic: Bitcoin current supply and gettxoutsetinfo (Read 128 times)

legendary
Activity: 3472
Merit: 4801
January 26, 2020, 06: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://bitcointalksearch.org/topic/how-many-bitcoins-have-been-provably-lost-at-least-675321

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.
legendary
Activity: 3038
Merit: 4418
Crypto Swap Exchange
January 26, 2020, 11:55:09 AM
#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.
newbie
Activity: 14
Merit: 16
January 26, 2020, 11:36:32 AM
#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.
legendary
Activity: 3038
Merit: 4418
Crypto Swap Exchange
January 26, 2020, 11:26:36 AM
#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.
newbie
Activity: 14
Merit: 16
January 26, 2020, 11:16:18 AM
#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.
Jump to: