Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update BIP173: new reference impls + tests fix #565

Merged
merged 3 commits into from
Aug 7, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions bip-0173.mediawiki
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,12 @@ program is neither 20 nor 32 bytes, the script must fail.''
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.
Version 0 witness addresses are always 42 or 62 characters, but implementations MUST allow the use of any version.

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

===Compatibility===

Only new software will be able to use these addresses, and only for
Expand All @@ -242,8 +248,10 @@ P2PKH addresses can be used.
* Reference encoder and decoder:
** [https://github.com/sipa/bech32/tree/master/ref/c For C]
** [https://github.com/sipa/bech32/tree/master/ref/javascript For JavaScript]
** [https://github.com/sipa/bech32/tree/master/ref/go For Go]
** [https://github.com/sipa/bech32/tree/master/ref/python For Python]
** [https://github.com/sipa/bech32/tree/master/ref/haskell For Haskell]
** [https://github.com/sipa/bech32/tree/master/ref/ruby For Ruby]
** [https://github.com/sipa/bech32/tree/master/ref/rust For Rust]

* Fancy decoder that localizes errors:
Expand All @@ -264,9 +272,9 @@ The following list gives valid segwit addresses and the scriptPubKey that they
translate to in hex.
* <tt>BC1QW508D6QEJXTDG4Y5R3ZARVARY0C5XW7KV8F3T4</tt>: <tt>0014751e76e8199196d454941c45d1b3a323f1433bd6</tt>
* <tt>tb1qrp33g0q5c5txsp9arysrx4k6zdkfs4nce4xj0gdcccefvpysxf3q0sl5k7</tt>: <tt>00201863143c14c5166804bd19203356da136c985678cd4d27a1b8c6329604903262</tt>
* <tt>bc1pw508d6qejxtdg4y5r3zarvary0c5xw7kw508d6qejxtdg4y5r3zarvary0c5xw7k7grplx</tt>: <tt>8128751e76e8199196d454941c45d1b3a323f1433bd6751e76e8199196d454941c45d1b3a323f1433bd6</tt>
* <tt>BC1SW50QA3JX3S</tt>: <tt>9002751e</tt>
* <tt>bc1zw508d6qejxtdg4y5r3zarvaryvg6kdaj</tt>: <tt>8210751e76e8199196d454941c45d1b3a323</tt>
* <tt>bc1pw508d6qejxtdg4y5r3zarvary0c5xw7kw508d6qejxtdg4y5r3zarvary0c5xw7k7grplx</tt>: <tt>5128751e76e8199196d454941c45d1b3a323f1433bd6751e76e8199196d454941c45d1b3a323f1433bd6</tt>
* <tt>BC1SW50QA3JX3S</tt>: <tt>6002751e</tt>
* <tt>bc1zw508d6qejxtdg4y5r3zarvaryvg6kdaj</tt>: <tt>5210751e76e8199196d454941c45d1b3a323</tt>
* <tt>tb1qqqqqp399et2xygdj5xreqhjjvcmzhxw4aywxecjdzew6hylgvsesrxh6hy</tt>: <tt>0020000000c4a5cad46221b2a187905e5266362b99d5e91c6ce24d165dab93e86433</tt>

The following list gives invalid segwit addresses and the reason for
Expand Down