What does it mean if TXID and WTXID are the same?

2

I'm having a tough time understanding what exactly WTXID is and what it means when WTXID and TXID are the same (and vica versa).

What I understand is that WTXID includes the witness data. Since non-segwit transactions do not have the witness segregated, their WTXID should be the same as the TXID. Is that correct?

Tzadiko

Posted 2019-06-14T02:58:41.587

Reputation: 21

Answers

3

The wtxid and txid are the same if and only if the transaction does not contain any segwit inputs. The wtxid is the hash of the entire transaction including all segwit data (i.e. the marker and flag bytes and the witness fields themselves). The txid is the hash of the non-segwit parts of the transaction. Because a transaction that does not have any segwit inputs does not have any segwit data at all, both the wtxid and txid hash the same data, so they are the same.

Andrew Chow

Posted 2019-06-14T02:58:41.587

Reputation: 40 910

Thank you. By the way, do you know what RPC command I can use to get the inputs and outputs of transactions returned by getrawmempool?Tzadiko 2019-06-16T00:39:13.320

getrawtransaction can give you the full details of a transaction.Andrew Chow 2019-06-16T01:50:58.910