Simple tx ID malleability fix, opcode proposal: OP_TXHASHVERIFY



Summary:

The author is proposing a solution to create transactions that are immune to transaction ID malleability. The proposed solution involves introducing an opcode called OP_TXHASHVERIFY, which would only work if added to a scriptSig as the very first operation and would abort if the hash of the transaction with all OP_TXHASHVERIFY operations (including stack push) removed does not match what has been pushed on the stack. To produce a transaction with one or more inputs protected against tx ID malleability, one would first calculate the tx ID of the tx, then for each input they wish to protect, add "0x32 $TX_HASH OP_TXHASHVERIFY" to the beginning of the scriptSig. When evaluating OP_TXHASHVERIFY, a copy of the tx in question is made, and the "0x32 OP_TXHASHVERIFY" sequence is removed from the beginning of all scriptSigs (if present). If the tx copy hash does not match the top stack item, the operation will abort.This solution adds 34 bytes per input and is meant to be a temporary solution until something better becomes available (e.g. Segwit). The proposal is seen as valuable because it allows users to not worry about tx ID malleability. The author asks for feedback on the proposal.


Updated on: 2023-06-11T19:59:57.040411+00:00