Since we’re probably not going to support bip39 mnemonics in the wallet itself, but it’s an often requested feature, this PR provides a simple Rust utility to import one.
This puts the utility in share
so it’s included in releases. Alternatively we could make a separate repo akin to HWI. Or perhaps Rust Bitcoin could ship it as an example.
Usage (first bip39 test vector):
0cd share/wallet
1cargo run -- import bip39
2
3Specify network: 'main' (default) or 'test' (testnet and signet)
4main
5Enter bip39 mnemonic:
6abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about
7Enter passphrase (optional):
8TREZOR
9Parsed 12 word mnemonic.
10Import into your wallet as follows:
11
12importdescriptors '[{"desc": "pkh(xprv9s21ZrQH143K3h3fDYiay8mocZ3afhfULfb5GX8kCBdno77K4HiA15Tg23wpbeF1pLfs1c5SPmYHrEpTuuRhxMwvKDwqdKiGJS9XFKzUsAF/44h/0h/0h/<0;1>/*)#y6qw5vhg", "timestamp": "now", "active": true}, {"desc": "sh(wpkh(xprv9s21ZrQH143K3h3fDYiay8mocZ3afhfULfb5GX8kCBdno77K4HiA15Tg23wpbeF1pLfs1c5SPmYHrEpTuuRhxMwvKDwqdKiGJS9XFKzUsAF/49h/0h/0h/<0;1>/*))#u20wznzk", "timestamp": "now", "active": true}, {"desc": "wpkh(xprv9s21ZrQH143K3h3fDYiay8mocZ3afhfULfb5GX8kCBdno77K4HiA15Tg23wpbeF1pLfs1c5SPmYHrEpTuuRhxMwvKDwqdKiGJS9XFKzUsAF/84h/0h/0h/<0;1>/*)#53uwn79v", "timestamp": "now", "active": true}, {"desc": "tr(xprv9s21ZrQH143K3h3fDYiay8mocZ3afhfULfb5GX8kCBdno77K4HiA15Tg23wpbeF1pLfs1c5SPmYHrEpTuuRhxMwvKDwqdKiGJS9XFKzUsAF/86h/0h/0h/<0;1>/*)#r9yp5mw9", "timestamp": "now", "active": true}]'
Pro tip: use -blockfilterindex
for an ultra fast rescanblockchain
experience.
Dependencies:
- rust-bitcoin crates
- bip39 (community crate)
- bitcoin (convert master key to xpriv)
- miniscript (community crate, for descriptors)
Fixes #19151
Could be expanded to import codex32, see #27351.