Bitcoin Forum

Bitcoin => Bitcoin Technical Support => Topic started by: asketak on October 29, 2017, 04:01:42 PM



Title: Bitcoin-cli returning negative output of transaction
Post by: asketak on October 29, 2017, 04:01:42 PM
Hello, I am running full node and using bitcoin-cli to get data from blockchain.
When I want to get info about this transaction: https://blockchain.info/tx/4c0de1532f0cebb80ebb3a4e787bcd7f512789ab70109307195e697b2c3c25c0?show_adv=true

I run:
Code:
./bitcoin-cli getrawtransaction "4c0de1532f0cebb80ebb3a4e787bcd7f512789ab70109307195e697b2c3c25c0"
To get encoded transaction. When wanting to decode the transaction, I run(parameter is output of previous command):
Code:
 ./bitcoin-cli decoderawtransaction 01000000000101ee00ae484106c1c54b362b6d97c8b141fc7f4dedade3a2dd9edaa1fa2c2317da0100000017160014646abc1ac4bb8b780bc0c7e316629dfc18b8cfeaffffffff01a0d809000000000017a9144d3a3cc3b216b19bd8e6a9d16086b8620826ead98702483045022100ef58e75476f619b6cb4b60588a5d25aab54c29677749c3c33ef4928f0fe6f8c0022060a558b713232917ae623c84e9e615d8848c36abb272ce61df363351ff9ffef701210371104ae352bba2855cc0f0f88f27044b0795e65d01c18b32c7debf8bba09cc6200000000
This will give me
Code:
...
  "vout": [
    {
      "value": -45378677941.16448767,
      "n": 0,
...

I know, that transaction output can not be negative. I get the correct value of output most time when using the method above. Where is the problem? Do you get the same result when running the command?


Title: Re: Bitcoin-cli returning negative output of transaction
Post by: aleksej996 on October 29, 2017, 04:30:58 PM
No, I don't get the same result. I get no negative numbers.

Code:
"txid": "4c0de1532f0cebb80ebb3a4e787bcd7f512789ab70109307195e697b2c3c25c0",
  "hash": "3a522ffc32a4d7c845dea08ab38fdc017eff9329febee131036ce6f71d7d6640",
  "version": 1,
  "size": 216,
  "vsize": 134,
  "locktime": 0,
  "vin": [
    {
      "txid": "da17232cfaa1da9edda2e3aded4d7ffc41b1c8976d2b364bc5c1064148ae00ee",
      "vout": 1,
      "scriptSig": {
        "asm": "0014646abc1ac4bb8b780bc0c7e316629dfc18b8cfea",
        "hex": "160014646abc1ac4bb8b780bc0c7e316629dfc18b8cfea"
      },
      "txinwitness": [
        "3045022100ef58e75476f619b6cb4b60588a5d25aab54c29677749c3c33ef4928f0fe6f8c0022060a558b713232917ae623c84e9e615d8848c36abb272ce61df363351ff9ffef701",
        "0371104ae352bba2855cc0f0f88f27044b0795e65d01c18b32c7debf8bba09cc62"
      ],
      "sequence": 4294967295
    }
  ],
  "vout": [
    {
      "value": 0.00645280,
      "n": 0,
      "scriptPubKey": {
        "asm": "OP_HASH160 4d3a3cc3b216b19bd8e6a9d16086b8620826ead9 OP_EQUAL",
        "hex": "a9144d3a3cc3b216b19bd8e6a9d16086b8620826ead987",
        "reqSigs": 1,
        "type": "scripthash",
        "addresses": [
          "38jMiiZs2C5n5MPkyc5pSA7wwW6H4p6hPa"
        ]
      }
    }
  ]
}

Are you running the latest version of Bitcoin Core? This transaction seems to be Segwit transaction so if you are running an older version of Bitcoin Core it might get confused or something.


Title: Re: Bitcoin-cli returning negative output of transaction
Post by: asketak on October 29, 2017, 05:02:04 PM
You are right, I am running old version of core. Thanks.