<p>This occurs when one of the inputs is unknown to the wallet, for example when participating in a multiparty transaction like a CoinJoin.</p>
<p>What happens is that the wallet checks to see how much value in the inputs it knows about, and if it is nonzero, computes the fee by subtracting the outputs value from it and then negating. The base assumption in this calculation is that all inputs in the transaction belong to the wallet - if any input is known, then the calculated input value will be nonzero, but all inputs must be known for this calculation to be correct.</p>
<p>So what's happened here is that your transaction has two inputs, one of which is known, one not. The known one appears to be the second input of 0.003. Taking that as the &quot;input value&quot;, the calculated fee as -(0.003 - 0.00896777) =  -(-0.00596777) = 0.00596777.</p>
<p>One thing to notice here is that the fee is given as a positive number, however the wallet is supposed to be reporting it as a negative number. This is an indicator of this particular issue.</p>

CC BY-SA 4.0
2024-06-18T20:56:02.880Z
Interesting, yeah, that checks out: 596777+282 = 597059 which is exactly the first input’s amount. Perhaps we’d be able to discover based on a positive fee that the wallet doesn’t have the entire information and prevent the fee from being displayed.
Murch
CC BY-SA 4.0
2024-06-19T14:39:45.697Z
Ah that may be on my end with regards to the negative value being positive, I am formatting the returned value from bitcoin-cli programmatically. Is there any scenario where it would not make sense to total the input values and output values and subtract them to get the fee?
Fontaine
CC BY-SA 4.0
2024-06-19T17:13:14.400Z
The wallet really shouldn't be returning the fee here since it can't accurately determine it.
Ava Chow
CC BY-SA 4.0
2024-06-18T20:54:03.820Z
2024-06-18T20:54:03.820Z
Ava Chow
<p>I am using the default signet network, my <code>txid</code> is <code>3923927eb3b6213bab5d0bee8364a87eafe357cb4d42ce6c587f0372735c7ff0</code>.</p>
<p><code>bitcoin-cli listtransactions</code> shows a fee of 0.00596777 when in reality the fee is 0.00000282. Why such a huge discrepancy?</p>
<p>Here is a link to the tx on <a href="https://mempool.space/signet/tx/3923927eb3b6213bab5d0bee8364a87eafe357cb4d42ce6c587f0372735c7ff0" rel="nofollow noreferrer">mempool.space</a></p>
<p>And here is the output from <code>listtransactions</code>:</p>
<pre><code>{
            abandoned = 0;
            address = tb1q9fnletvwwup855vyqttuya0evaypg0njqdjsv4;
            amount = &quot;-5e-05&quot;;
            &quot;bip125-replaceable&quot; = no;
            blockhash = 00000012d461cd4e35b5b41ba81decb75b76bdcf7d84844fc91917f47d760a9f;
            blockheight = 195521;
            blockindex = 440;
            blocktime = 1715698392;
            category = send;
            confirmations = 4991;
            fee = &quot;0.00596777&quot;;
            label = &quot;&quot;;
            time = 1715696690;
            timereceived = 1715696690;
            txid = 3923927eb3b6213bab5d0bee8364a87eafe357cb4d42ce6c587f0372735c7ff0;
            vout = 3;
            walletconflicts =             (
            );
            wtxid = d4e19c5eb0e51ebe05db73587bf2b52afebafdcc36480befd95e190f01fef9e0;
        }
</code></pre>
<p>EDIT:
As requested please see output direct from <code>bitcoin-cli</code>. FWIW this is a payjoin tx.</p>
<pre><code>{
    &quot;address&quot;: &quot;tb1q9fnletvwwup855vyqttuya0evaypg0njqdjsv4&quot;,
    &quot;category&quot;: &quot;send&quot;,
    &quot;amount&quot;: -0.00005000,
    &quot;label&quot;: &quot;&quot;,
    &quot;vout&quot;: 3,
    &quot;fee&quot;: 0.00596777,
    &quot;confirmations&quot;: 5180,
    &quot;blockhash&quot;: &quot;00000012d461cd4e35b5b41ba81decb75b76bdcf7d84844fc91917f47d760a9f&quot;,
    &quot;blockheight&quot;: 195521,
    &quot;blockindex&quot;: 440,
    &quot;blocktime&quot;: 1715698392,
    &quot;txid&quot;: &quot;3923927eb3b6213bab5d0bee8364a87eafe357cb4d42ce6c587f0372735c7ff0&quot;,
    &quot;wtxid&quot;: &quot;d4e19c5eb0e51ebe05db73587bf2b52afebafdcc36480befd95e190f01fef9e0&quot;,
    &quot;walletconflicts&quot;: [
    ],
    &quot;time&quot;: 1715696690,
    &quot;timereceived&quot;: 1715696690,
    &quot;bip125-replaceable&quot;: &quot;no&quot;,
    &quot;abandoned&quot;: false
  }
</code></pre>

CC BY-SA 4.0
2024-06-18T09:57:01.863Z
Where did you get the output from? It doesn't look like the JSONRPC returned by bitcoin-cli. Could you paste the output from bitcoin-cli?
Antoine Poinsot
CC BY-SA 4.0
2024-06-18T20:26:54.267Z
Yeah, e.g. the fields appear to be sorted alphabetically instead of in the order that bitcoin-cli would output them, and I don’t think that Bitcoin Core would ever output scientific notation. Any chance that this output was post-processed by another program to reach this state?
Murch
CC BY-SA 4.0
2024-06-19T14:37:14.853Z
I am formatting the returned value into pretty printed json. Sure, I will respond asap with the direct value from bitcoin-cli.
Fontaine
CC BY-SA 4.0
2024-06-19T15:06:17.473Z
Have added the unformatted output as an edit above.
Fontaine
<bitcoin-core><wallet><transaction-fees><json-rpc><listtransactions>
bitcoin-cli listtransactions fee amount is way off, why?
Fontaine
# bitcoin-cli listtransactions fee amount is way off, why?

(Asked by: username_0 on 2024-06-18)

I am using the default signet network, my `txid` is `3923927eb3b6213bab5d0bee8364a87eafe357cb4d42ce6c587f0372735c7ff0`.

`bitcoin-cli listtransactions` shows a fee of 0.00596777 when in reality the fee is 0.00000282. Why such a huge discrepancy?

Here is a link to the tx on [mempool.space](https://mempool.space/signet/tx/3923927eb3b6213bab5d0bee8364a87eafe357cb4d42ce6c587f0372735c7ff0)

And here is the output from `listtransactions`:

```
{
            abandoned = 0;
            address = tb1q9fnletvwwup855vyqttuya0evaypg0njqdjsv4;
            amount = "-5e-05";
            "bip125-replaceable" = no;
            blockhash = 00000012d461cd4e35b5b41ba81decb75b76bdcf7d84844fc91917f47d760a9f;
            blockheight = 195521;
            blockindex = 440;
            blocktime = 1715698392;
            category = send;
            confirmations = 4991;
            fee = "0.00596777";
            label = "";
            time = 1715696690;
            timereceived = 1715696690;
            txid = 3923927eb3b6213bab5d0bee8364a87eafe357cb4d42ce6c587f0372735c7ff0;
            vout = 3;
            walletconflicts =             (
            );
            wtxid = d4e19c5eb0e51ebe05db73587bf2b52afebafdcc36480befd95e190f01fef9e0;
        }

```

EDIT:
As requested please see output direct from `bitcoin-cli`. FWIW this is a payjoin tx.

```
{
    "address": "tb1q9fnletvwwup855vyqttuya0evaypg0njqdjsv4",
    "category": "send",
    "amount": -0.00005000,
    "label": "",
    "vout": 3,
    "fee": 0.00596777,
    "confirmations": 5180,
    "blockhash": "00000012d461cd4e35b5b41ba81decb75b76bdcf7d84844fc91917f47d760a9f",
    "blockheight": 195521,
    "blockindex": 440,
    "blocktime": 1715698392,
    "txid": "3923927eb3b6213bab5d0bee8364a87eafe357cb4d42ce6c587f0372735c7ff0",
    "wtxid": "d4e19c5eb0e51ebe05db73587bf2b52afebafdcc36480befd95e190f01fef9e0",
    "walletconflicts": [
    ],
    "time": 1715696690,
    "timereceived": 1715696690,
    "bip125-replaceable": "no",
    "abandoned": false
  }

```

**Tags:** bitcoin-core, wallet, transaction-fees, json-rpc, listtransactions

> **Comments:**
> **username_1**: Where did you get the output from? It doesn't look like the JSONRPC returned by bitcoin-cli. Could you paste the output from bitcoin-cli?  
> **username_2**: Yeah, e.g. the fields appear to be sorted alphabetically instead of in the order that bitcoin-cli would output them, and I don’t think that Bitcoin Core would ever output scientific notation. Any chance that this output was post-processed by another program to reach this state?  
> **username_0**: I am formatting the returned value into pretty printed json. Sure, I will respond asap with the direct value from bitcoin-cli.  
> **username_0**: Have added the unformatted output as an edit above.  

---

## 1 answers

### Answer by username_3 on 2024-06-18. Score: 3 | Accepted answer

This occurs when one of the inputs is unknown to the wallet, for example when participating in a multiparty transaction like a CoinJoin.

What happens is that the wallet checks to see how much value in the inputs it knows about, and if it is nonzero, computes the fee by subtracting the outputs value from it and then negating. The base assumption in this calculation is that all inputs in the transaction belong to the wallet - if any input is known, then the calculated input value will be nonzero, but all inputs must be known for this calculation to be correct.

So what's happened here is that your transaction has two inputs, one of which is known, one not. The known one appears to be the second input of 0.003. Taking that as the "input value", the calculated fee as -(0.003 - 0.00896777) = -(-0.00596777) = 0.00596777.

One thing to notice here is that the fee is given as a positive number, however the wallet is supposed to be reporting it as a negative number. This is an indicator of this particular issue.

> **Comments:**
> **username_2**: Interesting, yeah, that checks out: 596777+282 = 597059 which is exactly the first input’s amount. Perhaps we’d be able to discover based on a positive fee that the wallet doesn’t have the entire information and prevent the fee from being displayed.  
> **username_0**: Ah that may be on my end with regards to the negative value being positive, I am formatting the returned value from bitcoin-cli programmatically. Is there any scenario where it would not make sense to total the input values and output values and subtract them to get the fee?  
> **username_3**: The wallet really shouldn't be returning the fee here since it can't accurately determine it.  

---

