This PR expands the definition of what is a segwit output (the IsWitnessProgram API) in three ways:
The range of allowed outer witness versions (the first opcode of a witness program) is expanded from 17 to 31 different values. To the previous values of OP_0 through OP_16 we add 1NEGATE, NOP, DEPTH, CODESEPARATOR, and NOP1 through NOP10 (including CLTV, CSV, and MBV). This is the full range of single-byte opcodes that may begin a script, giving us a total of 31 different outer-version values for future hash mechanism extensions.
An optional shard specifier is allowed after the witness program, with 256 different unique values. The first 16 shards have a single-byte opcode format (OP_1 through OP_16), as does the 128th shard (1NEGATE, as it would otherwise be negative zero), and the other shards specifiers are one-byte pushes.
An optional "extension output" push between 2- and 75-bytes in length after the shard specifier, or after the witness program if the shard specifier is not present. This is an unconstrained field for use by future extensions to place extra information in the output needed for things like confidential transactions or issued assets, or a commitments to these values.
This PR expands the definition of what is a segwit output (the
IsWitnessProgram
API) in three ways:The range of allowed outer witness versions (the first opcode of a witness program) is expanded from 17 to 31 different values. To the previous values of
OP_0
throughOP_16
we add1NEGATE
,NOP
,DEPTH
,CODESEPARATOR
, andNOP1
throughNOP10
(includingCLTV
,CSV
, andMBV
). This is the full range of single-byte opcodes that may begin a script, giving us a total of 31 different outer-version values for future hash mechanism extensions.An optional shard specifier is allowed after the witness program, with 256 different unique values. The first 16 shards have a single-byte opcode format (
OP_1
throughOP_16
), as does the 128th shard (1NEGATE
, as it would otherwise be negative zero), and the other shards specifiers are one-byte pushes.An optional "extension output" push between 2- and 75-bytes in length after the shard specifier, or after the witness program if the shard specifier is not present. This is an unconstrained field for use by future extensions to place extra information in the output needed for things like confidential transactions or issued assets, or a commitments to these values.