Why are the substring opcodes disabled? I understand that OP_CAT is disabled because it can blow up the stack easily (in combination with OP_DUP). But the substring opcodes reduce the stack size.


I'd like to use OP_LEFT to implement a proof of work requirement to spend a transaction. A substring operation is needed because OP_ADD (for salting) and OP_GREATERTHAN only work on 32bit values.

1 Answer 1


I'm afraid that my answer here can't be better than "Ask Satoshi".

There was a series of bugs found in Bitcoin's early life, and the response by its creator was to disable a number of scripting opcodes. Some of these may have been bad choices (or very wise ones...), but we don't know, and it does not matter. For all intents and purposes, these opcodes do not exist, as "reenabling" them would be just as hard as introducing them as new operations in the first place (i.e. a hard fork).

  • So do you agree with my analysis, or can you see potential issues with these substring operations? Thanks for taking the time to answer my question!
    – hrobeers
    Commented Sep 23, 2016 at 11:31
  • I do not see any issues with those operations, no. Commented Sep 23, 2016 at 11:57
  • Looking at it from a software-development standpoint, string-manipulation operations (OP_CAT, OP_SUBSTR, OP_LEFT, and OP_RIGHT) are prone to implementation bugs with the potential for buffer overflows or other security issues.
    – Mark
    Commented Oct 31, 2022 at 23:57

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.