<p>Coming back to this much later, I was seriously overthinking this question – since Satoshi's original release, <code>OP_RESERVED1</code> and <code>OP_RESERVED2</code> were reserved immediately following <code>OP_EQUAL</code> and <code>OP_EQUALVERIFY</code>. In the implementation, <a href="https://github.com/trottier/original-bitcoin/blob/92ee8d9a994391d148733da77e2bbc2f4acc43cd/src/script.cpp#L484-L486" rel="nofollow noreferrer">a case statement for <code>OP_NOTEQUAL</code> is commented out referring people to <code>OP_NUMNOTEQUAL</code></a>.</p>
<p><code>OP_RESERVED1</code> was <code>OP_NOTEQUAL</code>, and <code>OP_RESERVED2</code> was <code>OP_NOTEQUALVERIFY</code>. Satoshi almost certainly decided to pull these out at the last minute before release, and shifting other opcodes would have required more testing than simply skipping the codepoints.</p>
<p>This might also simplify the explanation for <code>OP_RESERVED</code>'s location – maybe Satoshi started with <code>OP_0</code> at <code>0x50</code> and later realized <code>0x00</code> had the same behavior (and/or modified the system to use empty vectors for <code>0</code>), renaming <code>0x00</code> to <code>OP_0</code> and renaming <code>0x50</code> to <code>OP_RESERVED</code>.</p>

CC BY-SA 4.0
2022-04-06T03:41:10.570Z
2022-04-11T21:50:50.707Z
2022-04-11T21:50:50.707Z
Jason Dreyzehner
<blockquote>
<p>Since the earliest public release of Bitcoin, OP_RESERVED, OP_RESERVED1, and OP_RESERVED2 have been defined at 0x50 (80), 0x89 (137), and 0x8a (138), respectively.</p>
</blockquote>
<p>I doubt there's any known reason for them to exist. The script engine in Bitcoin obviously underwent a lot of changes during development and in the year following; a good portion of all the opcodes were completely rewritten, the behaviour of <code>OP_FALSE</code> was inverted, <code>OP_CODESEPERATOR</code> was effectively removed by execution changes, and so forth. There's many remnants of those changes and removals, and many of the opcodes have non-obvious quirks about how they are handled as a result.</p>
<p>It's worth remembering that the original releases of Bitcoin had &gt; 8 bit opcodes at <a href="https://github.com/trottier/original-bitcoin/blob/master/src/script.h#L140-L142" rel="nofollow noreferrer">least partially implemented</a>, and they were removed in the following year, so some of the space was reserved for the byte indicating their extension.</p>
<blockquote>
<p>Is there some other instruction set which reserves them (or where reserving them makes the &quot;Bitcoin instruction set&quot; consistent with that instruction set)?</p>
</blockquote>
<p>Bitcoin script's instruction set seems to be influenced by a research paper from the early 2000s that describes &quot;security forth&quot;, but the copies of this online seem to be well and truly rotted. Notably, the order of the operators is the same and it has matching oddities such as <code>OP_2OVER</code> and <code>OP_3DUP</code>, but these is shared by a number of other similar languages from the time as well.</p>

CC BY-SA 4.0
2021-04-27T19:41:28.000Z
Thanks for the info, I'd never found a close match for the instruction set! Do you have any reference or other information about that research paper? Do you know what the title was, or do you know where it might have been published?
Jason Dreyzehner
CC BY-SA 4.0
2021-04-27T19:57:49.633Z
I don’t recall anything other than the phrase “security forth”, it was just in a PDF on a university website that I saw a decade ago.
Claris
CC BY-SA 4.0
2021-04-27T20:48:39.420Z
Thanks for the tip! I'll mark this as the solution since it seems most likely so far. I also started a separate question to attempt to locate that research paper: https://bitcoin.stackexchange.com/questions/105805/what-prior-work-influenced-the-design-of-the-bitcoin-instruction-set
Jason Dreyzehner
CC BY-SA 4.0
2021-04-27T09:55:41.890Z
2021-04-27T09:55:41.890Z
Claris
<p>Since the <a href="https://github.com/bitcoin/bitcoin/blob/4405b78d6059e536c36974088a8ed4d9f0f29898/script.h#L26-L93" rel="nofollow noreferrer">earliest public release of Bitcoin</a>, <code>OP_RESERVED</code>, <code>OP_RESERVED1</code>, and <code>OP_RESERVED2</code> have been defined at <code>0x50</code> (80), <code>0x89</code> (137), and <code>0x8a</code> (138), respectively.</p>
<p>Why?</p>
<p>The intended purpose of all the other <a href="https://github.com/bitcoin/bitcoin/commit/a75560d828464c3f1138f52cf247e956fc8f937d" rel="nofollow noreferrer">now-disabled opcodes</a> seem to be well documented, but do we have any record or explanation for why the <code>OP_RESERVED{1,2}</code> opcodes were assigned at their current locations?</p>
<p><code>OP_RESERVED</code> seems pretty clearly placed to allow <code>OP_1</code> (<code>0x51</code>, 81) through <code>OP_16</code> (<code>0x60</code>, 96) to match each pushed number 1-to-1 with the second half of the byte (such that <code>0x515253</code> is easily read as <code>OP_1 OP_2 OP_3</code>). It may also be reserved to ensure users writing raw contracts don't accidentally assume <code>0x50</code> is either <code>OP_0</code> (<code>0x00</code>) or <code>OP_1NEGATE</code> (<code>0x4f</code>, 79), which might be easily confused because <code>0x80</code> is basically a negative sign in the Script Number encoding. (Any other ideas as to why Satoshi didn't fill in <code>OP_RESERVED</code>?)</p>
<p>For <code>OP_RESERVED1</code> and <code>OP_RESERVED2</code>, the reasoning seems less obvious.</p>
<p>In the oldest commit <a href="https://github.com/bitcoin/bitcoin/blob/4405b78d6059e536c36974088a8ed4d9f0f29898/script.h#L85-L93" rel="nofollow noreferrer">they are listed under <code>// bit logic</code></a>, a set of 8 opcodes which begins at <code>0x83</code> (131) and continue through <code>OP_RESERVED2</code> (<code>0x8a</code>, 138).</p>
<p>These don't seem to fall on any particularly special codepoints, and neither of the preceding or following opcode &quot;groups&quot; begin or end at any obviously special codepoints.</p>
<p>Is there something unusual about <code>0x89</code>/137 and <code>0x8a</code>/138 for which Satoshi might have reserved these codepoints?</p>
<p>Is there some other instruction set which reserves them (or where reserving them makes the &quot;Bitcoin instruction set&quot; consistent with that instruction set)?</p>

<script><satoshi-nakamoto><architecture>
Why were OP_RESERVED, OP_RESERVED1, and OP_RESERVED2 originally reserved?
Jason Dreyzehner
# Why were OP_RESERVED, OP_RESERVED1, and OP_RESERVED2 originally reserved?

(Asked by: username_0 on 2021-04-27)

