XPUB, YPUB, ZPUB Converter Tools I was wondering if there are any good X,Y,Zpub converter tools that any of you are aware of. For instance, a tool that could convert an Xpub into the equivalent Zpub.

I was inspired to ask this question, as I was playing around with multi-sig capabilities on both Electrum and Caravan. I created a Segwit MultiSig wallet on Caravan by inserting 3 Xpubs into the tool (https://unchained-capital.github.io/caravan/#/wallet). I got a wallet with bc1 addresses...

I then tried to re-create that wallet with only the xPubs on Electrum (mimicking a scenario where I didn't have all the signor keys), but Electrum read the xPubs as legacy and generated standard P2SH 3xxx... addresses in the wallet, a completely set of addresses. Not what I was looking for!

I then recreated the initial SegWit MultiSig wallet (from step 1) on Electrum, by actually connecting the same devices. I got the same bc1 addresses as Step 1. Nice.

I opened the Electrum wallet data for the MS wallet and noticed that Zpubs were noted, rather then the xPubs I had seen in the wallet data from Caravan. Note: both of these wallets generate the same addresses depending on the tool used.

I then put the zPubs into Caravan to try and recreate the same MS wallet using the Electrum data (which worked), and it automatically converted the zPubs from the Electrum wallet to xPubs with the note: https://gyazo.com/b66d8788e62208a2bdd021fb6ce53bd7


Is there a tool that performs the opposite functions, that converts an xPubs to a zPub?
This would give me comfort that I don't have to save both xPub and zPub wallet files! I could simply use either the Caravan or Electrum wallet file and be confident I could always derive the other format if needed.
There's a command line electrum option convert_xkey. If you're on linux or macosx you can see the documentation for it via electrum help convert_xkey. Alternatively you can use the console tab of electrum on all operating systems to achieve the same result. For example convert_xkey(xkey=&quot;xpub...&quot;,xtype=&quot;p2wpkh&quot;) will convert from p2pkh to p2wpkh