A version 0 witness program with a 20-byte program is a pay-to-witness-public-key-hash (P2WPKH) output and one with a 32-byte program is a pay-to-witness-script-hash (P2WSH) output; Bitcoin Core checks these sizes in VerifyWitnessProgram in src/script/interpreter.cpp.
Sources and checks
T1BIP 141, Segregated Witness (Consensus layer)BIP, says this directly
It is interpreted as a pay-to-witness-public-key-hash (P2WPKH) program.
Specification, Witness program, P2WPKH, read 2026-11-20
T1BIP 141, Segregated Witness (Consensus layer)BIP, says this directly
It is interpreted as a pay-to-witness-script-hash (P2WSH) program.
Specification, Witness program, P2WSH, read 2026-11-20
T1Bitcoin Core src/script/interpreter.cpp, VerifyWitnessProgramSource code, says this directly
} else if (program.size() == WITNESS_V0_KEYHASH_SIZE) {
VerifyWitnessProgram, read 2026-11-20
bitcoin/bitcoin at f498a5a671 contains this text in src/script/interpreter.h, and still does on the default branch.
Run it yourself
git clone https://github.com/bitcoin/bitcoin && git -C bitcoin show f498a5a6718d9157b6afb85412c3462439117702:src/script/interpreter.h | grep -nF 'inline constexpr size_t WITNESS_V0_KEYHASH_SIZE = 20;'bitcoin/bitcoin at f498a5a671 contains this text in src/script/interpreter.h, and still does on the default branch.
Run it yourself
git clone https://github.com/bitcoin/bitcoin && git -C bitcoin show f498a5a6718d9157b6afb85412c3462439117702:src/script/interpreter.h | grep -nF 'inline constexpr size_t WITNESS_V0_SCRIPTHASH_SIZE = 32;'bitcoin/bitcoin at f498a5a671 contains this text in src/script/interpreter.cpp.
Run it yourself
git clone https://github.com/bitcoin/bitcoin && git -C bitcoin show f498a5a6718d9157b6afb85412c3462439117702:src/script/interpreter.cpp | grep -nF 'if (program.size() == WITNESS_V0_SCRIPTHASH_SIZE) {'Checked at block 976,753, 20 Nov 2026, 16:42 UTC: quotes 3/3, code 3/3
History
Nothing is edited silently; every revision keeps what it replaced.
- 20 Nov 2026, 16:42 UTCblock 976,753
Published Revision 1, run 2026-11-20-seed-segwit