Since the [earliest public release of Bitcoin](https://github.com/bitcoin/bitcoin/blob/4405b78d6059e536c36974088a8ed4d9f0f29898/script.h#L26-L93), `OP_RESERVED`, `OP_RESERVED1`, and `OP_RESERVED2` have been defined at `0x50` (80), `0x89` (137), and `0x8a` (138), respectively.

Why?

The intended purpose of all the other [now-disabled opcodes](https://github.com/bitcoin/bitcoin/commit/a75560d828464c3f1138f52cf247e956fc8f937d) seem to be well documented, but do we have any record or explanation for why the `OP_RESERVED{1,2}` opcodes were assigned at their current locations?

`OP_RESERVED` seems pretty clearly placed to allow `OP_1` (`0x51`, 81) through `OP_16` (`0x60`, 96) to match each pushed number 1-to-1 with the second half of the byte (such that `0x515253` is easily read as `OP_1 OP_2 OP_3`). It may also be reserved to ensure users writing raw contracts don't accidentally assume `0x50` is either `OP_0` (`0x00`) or `OP_1NEGATE` (`0x4f`, 79), which might be easily confused because `0x80` is basically a negative sign in the Script Number encoding. (Any other ideas as to why Satoshi didn't fill in `OP_RESERVED`?)

For `OP_RESERVED1` and `OP_RESERVED2`, the reasoning seems less obvious.

In the oldest commit [they are listed under `// bit logic`](https://github.com/bitcoin/bitcoin/blob/4405b78d6059e536c36974088a8ed4d9f0f29898/script.h#L85-L93), a set of 8 opcodes which begins at `0x83` (131) and continue through `OP_RESERVED2` (`0x8a`, 138).

These don't seem to fall on any particularly special codepoints, and neither of the preceding or following opcode "groups" begin or end at any obviously special codepoints.

Is there something unusual about `0x89`/137 and `0x8a`/138 for which Satoshi might have reserved these codepoints?

Is there some other instruction set which reserves them (or where reserving them makes the "Bitcoin instruction set" consistent with that instruction set)?

**Tags:** script, satoshi-nakamoto, architecture


---

## 2 answers

### Answer by username_0 on 2022-04-06. Score: 1 | Accepted answer

Coming back to this much later, I was seriously overthinking this question – since Satoshi's original release, `OP_RESERVED1` and `OP_RESERVED2` were reserved immediately following `OP_EQUAL` and `OP_EQUALVERIFY`. In the implementation, [a case statement for `OP_NOTEQUAL` is commented out referring people to `OP_NUMNOTEQUAL`](https://github.com/trottier/original-bitcoin/blob/92ee8d9a994391d148733da77e2bbc2f4acc43cd/src/script.cpp#L484-L486).

`OP_RESERVED1` was `OP_NOTEQUAL`, and `OP_RESERVED2` was `OP_NOTEQUALVERIFY`. Satoshi almost certainly decided to pull these out at the last minute before release, and shifting other opcodes would have required more testing than simply skipping the codepoints.

This might also simplify the explanation for `OP_RESERVED`'s location – maybe Satoshi started with `OP_0` at `0x50` and later realized `0x00` had the same behavior (and/or modified the system to use empty vectors for `0`), renaming `0x00` to `OP_0` and renaming `0x50` to `OP_RESERVED`.


---

### Answer by username_1 on 2021-04-27. Score: 4

> Since the earliest public release of Bitcoin, OP\_RESERVED, OP\_RESERVED1, and OP\_RESERVED2 have been defined at 0x50 (80), 0x89 (137), and 0x8a (138), respectively.

I doubt there's any known reason for them to exist. The script engine in Bitcoin obviously underwent a lot of changes during development and in the year following; a good portion of all the opcodes were completely rewritten, the behaviour of `OP_FALSE` was inverted, `OP_CODESEPERATOR` was effectively removed by execution changes, and so forth. There's many remnants of those changes and removals, and many of the opcodes have non-obvious quirks about how they are handled as a result.

It's worth remembering that the original releases of Bitcoin had > 8 bit opcodes at [least partially implemented](https://github.com/trottier/original-bitcoin/blob/master/src/script.h#L140-L142), and they were removed in the following year, so some of the space was reserved for the byte indicating their extension.

> Is there some other instruction set which reserves them (or where reserving them makes the "Bitcoin instruction set" consistent with that instruction set)?

Bitcoin script's instruction set seems to be influenced by a research paper from the early 2000s that describes "security forth", but the copies of this online seem to be well and truly rotted. Notably, the order of the operators is the same and it has matching oddities such as `OP_2OVER` and `OP_3DUP`, but these is shared by a number of other similar languages from the time as well.

> **Comments:**
> **username_0**: Thanks for the info, I'd never found a close match for the instruction set! Do you have any reference or other information about that research paper? Do you know what the title was, or do you know where it might have been published?  
> **username_1**: I don’t recall anything other than the phrase “security forth”, it was just in a PDF on a university website that I saw a decade ago.  
> **username_0**: Thanks for the tip! I'll mark this as the solution since it seems most likely so far. I also started a separate question to attempt to locate that research paper: https://bitcoin.stackexchange.com/questions/105805/what-prior-work-influenced-the-design-of-the-bitcoin-instruction-set  

---

