Bitcoin Forum
May 25, 2024, 04:40:37 AM
 News: Latest Bitcoin Core release: 27.0 [Torrent]
 Home Help Search Login Register More
 Pages: [1]
 Author Topic: Bitcoin current supply and gettxoutsetinfo  (Read 134 times)
Robot1982 (OP)
Newbie

Offline

Activity: 14
Merit: 16

 Bitcoin current supply and gettxoutsetinfo January 26, 2020, 04:16:18 PM

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

Offline

Activity: 2982
Merit: 4193

 Re: Bitcoin current supply and gettxoutsetinfo January 26, 2020, 04:26:36 PM

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.

 █████████████████████████████▐██▄█████████████████████▐██████▄▄▄███████████████▐████▄█████▄▄████████████▐█████▀▀▀▀▀███▄██████████▐███▀████████████████████▐█████████▄█████▌████████▐██▌█████▀██████▌████████▐██████████▀████▌█████████▀███▄█████▄███▀████████████▀█████████▀█████████████████▀███▀███████████████████████████████████ .BC.GAME ▄▄░░░▄▀▀▄████████▄▄▄▀███████████████████░░▄▄▄▄████████▄▄▄▄▄▄▄▄▄██▄████████▄▄▄▄████▄█████▄█▄▄██████████▄█████▄███████████████████████████████▀███▀████▄██▄██▄░░░░▄████████████▀▀▀█████▄▄▄███████████▀█████████████████████▀█████████████████████▄██▄████████████████████▄████████████████████████▀████████████████████████▄ ...CASINO....SPORTS....RACING.. █░░░░░░█░░░░░░█▀███▀░░▀███▀░░▀███▀▀░▀░░░░▀░▀░░░░▀░▀▄░░░░░░░░░░░░▀██████████░░░░░███░░░░▀░░█░░░███▄█░░░█░░██▌░░███░▀░░██▌░█░██░░███░░░█░██░█▀▀▀█▌░███░░█▀▀▀█▌▄█▄░░░██▄███▄█▄░░▄██▄▄███▄░░░░▀██▄▀ ▄▄████▄▄▄███▀▀███▄██████████▀███▄░▄██▀▄▄████▄▄░▀█▀▄██▀▄▄████▄▄▄███▀▀▀████▄▄██▀▄███▀▀███▄███████▄▄▀▀████▄▄▀▀███████▀███▄▄███▀░░░▀▀████▄▄▄███▀▀▀████▀▀████████▀▀████▀▀ WELCOME BONUSUP TO 5 BTC
Robot1982 (OP)
Newbie

Offline

Activity: 14
Merit: 16

 Re: Bitcoin current supply and gettxoutsetinfo January 26, 2020, 04:36:32 PM

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

Activity: 2982
Merit: 4193

 Re: Bitcoin current supply and gettxoutsetinfo January 26, 2020, 04:55:09 PMMerited by gmaxwell (1), ABCbits (1)

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

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.

 █████████████████████████████▐██▄█████████████████████▐██████▄▄▄███████████████▐████▄█████▄▄████████████▐█████▀▀▀▀▀███▄██████████▐███▀████████████████████▐█████████▄█████▌████████▐██▌█████▀██████▌████████▐██████████▀████▌█████████▀███▄█████▄███▀████████████▀█████████▀█████████████████▀███▀███████████████████████████████████ .BC.GAME ▄▄░░░▄▀▀▄████████▄▄▄▀███████████████████░░▄▄▄▄████████▄▄▄▄▄▄▄▄▄██▄████████▄▄▄▄████▄█████▄█▄▄██████████▄█████▄███████████████████████████████▀███▀████▄██▄██▄░░░░▄████████████▀▀▀█████▄▄▄███████████▀█████████████████████▀█████████████████████▄██▄████████████████████▄████████████████████████▀████████████████████████▄ ...CASINO....SPORTS....RACING.. █░░░░░░█░░░░░░█▀███▀░░▀███▀░░▀███▀▀░▀░░░░▀░▀░░░░▀░▀▄░░░░░░░░░░░░▀██████████░░░░░███░░░░▀░░█░░░███▄█░░░█░░██▌░░███░▀░░██▌░█░██░░███░░░█░██░█▀▀▀█▌░███░░█▀▀▀█▌▄█▄░░░██▄███▄█▄░░▄██▄▄███▄░░░░▀██▄▀ ▄▄████▄▄▄███▀▀███▄██████████▀███▄░▄██▀▄▄████▄▄░▀█▀▄██▀▄▄████▄▄▄███▀▀▀████▄▄██▀▄███▀▀███▄███████▄▄▀▀████▄▄▀▀███████▀███▄▄███▀░░░▀▀████▄▄▄███▀▀▀████▀▀████████▀▀████▀▀ WELCOME BONUSUP TO 5 BTC
DannyHamilton
Legendary

Offline

Activity: 3402
Merit: 4656

 Re: Bitcoin current supply and gettxoutsetinfo January 26, 2020, 11:00:52 PM

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]