Why does bitcoin-cli not show the correct TXID for this transaction?

1

I've been decoding some transactions on Testnet, and I've found one that bitcoin-cli decoderawtransaction seems to "fail" to decode correctly.

Here's the TXID: 400bb081cfea4802a1cdd8c365c886b9ccc0da59addd3d0b1f92cf0c04870738

For example:

1) You can retrieve the raw data as normal:

bitcoin-cli getrawtransaction 400bb081cfea4802a1cdd8c365c886b9ccc0da59addd3d0b1f92cf0c04870738

0200000000010129b0f742d41c6aad58dd0e779ca53b8bed1790465ed59ed20d2b6a3ecc6744920100000000ffffffff0178cdf5050000000016001443aac20a116e09ea4f7914be1c55e4c17aa600b702483045022100e8877e9351abcfc5dc20a9c9f55d7bcde8d64993d135a20568b5b8628ea3f7b102203801629aad6a7ec0960b4d830aedac673d620179753cc6f197eaed866a4959ba012103335134d7414e1d1a154600b124a96f5ef2c6ca21434d2622469a96bd5262fd5600000000

2) But when you decode that same raw data, you get this TXID:

{
  "txid": "ec4529406c0f8fb337114a3b8e270dd6e3ec9712299daa3eb17d1fc69aa58251",
  "hash": "ec4529406c0f8fb337114a3b8e270dd6e3ec9712299daa3eb17d1fc69aa58251",
  "size": 192,
  "vsize": 192,

Question:

Why is decoderawtransaction returning this TXID?

This is a segwit transaction, and it is returning the full hash for the TXID (including the witness data). Why?

Edit:

Here are some more:

  • a24cec50d5cf861d1af4b634f8ed1968c0e9484724bfef5af7f8c383605978c8 (testnet)
  • 1f3f7e0543f4eeb88d2e04a2e4d04e4ef321ebc69e58e9bfd607c7d2b565ea66 (testnet)

inersha

Posted 2017-08-30T12:19:42.483

Reputation: 2 236

Can you include the full output of the decoderawtransaction?Andrew Chow 2017-08-30T15:16:27.153

Answers

2

decoderawtransaction in 0.14.2 has some issues with decoding segwit transactions. Sometimes it will decode segwit transactions as non-segwit. These should mostly be fixed in Bitcoin Core 0.15.0.

Andrew Chow

Posted 2017-08-30T12:19:42.483

Reputation: 40 910