Dealing with OP_IF and OP_NOTIF malleability



Summary:

The proposed BIP draft is aimed at making malleability of transactions with OP_IF and OP_NOTIF impossible. The Bitcoin script system's flow control codes, OP_IF and OP_NOTIF, open a source of malleability, which can be altered by a third party without invalidating the transaction. While these codes are not commonly used in the blockchain, more sophisticated functions such as OP_CHECKLOCKTIMEVERITY are being introduced, and the related malleability should be fixed. The proposal serves as a supplement to BIP62 and should be implemented together with other malleability fixes. If the transaction version is 3 or above, the flow control value for OP_IF and OP_NOTIF must be either 0 or 1, or the transaction fails. Compatibility-wise, this is a softfork and the new rules only apply to transactions of version 3 or above, so that transactions created before the introduction of this BIP will still be accepted by the network. An OP_0NOTEQUAL could be used before the flow control code to transform any non-zero value to 1 for people who want to preserve the original behavior of OP_IF and OP_NOTIF. The reference for the proposal is BIP62.


Updated on: 2023-06-11T00:55:01.192244+00:00