During the design and brainstorming phase of the milli-sats CHIP we stubled upon the need for existing opcodes from the native-introspection section, to slightly change behavior. This leads to the question on how to do this backwards compatible.
And that lead to a wider discussion of backwards compatibility in the Bitcoin Script environment.
Up until now this has been solved on an individual basis. Those solutions range from Schnorr signatures being detected by the size of the signature. Which frankly is a hack.
In various other technologies we have authors basically state an upgrade paths is not possible because it would not be backwards compatible.
So, here came the idea during our talks to have a new opcode OP_ENV, which is short for environment-version.
The basic concept is, a script can push a version (OP_2 OP_ENV) and we tie in a protocol upgrade specific behaviors to that we need to upgrade.
In other words; the behavior of specific opcodes may be altered based on which VM-Environment version is set.
Now, to be clear, this IS NOT REQUIRED for the milli-satoshi’s CHIP. We can just do with a piecemeal solution (op_milli-sats-enabled), but I think it makes sense to take a step back and look if maybe we should make our VM and also BitcoinScript more future-proof.
Here are further examples; #1 - Re-visit the opcode - bitcoincash/CHIP-MilliSatoshi - Codeberg.org