Skip to content

Commit 59391f1

Browse files
committed
Elaborate on the encoding of witness versions
1 parent 9b1e7dc commit 59391f1

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

bip-0173.mediawiki

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,12 @@ program is neither 20 nor 32 bytes, the script must fail.''
227227
As a result of the previous rules, addresses are always between 14 and 74 characters long, and their length modulo 8 cannot be 0, 3, or 5.
228228
Version 0 witness addresses are always 42 or 62 characters, but implementations MUST allow the use of any version.
229229

230+
Implementations should take special care when converting the address to a
231+
scriptPubkey, where witness version ''n'' is stored as ''OP_n''. OP_0 is
232+
encoded as 0x00, but OP_1 through OP_16 are encoded as 0x51 though 0x60
233+
(81 to 96 in decimal). If a bech32 address is converted to an incorrect
234+
scriptPubKey the result will likely be either unspendable or insecure.
235+
230236
===Compatibility===
231237

232238
Only new software will be able to use these addresses, and only for

0 commit comments

Comments
 (0)