thx for the reply. I'm presently writing a command-line utility that performs wallet-discovery. The idea is to read in a master xpub and then generate all of the receive and change addresses for the wallet, checking for received tx, until the gap limit is reached. (It also handles multiple masters as in the case of copay wallets.)
In fact, I'm using your bitwasp library, so thx for that also!
As I have read bip32, bip44, and bip45 more, I have come to realize that the fault is not entirely with wallet authors using non-standard paths. bip32 was fine by itself, but then bip44 and 45 re-defined the path in new ways causing much confusion and no way to resolve it. So any code that is the recipient of an xpub (which contains depth but not path or bip number) is screwed because there is no in-band mechanism to know the bip-format. Asking users is a non-starter, except for maybe asking them which wallet software and version they are using.
Even worse, if the receiving app gets it wrong, it has no real way of knowing because new (and incorrect) keys are happily generated. They just won't have any received funds. No way to differentiate that from an empty wallet.
Seems really broken and bad for interop and user experience.
copay is especially crazy. Here's a snippet for how I have to deal with them. ( Copay 1.x )
// copay uses a crazy constant instead of a bip45 cosigner_index.
// why? cuz they can.
$copay_constant = '2147483647';
$relpath_base = $copay_constant;
$abspath_base = 'm/45/' . $copay_constant;
$relpath = $relpath_base . "/$type/$idx";
$abspath = $abspath_base . "/$type/$idx";
I suppose such games might not be necessary if my app were to receive the bip39 words, but that exposes the master private key and ruins the entire idea of 3rd party audits without private keys. And I'm not sure if that tells us the structure or not...
I am thinking we could solve this with a new bip that defines a standard format for wallet software to export master keys(s) so that necessary information is not lost, including:
+ list of xpubs ( and/or optionally xprivs )
+ absolute path including purpose ( bip number / format identifier )
+ number of signers (in case of multisig wallets)
Basically a standard wallet interchange format. :-)
I'm new to this hd wallet stuff. Has anyone drafted a relevant bip already that I'm just not aware of?