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?

1 Answer 1

5

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.

2
  • 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
    Jun 16, 2019 at 0:39
  • getrawtransaction can give you the full details of a transaction.
    – Andrew Chow
    Jun 16, 2019 at 1:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.