spesmilo / electrum

Electrum Bitcoin Wallet
https://electrum.org
MIT License
7.33k stars 3.05k forks source link

BIP48 broken for Specter wallet imports #7596

Open zanepocock opened 2 years ago

zanepocock commented 2 years ago

Running Electrum V 4.1.5

As mentioned in https://github.com/cryptoadvance/specter-desktop/issues/1490, at some point compatibility broke between the Specter-side export and Electrum-side import for BIP48 multisig wallets. Using xpubs and m/48h/0h/0h/2h derivation, the expected script type is P2WSH but Electrum instead derived P2SH.

A temporary fix was to manually change the xpubs to Zpubs and sort of "trick" Electrum into deriving the correct addresses.

Assuming Electrum still supports BIP48 but just changed something … is there a long-term spec I can pass back to the Crypto Advance / Specter team?

SomberNight commented 2 years ago

The main point of the {y,Y,z,Z}|{pub,prv} master keys was to avoid inferring anything from derivation paths.

Using xpubs and m/48h/0h/0h/2h derivation, the expected script type is P2WSH but Electrum instead derived P2SH.

Electrum atm does not let you restore from a master_key+derivation_path combination, so I am not sure what you mean. You can either restore from bip39_seed+script_type+derivation_path, or from master_key.

Assuming Electrum still supports BIP48 but just changed something …

I don't think we have changed anything w.r.t. this for years. If compatibility between Specter and Electrum was there at one point but has since broken, then it is more than likely that Specter made the change.

is there a long-term spec

We intend to deprecate y/zpubs and use some form of output script descriptors (although their base form is not a good fit to represent a single cosigner unfortunately).