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

<p>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).</p>

CC BY-SA 3.0
2016-09-23T11:31:24.303Z
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
CC BY-SA 3.0
2016-09-23T11:57:11.400Z
I do not see any issues with those operations, no.
Pieter Wuille
CC BY-SA 4.0
2022-10-31T23:57:19.027Z
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
CC BY-SA 3.0
2016-09-23T00:14:14.603Z
2016-09-23T00:14:14.603Z
Pieter Wuille
<p>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.</p>

<p>Context:</p>

<blockquote>
  <p>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.</p>
</blockquote>

<script><non-standard-transaction><opcodes>
Why is OP_SUBSTR disabled? (and OP_LEFT, OP_RIGHT)
hrobeers
# Why is OP_SUBSTR disabled? (and OP_LEFT, OP_RIGHT)

(Asked by: username_0 on 2016-09-21)

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.

Context:

> 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.

**Tags:** script, non-standard-transaction, opcodes


---

## 1 answers

### Answer by username_1 on 2016-09-23. Score: 15 | Accepted answer

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).

> **Comments:**
> **username_0**: 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!  
> **username_1**: I do not see any issues with those operations, no.  
> **username_2**: 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.  

---

