It's been a while. This
release adds:
- Path presets for common wallet software, hardware wallets, and Bip standards such as Bip44, Bip49, Bip84.
- Variables in paths for insertion of coin, account, and change values.
- Iteration can now occur at any path level, not only the deepest level. (needed by Ledger-Live)
- added --gen-words flag to control how many mnemonic words are created. [12..48]
corrected ethereum private key serialization - minor bug fixes
ExamplesLet's say we want to derive addresses for bitcoin-core software. First, we need to find out the preset identifier for this software.
$ ./hd-wallet-derive.php --help-presets | head -n 7
+-------------------------+----------------------+-------------------------+------------------+---------------------------+
| id | path | wallet | version | note |
+-------------------------+----------------------+-------------------------+------------------+---------------------------+
| bip44 | m/44'/c'/a'/v/x | Bip44 Compat | n/a | Bip44 |
| bip49 | m/49'/c'/a'/v/x | Bip49 Compat | n/a | Bip49 |
| bip84 | m/84'/c'/a'/v/x | Bip84 Compat | n/a | Bip84 |
| bitcoincore | m/a'/v'/x' | Bitcoin Core | v0.13 and above. | Bip32 fully hardened |
If we want only the ids, we could use the command:
$ ./hd-wallet-derive.php --help-presets --format=list
bip44
bip49
bip84
bitcoincore
bither
breadwallet
coinomi
coinomi_bech32
coinomi_p2sh
copay
copay_hardware_multisig
copay_legacy
electrum
electrum_legacy
electrum_legacy_multi
hive
jaxx
ledgerlive
multibit_hd
multibit_hd_44
mycelium
samourai
samourai_bech32
samourai_p2sh
trezor
wasabi
Deriving addresses for bitcoin-core using preset path.Using a preset means that we do not need to know the bip32 path. We can do:
$ ./hd-wallet-derive.php -g --key=xprv9tyUQV64JT5qs3RSTJkXCWKMyUgoQp7F3hA1xzG6ZGu6u6Q9VMNjGr67Lctvy5P8oyaYAL9CAWrUE9i6GoNMKUga5biW6Hx4tws2six3b9c --numderive=3 --preset=bitcoincore --cols=path,address
+------------+------------------------------------+
| path | address |
+------------+------------------------------------+
| m/0'/0'/0' | 1JsH5tzm2bphJySSLJ13AbFGP8KqJBYvG7 |
| m/0'/0'/1' | 19in8KwQy2waqzogwnVRvh2gt7EkHDGtwg |
| m/0'/0'/2' | 1CMc7jzi6ewKRzBNSCMkYzY3PU13ck6bxQ |
+------------+------------------------------------+
Deriving Change addresses for bitcoin-core using preset path.We can use the --path-change flag for this. requires a preset
with variable 'v' present in the path.
$ ./hd-wallet-derive.php -g --key=xprv9tyUQV64JT5qs3RSTJkXCWKMyUgoQp7F3hA1xzG6ZGu6u6Q9VMNjGr67Lctvy5P8oyaYAL9CAWrUE9i6GoNMKUga5biW6Hx4tws2six3b9c --numderive=3 --preset=bitcoincore --cols=path,address --path-change
+------------+------------------------------------+
| path | address |
+------------+------------------------------------+
| m/0'/1'/0' | 1B6q1KTyaa9yLHV2HTZC1rZaSKMG8KNqsp |
| m/0'/1'/1' | 15RF1R9ZaSqgtaTVBDm1ySU5MQ6dZeTpZf |
| m/0'/1'/2' | 1DpzhgrgWuRSnQjvLiZHMG2TAjs86znvjj |
+------------+------------------------------------+
Notice that that 2nd field has changed from 0' to 1'.
Similarly, the coin and account fields of a Bip44 path (or any custom path) can hold variables so that a single path preset works for various situations.