Author

Topic: Master public keys on Sparrow (Read 86 times)

legendary
Activity: 2646
Merit: 6681
Self-proclaimed Genius
January 16, 2025, 12:42:38 AM
#5
I don't really understand the use of the xpub displayed by Sparrow for a segwit wallet.
That's because other wallets do not utilize the "z" or other extended key formats like Bitcoin Core.
Those wallet have some mechanism to identify which derivation path to get to that extended key and the script type to use,
In Bitcoin Core and Sparrow, they use "descriptors".

In Sparrow, it can be seen in "Edit wallet output descriptor" button:

From that, your example wallet uses "wpkh" (P2WPKH) script type and the derivation path of m/84h/0h/0h from master private key to that extended public key.
Wallets supporting descriptors utilizes that.


For the recovery of that particular case when the user simply imported the xpub resulting with legacy HD watch-only wallet, you don't need a third-party tool nor command to recover it;
When importing to Electrum during script type selection screen:
Tick "legacy (p2pkh)", then edit the derivation path below from m/44h/0h/0h to m/84h/0h/0h to match the derivation path in your descriptor.

Then finalize the wallet creation process and the xpub and the legacy addresses of the improperly imported watch-only wallet should match.
legendary
Activity: 2380
Merit: 5213
January 14, 2025, 11:33:24 AM
#4
For such problems, I'd use Ian Coleman's site:
Code:
m/44'/0'/0'/0/0	14MBcf7YJ5Byq3pHDraB736BqAugrJAQ7U	030d0a570f3680b9bda4a174c601b9bf68c016fbe778370960e4e853f8d1713918	KwqFm83wSSL2AictcqCGM8CMUYzvqxLtyNrfKt7gqLbdG2tbKTb1

m/84'/0'/0'/0/0 bc1qnjrn2yzc0tswkse335an00eslax4xu78svqfmy 030889282c9000b81edf4fd8ff1ab8c671b8bd0bf2ac255099ebcac55c5a193e23 L26FLhhEzwXYQncePSMXZ2AHhmDraKSpATMgRzukq2oMbEP4jSBi
I'm no expert on manual xpub/zpub handling, but I'd try importing the private key first.
This will not work.
The legacy address you generated on m/44'/0'/0'/0/0 is same as the address generated with importing the seed phrase on electrum and selecting "Legacy" as the script type.
I am looking for the address generated from the xpub displayed by Sparrow. That's 1FGePHwdHJW65V5wgUGZF4RmrZtcLXtZG8.


So you can import the private key one after the other to recover the coins. It will likely be on the first address.
This works. Thank you.

I could find another solution too.
I exported the master private key from the wallet file. Then I converted the zpub to xpub using electrum console and imported the resulting key. In this way, it's not required to import individual private keys one by one.

The master privtate key I got from the wallet file was as follows.

Code:
zprvActF2dk8nnUbZtEAxJof2iws9q1gwkKyVBTPqV8txXEKgnKjrR5SH7wdEacz9RmByXMKRk9NpwBzBF183cV1dQJdeRh126DftsGV6pHCSoE

And below is the command I used in electrum console.

Code:
convert_xkey(xkey="zprvActF2dk8nnUbZtEAxJof2iws9q1gwkKyVBTPqV8txXEKgnKjrR5SH7wdEacz9RmByXMKRk9NpwBzBF183cV1dQJdeRh126DftsGV6pHCSoE",xtype="standard")


I don't really understand the use of the xpub displayed by Sparrow for a segwit wallet.
I think that can only lead to confusion.
legendary
Activity: 1512
Merit: 4795
Leading Crypto Sports Betting & Casino Platform
January 14, 2025, 11:17:52 AM
#3
There has been a way I do recover such coins if possible I am in such situation.

 I input the above seed phrase on iancoleman BIP39 tool. It will generate this m/84'/0'/0'/0/0   bc1qnjrn2yzc0tswkse335an00eslax4xu78svqfmy   030889282c9000b81edf4fd8ff1ab8c671b8bd0bf2ac255099ebcac55c5a193e23   L26FLhhEzwXYQncePSMXZ2AHhmDraKSpATMgRzukq2oMbEP4jSBi. You understood that. No need for further explanation.

