New specification and bech32 address format for new segwit script versions
UIP-15 introduced a new kind of witness program which does not fit the old specification (BIP-141):
A scriptPubKey (or redeemScript as defined in BIP16/P2SH) that consists of a 1-byte push opcode (for 0 to 16) followed by a data push between 2 and 40 bytes gets a new special meaning. The value of the first push is called the "version byte". The following byte vector pushed is called the "witness program".
Because instead of one data push remote staking script has two data pushes. This also breaks the specification of segwit addresses:
A segwit address[6] is a Bech32 encoding of:
- The human-readable part "bc"[7] for mainnet, and "tb"[8] for testnet.
- The data-part values:
- 1 byte: the witness version
- A conversion of the 2-to-40-byte witness program (as defined by BIP141) to base32
Therefore we need to introduce a new specification, i.e. we need to answer the following questions:
- What's the maximum size of segwit scripts?
- How many data pushes can a segwit script contain?
- What's the maximum size of a data push?
To answer these questions we need to consider script types which we might want to convert to segwit format.