<p>Sort of.</p>

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

<p>Currently, it reports:</p>

<pre><code>"height": 539935
"total_amount": 17249017.33071828
</code></pre>

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

<ul>
<li>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.</li>
<li>It excludes provably unspendable outputs (OP_RETURN outputs or outputs with a script longer than 10000 characters).</li>
</ul>

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

CC BY-SA 4.0
2018-09-04T15:11:32.333Z
2018-09-04T15:11:32.333Z
Pieter Wuille
<p>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?</p>

CC BY-SA 4.0
2018-09-04T07:39:47.020Z
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
CC BY-SA 4.0
2018-09-04T07:47:38.440Z
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
needprayfornotaxes
CC BY-SA 4.0
2018-09-04T08:02:26.380Z
Ah, yes, you are right. You will to sum all inputs and all outputs, and subtract at the end.
Raghav Sood
CC BY-SA 4.0
2018-09-04T08:06:55.290Z
but each transaction input need to be equal output right? so the result will be 0
needprayfornotaxes
CC BY-SA 4.0
2018-09-04T08:41:12.563Z
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
Raghav Sood
<balance>
Is there any tool to check sum of all BTC based on transactions?
needprayfornotaxes
# Is there any tool to check sum of all BTC based on transactions?

(Asked by: username_0 on 2018-09-04)

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?

**Tags:** balance

> **Comments:**
> **username_1**: 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.  
> **username_0**: 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  
> **username_1**: Ah, yes, you are right. You will to sum all inputs and all outputs, and subtract at the end.  
> **username_0**: but each transaction input need to be equal output right? so the result will be 0  
> **username_1**: 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  

---

## 1 answers

### Answer by username_2 on 2018-09-04. Score: 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.


---

