https://github.com/jl2012/bips/blob/mastopcodes/bip-mastopcodes.mediawiki This BIP defines the scripting system in Merkelized Abstract Syntax Tree (BIP114). It re-enables some of the previously disabled opcodes, introduces new opcodes, and defines expandable opcodes for future extension. It will: • re-enable CAT, SUBSTR, LEFT, RIGHT, INVERT, AND, OR, XOR, LSHIFT, and RSHIFT; • introduce new opcodes: DUPTOALTSTACK, DUPFROMALTSTACK, SWAPSTACK, SWAPCAT, and RESIZE; • define expandable opcodes for future softforks of stack manipulating opcodes: EXPAND1 to EXPAND32. This BIP is based on the BIP114 MAST: https://github.com/bitcoin/bips/blob/master/bip-0114.mediawiki Reference implementation, including the BIP9 logic and script tests, could be found at https://github.com/jl2012/bitcoin/tree/segwit_mast . This branch is rebased on top of the #7910 segwit PR. However, I have not tested the BIP9 activation. The implementation of the re-enabled opcode are mostly taken from the Elements Project. ------------- This BIP does not describe changes in CHECKSIG (e.g. new hash type, Schnorr sig), which I think should be another BIP. I have also considered more radical changes. For example, make all comparison opcode to be “VERIFY” type, and a script passes if and only if the stack is exactly empty after evaluation.