Is there any tool to check sum of all BTC based on transactions?

1

Is there any tool to check sum of all BTC based on transactions? We can easily get this amonut by sum up mining rewards, but what about sum up all non zero wallet balances?

needprayfornotaxes

Posted 2018-09-04T07:17:59.880

Reputation: 21

I don't know of an existing tool that does this, but it should be easy enough to iterate over each block and sum up the outputs.Raghav Sood 2018-09-04T07:39:47.020

are you sure that method? when I send you 1 BTC, and in next block you will send me 1BTC sum of our outputs will be 2 BTC, but we was operate using only 1 BTCneedprayfornotaxes 2018-09-04T07:47:38.440

Ah, yes, you are right. You will to sum all inputs and all outputs, and subtract at the end.Raghav Sood 2018-09-04T08:02:26.380

but each transaction input need to be equal output right? so the result will be 0needprayfornotaxes 2018-09-04T08:06:55.290

Since all coins start from a coinbase tx with a 0 input, at the end your outputs will exceed your inputs by the amount of BTC createdRaghav Sood 2018-09-04T08:41:12.563

Answers

1

Sort of.

Bitcoin Core's gettxoutsetinfo RPC command iterates through the entire UTXO set (the set of outputs that haven't been spent yet by another transaction).

Currently, it reports:

"height": 539935
"total_amount": 17249017.33071828

This is the approach you're looking for as it is computed from the actual outputs and inputs, though with a few caveats:

  • It is not computed on-the-fly from the blockchain; instead, it uses a database with unspent outputs that is always maintained by the validation code.
  • It excludes provably unspendable outputs (OP_RETURN outputs or outputs with a script longer than 10000 characters).

Note the discrepancy with the expected amount in circulation at that height (17249200.00000000). There are various reasons for this. My answer https://bitcoin.stackexchange.com/a/38998/208 goes into the details.

Pieter Wuille

Posted 2018-09-04T07:17:59.880

Reputation: 54 032