2
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",
...
}
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 – 2018-01-13T02:59:57.090
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. – Andrew Chow – 2018-01-13T03:05:57.653
Thank you. In bitcoin-cli, is there a command to check the output 0 value of txid 2146415931a60db99ebf60849e2874dd67d37f870249a1ff06adcc6b8244155b – styling – 2018-01-13T11:07:39.247
Assuming that the transaction still contains an unspent output, you can use
getrawtransaction. If that transaction is part of your wallet, you can usegettransactionandlistunspent. – Andrew Chow – 2018-01-13T17:22:12.967