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?

  • 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. Sep 4 '18 at 7:39
  • 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 BTC Sep 4 '18 at 7:47
  • Ah, yes, you are right. You will to sum all inputs and all outputs, and subtract at the end. Sep 4 '18 at 8:02
  • but each transaction input need to be equal output right? so the result will be 0 Sep 4 '18 at 8:06
  • 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 created Sep 4 '18 at 8:41

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.