Skip to content

Commit 2e7c80f

Browse files
committed
Add signet support to gen_key_io_test_vectors.py
1 parent fe5e495 commit 2e7c80f

File tree

4 files changed

+393
-153
lines changed

4 files changed

+393
-153
lines changed

contrib/testgen/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ Utilities to generate test vectors for the data-driven Bitcoin tests.
44

55
Usage:
66

7-
PYTHONPATH=../../test/functional/test_framework ./gen_key_io_test_vectors.py valid 50 > ../../src/test/data/key_io_valid.json
8-
PYTHONPATH=../../test/functional/test_framework ./gen_key_io_test_vectors.py invalid 50 > ../../src/test/data/key_io_invalid.json
7+
PYTHONPATH=../../test/functional/test_framework ./gen_key_io_test_vectors.py valid 70 > ../../src/test/data/key_io_valid.json
8+
PYTHONPATH=../../test/functional/test_framework ./gen_key_io_test_vectors.py invalid 70 > ../../src/test/data/key_io_invalid.json

contrib/testgen/gen_key_io_test_vectors.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
# Distributed under the MIT software license, see the accompanying
44
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
55
'''
6-
Generate valid and invalid base58 address and private key test vectors.
6+
Generate valid and invalid base58/bech32(m) address and private key test vectors.
77
88
Usage:
9-
PYTHONPATH=../../test/functional/test_framework ./gen_key_io_test_vectors.py valid 50 > ../../src/test/data/key_io_valid.json
10-
PYTHONPATH=../../test/functional/test_framework ./gen_key_io_test_vectors.py invalid 50 > ../../src/test/data/key_io_invalid.json
9+
PYTHONPATH=../../test/functional/test_framework ./gen_key_io_test_vectors.py valid 70 > ../../src/test/data/key_io_valid.json
10+
PYTHONPATH=../../test/functional/test_framework ./gen_key_io_test_vectors.py invalid 70 > ../../src/test/data/key_io_invalid.json
1111
'''
1212
# 2012 Wladimir J. van der Laan
1313
# Released under MIT License
@@ -56,12 +56,16 @@
5656
((SCRIPT_ADDRESS,), 20, (), (False, 'main', None, None), script_prefix, script_suffix),
5757
((PUBKEY_ADDRESS_TEST,), 20, (), (False, 'test', None, None), pubkey_prefix, pubkey_suffix),
5858
((SCRIPT_ADDRESS_TEST,), 20, (), (False, 'test', None, None), script_prefix, script_suffix),
59+
((PUBKEY_ADDRESS_TEST,), 20, (), (False, 'signet', None, None), pubkey_prefix, pubkey_suffix),
60+
((SCRIPT_ADDRESS_TEST,), 20, (), (False, 'signet', None, None), script_prefix, script_suffix),
5961
((PUBKEY_ADDRESS_REGTEST,), 20, (), (False, 'regtest', None, None), pubkey_prefix, pubkey_suffix),
6062
((SCRIPT_ADDRESS_REGTEST,), 20, (), (False, 'regtest', None, None), script_prefix, script_suffix),
6163
((PRIVKEY,), 32, (), (True, 'main', False, None), (), ()),
6264
((PRIVKEY,), 32, (1,), (True, 'main', True, None), (), ()),
6365
((PRIVKEY_TEST,), 32, (), (True, 'test', False, None), (), ()),
6466
((PRIVKEY_TEST,), 32, (1,), (True, 'test', True, None), (), ()),
67+
((PRIVKEY_TEST,), 32, (), (True, 'signet', False, None), (), ()),
68+
((PRIVKEY_TEST,), 32, (1,), (True, 'signet', True, None), (), ()),
6569
((PRIVKEY_REGTEST,), 32, (), (True, 'regtest', False, None), (), ()),
6670
((PRIVKEY_REGTEST,), 32, (1,), (True, 'regtest', True, None), (), ())
6771
]
@@ -76,6 +80,10 @@
7680
('tb', 0, 32, (False, 'test', None, True), Encoding.BECH32, p2wsh_prefix),
7781
('tb', 1, 32, (False, 'test', None, True), Encoding.BECH32M, p2tr_prefix),
7882
('tb', 3, 16, (False, 'test', None, True), Encoding.BECH32M, (OP_3, 16)),
83+
('tb', 0, 20, (False, 'signet', None, True), Encoding.BECH32, p2wpkh_prefix),
84+
('tb', 0, 32, (False, 'signet', None, True), Encoding.BECH32, p2wsh_prefix),
85+
('tb', 1, 32, (False, 'signet', None, True), Encoding.BECH32M, p2tr_prefix),
86+
('tb', 3, 32, (False, 'signet', None, True), Encoding.BECH32M, (OP_3, 32)),
7987
('bcrt', 0, 20, (False, 'regtest', None, True), Encoding.BECH32, p2wpkh_prefix),
8088
('bcrt', 0, 32, (False, 'regtest', None, True), Encoding.BECH32, p2wsh_prefix),
8189
('bcrt', 1, 32, (False, 'regtest', None, True), Encoding.BECH32M, p2tr_prefix),