Take the private key and import it on Electrum.
L26FLhhEzwXYQncePSMXZ2AHhmDraKSpATMgRzukq2oMbEP4jSBi

It will generate this address: 1FGePHwdHJW65V5wgUGZF4RmrZtcLXtZG8

Which is the address that is first generated by this public key.
xpub6CD4powCKnww5mvQPcmQyghbMvZHTy4q2BLZ55kjkr1YTP2Rte4Zanwq3Rv4nHdQvY1mMTB37bP QLWrDQgceT1TcB2MuQ5FKgaKtqUGfCro

So you can import the private key one after the other to recover the coins. It will likely be on the first address.


You can even convert the seed phrase to the equivalent BIP44 on Electrum. nc50lc has a post on it. If I see it, I will edit this post. Or nc50lc or anyone that saw the post can post about it below.
legendary
Activity: 3290
Merit: 16489
Thick-Skinned Gang Leader and Golden Feather 2021
January 14, 2025, 11:09:12 AM
#2
For such problems, I'd use Ian Coleman's site:
Code:
m/44'/0'/0'/0/0	14MBcf7YJ5Byq3pHDraB736BqAugrJAQ7U	030d0a570f3680b9bda4a174c601b9bf68c016fbe778370960e4e853f8d1713918	KwqFm83wSSL2AictcqCGM8CMUYzvqxLtyNrfKt7gqLbdG2tbKTb1

m/84'/0'/0'/0/0 bc1qnjrn2yzc0tswkse335an00eslax4xu78svqfmy 030889282c9000b81edf4fd8ff1ab8c671b8bd0bf2ac255099ebcac55c5a193e23 L26FLhhEzwXYQncePSMXZ2AHhmDraKSpATMgRzukq2oMbEP4jSBi
I'm no expert on manual xpub/zpub handling, but I'd try importing the private key first.

Charles-Tim wrote it down better under here:
legendary
Activity: 2380
Merit: 5213
January 14, 2025, 09:59:43 AM
#1
When you generate a new wallet on Sparrow, it gives you two master public keys (xpub and zpub).
A few days ago, someone mistakely used the xpub instead of the zpub to create the watch-only wallet on bluewallet. (Click here to visit the relevant thread.)
The user sent some fund to the watch-only wallet created using the xpub to bluewallet and asked how to recover the fund.

I was going to suggest him to create a new wallet with the same seed phrase on Sparrow itself or electrum and this time select "Legacy" option, but before that I decided to test it myself and make sure it works. Surprisingly, it didn't work.


Example:

Code:
replace trophy tonight marriage barrel unique bachelor ranch pave agree burst tired 

Sparrow displays only segwit addresses, but two master public keys for the above seed phrase.

Xpub:

Code:
xpub6CD4powCKnww5mvQPcmQyghbMvZHTy4q2BLZ55kjkr1YTP2Rte4Zanwq3Rv4nHdQvY1mMTB37bPQLWrDQgceT1TcB2MuQ5FKgaKtqUGfCro

Zpub:

Code:
zpub6qsbS9H2dA2tnNJe4LLfPrtbhrrBMD3prQNzdsYWWrmJZaetPxPgpvG75qqEn6wFjpFNrQNA2v6W765Lr5Sg3UpouhkkZttJE2TBciUyDAq

The above master public keys can be converted to each other using Bitcoin Extended Public Key Converter. Everything is fine till here.

But how can recover the fund sent to the addresses generated from the above xpub?
If you import the above seed phrase to electrum and select "Legacy" as the script type, you would get the following xpub.

Code:
xpub6BikEmhB6KYbPeTqxNwqdxiU4XcLoFvW2n2aR6EpJSMckruncGqdWtT9XCz4jSzokHwiJjoH2dATS1vWG7q6viKvBuMcfS53ycm39fPPtQW
Jump to: