Why is OP_SUBSTR disabled? (and OP_LEFT, OP_RIGHT)

6

1

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.

hrobeers

Posted 2016-09-21T14:15:47.153

Reputation: 73

Answers

6

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

Pieter Wuille

Posted 2016-09-21T14:15:47.153

Reputation: 54 032

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 2016-09-23T11:31:24.303

I do not see any issues with those operations, no.Pieter Wuille 2016-09-23T11:57:11.400