<p><code>decoderawtransaction</code> 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.</p>

CC BY-SA 3.0
2017-08-30T15:16:59.200Z
2017-08-30T15:43:48.793Z
2017-08-30T15:43:48.793Z
Ava Chow
<p>I've been decoding some transactions on <strong>Testnet</strong>, and I've found one that <code>bitcoin-cli decoderawtransaction</code> seems to "fail" to decode correctly.</p>

<p>Here's the TXID: <code>400bb081cfea4802a1cdd8c365c886b9ccc0da59addd3d0b1f92cf0c04870738</code></p>

<p><strong>For example:</strong></p>

<p>1) You can retrieve the raw data as normal:</p>

<pre><code>bitcoin-cli getrawtransaction 400bb081cfea4802a1cdd8c365c886b9ccc0da59addd3d0b1f92cf0c04870738

0200000000010129b0f742d41c6aad58dd0e779ca53b8bed1790465ed59ed20d2b6a3ecc6744920100000000ffffffff0178cdf5050000000016001443aac20a116e09ea4f7914be1c55e4c17aa600b702483045022100e8877e9351abcfc5dc20a9c9f55d7bcde8d64993d135a20568b5b8628ea3f7b102203801629aad6a7ec0960b4d830aedac673d620179753cc6f197eaed866a4959ba012103335134d7414e1d1a154600b124a96f5ef2c6ca21434d2622469a96bd5262fd5600000000
</code></pre>

<p>2) But when you decode that same raw data, you get this TXID:</p>

<pre><code>{
  "txid": "ec4529406c0f8fb337114a3b8e270dd6e3ec9712299daa3eb17d1fc69aa58251",
  "hash": "ec4529406c0f8fb337114a3b8e270dd6e3ec9712299daa3eb17d1fc69aa58251",
  "size": 192,
  "vsize": 192,
</code></pre>

<p><strong>Question:</strong></p>

<p>Why is <code>decoderawtransaction</code> returning this TXID?</p>

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

<p><strong>Edit:</strong></p>

<p>Here are some more:</p>

<ul>
<li><code>a24cec50d5cf861d1af4b634f8ed1968c0e9484724bfef5af7f8c383605978c8</code> (testnet)</li>
<li><code>1f3f7e0543f4eeb88d2e04a2e4d04e4ef321ebc69e58e9bfd607c7d2b565ea66</code> (testnet)</li>
</ul>

CC BY-SA 3.0
2017-08-30T15:16:27.153Z
Can you include the full output of the `decoderawtransaction`?
Ava Chow
<segregated-witness><transaction-id>
Why does bitcoin-cli not show the correct TXID for this transaction?
inersha
# Why does bitcoin-cli not show the correct TXID for this transaction?

(Asked by: username_0 on 2017-08-30)

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)

**Tags:** segregated-witness, transaction-id

> **Comments:**
> **username_1**: Can you include the full output of the `decoderawtransaction`?  

---

## 1 answers

### Answer by username_1 on 2017-08-30. Score: 2 | Accepted answer

`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.


---

