0

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!

rockstardev
  • 157
  • 8

1 Answers1

1

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].

RedGrittyBrick
  • 26,841
  • 3
  • 25
  • 51