<p>To find the fee of the transaction, you need to know the value of the inputs and outputs and find the difference between those two values. </p>

<p>Unfortunately this is much more difficult for receiving transactions, because by default bitcoin core only holds the information for transactions which are related to your wallet, not all transactions (this can be enabled with <code>txindex=1</code> argument).</p>

<p>What this means is that, to find the fee for a receive transaction, you can call <code>getrawtransaction "txid" true</code> with the txid you obtain from <code>listtransactions</code>. The last argument, <code>true</code> is set to make the output "verbose" so that it includes more information about the transaction than just the hex encoded transaction itself. It will return a JSON object with <code>vin</code> and <code>vout</code> arrays which you can iterate over. You can simply sum the output values. The trouble is finding the input values. Input values are not given in transactions, so you must look them up individually. This is a problem for receiving transactions because the transactions they spend from are usually unrelated to your wallet and thus cannot be looked up without <code>txindex=1</code>. </p>

CC BY-SA 3.0
2017-11-19T03:22:15.797Z
You are right, The trouble in here finding the input values!! How does blockchain.info and other chains get these info?
Tailer
CC BY-SA 3.0
2017-11-19T11:26:56.240Z
I assume blockchain.info and similar sites use their own databases of information rather than querying it from a node every time
meshcollider
CC BY-SA 3.0
2017-11-19T20:42:48.663Z
Yeah I guess they update each new transaction to their database.
Tailer
CC BY-SA 3.0
2017-11-19T00:34:26.580Z
2017-11-19T00:34:26.580Z
meshcollider
<p>I'm using bitcoin core full node on ubuntu. When I call listtransactions some transactions coming up with no fee key.</p>

<pre><code>  [8] =&gt; Array
    (
        [account] =&gt; 
        [address] =&gt; 1MTLEprpnQwLHMeYh51CQrCWxSuZPGSZ6T
        [category] =&gt; send
        [amount] =&gt; -0.0028107
        [vout] =&gt; 0
        [fee] =&gt; -1.13E-5
        [confirmations] =&gt; 0
        [trusted] =&gt; 1
        [txid] =&gt; 6c74d8ac3b9b57184ed5dff72d48474c5ecf8dac4ec9388cb0ff33bf8e3bfcbc
        [walletconflicts] =&gt; Array
            (
            )

        [time] =&gt; 1511008107
        [timereceived] =&gt; 1511008107
        [bip125-replaceable] =&gt; no
        [abandoned] =&gt; 
    )

[9] =&gt; Array
    (
        [account] =&gt; 
        [address] =&gt; 12zJ7ZbDW59mmNBPrxBAEjtWf8JzwgLNum
        [category] =&gt; receive
        [amount] =&gt; 0.00240164
        [label] =&gt; 
        [vout] =&gt; 0
        [confirmations] =&gt; 0
        [trusted] =&gt; 
        [txid] =&gt; 25d0812c7dcf3c938430dc5c61566b8346b6e6d300b1e3cd3fc7d4031eb93cbe
        [walletconflicts] =&gt; Array
            (
            )

        [time] =&gt; 1511010977
        [timereceived] =&gt; 1511010977
        [bip125-replaceable] =&gt; no
    )
</code></pre>

<p>)</p>

<p>Transaction on blockchain: <a href="https://blockchain.info/tx/25d0812c7dcf3c938430dc5c61566b8346b6e6d300b1e3cd3fc7d4031eb93cbe" rel="nofollow noreferrer">https://blockchain.info/tx/25d0812c7dcf3c938430dc5c61566b8346b6e6d300b1e3cd3fc7d4031eb93cbe</a></p>

<p>I have read that just now on bitcoin.org,</p>

<blockquote>
  <p>If sending payment, the fee paid as a negative bitcoins value. May be
  0. Not returned if receiving payment or for move category payments</p>
</blockquote>

<p>Which answers my question, but now i'm wondering how to get the fee of received transaction.</p>

<bitcoin-core><bitcoind>
Bitcoin core - Listtransactions doesn't show fee of received transactions
Tailer
# Bitcoin core - Listtransactions doesn't show fee of received transactions

(Asked by: username_0 on 2017-11-18)

I'm using bitcoin core full node on ubuntu. When I call listtransactions some transactions coming up with no fee key.

```
  [8] => Array
    (
        [account] => 
        [address] => 1MTLEprpnQwLHMeYh51CQrCWxSuZPGSZ6T
        [category] => send
        [amount] => -0.0028107
        [vout] => 0
        [fee] => -1.13E-5
        [confirmations] => 0
        [trusted] => 1
        [txid] => 6c74d8ac3b9b57184ed5dff72d48474c5ecf8dac4ec9388cb0ff33bf8e3bfcbc
        [walletconflicts] => Array
            (
            )

        [time] => 1511008107
        [timereceived] => 1511008107
        [bip125-replaceable] => no
        [abandoned] => 
    )

[9] => Array
    (
        [account] => 
        [address] => 12zJ7ZbDW59mmNBPrxBAEjtWf8JzwgLNum
        [category] => receive
        [amount] => 0.00240164
        [label] => 
        [vout] => 0
        [confirmations] => 0
        [trusted] => 
        [txid] => 25d0812c7dcf3c938430dc5c61566b8346b6e6d300b1e3cd3fc7d4031eb93cbe
        [walletconflicts] => Array
            (
            )

        [time] => 1511010977
        [timereceived] => 1511010977
        [bip125-replaceable] => no
    )

```

)

Transaction on blockchain: <https://blockchain.info/tx/25d0812c7dcf3c938430dc5c61566b8346b6e6d300b1e3cd3fc7d4031eb93cbe>

I have read that just now on bitcoin.org,

> If sending payment, the fee paid as a negative bitcoins value. May be
> 0. Not returned if receiving payment or for move category payments

Which answers my question, but now i'm wondering how to get the fee of received transaction.

**Tags:** bitcoin-core, bitcoind


---

## 1 answers

### Answer by username_1 on 2017-11-19. Score: 4 | Accepted answer

To find the fee of the transaction, you need to know the value of the inputs and outputs and find the difference between those two values.

Unfortunately this is much more difficult for receiving transactions, because by default bitcoin core only holds the information for transactions which are related to your wallet, not all transactions (this can be enabled with `txindex=1` argument).

What this means is that, to find the fee for a receive transaction, you can call `getrawtransaction "txid" true` with the txid you obtain from `listtransactions`. The last argument, `true` is set to make the output "verbose" so that it includes more information about the transaction than just the hex encoded transaction itself. It will return a JSON object with `vin` and `vout` arrays which you can iterate over. You can simply sum the output values. The trouble is finding the input values. Input values are not given in transactions, so you must look them up individually. This is a problem for receiving transactions because the transactions they spend from are usually unrelated to your wallet and thus cannot be looked up without `txindex=1`.

> **Comments:**
> **username_0**: You are right, The trouble in here finding the input values!! How does blockchain.info and other chains get these info?  
> **username_1**: I assume blockchain.info and similar sites use their own databases of information rather than querying it from a node every time  
> **username_0**: Yeah I guess they update each new transaction to their database.  

---

