3

Why is the wtxid considered malleable since the transaction is unconfirmed? How can a third-party modify it?

2 Answers 2

2

All transaction data is committed to the WTXID, unlike in the case of TXID's.

Malleability is found in the unlocking script/data of a transaction. It is malleable, because is not committed to the signature (circular dependency).

Sources of TX Malleability:

  • Signature Malleability
  • Input Script Malleability

See BIP62 for a great overview of TX malleability sources.

The unlocking script data is found in input scripts (non-witness tx's) and witnesses (witness tx's). For a witness transaction, if the witness is modified in a way that doesn't affect validity, this necessarily changes the resulting WTXID.

The TXID's of witness transactions are not malleable, because the input script is empty and witness data is stripped for its TXID derivation. Transactions are not referenced by WTXID, but by TXID's.

1
  • 1
    I should mention, even if only TXIDs are committed to block headers (merkle root), WTXIDs are committed to a coinbase output (witness root), so that once confirmed, none of the witness transaction data cannot be modified.
    – James C.
    Jan 15, 2019 at 16:03
2

To add to James' answer, the "segregated" witness can be switched out for an alternative valid witness which changes the wtxid but not the txid. The txid stays the same if you change the witness as the witness is not hashed for the txid but is for wtxid.

Thanks to Gloria Zhao for providing this graphic from BIP144 during a Bitcoin Core PR review club in June 2021.

txid and wtxid

Your Answer

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

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