<blockquote>
<p><strong>But how do I calculate the actually amount that came in or went out for this transaction?</strong></p>
</blockquote>
<p>The amount in Satoshis that went out from the sender's wallet(s) is the sum of the <code>[vin][value]</code> amounts in that transaction.</p>
<p>The amount that went to recipient's wallets is the sum of the <code>[vout][value]</code> amounts</p>
<p>The difference between these two totals is the amount that was paid as a mining fee.</p>
<p>It is likely that one of the outputs was change being returned to the sender.  So the total reduction to the sender's &quot;balance&quot; is sum of <code>[vin][value]</code> minus one of the <code>[vout][value]</code>.</p>

CC BY-SA 4.0
2022-07-05T10:02:58.100Z
2022-07-05T10:02:58.100Z
RedGrittyBrick
<p>I used nownodes api to get this response on a transaction:</p>
<pre><code>(
    [txid] =&gt; 38ac1348219f8aa9349f497bfa6f8d05f775cafbbd26354867d22ca84f15e1e1
    [version] =&gt; 2
    [vin] =&gt; Array
        (
            [0] =&gt; stdClass Object
                (
                    [txid] =&gt; 38cff250be850140644a1abf022b22f3e59cab15c6091706c3f73218a4d72050
                    [vout] =&gt; 1
                    [sequence] =&gt; 4294967295
                    [n] =&gt; 0
                    [addresses] =&gt; Array
                        (
                            [0] =&gt; 1EJtMFThodiQ1j26xy1kugFck9325C38CQ
                        )

                    [isAddress] =&gt; 1
                    [value] =&gt; 158316
                    [hex] =&gt; 4830450221009548f997389fd9881dfed78fe25fcce77f5b96d1545da91dfa13f56db3c02f6e02207fe239ac7916681edc36afd6a9a569981cd12c2c6801616bc15794be5c024431012102afe2e887e3ff56edcebe6b1aa6bf48f4a5a7f02cfc8d743e778896df2054adee
                )

        )

    [vout] =&gt; Array
        (
            [0] =&gt; stdClass Object
                (
                    [value] =&gt; 7000
                    [n] =&gt; 0
                    [hex] =&gt; a9144a09be6e2917ef00e5d72bc38035db5c5a5ed8ec87
                    [addresses] =&gt; Array
                        (
                            [0] =&gt; 38SVbkkFE8qcJuGyTJ9fY2cbGS3xknEfYr
                        )

                    [isAddress] =&gt; 1
                )

            [1] =&gt; stdClass Object
                (
                    [value] =&gt; 146856
                    [n] =&gt; 1
                    [hex] =&gt; 76a91491fb9214e6ad9b3ea19c1fd7d3a646e12f804d2688ac
                    [addresses] =&gt; Array
                        (
                            [0] =&gt; 1EJtMFThodiQ1j26xy1kugFck9325C38CQ
                        )

                    [isAddress] =&gt; 1
                )

        )

    [blockHash] =&gt; 000000000000000000050bfb2a645a5eb7ac882aeb1782bce37ef6a2652c383b
    [blockHeight] =&gt; 743696
    [confirmations] =&gt; 8
    [blockTime] =&gt; 1657005608
    [value] =&gt; 153856
    [valueIn] =&gt; 158316
    [fees] =&gt; 4460
    [hex] =&gt; 02000000015020d7a41832f7c3061709c615ab9ce5f3222b02bf1a4a64400185be50f2cf38010000006b4830450221009548f997389fd9881dfed78fe25fcce77f5b96d1545da91dfa13f56db3c02f6e02207fe239ac7916681edc36afd6a9a569981cd12c2c6801616bc15794be5c024431012102afe2e887e3ff56edcebe6b1aa6bf48f4a5a7f02cfc8d743e778896df2054adeeffffffff02581b00000000000017a9144a09be6e2917ef00e5d72bc38035db5c5a5ed8ec87a83d0200000000001976a91491fb9214e6ad9b3ea19c1fd7d3a646e12f804d2688ac00000000
)
</code></pre>
<ol>
<li>The transaction was for: 0.0001146 BTC</li>
<li>And the fee was:  0.0000446</li>
<li>Totalling: 0.0001592</li>
</ol>
<p>However, based on teh result from Nownodes, how can I see what the transaction total was? I can easily see the fee under &quot;Fees&quot;. But how do I calculate the actually amount that came in or went out for this transaction?</p>
<p>Thanks!</p>

