Post
Topic
Board Electrum
Re: importing public keys, derivation paths and zero balance
by
nc50lc
on 07/05/2024, 04:45:48 UTC
any solution for this?
i thought that i could do this with the public keys but i think i was wrong.
This depends on the addresses associated with your UTXOs. (those 2 addresses with balance)
If its parent descriptor is indeed those "combo()" descriptors, then,
there's no way you can import the master public key to Electrum due to its key derivation which entirely uses "hardened derivation".

If it's in any of the other descriptor (excluding "tr"), then you can do the instructions in my previous reply.

To make sure, use Bitcoin Core's console and use the command: getaddressinfo <address> and it'll show you its parent descriptor.

Quote from: blapaz
i just want a way to:
- check the balance of all my addresses
- have a list of all my addresses that i can give around to people (don't want to reuse the same wallet address)
- don't want to download the whole blockchain (eg. using bitcoin core)
If it's still in the combo() descriptors;
One way to do this is to send all of your coins to your newly generated address that is a child of your new descriptors or to a new wallet.
Then those descriptor's extended public key can be imported to Electrum.

For the latter (new wallet); you can use an Electrum "Cold Storage" setup which uses an offine Air-Gap Electrum and an online watch-only Electrum.
Basically, create a new wallet in the offline machine (where your keys will be kept), import its xpub to the online Electrum, then this'll fulfill your requirements.
Link: https://electrum.readthedocs.io/en/latest/coldstorage.html

For the former (same Bitcoin Core wallet); get a new addresses (not bech32m) in Bitcoin Core's receive tab and use getaddressinfo command.
Among the results, "ismine" and "solvable" should be both true, then "parent_desc" isn't the migrated combo descriptor from your legacy wallet.dat which Electrum doesn't support.
Then to absolutely make sure that you're not using a watch-only Bitcoin Core wallet, use getwalletinfo command and see if "private_keys_enabled" is true.

Then you can import its parent descriptor to Electrum to restore that address and all of your address of the same script type.
You can double-check Electrum 'Addresses' tab (View->Show Addresses) to see if it has same addresses you create in Bitcoin Core's 'Receive' tab.


Lastly, to send your current bitcoin to your selected destination without the blockchain (using Electrum and Bitcoin Core):
  • In Electrum, create a new watch-only imported wallet by selecting "Import new addresses or private keys" in the new wallet menu, then paste the two addresses there.
  • Wait for the balance to sync, then create an unsigned transaction using the 'Send' tab. (send to either a new wallet or your new descriptor' address)
  • Export that transaction by clicking "Share->Save to file/Copy to Clipboard".
  • In Bitcoin Core, select the correct wallet if you have multiple loaded, then import the transaction using the menu: "File->Load PSBT from...".
  • Sign it and then copy the signed PSBT string, open the console and use the command: finalizepsbt "copied_PSBT_string"
  • Copy the result signed raw transaction and import that to Electrum using "Tools->Load transaction->from Text", review everything and click broadcast to send it.