<blockquote>
  <p>How could the transaction have negative value of amount and fee ? Could this be the reason of that error "bad-txns-in-belowout"?</p>
</blockquote>

<p>No, it is not. The negatives you see are normal; the values are actually positive, but because you are sending money away from your wallet, they will display as negative relative to your wallet.</p>

<p>That error means that the value of the inputs is less than the value of the outputs. You need to check that output 0 of <code>2146415931a60db99ebf60849e2874dd67d37f870249a1ff06adcc6b8244155b</code> actually has the value that you want to spend.</p>

CC BY-SA 3.0
2018-01-13T02:59:57.090Z
I don't understand. I set the amount and fee to positive 0.08 and 0.001 BTC,  How could the transaction turn out to have negative amount and fee ?
styling
CC BY-SA 3.0
2018-01-13T03:05:57.653Z
Sorry, I slightly misunderstood your question, although my answer is till mostly correct. The negative values are relative to your wallet. Your wallet in that transaction is losing 0.08 + 0.001, so if you were to add those values to your wallet and get the correct balance, they need to be negative. The negatives there are normal for sending from your wallet. The problem is that the output that you are spending does not have enough money. I will update my answer accordingly.
Ava Chow
CC BY-SA 3.0
2018-01-13T11:07:39.247Z
Thank you. In bitcoin-cli, is there a command to check the output 0 value of txid 2146415931a60db99ebf60849e2874dd67d37f870249a1ff06adcc6b8244155b
styling
CC BY-SA 3.0
2018-01-13T17:22:12.967Z
Assuming that the transaction still contains an unspent output, you can use `getrawtransaction`. If that transaction is part of your wallet, you can use `gettransaction` and `listunspent`.
Ava Chow
CC BY-SA 3.0
2018-01-13T02:56:00.760Z
2018-01-13T03:08:08.347Z
2018-01-13T03:08:08.347Z
Ava Chow
<p>Using bitcoin-cli decoderawtransaction, i got the txid of the only one vin, and the value of two vout are set at 0.015 BTC. Then, using bitcoin-cli gettransaction, i got negative value of amount and fee. How could the transaction have negative value of amount and fee ? Could this be the reason of that error "bad-txns-in-belowout"?</p>

<pre>
./bitcoin-cli -regtest decoderawtransaction "hexvalue"
{
  "txid": "35d2e765217d71db34fd0cd1cf52f419fc525069ac87ed9f413b194851c70849",
  "hash": "35d2e765217d71db34fd0cd1cf52f419fc525069ac87ed9f413b194851c70849",
  "version": 1,
  "size": 338,
  "vsize": 338,
  "locktime": 0,
  "vin": [
    {
      "txid": "2146415931a60db99ebf60849e2874dd67d37f870249a1ff06adcc6b8244155b",
      "vout": 0,
''' 
    }
  "vout": [
    {
      "value": 0.01500000,
      "n": 0,
      "scriptPubKey": {
        "asm": "OP_DUP OP_HASH160 dd100be7d9aea5721158ebde6d6a1fd8fff93bb1 OP_EQUALVERIFY OP_CHECKSIG",
        "hex": "76a914dd100be7d9aea5721158ebde6d6a1fd8fff93bb188ac",
        "reqSigs": 1,
        "type": "pubkeyhash",
        "addresses": [
          "n1fprNxRhWrpkJ34A4cNsSZbHsnzhob2KL"
        ]
      }
    },
    {
      "value": 0.01500000,
      "n": 1,
...
    }
}

./bitcoin-cli -regtest gettransaction 2146415931a60db99ebf60849e2874dd67d37f870249a1ff06adcc6b8244155b
{
  "amount": -0.08000000,
  "fee": -0.00100000,
  "confirmations": 0,
  "trusted": true,
  "txid": "2146415931a60db99ebf60849e2874dd67d37f870249a1ff06adcc6b8244155b",
...
}
</pre>

<transactions>
Bitcoin core "bad-txns-in-belowout"
styling
# Bitcoin core "bad-txns-in-belowout"

(Asked by: username_0 on 2018-01-13)

Using bitcoin-cli decoderawtransaction, i got the txid of the only one vin, and the value of two vout are set at 0.015 BTC. Then, using bitcoin-cli gettransaction, i got negative value of amount and fee. How could the transaction have negative value of amount and fee ? Could this be the reason of that error "bad-txns-in-belowout"?

```

./bitcoin-cli -regtest decoderawtransaction "hexvalue"
{
  "txid": "35d2e765217d71db34fd0cd1cf52f419fc525069ac87ed9f413b194851c70849",
  "hash": "35d2e765217d71db34fd0cd1cf52f419fc525069ac87ed9f413b194851c70849",
  "version": 1,
  "size": 338,
  "vsize": 338,
  "locktime": 0,
  "vin": [
    {
      "txid": "2146415931a60db99ebf60849e2874dd67d37f870249a1ff06adcc6b8244155b",
      "vout": 0,
''' 
    }
  "vout": [
    {
      "value": 0.01500000,
      "n": 0,
      "scriptPubKey": {
        "asm": "OP_DUP OP_HASH160 dd100be7d9aea5721158ebde6d6a1fd8fff93bb1 OP_EQUALVERIFY OP_CHECKSIG",
        "hex": "76a914dd100be7d9aea5721158ebde6d6a1fd8fff93bb188ac",
        "reqSigs": 1,
        "type": "pubkeyhash",
        "addresses": [
          "n1fprNxRhWrpkJ34A4cNsSZbHsnzhob2KL"
        ]
      }
    },
    {
      "value": 0.01500000,
      "n": 1,
...
    }
}

./bitcoin-cli -regtest gettransaction 2146415931a60db99ebf60849e2874dd67d37f870249a1ff06adcc6b8244155b
{
  "amount": -0.08000000,
  "fee": -0.00100000,
  "confirmations": 0,
  "trusted": true,
  "txid": "2146415931a60db99ebf60849e2874dd67d37f870249a1ff06adcc6b8244155b",
...
}

```

**Tags:** transactions


---

## 1 answers

### Answer by username_1 on 2018-01-13. Score: 3

> How could the transaction have negative value of amount and fee ? Could this be the reason of that error "bad-txns-in-belowout"?

No, it is not. The negatives you see are normal; the values are actually positive, but because you are sending money away from your wallet, they will display as negative relative to your wallet.

That error means that the value of the inputs is less than the value of the outputs. You need to check that output 0 of `2146415931a60db99ebf60849e2874dd67d37f870249a1ff06adcc6b8244155b` actually has the value that you want to spend.

> **Comments:**
> **username_0**: I don't understand. I set the amount and fee to positive 0.08 and 0.001 BTC,  How could the transaction turn out to have negative amount and fee ?  
> **username_1**: Sorry, I slightly misunderstood your question, although my answer is till mostly correct. The negative values are relative to your wallet. Your wallet in that transaction is losing 0.08 + 0.001, so if you were to add those values to your wallet and get the correct balance, they need to be negative. The negatives there are normal for sending from your wallet. The problem is that the output that you are spending does not have enough money. I will update my answer accordingly.  
> **username_0**: Thank you. In bitcoin-cli, is there a command to check the output 0 value of txid 2146415931a60db99ebf60849e2874dd67d37f870249a1ff06adcc6b8244155b  
> **username_1**: Assuming that the transaction still contains an unspent output, you can use `getrawtransaction`. If that transaction is part of your wallet, you can use `gettransaction` and `listunspent`.  

---

