-
-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathREADME.txt
2847 lines (2335 loc) · 145 KB
/
README.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
SLIP-39 WALLET "SEED" GENERATION & BACKUP
Perry Kundert
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
2021-12-20 10:55:00
Creating Ethereum, Bitcoin and other accounts is complex and fraught
with potential for loss of funds.
A 12- or 24-word BIP-39 seed recovery Mmnemonic Phrase helps, but a
*single* lapse in security dooms the account (and all derived accounts,
in fact). If someone finds your recovery phrase (or you lose it), the
accounts derived from that seed are /gone/.
The SLIP-39 standard allows you to split the seed between 1, 2, or more
groups of several mnemonic recovery phrases. This is better, but
creating such accounts is difficult; presently, only the Trezor supports
these directly, and they can only be created "manually". Writing down 5
or more sets of 20 words is difficult, error-prone and time consuming.
Table of Contents
─────────────────
1. Hardware Wallet "Seed" Configuration
.. 1. TL;DR Backup and Recover your BIP-39 Mnemonic
2. Security with Availability
.. 1. Shamir's Secret Sharing System (SSSS)
3. SLIP-39 Account Creation, Recovery and Generation
.. 1. Creating New SLIP-39 Recoverable Seeds
.. 2. The macOS/win32 `SLIP-39.app' GUI App
.. 3. The Python `slip39' CLI
.. 4. Recovery & Re-Creation
.. 5. Generation of Addresses
.. 6. The `slip39' module API
4. Conversion from BIP-39 to SLIP-39
.. 1. BIP-39 vs. SLIP-39 Incompatibility
.. 2. BIP-39 vs SLIP-39 Key Derivation Summary
.. 3. BIP-39 Backup via SLIP-39
5. Cryptocurrency Invoicing and Licensing
.. 1. Using Plain HD Wallet Accounts
.. 2. "Forwarder" Account Addresses
.. 3. Single-Use Accounts using Pre-Signed Transfers
.. 4. Testing `MultiPayoutERC20'
6. Building & Installing
.. 1. Homebrew on macOS, or Nix on Linux or macOS
.. 2. Native Python3 on Linux
.. 3. The `slip39' Module
.. 4. The `slip39' GUI
7. Licensing
.. 1. Create an Ed25519 "Agent" Key
.. 2. Validating an Advanced Feature License
8. Dependencies
.. 1. The `python-shamir-mnemonic' API
1 Hardware Wallet "Seed" Configuration
══════════════════════════════════════
Your keys, your Bitcoin. Not your keys, not your Bitcoin.
—Andreas Antonopoulos
The [python-slip39] project (and the [SLIP-39 macOS/win32 App]) exists
to assist in the safe creation, backup and documentation of
[Hierarchical Deterministic (HD) Wallet] seeds and derived accounts,
with various SLIP-39 sharing parameters. It generates the new random
wallet seed, and generates the expected standard Ethereum account(s)
(at [derivation path] *m/44'/60'/0'/0/0* by default) and Bitcoin
accounts (at Bech32 derivation path *m/84'/0'/0'/0/0* by default),
with wallet address and QR code (compatible with Trezor and Ledger
derivations). It produces the required SLIP-39 phrases, and outputs a
single PDF containing all the required printable cards to document the
seed (and the specified derived accounts).
On an secure (ideally air-gapped) computer, new seeds can /safely/ be
generated (*without trusting this program*) and the PDF saved to a USB
drive for printing (or directly printed without the file being saved
to disk.). Presently, `slip39' can output example ETH, BTC, LTC,
DOGE, BSC, and XRP addresses derived from the seed, to /illustrate/
what accounts are associated with the backed-up seed. Recovery of the
seed to a [Trezor Safe 3] is simple, by entering the mnemonics right
on the device.
We also support the backup of existing insecure and unreliable 12- or
24-word BIP-39 Mnemonic Phrases as SLIP-39 Mnemonic cards, for
existing BIP-39 hardware wallets like the [Ledger Nano], etc.! Use
your existing BIP-39 Phrase as your Seed Source, select "Using BIP-39"
(and enter your BIP-39 passphrase), and generate a set of SLIP-39
Mnemonic cards. Later, use the SLIP-39 App and set your Seed Source
to Recover from your SLIP-39 Mnemonic cards, click "Using BIP-39" to
get your BIP-39 Mnemonic back, and use it (and your passphrase) to
recover your accounts to your Ledger (or other) hardware wallet.
Output of BIP-38 or JSON encrypted Paper Wallets is also supported,
for import into standard software cryptocurrency wallets.
<./images/slip39.png>
[python-slip39] <https://github.com/pjkundert/python-slip39.git>
[SLIP-39 macOS/win32 App] <https://slip39.com/app>
[Hierarchical Deterministic (HD) Wallet]
<https://wolovim.medium.com/ethereum-201-hd-wallets-11d0c93c87>
[derivation path]
<https://medium.com/myetherwallet/hd-wallets-and-derivation-paths-explained-865a643c7bf2>
[Trezor Safe 3] <https://trezor.go2cloud.org/SHdv>
[Ledger Nano]
<https://shop.ledger.com/pages/ledger-nano-x?r=2cd1cb6ae51f>
1.1 TL;DR Backup and Recover your BIP-39 Mnemonic
─────────────────────────────────────────────────
Here's a full round-trip demonstration of:
• Creating new (or "Backing Up" existing) Seed Entropy as a BIP-39
Mnemonic
• Recovering the Seed Entropy from SLIP-39 (via
<https://iancoleman.io/slip39/>)
• Recovering the original BIP-39 (via <https://iancoleman.io/bip39/>)
First, we generate SLIP-39 Cards representing a BIP-39 Mnemonic seed.
Remember, your BIP-39 Mnemonic simply encodes your 128- or 256-bit
Seed Entropy. So, we're not backing up your Mnemonic phrase – we're
backing up the raw seed data that is encoded into your BIP-39
Mnemonic.
┌────
│ # python3 -m pip install slip39; slip39 -q --using-bip39 # to generate one from scratch, or
│ slip39 --secret "seven replace great luggage fox rent general tower guess inside smile sing"
└────
SLIP39-2024-12-08+14.59.42-ETH-0x6E6268F14B922cb924C7683A415B30C2bf967000.pdf
<./images/SLIP39-backup-BIP39.png>
If you look at the generated SLIP39 PDF, you'll see that the cover
page contains the original BIP-39 Mnemonic phrase (for confirmation),
and generates a number of SLIP-39 Mnemonic cards. These cards encode
the original Seed Entropy, and are what you use to recover the BIP-39
Mnemonic whenever you need it.
I *recommend* that you /tear off and destroy/ the BIP-39 Mnemonic from
the cover sheet, once you've confirmed you can recover it anytime you
want, and you've set up your hardware wallet, and confirmed that it
contains the same cryptocurrency addresses displayed in the PDF.
<./images/SLIP39-recover-BIP39-entropy.png>
Practice this full round-trip several times with a bad BIP-39 Mnemonic
like "zoo zoo … wrong". This is the only way to become comfortable
with your ability to recover your original seed data, and (hence) your
BIP-39 Mnemonic.
Later, when you need to recover your BIP-39 Seed Entropy and Mnemonic,
use this SLIP-39 App or <https://iancoleman.io/slip39/> and enter some
of your SLIP-39 Mnemonic Cards. These may need to be collected from
friends and family.
<./images/SLIP39-recover-BIP39-mnemonic.png>
In this case, we're using the First and Second cards, intended for you
to secure, separately from each other; for example, in two safes or
other secure locations like locked filing cabinets, at 2 locations
known to you and your partner(s):
Finally, convert the recovered Seed Entropy back to your BIP-39
Mnemonic. This requires 2 steps if you use
<https://iancoleman.io/bip39/>
In this step, we're simply converting the recovered Seed Entropy back
into its BIP-39 Mnemonic. You need to select the "[X] show entropy
details" checkbox in order to enter the raw Seed Entropy we've
recovered in the last step:
Alternatively, you can use the SLIP-39 App or the `slip39-recovery'
command-line tool, and do it all in one step. This illustrates
recovering your BIP-39 Mnemonic from the SLIP-39 Cards generated in
the first step:
┌────
│ python3 -m slip39.recovery --using-bip39 \
│ -m "pitch negative acrobat romp desert usual negative darkness friar artist estimate aluminum beard crowd email season guard hybrid kidney cards" \
│ -m "pitch negative beard romp diagnose timely ruler emission acrobat adult stilt dress typical blue inmate lilac pajamas trend duration endless"
└────
seven replace great luggage fox rent general tower guess inside smile
sing
2 Security with Availability
════════════════════════════
For both BIP-39 and SLIP-39, a 128- or 256-bit random "seed" is the
source of an unlimited sequence of Ethereum and Bitcoin Heirarchical
Deterministic (HD) derived Wallet accounts. Anyone who can obtain
this seed gains control of all Ethereum, Bitcoin (and other) accounts
derived from it, so it must be securely stored.
Losing this seed means that all of the HD Wallet accounts are
permanently lost. It must be /both/ backed up securely, /and/ be
readily accessible.
Therefore, we must:
• Ensure that nobody untrustworthy can recover the seed, but
• Store the seed in many places, probably with several (some perhaps
untrustworthy) people.
How can we address these conflicting requirements?
2.1 Shamir's Secret Sharing System (SSSS)
─────────────────────────────────────────
[Satoshi Lab's (Trezor) SLIP-39] uses SSSS to distribute the ability
to recover the key to 1 or more "groups". Collecting the mnemonics
from the required number of groups allows recovery of the seed.
For BIP-39, the number of groups is always 1, and the number of
mnemonics required for that group is always 1. This selection is both
insecure (easy to accidentally disclose) and unreliable (easy to
accidentally lose), but since most hardware wallets *only* accept
BIP-39 phrases, we also provide a way to /backup your BIP-39 phrase/
using SLIP-39!
For SLIP-39, you specify a "group_threshold" of /how many/ of your
groups must be successfully collected, to recover the seed; this seed
is (conceptually) split between 1 or more groups (though not in
reality – each group's data /alone/ gives away /no information/ about
the seed).
For example, you might have First, Second, Fam and Frens groups, and
decide that any 2 groups can be combined to recover the seed. Each
group has members with varying levels of trust and persistence, so
have different number of Members, and differing numbers Required to
recover that group's data:
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Group Required Members Description
─────────────────────────────────────────────────────────────────────
First 1 / 1 Stored at home
Second 1 / 1 Stored in office safe
Fam 2 / 4 Distributed to family members
Frens 3 / 6 Distributed to friends and associates
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
The account owner might store their First and Second group data in
their home and office safes. These are 1/1 groups (1 required, and
only 1 member, so each of these are 1-card groups.)
If the Seed needs to be recovered, collecting the First and Second
cards from the home and office safe is sufficient to recover the Seed,
and re-generate all of the HD Wallet accounts.
Only 2 Fam group member's cards must be collected to recover the Fam
group's data. So, if the HD Wallet owner loses their home (and the
one and only First group card) in a fire, they could get the one
Second group card from the office safe, and also 2 cards from Fam
group members, and recover the Seed and all of their wallets.
If catastrophe strikes and the wallet owner dies, and the heirs don't
have access to either the First (at home) or Second (at the office)
cards, they can collect 2 Fam cards and 3 Frens cards (at the funeral,
for example), completing the Fam and Frens groups' data, and recover
the Seed, and all derived HD Wallet accounts.
Since Frens are less likely to persist long term, we'll produce more
(6) of these cards. Depending on how trustworthy the group is, adjust
the Fren group's Required number higher (less trustworthy, more likely
to know each-other, need to collect more to recover the group), or
lower (more trustworthy, less likely to collude, need less to
recover).
[Satoshi Lab's (Trezor) SLIP-39]
<https://github.com/satoshilabs/slips/blob/master/slip-0039.md>
3 SLIP-39 Account Creation, Recovery and Generation
═══════════════════════════════════════════════════
Generating a new SLIP-39 encoded Seed is easy, with results available
as PDF and text. Any number of derived HD wallet account addresses
can be generated from this Seed, and the Seed (and all derived HD
wallets, for all cryptocurrencies) can be recovered by collecting the
desired groups of recover card phrases. The default recovery groups
are as described above.
3.1 Creating New SLIP-39 Recoverable Seeds
──────────────────────────────────────────
This is what the first page of the output SLIP-39 mnemonic cards PDF
looks like:
<./images/slip39-cards.png>
Run the following to obtain a PDF file containing business cards with
the default SLIP-39 groups for a new account Seed named "Personal"
(usable with any hardware wallet with SLIP-39 support, such as the
Trezor Safe) ; insert a USB drive to collect the output, and run:
┌────
│ $ python3 -m pip install slip39 # Install slip39 in Python3
│ $ cd /Volumes/USBDRIVE/ # Change current directory to USB
│ $ python3 -m slip39 Personal # Or just run "slip39 Personal"
│ 2022-11-22 05:35:21 slip39.layout ETH m/44'/60'/0'/0/0 : 0x0F04cab1855CE275bd098c918075373EB3944Ba3
│ 2022-11-22 05:35:21 slip39.layout BTC m/84'/0'/0'/0/0 : bc1qszvts5vyxy265er6ngk3ew4utx5sll2ck2m7m2
│ 2022-11-22 05:35:22 slip39.layout Writing SLIP39-encoded wallet for 'Personal' to:\
│ Personal-2022-11-22+05.35.22-ETH-0x0F04cab1855CE275bd098c918075373EB3944Ba3.pdf
└────
The resultant PDF will be output into the designated file.
This PDF file contains business card sized SLIP-39 Mnemonic cards, and
will print on a single page of 8-1/2"x11" paper or card stock, and the
cards can be cut out (`--card index', `credit', `half' (page), `third'
and `quarter' are also available, as well as 4x6 `photo' and custom
`"(<h>,<w>),<margin>"').
To get the data printed on the terminal as in this example (so you
could write it down on cards instead), add a `-v' (to see it logged in
a tabular format), or `--text' to have it printed to stdout in full
lines (ie. for pipelining to other programs).
3.1.1 BIP-39 Mnemonic Phrase Backup using SLIP-39
╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
To obtain the Seed in BIP-39 format, with its original "entropy"
backed up using SLIP-39 (supporting any BIP-39 hardware wallet, and
recoverable from the Mnemonic cards using SLIP-39), use the
`--using-bip39' option:
┌────
│ $ slip39 --using-bip39 Personal-BIP-39
│ 2022-11-22 05:47:13 slip39.layout ETH m/44'/60'/0'/0/0 : 0x927232296120343A89DeAb15F108a420087a2Ef3
│ 2022-11-22 05:47:13 slip39.layout BTC m/84'/0'/0'/0/0 : bc1qgs6xg5kvrrxp4579y22a4tf0d8me4dslwxjr9x
│ 2022-11-22 05:47:15 slip39.layout Writing SLIP39 backup for BIP-39-encoded wallet for 'Personal-BIP-39' to:\
│ Personal-BIP-39-2022-11-22+05.47.15-ETH-0x927232296120343A89DeAb15F108a420087a2Ef3.pdf
└────
This is the best approach, if you want a new Seed and need to support
a BIP-39-only Hardware Wallet. (If you already have a BIP-39 Mnemonic
Phrase, see 3.4.3)
3.1.2 Paper Wallets for Software Wallet Support
╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
The Trezor hardware wallet natively supports the input of SLIP-39
Mnemonics. However, most software wallets do not (yet) support
SLIP-39. So, how do we load the Crypto wallets produced from our Seed
into software wallets such as the Metamask plugin or the Brave
browser, for example?
The `slip39.gui' (and the macOS/win32 SLIP-39.App) support output of
standard BIP-38 encrypted wallets for Bitcoin-like cryptocurrencies
such as BTC, LTC and DOGE. It also outputs encrypted Ethereum JSON
wallets for ETH. Here is how to produce them (from a test secret
Seed; exclude `--secret ffff...' for yours!):
┌────
│ slip39 -c ETH -c BTC -c DOGE -c LTC --secret ffffffffffffffffffffffffffffffff \
│ --no-card --wallet password --wallet-hint 'bad:pass...' 2>&1
└────
┌────
│ 2024-12-08 14:59:43 slip39 It is recommended to not use '-s|--secret <hex>'; specify '-' to read from input
│ 2024-12-08 14:59:43 slip39 It is recommended to not use '-w|--wallet <password>'; specify '-' to read from input
│ 2024-12-08 14:59:43 slip39 Generated 128-bit SLIP-39 Mnemonics w/ identifier 19372 requiring 2 of 4 (extendable) groups to recover
│ 2024-12-08 14:59:43 slip39.layout ETH m/44'/60'/0'/0/0 : 0x824b174803e688dE39aF5B3D7Cd39bE6515A19a1
│ 2024-12-08 14:59:43 slip39.layout BTC m/84'/0'/0'/0/0 : bc1q9yscq3l2yfxlvnlk3cszpqefparrv7tk24u6pl
│ 2024-12-08 14:59:43 slip39.layout DOGE m/44'/3'/0'/0/0 : DN8PNN3dipSJpLmyxtGe4EJH38EhqF8Sfy
│ 2024-12-08 14:59:43 slip39.layout LTC m/84'/2'/0'/0/0 : ltc1qe5m2mst9kjcqtfpapaanaty40qe8xtusmq4ake
│ 2024-12-08 14:59:45 slip39.layout Writing SLIP39-encoded wallet for 'SLIP39' to: SLIP39-2024-12-08+14.59.44-ETH-0x824b174803e688dE39aF5B3D7Cd39bE6515A19a1.pdf
└────
And what they look like:
<./images/slip39-wallets.png>
To recover your real SLIP-39 Seed Entropy and print wallets, use the
SLIP-39 App's "Recover" Controls, or to do so on the command-line, use
`slip39-recover':
┌────
│ slip39-recovery -v \
│ --mnemonic "material leaf acrobat romp charity capital omit skunk change firm eclipse crush fancy best tracks flip grownup plastic chew peanut" \
│ --mnemonic "material leaf beard romp disaster duke flame uncover group slice guest blue gums duckling total suitable trust guitar payment platform" \
│ 2>&1
└────
┌────
│ 2024-12-08 14:59:46 slip39.recovery Recovered 128-bit Encrypted SLIP-39 Seed Entropy using 2 groups comprising 2 mnemonics
│ 2024-12-08 14:59:46 slip39.recovery Seed decoded from SLIP-39 Mnemonics w/ no passphrase
│ 2024-12-08 14:59:46 slip39.recovery Recovered SLIP-39 secret; To re-generate SLIP-39 wallet, send it to: python3 -m slip39 --secret -
│ ffffffffffffffffffffffffffffffff
└────
You can run this as a command-line pipeline. Here, we use some
SLIP-39 Mnemonics that encode the `ffff...' Seed Entropy; note that
the wallets match those output above:
┌────
│ slip39-recovery \
│ --mnemonic "material leaf acrobat romp charity capital omit skunk change firm eclipse crush fancy best tracks flip grownup plastic chew peanut" \
│ --mnemonic "material leaf beard romp disaster duke flame uncover group slice guest blue gums duckling total suitable trust guitar payment platform" \
│ | slip39 -c ETH -c BTC -c DOGE -c LTC --secret - \
│ --no-card --wallet password --wallet-hint 'bad:pass...' \
│ 2>&1
└────
┌────
│ 2024-12-08 14:59:46 slip39 It is recommended to not use '-w|--wallet <password>'; specify '-' to read from input
│ 2024-12-08 14:59:46 slip39 Generated 128-bit SLIP-39 Mnemonics w/ identifier 23368 requiring 2 of 4 (extendable) groups to recover
│ 2024-12-08 14:59:46 slip39.layout ETH m/44'/60'/0'/0/0 : 0x824b174803e688dE39aF5B3D7Cd39bE6515A19a1
│ 2024-12-08 14:59:46 slip39.layout BTC m/84'/0'/0'/0/0 : bc1q9yscq3l2yfxlvnlk3cszpqefparrv7tk24u6pl
│ 2024-12-08 14:59:46 slip39.layout DOGE m/44'/3'/0'/0/0 : DN8PNN3dipSJpLmyxtGe4EJH38EhqF8Sfy
│ 2024-12-08 14:59:46 slip39.layout LTC m/84'/2'/0'/0/0 : ltc1qe5m2mst9kjcqtfpapaanaty40qe8xtusmq4ake
│ 2024-12-08 14:59:48 slip39.layout Writing SLIP39-encoded wallet for 'SLIP39' to: SLIP39-2024-12-08+14.59.47-ETH-0x824b174803e688dE39aF5B3D7Cd39bE6515A19a1.pdf
└────
3.1.3 Supported Cryptocurrencies
╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
While the SLIP-39 Seed is not cryptocurrency-specific (any wallet for
any cryptocurrency can be derived from it), each type of
cryptocurrency has its own standard derivation path
(eg. `m/44'/3'/0'/0/0' for DOGE), and its own address representation
(eg. Bech32 at `m/84'/0'/0'/0/0' for BTC
eg. `bc1qcupw7k8enymvvsa7w35j5hq4ergtvus3zk8a8s').
When you import your SLIP-39 Seed into a Trezor, you gain access to
all derived HD cryptocurrency wallets supported directly by that
hardware wallet, and *indirectly*, to any coin and/or blockchain
network supported by any wallet software (eg. Metamask).
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Crypto Semantic Path Address Support
──────────────────────────────────────────────────────
ETH Legacy m/44'/60'/0'/0/0 0x…
BSC Legacy m/44'/60'/0'/0/0 0x… Beta
BTC Legacy m/44'/ 0'/0'/0/0 1…
SegWit m/49'/ 0'/0'/0/0 3…
Bech32 m/84'/ 0'/0'/0/0 bc1…
LTC Legacy m/44'/ 2'/0'/0/0 L…
SegWit m/49'/ 2'/0'/0/0 M…
Bech32 m/84'/ 2'/0'/0/0 ltc1…
DOGE Legacy m/44'/ 3'/0'/0/0 D…
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
◊ 3.1.3.1 ETH, BTC, LTC, DOGE
These coins are natively supported both directly by the Trezor
hardware wallet, and by most software wallets and "web3" platforms
that interact with the Trezor, or can import the BIP-38 or Ethereum
JSON Paper Wallets produced by `python-slip39'.
◊ 3.1.3.2 Binance Smart Chain (BSC): binance.com
The Binance Smart Chain uses standard Ethereum addresses; support for
the BSC is added directly to the wallet software; here are the
instructions for adding BSC support for the Trezor hardware wallet,
[using the Metamask software wallet]. In `python-slip39', BSC is
simply an alias for ETH, since the wallet addresses and Ethereum JSON
Paper Wallets are identical.
[using the Metamask software wallet]
<https://docs.binance.org/smart-chain/wallet/trezor.html>
3.2 The macOS/win32 `SLIP-39.app' GUI App
─────────────────────────────────────────
If you prefer a graphical user-interface, try the macOS/win32
SLIP-39.App. You can run it directly if you install Python 3.9+ from
[python.org/downloads] or using homebrew `brew install
[email protected]'. Then, start the GUI in a variety of ways:
┌────
│ slip39-gui
│ python3 -m slip39.gui
└────
Alternatively, download and install the macOS/win32 GUI App .zip, .pkg
or .dmg installer from [github.com/pjkundert/python-slip-39/releases].
[python.org/downloads] <https://python.org/downloads>
[github.com/pjkundert/python-slip-39/releases]
<https://github.com/pjkundert/python-slip39/releases/latest>
3.3 The Python `slip39' CLI
───────────────────────────
From the command line, you can create SLIP-39 Seed Mnemonic card PDFs.
3.3.1 `slip39' Synopsis
╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
The full command-line argument synopsis for `slip39' is:
┌────
│ slip39 --help 2>&1 | sed 's/^/: /' # (just for output formatting)
└────
┌────
│ usage: slip39 [-h] [-v] [-q] [-o OUTPUT] [-t THRESHOLD] [-g GROUP] [-f FORMAT]
│ [-c CRYPTOCURRENCY] [-p PATH] [-j JSON] [-w WALLET]
│ [--wallet-hint WALLET_HINT] [--wallet-format WALLET_FORMAT]
│ [-s SECRET] [-e ENTROPY] [--show] [--no-show] [--bits BITS]
│ [--using-bip39] [--passphrase PASSPHRASE] [-C CARD] [--no-card]
│ [--paper PAPER] [--cover] [--no-cover] [--identifier IDENTIFIER]
│ [--extendable] [--no-extendable] [--text]
│ [--watermark WATERMARK] [--double-sided] [--no-double-sided]
│ [--single-sided]
│ [names ...]
│
│ Create and output SLIP-39 encoded Seeds and Paper Wallets to a PDF file.
│
│ positional arguments:
│ names Account names to produce; if --secret Entropy is
│ supplied, only one is allowed.
│
│ options:
│ -h, --help show this help message and exit
│ -v, --verbose Display logging information.
│ -q, --quiet Reduce logging output.
│ -o OUTPUT, --output OUTPUT
│ Output PDF to file or '-' (stdout: use -q!);
│ formatting w/ name, date, time, crypto, path, address
│ allowed
│ -t THRESHOLD, --threshold THRESHOLD
│ Number of groups required for recovery (default: half
│ of groups, rounded up)
│ -g GROUP, --group GROUP
│ A group name[[<require>/]<size>] (default: <size> = 1,
│ <require> = half of <size>, rounded up, eg.
│ 'Frens(3/5)' ).
│ -f FORMAT, --format FORMAT
│ Specify crypto address formats: legacy, segwit,
│ bech32; default: ETH:legacy, BTC:bech32, LTC:bech32,
│ DOGE:legacy, BSC:legacy, XRP:legacy
│ -c CRYPTOCURRENCY, --cryptocurrency CRYPTOCURRENCY
│ A crypto name and optional derivation path (eg.
│ '../<range>/<range>'); defaults: ETH:m/44'/60'/0'/0/0,
│ BTC:m/84'/0'/0'/0/0, LTC:m/84'/2'/0'/0/0,
│ DOGE:m/44'/3'/0'/0/0, BSC:m/44'/60'/0'/0/0,
│ XRP:m/44'/144'/0'/0/0
│ -p PATH, --path PATH Modify all derivation paths by replacing the final
│ segment(s) w/ the supplied range(s), eg. '.../1/-'
│ means .../1/[0,...)
│ -j JSON, --json JSON Save an encrypted JSON wallet for each Ethereum
│ address w/ this password, '-' reads it from stdin
│ (default: None)
│ -w WALLET, --wallet WALLET
│ Produce paper wallets in output PDF; each wallet
│ private key is encrypted this password (use
│ --wallet="" for empty password)
│ --wallet-hint WALLET_HINT
│ Paper wallets password hint
│ --wallet-format WALLET_FORMAT
│ Paper wallet size; half, third, quarter or
│ '(<h>,<w>),<margin>' (default: quarter)
│ -s SECRET, --secret SECRET
│ Use the supplied BIP-39 Mnemonic or 128-, 256- or
│ 512-bit hex value as the secret seed; '-' reads it
│ from stdin (eg. output from slip39.recover)
│ -e ENTROPY, --entropy ENTROPY
│ Additional entropy; if 0x... hex, used directly;
│ otherwise, UTF-8 stretched via SHA-512
│ --show Show derivation of master seed
│ --no-show Disable showing derivation of master seed
│ --bits BITS Ensure that the seed is of the specified bit length;
│ 128, 256, 512 supported.
│ --using-bip39 Generate Seed from secret Entropy using BIP-39
│ generation algorithm (encode as BIP-39 Mnemonics,
│ encrypted using --passphrase)
│ --passphrase PASSPHRASE
│ Encrypt the master secret w/ this passphrase, '-'
│ reads it from stdin (default: None/'')
│ -C CARD, --card CARD Card size; business, credit, index, half, third,
│ quarter, photo or '(<h>,<w>),<margin>' (default:
│ business)
│ --no-card Disable PDF SLIP-39 mnemonic card output
│ --paper PAPER Paper size (default: Letter)
│ --cover Produce PDF SLIP-39 cover page
│ --no-cover Disable PDF SLIP-39 cover page
│ --identifier IDENTIFIER
│ Specify a SLIP-39 encoding identifier (default: random
│ integer)
│ --extendable Force extendable SLIP-39 encoding (the default)
│ --no-extendable Force non-extendable SLIP-39 encoding (the historical
│ default)
│ --text Enable textual SLIP-39 mnemonic output to stdout
│ --watermark WATERMARK
│ Include a watermark on the output SLIP-39 mnemonic
│ cards
│ --double-sided Enable double-sided PDF (default)
│ --no-double-sided Disable double-sided PDF
│ --single-sided Enable single-sided PDF
└────
3.4 Recovery & Re-Creation
──────────────────────────
Later, if you need to recover the wallet seed, keep entering SLIP-39
mnemonics into `slip39-recovery' until the secret is recovered
(invalid/duplicate mnemonics will be ignored):
┌────
│ $ python3 -m slip39.recovery # (or just "slip39-recovery")
│ Enter 1st SLIP-39 mnemonic: ab c
│ Enter 2nd SLIP-39 mnemonic: veteran guilt acrobat romp burden campus purple webcam uncover ...
│ Enter 3rd SLIP-39 mnemonic: veteran guilt acrobat romp burden campus purple webcam uncover ...
│ Enter 4th SLIP-39 mnemonic: veteran guilt beard romp dragon island merit burden aluminum worthy ...
│ 2021-12-25 11:03:33 slip39.recovery Recovered SLIP-39 secret; Use: python3 -m slip39 --secret ...
│ 383597fd63547e7c9525575decd413f7
└────
Finally, re-create the wallet seed, perhaps including an encrypted
JSON Paper Wallet for import of some accounts into a software wallet
(use `--json password' to output encrypted Ethereum JSON wallet
files):
┌────
│ slip39 --secret 383597fd63547e7c9525575decd413f7 --wallet password --wallet-hint bad:pass... 2>&1
└────
┌────
│ 2024-12-08 14:59:49 slip39 It is recommended to not use '-s|--secret <hex>'; specify '-' to read from input
│ 2024-12-08 14:59:49 slip39 It is recommended to not use '-w|--wallet <password>'; specify '-' to read from input
│ 2024-12-08 14:59:49 slip39 Generated 128-bit SLIP-39 Mnemonics w/ identifier 11684 requiring 2 of 4 (extendable) groups to recover
│ 2024-12-08 14:59:49 slip39.layout ETH m/44'/60'/0'/0/0 : 0xb44A2011A99596671d5952CdC22816089f142FB3
│ 2024-12-08 14:59:49 slip39.layout BTC m/84'/0'/0'/0/0 : bc1qcupw7k8enymvvsa7w35j5hq4ergtvus3zk8a8s
│ 2024-12-08 14:59:50 slip39.layout Writing SLIP39-encoded wallet for 'SLIP39' to: SLIP39-2024-12-08+14.59.50-ETH-0xb44A2011A99596671d5952CdC22816089f142FB3.pdf
│ SLIP39-2024-12-08+14.59.50-ETH-0xb44A2011A99596671d5952CdC22816089f142FB3.pdf
└────
3.4.1 `slip39.recovery' Synopsis
╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
┌────
│ python3 -m slip39.recovery --help 2>&1 | sed 's/^/: /' # (just for output formatting)
└────
┌────
│ usage: __main__.py [-h] [-v] [-q] [-m MNEMONIC] [-e] [--no-entropy] [-b] [-u]
│ [--binary] [--language LANGUAGE] [-p PASSPHRASE]
│
│ Recover and output secret Seed from SLIP-39 or BIP-39 Mnemonics
│
│ options:
│ -h, --help show this help message and exit
│ -v, --verbose Display logging information.
│ -q, --quiet Reduce logging output.
│ -m MNEMONIC, --mnemonic MNEMONIC
│ Supply another SLIP-39 (or a BIP-39) mnemonic phrase
│ -e, --entropy Return the BIP-39 Mnemonic Seed Entropy instead of the
│ generated Seed (default: True if --using-bip39 w/o
│ passphrase)
│ --no-entropy Return the BIP-39 Mnemonic generated Seed
│ -b, --bip39 Recover Entropy and generate 512-bit secret Seed from
│ BIP-39 Mnemonic + passphrase
│ -u, --using-bip39 Recover Entropy from SLIP-39, generate 512-bit secret
│ Seed using BIP-39 Mnemonic + passphrase
│ --binary Output seed in binary instead of hex
│ --language LANGUAGE BIP-39 Mnemonic language (default: english)
│ -p PASSPHRASE, --passphrase PASSPHRASE
│ Decrypt the SLIP-39 or BIP-39 master secret w/ this
│ passphrase, '-' reads it from stdin (default: None/'')
│
│ If you obtain a threshold number of SLIP-39 mnemonics, you can recover the original
│ secret Seed Entropy, and then re-generate one or more wallets from it.
│
│ Enter the mnemonics when prompted and/or via the command line with -m |--mnemonic "...".
│
│ The secret Seed Entropy can then be used to generate a new SLIP-39 encoded wallet:
│
│ python3 -m slip39 --secret = "ab04...7f"
│
│ SLIP-39 Mnemonics may be encrypted with a passphrase; this is *not* Ledger-compatible, so it rarely
│ recommended! Typically, on a Trezor, you recover using your SLIP-39 Mnemonics, and then use the
│ "Hidden wallet" feature (passwords entered on the device) to produce alternative sets of accounts.
│
│ BIP-39 Mnemonics can be backed up as SLIP-39 Mnemonics, in two ways:
│
│ 1) The actual BIP-39 standard 512-bit Seed can be generated by supplying --passphrase, but only at
│ the cost of 59-word SLIP-39 mnemonics. This is because the *output* 512-bit BIP-39 Seed must be
│ stored in SLIP-39 -- not the *input* 128-, 160-, 192-, 224-, or 256-bit entropy used to create the
│ original BIP-39 mnemonic phrase.
│
│ 2) The original BIP-39 12- or 24-word, 128- to 256-bit Seed Entropy can be recovered by supplying
│ --entropy. This modifies the BIP-39 recovery to return the original BIP-39 Mnemonic Entropy, before
│ decryption and seed generation. It has no effect for SLIP-39 recovery.
└────
3.4.2 Pipelining `slip39.recovery | slip39 --secret -'
╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
The tools can be used in a pipeline to avoid printing the secret.
Here we generate some mnemonics, sorting them in reverse order so we
need more than just the first couple to recover. Observe the Ethereum
wallet address generated.
Then, we recover the master secret seed in hex with `slip39-recovery',
and finally send it to `slip39 --secret -' to re-generate the same
wallet as we originally created.
┌────
│ ( python3 -m slip39 --text --no-card \
│ | ( sort -r ; echo "...later, after recovering SLIP-39 mnemonics..." 1>&2 ) \
│ | python3 -m slip39.recovery \
│ | python3 -m slip39 --secret - --no-card \
│ ) 2>&1
└────
┌────
│ 2024-12-08 14:59:51 slip39 Generated 128-bit SLIP-39 Mnemonics w/ identifier 2077 requiring 2 of 4 (extendable) groups to recover
│ 2024-12-08 14:59:51 slip39.layout ETH m/44'/60'/0'/0/0 : 0x603F96623eBDa2eEfaB2dcA51c5cE963929AeE29
│ 2024-12-08 14:59:51 slip39.layout BTC m/84'/0'/0'/0/0 : bc1qhsphmxzgjhvhd3ank2f3zt3kuknp4xl6jzmzj5
│ ...later, after recovering SLIP-39 mnemonics...
│ 2024-12-08 14:59:51 slip39 Generated 128-bit SLIP-39 Mnemonics w/ identifier 31967 requiring 2 of 4 (extendable) groups to recover
│ 2024-12-08 14:59:51 slip39.layout ETH m/44'/60'/0'/0/0 : 0x603F96623eBDa2eEfaB2dcA51c5cE963929AeE29
│ 2024-12-08 14:59:51 slip39.layout BTC m/84'/0'/0'/0/0 : bc1qhsphmxzgjhvhd3ank2f3zt3kuknp4xl6jzmzj5
└────
3.4.3 Pipelining Backup of a BIP-39 Mnemonic Phrase
╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
A primary use case for `python-slip39' will be to backup an existing
BIP-39 Mnemonic Phrase to SLIP-39 cards, so here it is. Suppose you
have some (arbitrary) way to recover (or generate) some Entropy; for
example, by recovering the original seed entropy used to generate a
BIP-39 Mhemonic:
┌────
│ ( python3 -m slip39.recovery --bip39 --entropy \
│ --mnemonic "zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo wrong" \
│ | python3 -m slip39 --using-bip39 --secret - \
│ ) 2>&1
└────
┌────
│ 2024-12-08 14:59:51 slip39 Assuming BIP-39 seed entropy: Ensure you recover and use via a BIP-39 Mnemonic
│ 2024-12-08 14:59:51 slip39 Generated 128-bit SLIP-39 Mnemonics w/ identifier 6662 requiring 2 of 4 (extendable) groups to recover
│ 2024-12-08 14:59:51 slip39.layout ETH m/44'/60'/0'/0/0 : 0xfc2077CA7F403cBECA41B1B0F62D91B5EA631B5E
│ 2024-12-08 14:59:51 slip39.layout BTC m/84'/0'/0'/0/0 : bc1qk0a9hr7wjfxeenz9nwenw9flhq0tmsf6vsgnn2
│ 2024-12-08 14:59:52 slip39.layout Writing SLIP39 backup for BIP-39-encoded wallet for 'SLIP39' to: SLIP39-2024-12-08+14.59.52-ETH-0xfc2077CA7F403cBECA41B1B0F62D91B5EA631B5E.pdf
│ SLIP39-2024-12-08+14.59.52-ETH-0xfc2077CA7F403cBECA41B1B0F62D91B5EA631B5E.pdf
└────
Better yet, if you already have a BIP-39 Mnemonic, you can just use
that directly (we'll use a bit of "wrapping" around the filename
output, so the first page shows up here):
┌────
│ echo -n "[[./$( \
│ python3 -m slip39 --secret "zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo wrong" --output ./images/SLIP39-Example.pdf \
│ )]]"
│
└────
<././images/SLIP39-Example.pdf>
Note the presence of the BIP-39 recovery phrase on the cover sheet;
this is recovered by round-tripping the original BIP-39 seed entropy,
through SLIP-39, and re-encoding back to BIP-39.
3.5 Generation of Addresses
───────────────────────────
For systems that require a stream of groups of wallet Addresses
(eg. for preparing invoices for clients, with a choice of
cryptocurrency payment options), `slip-generator' can produce a stream
of groups of addresses.
3.5.1 `slip39-generator' Synopsis
╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
┌────
│ slip39-generator --help --version | sed 's/^/: /' # (just for output formatting)
└────
┌────
│ usage: slip39-generator [-h] [-v] [-q] [-s SECRET] [-f FORMAT] [--xpub]
│ [--no-xpub] [-c CRYPTOCURRENCY] [--path PATH]
│ [-d DEVICE] [--baudrate BAUDRATE] [-e ENCRYPT]
│ [--decrypt ENCRYPT] [--enumerated] [--no-enumerate]
│ [--receive] [--corrupt CORRUPT]
│
│ Generate public wallet address(es) from a secret seed
│
│ options:
│ -h, --help show this help message and exit
│ -v, --verbose Display logging information.
│ -q, --quiet Reduce logging output.
│ -s SECRET, --secret SECRET
│ Use the supplied 128-, 256- or 512-bit hex value as
│ the secret seed; '-' (default) reads it from stdin
│ (eg. output from slip39.recover)
│ -f FORMAT, --format FORMAT
│ Specify crypto address formats: legacy, segwit,
│ bech32; default: ETH:legacy, BTC:bech32, LTC:bech32,
│ DOGE:legacy, BSC:legacy, XRP:legacy
│ --xpub Output xpub... instead of cryptocurrency wallet
│ address (and trim non-hardened default path segments)
│ --no-xpub Inhibit output of xpub (compatible w/ pre-v10.0.0)
│ -c CRYPTOCURRENCY, --cryptocurrency CRYPTOCURRENCY
│ A crypto name and optional derivation path (default:
│ "ETH:{Account.path_default('ETH')}"), optionally w/
│ ranges, eg: ETH:../0/-
│ --path PATH Modify all derivation paths by replacing the final
│ segment(s) w/ the supplied range(s), eg. '.../1/-'
│ means .../1/[0,...)
│ -d DEVICE, --device DEVICE
│ Use this serial device to transmit (or --receive)
│ records
│ --baudrate BAUDRATE Set the baud rate of the serial device (default:
│ 115200)
│ -e ENCRYPT, --encrypt ENCRYPT
│ Secure the channel from errors and/or prying eyes with
│ ChaCha20Poly1305 encryption w/ this password; '-'
│ reads from stdin
│ --decrypt ENCRYPT
│ --enumerated Include an enumeration in each record output (required
│ for --encrypt)
│ --no-enumerate Disable enumeration of output records
│ --receive Receive a stream of slip.generator output
│ --corrupt CORRUPT Corrupt a percentage of output symbols
│
│ Once you have a secret seed (eg. from slip39.recovery), you can generate a sequence
│ of HD wallet addresses from it. Emits rows in the form:
│
│ <enumeration> [<address group(s)>]
│
│ If the output is to be transmitted by an insecure channel (eg. a serial port), which may insert
│ errors or allow leakage, it is recommended that the records be encrypted with a cryptographic
│ function that includes a message authentication code. We use ChaCha20Poly1305 with a password and a
│ random nonce generated at program start time. This nonce is incremented for each record output.
│
│ Since the receiver requires the nonce to decrypt, and we do not want to separately transmit the
│ nonce and supply it to the receiver, the first record emitted when --encrypt is specified is the
│ random nonce, encrypted with the password, itself with a known nonce of all 0 bytes. The plaintext
│ data is random, while the nonce is not, but since this construction is only used once, it should be
│ satisfactory. This first nonce record is transmitted with an enumeration prefix of "nonce".
└────
3.5.2 Producing Addresses
╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
Addresses can be produced in plaintext or encrypted, and output to
stdout or to a serial port.
┌────
│ echo ffffffffffffffffffffffffffffffff | slip39-generator --secret - --path '../-3' 2>&1
└────
┌────
│ 0: [["ETH", "m/44'/60'/0'/0/0", "0x824b174803e688dE39aF5B3D7Cd39bE6515A19a1"], ["BTC", "m/84'/0'/0'/0/0", "bc1q9yscq3l2yfxlvnlk3cszpqefparrv7tk24u6pl"]]
│ 1: [["ETH", "m/44'/60'/0'/0/1", "0x8D342083549C635C0494d3c77567860ee7456963"], ["BTC", "m/84'/0'/0'/0/1", "bc1qnec684yvuhfrmy3q856gydllsc54p2tx9w955c"]]
│ 2: [["ETH", "m/44'/60'/0'/0/2", "0x52787E24965E1aBd691df77827A3CfA90f0166AA"], ["BTC", "m/84'/0'/0'/0/2", "bc1q2snj0zcg23dvjpw7m9lxtu0ap0hfl5tlddq07j"]]
│ 3: [["ETH", "m/44'/60'/0'/0/3", "0xc2442382Ae70c77d6B6840EC6637dB2422E1D44e"], ["BTC", "m/84'/0'/0'/0/3", "bc1qxwekjd46aa5n0s3dtsynvtsjwsne7c5f5w5dsd"]]
└────
To produce accounts from a BIP-39 or SLIP-39 seed, recover it using
slip39-recovery.
Here's an example of recovering a test BIP-39 seed; note that it
yields the well-known ETH `0xfc20...1B5E' and BTC `bc1qk0...gnn2'
accounts associated with this test Mnemonic:
┌────
│ ( python3 -m slip39.recovery --bip39 --mnemonic 'zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo wrong' \
│ | python3 -m slip39.generator --secret - --path '../-3' --format 'BTC:segwit' --crypto 'DOGE' ) 2>&1
└────
┌────
│ 0: [["DOGE", "m/44'/3'/0'/0/0", "DTMaJd8wqye1fymnjxZ5Cc5QkN1w4pMgXT"], ["BTC", "m/49'/0'/0'/0/0", "3CfyLSjYFFV6MUAMh3auTK9kfpPscPCHth"]]
│ 1: [["DOGE", "m/44'/3'/0'/0/1", "DGkL2LD5FfccAaKtx8G7TST5iZwrNkecTY"], ["BTC", "m/49'/0'/0'/0/1", "31nD3MEioUDchu7bVaHUCdCa4vxxsqDYwu"]]
│ 2: [["DOGE", "m/44'/3'/0'/0/2", "DQa3SpFZH3fFpEFAJHTXZjam4hWiv9muJX"], ["BTC", "m/49'/0'/0'/0/2", "32pqj8rgW1BdXK2Cygwn2JVYPnVRknfTE4"]]
│ 3: [["DOGE", "m/44'/3'/0'/0/3", "DTW5tqLwspMY3NpW3RrgMfjWs5gnpXtfwe"], ["BTC", "m/49'/0'/0'/0/3", "3CimS2PfrNykKtJe1uxM4QtaDopaFHdVN1"]]
└────
We can encrypt the output, to secure the sequence (and due to
integrated MACs, ensures no errors occur over an insecure channel like
a serial cable):
┌────
│ ( slip39-recovery --bip39 --mnemonic 'zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo wrong' \
│ | slip39-generator --secret - --path '../-3' --encrypt 'password' ) 2>&1 \
│ | sed -E 's/^(.{100})(.{1,})$/\1.../' # (shorten output)
└────
┌────
│
│
│ nonce: be5a2e328fbf1c86a79b438fcbd2c6c0cdcce977c6c977bf6db5996d
│ 0: e6f774e9f46725f9fd8043a017985ae153eecb8317ff5558c69c052b102f5124f4ce6c50b6c5e5c7d3c3430bc64df...
│ 1: fbb5436d2edc197245371a22b48f48e03bb39c471de559819839b58a10b1d91c06e7c46f4b771bb9aff46a6f5ec1c...
│ 2: 27914ff679eee2ab0b9caad40eef37f2ec06d5ede7e0f2bae30cf94c6b9a4da362645360e5898d672e27fb163cbe9...
│ 3: 06c7275ad3c815581d89b624e11d986894f2bef0e1aad1ef886b4c2546986b1e09d920aa98ca1904aad24432c97a8...
└────
On the receiving computer, we can decrypt and recover the stream of
accounts from the wallet seed; any rows with errors are ignored:
┌────
│ ( slip39-recovery --bip39 --mnemonic 'zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo wrong' \
│ | slip39-generator --secret - --path '../-3' --encrypt 'password' \
│ | slip39-generator --receive --decrypt 'password' ) 2>&1
└────
┌────
│ 0: [["ETH", "m/44'/60'/0'/0/0", "0xfc2077CA7F403cBECA41B1B0F62D91B5EA631B5E"], ["BTC", "m/84'/0'/0'/0/0", "bc1qk0a9hr7wjfxeenz9nwenw9flhq0tmsf6vsgnn2"]]
│ 1: [["ETH", "m/44'/60'/0'/0/1", "0xd1a7451beB6FE0326b4B78e3909310880B781d66"], ["BTC", "m/84'/0'/0'/0/1", "bc1qkd33yck74lg0kaq4tdcmu3hk4yruhjayxpe9ug"]]
│ 2: [["ETH", "m/44'/60'/0'/0/2", "0x578270B5E5B53336baC354756b763b309eCA90Ef"], ["BTC", "m/84'/0'/0'/0/2", "bc1qvr7e5aytd0hpmtaz2d443k364hprvqpm3lxr8w"]]
│ 3: [["ETH", "m/44'/60'/0'/0/3", "0x909f59835A5a120EafE1c60742485b7ff0e305da"], ["BTC", "m/84'/0'/0'/0/3", "bc1q6t9vhestkcfgw4nutnm8y2z49n30uhc0kyjl0d"]]
└────
3.5.3 X Public Keys
╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
If you prefer, you can output "xpub…" format public keys, instead of
account addresses. By default, this will elide the non-hardened
portion of the default addresses – use the "xpub…" keys to produce
the remaining non-hardened portion of the HD wallet paths locally.
For example, assume you must produce a sequence of accounts for each
client client of your company to deposit into. Your highly secure
serial-connected "key enclave" system (which must know your HD wallet
seed) emits a sequence of xpubkeys for each new client over a serial
cable, to your accounting system:
┌────
│ ( echo 'zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo wrong' \
│ | python3 -m slip39.generator --secret - --xpub --path "../-2'" --encrypt 'password' \
│ | python3 -m slip39.generator -v --receive --decrypt 'password' ) 2>&1
└────
┌────
│ 2024-12-08 14:59:56 slip39.generator Decrypting accountgroups with nonce: 34013a044655a6666604dec5
│ 0: [["ETH", "m/44'/60'/0'", "xpub6C2y6te3rtGg9SspDDFbjGEgn7yxc5ZzzkBk62yz3GRKvuqdaMDS7NUbesTJ44FprxAE7hvm5ZQjDMbYWehdJQsyBCP3mL87nnB4cB47HGS"], ["BTC", "m/84'/0'/0'", "zpub6rD5AGSXPTDMSnpmczjENMT3NvVF7q5MySww6uxitUsBYgkZLeBywrcwUWhW5YkeY2aS7xc45APPgfA6s6wWfG2gnfABq6TDz9zqeMu2JCY"]]
│ 1: [["ETH", "m/44'/60'/1'", "xpub6C2y6te3rtGgCPb4Gi89Qin7Da2dvnnHSuR9rLQV6bWQKiyfKyjtVzr2n9mKmTEHzr4rzK78LmdSXLSzvpZqVs4ussUU8NyXpt9nWWbKG3C"], ["BTC", "m/84'/0'/1'", "zpub6rD5AGSXPTDMUaSe3aGDqWk4uMTwcrFwytkKuDGmi3ofUkJ4dQxXHZwiXWbHHrELJAor8xGs61F8sbKS2JdQkLZRnu5PGktmr6F32nEBUBb"]]
│ 2: [["ETH", "m/44'/60'/2'", "xpub6C2y6te3rtGgENnaK62SyPawqKvbde17wc2ndMGFWi2yAkk3piwEY9QK8egtE9ye9uoqiqs5WV3MTNCCP2qjUNDb8cmSg4ZsVnwQnkziXVh"], ["BTC", "m/84'/0'/2'", "zpub6rD5AGSXPTDMYx2sQPuZgceniniRXDK5tELiREjxfSGJENNxuQD3u2yfpRqnNE1JeH14Pa7MVGrofDJtyXw252ws9HgRcd82X2M4KzkUfpZ"]]
└────
As required (throttled by hardward the serial cable RTS/CTS signals)
your accounting system receives these "xpub…" addresses:
┌────
│ ( echo 'zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo wrong' \
│ | python3 -m slip39.generator --secret - --xpub --path "../-2'" --encrypt 'password' \
│ | python3 -m slip39.generator -v --receive --decrypt 'password' \
│ | while IFS=':' read num json; do \
│ echo "--- $(( num ))"; \
│ echo "$json" | jq -c '.[]'; \
│ done \
│ ) 2>&1
└────
┌────
│ 2024-12-08 14:59:56 slip39.generator Decrypting accountgroups with nonce: 4592f0d313586962da9e544c
│ --- 0
│ ["ETH","m/44'/60'/0'","xpub6C2y6te3rtGg9SspDDFbjGEgn7yxc5ZzzkBk62yz3GRKvuqdaMDS7NUbesTJ44FprxAE7hvm5ZQjDMbYWehdJQsyBCP3mL87nnB4cB47HGS"]
│ ["BTC","m/84'/0'/0'","zpub6rD5AGSXPTDMSnpmczjENMT3NvVF7q5MySww6uxitUsBYgkZLeBywrcwUWhW5YkeY2aS7xc45APPgfA6s6wWfG2gnfABq6TDz9zqeMu2JCY"]
│ --- 1
│ ["ETH","m/44'/60'/1'","xpub6C2y6te3rtGgCPb4Gi89Qin7Da2dvnnHSuR9rLQV6bWQKiyfKyjtVzr2n9mKmTEHzr4rzK78LmdSXLSzvpZqVs4ussUU8NyXpt9nWWbKG3C"]
│ ["BTC","m/84'/0'/1'","zpub6rD5AGSXPTDMUaSe3aGDqWk4uMTwcrFwytkKuDGmi3ofUkJ4dQxXHZwiXWbHHrELJAor8xGs61F8sbKS2JdQkLZRnu5PGktmr6F32nEBUBb"]
│ --- 2
│ ["ETH","m/44'/60'/2'","xpub6C2y6te3rtGgENnaK62SyPawqKvbde17wc2ndMGFWi2yAkk3piwEY9QK8egtE9ye9uoqiqs5WV3MTNCCP2qjUNDb8cmSg4ZsVnwQnkziXVh"]
│ ["BTC","m/84'/0'/2'","zpub6rD5AGSXPTDMYx2sQPuZgceniniRXDK5tELiREjxfSGJENNxuQD3u2yfpRqnNE1JeH14Pa7MVGrofDJtyXw252ws9HgRcd82X2M4KzkUfpZ"]
└────
Then, it generates each client's sequence of addresses locally: you