<transaction-input>
How to interpret vin/vout on a Bitcoin transaction?
rockstardev
# How to interpret vin/vout on a Bitcoin transaction?

(Asked by: username_0 on 2022-07-05)

I used nownodes api to get this response on a transaction:

```
(
    [txid] => 38ac1348219f8aa9349f497bfa6f8d05f775cafbbd26354867d22ca84f15e1e1
    [version] => 2
    [vin] => Array
        (
            [0] => stdClass Object
                (
                    [txid] => 38cff250be850140644a1abf022b22f3e59cab15c6091706c3f73218a4d72050
                    [vout] => 1
                    [sequence] => 4294967295
                    [n] => 0
                    [addresses] => Array
                        (
                            [0] => 1EJtMFThodiQ1j26xy1kugFck9325C38CQ
                        )

                    [isAddress] => 1
                    [value] => 158316
                    [hex] => 4830450221009548f997389fd9881dfed78fe25fcce77f5b96d1545da91dfa13f56db3c02f6e02207fe239ac7916681edc36afd6a9a569981cd12c2c6801616bc15794be5c024431012102afe2e887e3ff56edcebe6b1aa6bf48f4a5a7f02cfc8d743e778896df2054adee
                )

        )

    [vout] => Array
        (
            [0] => stdClass Object
                (
                    [value] => 7000
                    [n] => 0
                    [hex] => a9144a09be6e2917ef00e5d72bc38035db5c5a5ed8ec87
                    [addresses] => Array
                        (
                            [0] => 38SVbkkFE8qcJuGyTJ9fY2cbGS3xknEfYr
                        )

                    [isAddress] => 1
                )

            [1] => stdClass Object
                (
                    [value] => 146856
                    [n] => 1
                    [hex] => 76a91491fb9214e6ad9b3ea19c1fd7d3a646e12f804d2688ac
                    [addresses] => Array
                        (
                            [0] => 1EJtMFThodiQ1j26xy1kugFck9325C38CQ
                        )

                    [isAddress] => 1
                )

        )

    [blockHash] => 000000000000000000050bfb2a645a5eb7ac882aeb1782bce37ef6a2652c383b
    [blockHeight] => 743696
    [confirmations] => 8
    [blockTime] => 1657005608
    [value] => 153856
    [valueIn] => 158316
    [fees] => 4460
    [hex] => 02000000015020d7a41832f7c3061709c615ab9ce5f3222b02bf1a4a64400185be50f2cf38010000006b4830450221009548f997389fd9881dfed78fe25fcce77f5b96d1545da91dfa13f56db3c02f6e02207fe239ac7916681edc36afd6a9a569981cd12c2c6801616bc15794be5c024431012102afe2e887e3ff56edcebe6b1aa6bf48f4a5a7f02cfc8d743e778896df2054adeeffffffff02581b00000000000017a9144a09be6e2917ef00e5d72bc38035db5c5a5ed8ec87a83d0200000000001976a91491fb9214e6ad9b3ea19c1fd7d3a646e12f804d2688ac00000000
)

```

1. The transaction was for: 0.0001146 BTC
2. And the fee was: 0.0000446
3. Totalling: 0.0001592

However, based on teh result from Nownodes, how can I see what the transaction total was? I can easily see the fee under "Fees". But how do I calculate the actually amount that came in or went out for this transaction?

Thanks!

**Tags:** transaction-input


---

## 1 answers

### Answer by username_1 on 2022-07-05. Score: 1 | Accepted answer

> **But how do I calculate the actually amount that came in or went out for this transaction?**

The amount in Satoshis that went out from the sender's wallet(s) is the sum of the `[vin][value]` amounts in that transaction.

The amount that went to recipient's wallets is the sum of the `[vout][value]` amounts

The difference between these two totals is the amount that was paid as a mining fee.

It is likely that one of the outputs was change being returned to the sender. So the total reduction to the sender's "balance" is sum of `[vin][value]` minus one of the `[vout][value]`.


---

