segregated witness – Bitcoin transaction malleability is it just for unconfirmed transaction?

15 views 7:05 pm 0 Comments February 26, 2024


TL;DR: Sure, as soon as a transaction is confirmed, until a series reorganization makes it unconfirmed once more, no types of malleability are attainable. SegWit particularly fastened TXID malleability of unconfirmed transactions, however different types of malleability are attainable.


Transaction malleability on the whole refers to the potential of a 3rd occasion altering some elements of a transaction with out making it invalid. For instance, with ECDSA it is attainable to vary a sound signature into a unique signature that’s nonetheless legitimate for a similar message. This is not an issue in most cryptosystems, however as a result of in pre-SegWit transactions the TXID depends upon the transaction signatures and transaction inputs reference the TXID of a transaction whose outputs they’re spending, this makes it unsafe to depend on chains of unconfirmed transactions (required by off-chain protocols similar to Lightning).

Whereas there have been proposals to restrict the ECDSA scheme to take away this vulnerability (see BIP62 which additionally covers different malleability vectors), SegWit took a extra normal strategy by introducing the “witness”, a brand new transaction part the place signatures and different knowledge wanted to fulfill scripts go, that is not relied on by the TXID. This was a superior answer in that it is now attainable to create chains of unsigned or partially signed transactions and know that it doesn’t matter what signatures and different knowledge might be included within the witness, the TXIDs will keep the identical and the chain stays legitimate.

Nevertheless, TXID malleability is not the one sort of malleability to look out for. Some scripts might be glad in a number of methods, and if a 3rd occasion can provide you with an answer that takes extra space within the witness, they’ll cut back the charge charge of your transaction. As one other instance, it was not too long ago mentioned that if a Taproot script tree consists of the identical script a number of occasions on totally different ranges, a 3rd occasion that is aware of the tree construction can change the witness to spend the script at a deeper stage, which once more will increase the witness dimension and lowers your charge charge. These sources of malleability can typically be prevented.

Leave a Reply

Your email address will not be published. Required fields are marked *