@@ -92,7 +92,7 @@ Python reference library so you can see how little work this is. We
92
92
start by importing the library:
93
93
94
94
``` python3
95
- import segwit_addr
95
+ >> > import segwit_addr
96
96
```
97
97
98
98
Bech32 addresses have a Human-Readable Part (HRP) that indicates what
@@ -104,17 +104,17 @@ testnet address is tb1q3w[...]g7a. We'll set the Bitcoin mainnet HRP of
104
104
are for the network we expect.
105
105
106
106
``` python3
107
- HRP = ' bc'
107
+ >> > HRP = ' bc'
108
108
```
109
109
110
110
Finally, we have a few addresses we want to check---one that should work
111
111
and two that should fail. (See [ BIP173] [ ] for a complete set of
112
112
[ reference test vectors] [ bip173 test vectors ] .)
113
113
114
114
``` python3
115
- good_address= ' bc1qd6h6vp99qwstk3z668md42q0zc44vpwkk824zh'
116
- typo_address= ' bc1qd6h6vp99qwstk3z669md42q0zc44vpwkk824zh'
117
- wrong_network_address= ' tb1q3wrc5yq9c300jxlfeg7ae76tk9gsx044ucyg7a'
115
+ >> > good_address= ' bc1qd6h6vp99qwstk3z668md42q0zc44vpwkk824zh'
116
+ >> > typo_address= ' bc1qd6h6vp99qwstk3z669md42q0zc44vpwkk824zh'
117
+ >> > wrong_network_address= ' tb1q3wrc5yq9c300jxlfeg7ae76tk9gsx044ucyg7a'
118
118
```
119
119
120
120
Now we can simply attempt to decode each of these addresses
@@ -124,11 +124,11 @@ Now we can simply attempt to decode each of these addresses
124
124
(0 , [110 , 175 , 166 , 4 , 165 , 3 , 160 , 187 , 68 , 90 , 209 ,
125
125
246 , 218 , 168 , 15 , 22 , 43 , 86 , 5 , 214 ])
126
126
127
- In [ 16 ]: segwit_addr.decode(HRP , typo_address)
128
- Out[ 16 ]: (None , None )
127
+ >> > segwit_addr.decode(HRP , typo_address)
128
+ (None , None )
129
129
130
- In [ 17 ]: segwit_addr.decode(HRP , wrong_network_address)
131
- Out[ 17 ]: (None , None )
130
+ >> > segwit_addr.decode(HRP , wrong_network_address)
131
+ (None , None )
132
132
```
133
133
134
134
If we get back a None for the first value (the witness version), the
0 commit comments