src/test/data/key_io_invalid.json

Lines changed: 108 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -6,147 +6,207 @@
66
"x"
77
],
88
[
9-
"1KyjgD9vFKmFSysJPUqQdXT8Yy5r82D6y74dfsg1ANTteuHJuP2q1aP1WgGX3oetFRtatKVXxPU"
9+
"2v7k5Bb8Lr1MMgTgW6HAf5YHXi6BzpPjHpQ4srD4RSwHYpzXKiXmLAgiLhkXvp3JF5v7nq45EWr"
1010
],
1111
[
12-
"2CwgfUPJ6BCa16PuFjKeMzLJJUpqnXm9mCtoXVGiGN7s9dNCKfCN5SdT7cu4nMY5omWHPrQLAqYL"
12+
"RAZzCGtMbiUgMiiyrZySrSpdfnQReFXA3r"
1313
],
1414
[
15-
"grEx1jdq4kpgsvorxP5PRyjgbXpvAVpaL5HEcqpDmF6ZpwuqRbzHX64GZ9eUwoSTvmbQb9fnqnh"
15+
"NYamy7tcPQTzoU5iyQojD3sqhiz7zxkvn8"
1616
],
1717
[
18-
"7RSWWNt7pyiZkNnLTuocsLMM6e3c7Mvvq8phtaBVyhuceG37y9r"
18+
"geaFG555Ex5nyRf7JjW6Pj2GwZA8KYxtJJLbr1eZhVW75STbYBZeRszy3wg4pkKdF4ez9J4wQiz"
1919
],
2020
[
21-
"7VXvPTB9ZdTRUS2W1KpcykSA1XHaVrfUGhKvWQXQLMVUNefmaLkF9DFC4fZJ5aMCxmj4HRQcLFGix"
21+
"2Cxmid3c2XQ2zvQ8SA1ha2TKqvqbJS9XFmXRsCneBS3Po7Qqb65z5zNdsoF9AfieXFcpoVPmkmfa"
2222
],
2323
[
24-
"91bBALqY4D1Mmz4vqnCwdGSB4U1sqnZPrKZ8aHENoT5irq6bB9Nc"
24+
"gaJ7UVge2njVg9tFTetJrtHgruMm7aQDiSAxfHrVEgzK8N2ooagDVmDkdph434xzc4K96Gjyxcs"
2525
],
2626
[
27-
"tc19jm4rn"
27+
"5JN5BEVQPZ3tAiatz1RGXkrJuE3EC6bervMaPb38wTNgEuZCeqp"
2828
],
2929
[
30-
"bt1py306q853jeddsuaasstjxjz6l9uehmx8kgpe94lvvwj85rah56asxg35e3"
30+
"3TnFbyUtBRS5rE1KTW81qLVspjJNaB3uu6uuvLjxhZo2DB6PCGh"
3131
],
3232
[
33-
"tb13u87aul665v37upwmu9a4nh82rj9cv94x5tps52e39e6k56t2ryzqv9mkxa"
33+
"7UgSZGaMaTc4d2mdEgcGBFiMeS6eMsithGUqvBsKTQdGzD7XQDbMEYo3gojdbXEPbUdFF3CQoK72f"
3434
],
3535
[
36-
"bcrt1rkqk977nr"
36+
"9261wfqQqruNDnBDhbbb4tN9oKA1KpRFHeoYeufyJApVGixyAG4V"
3737
],
3838
[
39-
"bc10v6wh2rtujsn9hnsyfzzsd9y3rx9n8xhue0agk7c8q9tv3lga7css5jku9rstle93e5fhc8dl"
39+
"cS824CTUh18scFmYuqt6BgxuRhdR4dEEnCHs3fzBbcyQgbfasHbw"
4040
],
4141
[
42-
"tb1q9quwy0k48ne8ppmr7p0jhj6hks7smd7l"
42+
"tc1q0ywf7wkz6t580n3yemd3ucfw8jxn93tpc6wskt"
4343
],
4444
[
45-
"bcrt1q5l6rmlw2et02krnfgl9uuxp8q30dktcjvuzsw7gyk2ykkkm2td0prkw9de"
45+
"bt1pxeeuh96wpm5c6u3kavts2qgwlv6y8um7u7ga6ltlwrhrv7w9vers8lgt3k"
4646
],
4747
[
48-
"bc1q5ezcdrt4qqmkcqz8n50hgww88gqzfx4m6"
48+
"tb130lvl2lyugsk2tf3zhwcjjv39dmwt2tt7ytqaexy8edwcuwks6p5scll5kz"
4949
],
5050
[
51-
"tb1q5gcna4un84qevljj3wk6rvm97f8f00gwtcu7v258cvn880wkf7gqesasqn"
51+
"bcrt1rhsveeudk"
5252
],
5353
[
54-
"bcrt1qtevjqsc85md7pa0CQEnpvdx977juj30usufphy"
54+
"bc10rmfwl8nxdweeyc4sf89t0tn9fv9w6qpyzsnl2r4k48vjqh03qas9asdje0rlr0phru0wqw0p"
5555
],
5656
[
57-
"bc1qret0yy8cmhsh6vw87lxtzt7w0sk4026l5qrvy7"
57+
"tb1qjqnfsuatr54e957xzg9sqk7yqcry9lns"
5858
],
5959
[
60-
"tb1qnw0xfgkucr4ysapsj8gd0u40fpj05n8cn24unkql8mc4ckkcp0mqc7acjd"
60+
"bcrt1q8p08mv8echkf3es027u4cdswxlylm3th76ls8v6y4zy4vwsavngpr4e4td"
6161
],
6262
[
63-
"bcrt1qu26l525vmxfv59gxm2r0c8alnkpzmat2mga2qw"
63+
"BC1QNC2H66VLWTWTW52DP0FYUSNU3QQG5VT4V"
6464
],
6565
[
66-
"bc1prjkeqgknynar5tj6v76yn3u27rep8jf366kmhglq898yn3aczk9ss73nrl"
66+
"tb1qgk665m2auw09rc7pqyf7aulcuhmatz9xqtr5mxew7zuysacaascqs9v0vn"
6767
],
6868
[
69-
"tb1zq0vsl9pta9uwh2txtrmxyedjtqcfkqt5"
69+
"bcrt17CAPP7"
7070
],
7171
[
72-
"bcrt1suvw5wa9elxy3a43ctljjn8avcmqpzwz5m4tycs"
72+
"bc1qxmf2d6aerjzam3rur0zufqxqnyqfts5u302s7x"
7373
],
7474
[
75-
"gf7t7z22jkuKcEjc8gELEYau3NzgGFLtLNEdMpJKcVt6z7mmvEJHH37y36MNGSmriFaPAbGghdh"
75+
"tb1qn8x5dnzpexq7nnvrvnhwr9c3wkakpcyu9wwsjzq9pstkwg0t6qhs4l3rv6"
7676
],
7777
[
78-
"mn9CPaeodb6L1CtJu1KaLtJhDbYL55Hxwe"
78+
"BCRT1Q397G2RNVYRL5LK07CE8NCKHVKP8Z4SC9U0MVH9"
7979
],
8080
[
81-
"cTSecEa3nqxF4mgYkGrxRKeWLpXWng6nUgL4sVeAhrNbtdf1z8hz1VFesD492QWZ4JprpRW1Drr"
81+
"bc1pgxwyajq0gdn389f69uwn2fw9q0z5c9s063j5dgkdd23ajaud4hpsercr9h"
8282
],
8383
[
84-
"4UjQEEvAT4Y9a3mtLFjzhcVBBKz8NiqAMfGhMwaSKgMqatpGT3qWzKY2f9HedshfSaAa439Vn3yNc"
84+
"tb1z6mnmp5k542l6yk4ul0mp4rq3yvz44lfm"
8585
],
8686
[
87-
"5ip19k2UhwhpHMK8ym6ZGnLA8J9JvHzv418AwohCMf3WrCfwLhG"
87+
"bcrt17capp7"
8888
],
8989
[
90-
"tc1qe7avhvpmn9le76kxlcvwl69ldm0n66gefjetyn"
90+
"2D2bqvKseKHdoKjCNvjVULUgmxHu9hjKGwDbPRjTRH59tsHNLeyKwq3vyVBbo9LByY9wiapqjwFY"
9191
],
9292
[
93-
"bt1pz4l3ja200jyyhtaxvz4ffm3t33ares72745gwjspttzdllvmte5qs0kd5q"
93+
"2SSjAim4wZpeQRe5zTj1qqS6Li9ttJDaZ3ze"
9494
],
9595
[
96-
"tb13wthrv4wkvpxl57d0plyfqjxvzu9qmdzg7eldaeut2hmcpp02mw2q3ep6tw"
96+
"mi9H6MjLwXxy9kxe1x4ToxyLRBsmcZxgVi"
9797
],
9898
[
99-
"bcrt1rqg9chz23"
99+
"VciXoxEitcn88jy197J9n9cpJ1pZahzU3SyWUiHqLgcfjttLEEJz"
100100
],
101101
[
102-
"BC102A2J0QF2MX8926EQ3WZGDC45PXL4QN267673J7P7JMJ6VD0RDTAWVQ2ZFNP4JJAW85JXP080"
102+
"KppmwADGoExPT9Eq5hjRWpWFDbzJyfzHFgsfxBiDHNpVBgWPRNuy"
103103
],
104104
[
105-
"tb1qx0shsrwmrl57djkm0yyqdyp02cmpjmlw"
105+
"TN7EQXMxKffzvHo54yHHu9R4ks9f5gWBW3MMVf5k72zAqrgVK9ys"
106106
],
107107
[
108-
"bcrt17capp7"
108+
"92dbrMEYzP5dD5UhQ6maNkCQ4GLG42BM4Gc6XKZzSSMSfosfkkcB"
109+
],
110+
[
111+
"J7VQxPxyzuWEkRstQWpCz2AgysEz1APgnWCEQrFvkN3umAnCrhQF"
109112
],
110113
[
111-
"bc1qvgrlqspye3z2ufaekn7qygm7guqjx982l"
114+
"tc1qymllj6c96v5qj2504y27ldtner6eh8ldx38t83"
112115
],
113116
[
114-
"tb1qk8lfs3l8df9gkw69240g0ckg4ywmw9qvmcm0pltxt8udk9szrhxqkhd5n2"
117+
"bt1flep4g"
115118
],
116119
[
117-
"bcrt1qKW6Cxkky8a7gyvmkw9p3v5l2gx8zgyjtjv7dl7"
120+
"tb13c553hwygcgj48qwmr9f8q0hgdcfklyaye5sxzcpcjnmxv4z506xs90tchn"
118121
],
119122
[
120-
"bc1a8xfp7"
123+
"bcrt1tyddyu"
121124
],
122125
[
123-
"tb1dclvmr"
126+
"bc10qssq2mknjqf0glwe2f3587wc4jysvs3f8s6chysae6hcl6fxzdm4wxyyscrl5k9f5qmnf05a"
124127
],
125128
[
126-
"bcrt1q26vevm7x046n9h3jg6zsgyd3228ra25ck7jah2"
129+
"tb1q425lmgvxdgtyl2m6xuu2pc354y4fvgg8"
127130
],
128131
[
129-
"BC1PCCNQDKKS5ZQ0AC69MQYQXU8ADGSGE53UY3AXXHJYFDG77Y0WX9AQHEHRL7"
132+
"bcrt1q9wp8e5d2u3u4g0pll0cy7smeeuqezdun9xl439n3p2gg4fvgfvk3hu52hj"
130133
],
131134
[
132-
"tb1zys2pfhe9fslxat85y7uc5e78uq7449ct"
135+
"bc1qrz5acazpue8vl4zsaxn8fxtmeuqmyjkq3"
133136
],
134137
[
135-
"bcrt1slnwcpwf88ffa708xpfkm6a5wsaq9me7y0fmvg3"
138+
"tb1qkeuglpgmnex9tv3fr7htzfrh3rwrk23r52rx9halxzmv9fr85lwq0fwhmp"
136139
],
137140
[
138-
"dhBi3wYUjrVsW1pA4XhLjdavSQYSnsECskAoZ1dqLnV8hCSxuo9EZ9tf4cCoxn7fnKgCoJK3mcE"
141+
"bcrt1qd0t2wrhl7s57z99rsyaekpq0dyjcQRSSmz80r4"
139142
],
140143
[
141-
"2UFHPygbpDdbzmQx688QnMqSunZi97Yn5T7DVBdKyTD7sCfGi5fi8r2ct92FNUZPMm1xswo8Ve8c"
144+
"BC1QXLFDUCGX90T3E53PQCNKJ2PK25MSF3VLPMVY6T"
142145
],
143146
[
144-
"2yAaXFzjninFv5dn3JnWQ5y9nYkK5ZCMAkDWr4Y9WUiCGa3UiYfs"
147+
"tb1qmycg4zszgnk34vaurx3cu8wpvteg9h40yq6cp52gt26gjel03t3su3x3xu"
145148
],
146149
[
147-
"tc1qmfcz6l7gfwwt0tucqgtmhwlkgtd47a3urnjpt4"
150+
"bcrt1q9hy58r4fnuxqzdqndpmq9pptc9nt2dw3rczf5e"
148151
],
149152
[
150-
"bt1flep4g"
153+
"BC1PA7682NAY6JQSLUWAJYTC0ERWTMW7A4RPWLNTUS32LCXWLHVKKKTQ2UL8CG"
154+
],
155+
[
156+
"tb1z850dpxnwz2fzae5h2myatj4yvu6rq5xq"
157+
],
158+
[
159+
"bcrt1sp525pzjsmpqvcrawjreww36e9keg876skjvpwt"
160+
],
161+
[
162+
"xcAvW5jurCpzSpLxBKEhCewCgwwuGhqJnC"
163+
],
164+
[
165+
"2Cvv8yp9kXbQt8EKh6Yma95yJ1uwYF9YKXuVhGJyu3dHGVsb2AVpTC62TFACZZ3KDNrALxR2CVNs"
166+
],
167+
[
168+
"niUuL46hCuEVvkAzZKHvD746qbmLmzip9Pv3F6UZV14JxzEXBnTkVxCT4URapChJG6qAEgsZs6G"
169+
],
170+
[
171+
"2UHHgGfiipzvB8Eumnmvq6SowvrMJimjT3NwwG1839XEiUfwtpSdkUrseNsQuagXv21ce7aZu6yo"
172+
],
173+
[
174+
"8u9djKu4u6o3bsgeR4BKNnLK3akpo64FYzDAmA9239wKeshgF97"
175+
],
176+
[
177+
"TC1QPAARXSLVMXHVRR0474LZXQYZWLGFZYPSFVL9E4"
178+
],
179+
[
180+
"bt1pakek0n2267t9yaksxaczgr2syhv9y3xkx0wnsdwchfa6xkmjtvuqg3kgyr"
181+
],
182+
[
183+
"tb13h83rtwq62udrhwpn87uely7cyxcjrj0azz6a4r3n9s87x5uj98ys6ufp83"
184+
],
185+
[
186+
"bcrt1rk5vw5qf2"
187+
],
188+
[
189+
"bc10d3rmtg62h747en5j6fju5g5qyvsransrkty6ghh96pu647wumctejlsngh9pf26cysrys2x2"
190+
],
191+
[
192+
"tb1qajuy2cdwqgmrzc7la85al5cwcq374tsp"
193+
],
194+
[
195+
"bcrt1q3udxvj6x20chqh723mn064mzz65yr56ef00xk8czvu3jnx04ydapzk02s5"
196+
],
197+
[
198+
"bc1qule2szwzyaq4qy0s3aa4mauucyqt6fewe"
199+
],
200+
[
201+
"tb1ql0qny5vg9gh5tyzke6dw36px5ulkrp24x53x0pl2t5lpwrtejw3s2seej2"
202+
],
203+
[
204+
"bcrt17CAPP7"
205+
],
206+
[
207+
"bc1qtvm6davyf725wfedc2d5mrgfewqgcrce8gjrpl"
208+
],
209+
[
210+
"tb1q5acjgtqrrw3an0dzavxxxzlex8k7aukjzjk9v2u4rmfdqxjphcyq7ge97e"
151211
]
152212
]

0 commit comments

Comments
 (0)