-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Different bip32 prefixes for various output scripts #934
Comments
The change would need to be somewhere here https://github.com/bitcoinjs/bitcoinjs-lib/blob/master/src/networks.js#L10 I am not sure if it's better to add new fields, like Also there would need to be changes in hdnode.tobase58... How we do it in web walet is that we, when importing/exporting xpubs, temporarily clone the |
@Runn1ng what happens when you adding P2WPKH (not in P2SH)? Another version of xpub? |
Is there a BIP for it? |
Sorry for late follow-up Nope, there is no BIP for it, but there is no BIP for XPUBs in the first place.(not even in BIP49) We use what's used in Electrum. The linked PR (#927) is possibly solving this (haven't tested it) |
... I’d reeeeeeally like a BIP first... But I see where the problem would lie. Extended keys should use bech32 and just write the script in the hrp, imo. |
@dabura667 write a BIP! |
Yea.. reading around, I found only a ML post by ThomasV and a page on electrum.org with the versions, but without reviewing source code it's hard to know what others are actually implementing. I noticed that two of the prefixes can have multiple scripts, P2SH, or P2PKH. I'd love to know if this is part of the "spec" or if maybe some wallets are just abusing it.. |
Closing in favour of #927 (and move discussion there) |
When we added segwit accounts at trezor wallet, we realized people are exporting/importing XPUBs wrong - meaning, XPUBs from P2WPKH-in-P2SH HD nodes to "traditional" P2PKH wallets, and that caused confusion.
Both us and Electrum added different xpub version magics for P2WPKH-in-P2SH XPUBs - the segwit xpubs now start at "Ypub".
So instead of
network.bip32.public_key
, there should be an array? Or something similar (also see https://github.com/trezor/trezor-common/blob/master/coins.json#L14 )We also added special magic to litecoin p2wpkh-in-p2sh xpubs for this reason ( https://github.com/trezor/trezor-common/blob/master/coins.json#L173 ) - we did, however, just made the p2wpkh-in-p2sh litecoin up and we didn't add all the other 8 magics, since we don't need those in trezor web wallet.
I am not sure how to do this elegantly, and if it's worth breaking compatibility.
The text was updated successfully, but these errors were encountered: