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.


The intended purpose of all the other now-disabled opcodes 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, 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)?

Source link


Please enter your comment!
Please enter your name here