You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: bip-0141.mediawiki
+7-11Lines changed: 7 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -57,21 +57,17 @@ If there are more than one scriptPubKey matching the pattern, the one with highe
57
57
58
58
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 32 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".
59
59
60
-
Witness verification logic is either
61
-
# triggered by a scriptPubKey that is exactly a push of a version byte, plus a push of a witness program, or
62
-
# triggered when a scriptPubKey is a P2SH script, and the BIP16 redeemScript pushed in the scriptSig is exactly a push of a version byte plus a push of a witness program.
60
+
There are two cases in which witness validation logic are triggered. Each case determines the location of the witness version byte and program, as well as the form of the scriptSig:
61
+
# Triggered by a scriptPubKey that is exactly a push of a version byte, plus a push of a witness program. The scriptSig must be exactly empty.
62
+
# Triggered when a scriptPubKey is a P2SH script, and the BIP16 redeemScript pushed in the scriptSig is exactly a push of a version byte plus a push of a witness program. The scriptSig must be exactly a push of the BIP16 redeemScript.
63
63
64
-
New rules for scriptSig:
65
-
* In case 1, the scriptSig must be exactly empty.
66
-
* In case 2, the scriptSig must be exactly a push of the BIP16 redeemScript.
67
-
68
-
If the version byte is 0, and the witness program is 20 bytes,
64
+
If the version byte is 0, and the witness program is 20 bytes:
69
65
* It is interpreted as a pay-to-witness-public-key-hash (P2WPKH) program.
70
-
* The witness must consist of exactly 2 items. The first one is a signature, and the second one is a public key.
71
-
* HASH160 of the public key must match the 20-byte witness program.
66
+
* The witness must consist of exactly 2 items. The first one a signature, and the second one a public key.
67
+
* The HASH160 of the public key must match the 20-byte witness program.
72
68
* After normal script evaluation, the signature is verified against the public key with CHECKSIG operation. The verification must result in a single TRUE on the stack.
73
69
74
-
If the version byte is 0, and the witness program is 32 bytes,
70
+
If the version byte is 0, and the witness program is 32 bytes:
75
71
* It is interpreted as a pay-to-witness-script-hash (P2WSH) program.
76
72
* The witness must consist of an input stack to feed to the script, followed by a serialized script ("witnessScript").
77
73
* The witnessScript is popped off the initial witness stack. SHA256 of the witnessScript must match the 32-byte witness program.
0 commit comments