unchained-capital / caravan

Bitcoin multisig coordination software
https://unchained-capital.github.io/caravan/
MIT License
203 stars 178 forks source link

Keep Zpub or Ypub in json config #136

Closed mbican closed 6 months ago

mbican commented 4 years ago

if I import Zpub it is immediately converted to xpub e.g.: Zpub6xvDzwpKHczhpJzkkveFAqAsayzq7dC49Rr3R1qP8cGivqrMbUEip1fRbThiDLhtWA9EptBSVvUrKdrwwp7jt4bePNL3b7d9bo9EvgBQB4T -> xpub68McGNk3RJMNh9T99Yc1vae4XFfg22XTzw9vvxn4zpgZCTezKkXKUmVDkLq4f6B9TQqeTLzChPPFRu24DC8m977mpDpo1tXBAck5Za3Vosz

If I later take the xpub from json and put it to electrum it doesn't work :-(

I'm submitting a Bug report

Expected Behavior

as per slip-0132 https://github.com/satoshilabs/slips/blob/master/slip-0132.md based on script type extended public key should start with P2SH: xpub Multi-signature P2WSH in P2SH: Ypub Multi-signature P2WSH: Zpub

I would want to convert to appropriate type *pub based address type

Current Behavior

Currently regardless of address type extended public key is always converted to xpub. It shows incorrect error message: "Your extended public key has been converted from Zpub to xpub, this may indicate an invalid network setting, if so correct setting, remove key and try again"

Possible Solution

Steps to Reproduce (for bugs)

  1. go to https://unchained-capital.github.io/caravan/#/wallet
  2. Swtich to P2WSH address type
  3. Extended Public Key 1: "Enter as text"
  4. paste: Zpub6xvDzwpKHczhpJzkkveFAqAsayzq7dC49Rr3R1qP8cGivqrMbUEip1fRbThiDLhtWA9EptBSVvUrKdrwwp7jt4bePNL3b7d9bo9EvgBQB4T

Environment

bucko13 commented 4 years ago

Thanks for the report! I'm going to label this as a feature request rather than a bug as this is expected behavior given the feature support currently in Caravan. Basically, Caravan supports reading from the different xpub types to make it possible to import xpubs from trezor and electrum primarily, but then stays fully in the world of xpubs. Unfortunately, BIP84/SLIP0132 are not fully supported standards yet across all wallets and so Caravan for now has opted to keep extended public keys with the xpub/tpub prefixes while making sure to explicitly store the HD path in its config. Electrum won't know how to read this xpub, but you should be able to find tools that can convert the xpub from Caravan given the HD path into the zpub that Electrum understands.

If you're interested in helping adding support for this, the first place I'd recommend looking is in the unchained-bitcoin library, specifically the tools used for converting xpub prefix versions here

waldenraines commented 3 years ago

See also https://github.com/unchained-capital/caravan/issues/218

wksantiago commented 3 years ago

Thanks

Thanks for the report! I'm going to label this as a feature request rather than a bug as this is expected behavior given the feature support currently in Caravan. Basically, Caravan supports reading from the different xpub types to make it possible to import xpubs from trezor and electrum primarily, but then stays fully in the world of xpubs. Unfortunately, BIP84/SLIP0132 are not fully supported standards yet across all wallets and so Caravan for now has opted to keep extended public keys with the xpub/tpub prefixes while making sure to explicitly store the HD path in its config. Electrum won't know how to read this xpub, but you should be able to find tools that can convert the xpub from Caravan given the HD path into the zpub that Electrum understands.

If you're interested in helping adding support for this, the first place I'd recommend looking is in the unchained-bitcoin library, specifically the tools used for converting xpub prefix versions here

Thanks @bucko13 for the information

demerzel3 commented 3 years ago

You could use this tool https://jlopp.github.io/xpub-converter/ to convert the xpub back to Zpub for usage in other wallets.

jevidon commented 6 months ago

The Caravan Library is transitioning to a new home, and as part of this move current issues will be closed and archived. Please go check out the new location here: https://github.com/caravan-bitcoin/caravan/issues