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
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -52,7 +52,7 @@ The <code>marker</code> MUST be <code>0x00</code>.
52
52
53
53
The <code>flag</code> MUST be a 1-byte non-zero value. Currently, <code>0x01</code> MUST be used.
54
54
55
-
The <code>witness</code> is a serialization of all witness data of the transaction. Each txin is associated with a witness field. A witness field starts with a <code>var_int</code> to indicate the number of stack items for the txin. It is followed by stack items, with each item starts with a <code>var_int</code> to indicate the length. Witness data is NOT script and is not restricted by the 520-byte push limit.
55
+
The <code>witness</code> is a serialization of all witness data of the transaction. Each txin is associated with a witness field. A witness field starts with a <code>var_int</code> to indicate the number of stack items for the txin. It is followed by stack items, with each item starts with a <code>var_int</code> to indicate the length. Witness data is NOT script.
56
56
57
57
A non-witness program (defined hereinafter) txin MUST be associated with an empty witness field, represented by a <code>0x00</code>. If all txins are not witness program, a transaction's <code>wtxid</code> is equal to its <code>txid</code>.
58
58
@@ -85,20 +85,20 @@ There are two cases in which witness validation logic are triggered. Each case d
85
85
86
86
If the version byte is 0, and the witness program is 20 bytes:
87
87
* It is interpreted as a pay-to-witness-public-key-hash (P2WPKH) program.
88
-
* The witness must consist of exactly 2 items. The first one a signature, and the second one a public key.
88
+
* The witness must consist of exactly 2 items (≤ 520 bytes each). The first one a signature, and the second one a public key.
89
89
* The HASH160 of the public key must match the 20-byte witness program.
90
90
* 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.
91
91
92
92
If the version byte is 0, and the witness program is 32 bytes:
93
93
* It is interpreted as a pay-to-witness-script-hash (P2WSH) program.
94
94
* The witness must consist of an input stack to feed to the script, followed by a serialized script ("witnessScript").
95
-
* The witnessScript is popped off the initial witness stack. SHA256 of the witnessScript must match the 32-byte witness program.
96
-
* The witnessScript is deserialized, and executed after normal script evaluation with the remaining witness stack.
95
+
* The witnessScript (≤ 10,000 bytes) is popped off the initial witness stack. SHA256 of the witnessScript must match the 32-byte witness program.
96
+
* The witnessScript is deserialized, and executed after normal script evaluation with the remaining witness stack (≤ 520 bytes for each stack item).
97
97
* The script must not fail, and result in exactly a single TRUE on the stack.
98
98
99
99
If the version byte is 0, but the witness program is neither 20 nor 32 bytes, the script must fail.
100
100
101
-
If the version byte is 1 to 16, no further interpretation of the witness program or witness happens.
101
+
If the version byte is 1 to 16, no further interpretation of the witness program or witness happens, and there is no size restriction for the witness. These versions are reserved for future extensions.
0 commit comments