New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bip32: Understand and fix the m/
problem
#2673
Comments
If you want to support those BIPs it definitely needs to be another crate that I will have no part in maintaining. If people want their keys to serve specific purposes they should use descriptors, not abuse their key derivation paths for it. |
Also, "derivation path" is definitely a standard term. You can search it and you will find hundreds of articles, for example https://www.ledger.com/blog/understanding-crypto-addresses-and-derivation-paths |
I may be wrong in original description "chain" may only be the internal/external child number not everything after it ... |
Context:
Some more things of interest:
BIP-32 never mentions the term 'derivation path' so our
DerivationPath
is either misnamed or arust-bitcoin
only concept. The bip uses the term "chain" to refer to the stuff after the account eg thea/b/c
inm/i'/0'/a/b/c
Note BIP-43 and BIP-44 add "purpose" and "coin" to the front of the unnamed-thing-that-we-call-derivation-path
The best nomenclature I can garner from the combination of all three bips is that the unnamed-thing-that-we-call-derivation-path is the string representation of a Hierarchical Deterministic Wallet (HDW) that may or may not include the chain (as defined above).
To Close this issue:
bip32
module should continue to support parsing a HDW string of formm/44'/0'/0'/0/a/b/c
a/b/c
bit from (1) and one should be able to extend a HDW witha
,a/b/c
, etc.Other considerations
The module is probably too tightly named, should it be called
hdw
and support bips 43, and 44 (ie., functionpurpose()
returns a const and we have all the "current" purposes hardcoded (see below)Some of my personal notes on HDW
BIP-32: Defines HD wallets, default account is
m/0'/*
BIP-43: Defines purpose i.e.,
m/0'
BIP-44: Defines
m / purpose' / coin_type' / account' / change / address_index
(Bitcoin mainnet is coin_type 0) -
m/44'/0'/0'
??? : Defines account for P2PKH outputs:
BIP-45: Defines account for P2SH multisig outputs:
m/45'/0'/0'
BIP-48: Defines account for BIP-69 sorted multisig outputs:
m/48'/0'/0'
BIP-49: Defines account for P2SH-P2WPKH (nested) outputs:
m/49'/0'/0'
BIP-84: Defines account for P2WPKH (BIP-173) outputs:
m/84'/0'/0'
BIP-86: Defines account for P2TR outputs (BIP-341):
m/86'/0'/0'
BIP-87: Defines account for P2WSH sorted multi (Hierarchy for Deterministic Multisig Wallets)
Elephant
Just to mention the elephant in the room, should the
bip32
module (in its current or future form) even be inrust-bitcoin
or should it be a separate crate? Some of this is pure wallet stuff but some, for example parsing output from Bitcoin Core, is more general.The text was updated successfully, but these errors were encountered: