<p>The result you are getting is correct. The error is that you think it's too high when it's correct.</p>
<p>Say I buy a book for $5, but I pay with a $100 bill. The amount &quot;sent to anyone&quot; from my wallet is $100, not $5. So the total of the amounts <em>sent</em> will be greater than the <em>net</em> amounts paid.</p>
<p>The total of the amounts &quot;sent to anyone from a known wallet address&quot; will include the change that was sent from the wallet even though it remained the property of the owner of the wallet.</p>
<p>If you want to get a different answer, you'll have to ask a different question.</p>

CC BY-SA 4.0
2021-06-28T07:58:25.053Z
Makes sense. But by the looks of it the transaction details returned by gettransaction respresent the amount specified at the RPC API level, not the actual underpinnings - https://developer.bitcoin.org/reference/rpc/gettransaction.html
Oliver Weichhold
CC BY-SA 4.0
2021-06-28T16:42:03.177Z
It depends what the client knows. If the transaction originated locally, the client knows what is change and what is not. If the transaction was observed, then it generally has no way of knowing. If it sees $100 go in and $30 come out one output and $70 come out the other, it has no way to know if $70 is change, $30 is change, or neither is change.
David Schwartz
CC BY-SA 4.0
2021-06-28T05:31:13.233Z
2021-06-28T05:31:13.233Z
David Schwartz
<p>I'd like to calculate the total amount of bitcoin sent to anyone from a known wallet address.</p>
<p>My initial idea was to page through everything returned by the <code>listtransactions</code> RPC, get the transaction details through <code>gettransaction</code> and calculate the sum of all transaction details of category &quot;send&quot;. But somehow the result appears to be by far too high.</p>

<transactions><json-rpc>
Calculating total sum of bitcoins sent by wallet
Oliver Weichhold
# Calculating total sum of bitcoins sent by wallet

(Asked by: username_0 on 2021-06-27)

I'd like to calculate the total amount of bitcoin sent to anyone from a known wallet address.

My initial idea was to page through everything returned by the `listtransactions` RPC, get the transaction details through `gettransaction` and calculate the sum of all transaction details of category "send". But somehow the result appears to be by far too high.

**Tags:** transactions, json-rpc


---

## 1 answers

### Answer by username_1 on 2021-06-28. Score: 1 | Accepted answer

The result you are getting is correct. The error is that you think it's too high when it's correct.

Say I buy a book for $5, but I pay with a $100 bill. The amount "sent to anyone" from my wallet is $100, not $5. So the total of the amounts *sent* will be greater than the *net* amounts paid.

The total of the amounts "sent to anyone from a known wallet address" will include the change that was sent from the wallet even though it remained the property of the owner of the wallet.

If you want to get a different answer, you'll have to ask a different question.

> **Comments:**
> **username_0**: Makes sense. But by the looks of it the transaction details returned by gettransaction respresent the amount specified at the RPC API level, not the actual underpinnings - https://developer.bitcoin.org/reference/rpc/gettransaction.html  
> **username_1**: It depends what the client knows. If the transaction originated locally, the client knows what is change and what is not. If the transaction was observed, then it generally has no way of knowing. If it sees $100 go in and $30 come out one output and $70 come out the other, it has no way to know if $70 is change, $30 is change, or neither is change.  

---

