Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: NotATether on August 10, 2022, 04:56:59 PM



Title: Is anybody using OP_RESERVED even for academic purposes?
Post by: NotATether on August 10, 2022, 04:56:59 PM
Bitcoin Wiki's script page says that OP_RESERVED causes script evaluation to fail unless it's in an unexecuted IF statement.

According to https://bitcoin.stackexchange.com/questions/105778/why-were-op-reserved-op-reserved1-and-op-reserved2-originally-reserved , nobody really knows why they were introduced. And, all google searches to find at least an academic usage of the opcodes have not turned any results.

So, is it really true that these opcodes are virtually unused, and not useful for anything?


Title: Re: Is anybody using OP_RESERVED even for academic purposes?
Post by: achow101 on August 10, 2022, 06:12:30 PM
They are literally unused and are unusable because they do not appear in the script interpreter. The main loop of the interpreter doesn't handle OP_RESERVED, and the default for unhandled opcdoes is to immediately fail. This behavior has existed since the original 0.1.0 release.

The are likely named OP_RESERVED because Satoshi was probably saving some space to add new opcodes in the future. However the only way to change the behavior of these opcodes is to do a hard fork which redefines them to only fail under specific conditions. Since the original release, the OP_NOP opcodes were added (which would also have been a hard fork), and with Taproot, OP_SUCCESS. These opcodes allow us to introduce new opcodes as soft forks.


Title: Re: Is anybody using OP_RESERVED even for academic purposes?
Post by: garlonicon on August 10, 2022, 06:32:55 PM
They can be used in one case: to mark transaction as failed if some conditions are met. "<condition> OP_NOTIF OP_RESERVED OP_ENDIF" is the same as "<condition> OP_VERIFY".


Title: Re: Is anybody using OP_RESERVED even for academic purposes?
Post by: Sandra_hakeem on August 10, 2022, 09:21:10 PM
Bitcoin Wiki's script page says that OP_RESERVED causes script evaluation to fail unless it's in an unexecuted IF statement.

According to https://bitcoin.stackexchange.com/questions/105778/why-were-op-reserved-op-reserved1-and-op-reserved2-originally-reserved , nobody really knows why they were introduced. And, all google searches to find at least an academic usage of the opcodes have not turned any results.

So, is it really true that these opcodes are virtually unused, and not useful for anything?

I think it's logical just as achow101 said......I have learnt that it associates some values along portional bytes, expressing  them as ''0x515253'' ? It also partly help programmers differentiate between the negative sign in the Script Number encoding. They might easily assume 0x50 is either OP_0 (0x00) or OP_1NEGATE (0x4f, 79).
References at https://bitcoin.stackexchange.com/questions/105778/why-were-op-reserved-op-reserved1-and-op-reserved2-originally-reserved (https://bitcoin.stackexchange.com/questions/105778/why-were-op-reserved-op-reserved1-and-op-reserved2-originally-reserved)