Title: importing public keys, derivation paths and zero balance Post by: blapaz on May 05, 2024, 03:54:57 PM hi,
i used bitcoin core long time ago and exported the public keys. i have a file like this: ``` combo(xpub.../0'/0'/*')#6h... combo(xpub.../0'/1'/*')#23... pkh([fd.../44'/0'/0']xpub.../0/*)#59... pkh([fd.../44'/0'/0']xpub.../1/*)#93... sh(wpkh([fd.../49'/0'/0']xpub.../0/*))#6ls... sh(wpkh([fd.../49'/0'/0']xpub.../1/*))#077... tr([fd.../86'/0'/0']xpub.../0/*)#7253... tr([fd.../86'/0'/0']xpub.../1/*)#073... wpkh([fd.../84'/0'/0']xpub.../0/*)#w9xl4... wpkh([fd.../84'/0'/0']xpub.../1/*)#l3r7... ``` i created 5 wallets and imported the public keys. the import accepted only the 'xpub...' part. why do i see zero balance? i had some funds in it. why don't i see the addresses that i previously used? i just want to have a watch only wallet, from which to check: - the addresses - the balance thanks in advance Title: Re: importing public keys, derivation paths and zero balance Post by: Charles-Tim on May 05, 2024, 04:00:35 PM It is because the address is not funded or because the coins on it has been spent.
Title: Re: importing public keys, derivation paths and zero balance Post by: Yamane_Keto on May 05, 2024, 06:25:49 PM why do i see zero balance? i had some funds in it. Search for the addresses in the block explorer. If there are no previous transactions, then the problem is most likely with derivation paths. why don't i see the addresses that i previously used? Since you did not generate xpub (in this case we call it Extended Public Key and not master private key) using electrum, you will need to modify the path to: Code: m/49'/0'/0'/49'/0'/0'/0 This is assuming that we are talking about Legacy address. What are you trying to do here? The easiest solution is to sync Bitcoin Core and then create a new Electrum wallet and send bitcoin to it. after that export your master private key a.k.a watch-only wallet Title: Re: importing public keys, derivation paths and zero balance Post by: BitMaxz on May 05, 2024, 10:57:29 PM i used bitcoin core long time ago and exported the public keys. Are you talking about Electrum or Bitcoin core? Weird the public key you posted above generated seems not from Bitcoin core but Electrum? I think the post above is right your wallet might be in a different derivation path but if you can't find it there's another way to scan it and look for the right derivation path just make sure that you only paste the xpub(Master public key) of your wallet, not a master private key. Here's the tool below and take note it only works on legacy wallets so if the wallet you generated before is segwit version then this won't work. - https://blockpath.com/wallets/local/101?action=appxpub For segwit wallet, you can use this tool - https://github.com/LedgerHQ/xpub-scan Title: Re: importing Bitcoin Core descriptor to Electrum Post by: nc50lc on May 06, 2024, 04:51:59 AM why do i see zero balance? i had some funds in it. That's because Electrum only derived the legacy addresses at xpub/0/* and xpub/1/* of the provided xpub from your Bitcoin Core's descriptors.why don't i see the addresses that i previously used? To import the correct addresses, you'll need to convert your xpub to other formats with the command convertxkey(). And read the notes at the bottom. These for example: pkh([fd.../44'/0'/0']xpub.../0/*)... In the order given:pkh([fd.../44'/0'/0']xpub.../1/*)... sh(wpkh([fd.../49'/0'/0']xpub.../0/*))... sh(wpkh([fd.../49'/0'/0']xpub.../1/*))... -snip- wpkh([fd.../84'/0'/0']xpub.../0/*)#... wpkh([fd.../84'/0'/0']xpub.../1/*)#...
Quote from: blapaz tr([fd.../86'/0'/0']xpub.../0/*)... Your TapRoot, "tr()" descriptors aren't supported by Electrum at the momenttr([fd.../86'/0'/0']xpub.../1/*)... so your only choice is to create an imported watch-only wallet using the bech32m addresses instead via "Import bitcoin addresses or private keys" new wallet option. Quote from: blapaz combo(xpub.../0'/0'/*')#6h... This one is tricky, since Electrum is designed to take 'extended public key' at the account_index (the "xpub/0/*" above).combo(xpub.../0'/1'/*')#23... And the derivation path indicates that the lower hierarchy should be derived with hardened derivation: you can't import that to Electrum because it doesn't support hardened addresses Instead, you should just import the addresses associated with your funds to Electrum. Note: Those "combo()" desccriptors are probably your keystore before migrating to a descriptor wallet and most probably where your bitcoins are if you've just migrated. The other descriptors are the ones created after migrating and probably empty. (those descriptors tell that it's a migrated wallet) Title: Re: importing public keys, derivation paths and zero balance Post by: blapaz on May 06, 2024, 09:58:21 AM thank you.
Quote Note: Those "combo()" desccriptors are probably your keystore before migrating to a descriptor wallet and most probably where your bitcoins are if you've just migrated. The other descriptors are the ones created after migrating and probably empty. (those descriptors tell that it's a migrated wallet) indeed, i migrated the wallet time ago (using bitcoin core). i know that i have the funds, because 2 of my addresses have funds. 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) any solution for this? i thought that i could do this with the public keys but i think i was wrong. ps: i am not afraid of the console, if there was a way to connect bitcoin core to an external node i'd use that Title: Re: importing public keys, derivation paths and zero balance Post by: nc50lc on May 07, 2024, 04:45:48 AM any solution for this? This depends on the addresses associated with your UTXOs. (those 2 addresses with balance)i thought that i could do this with the public keys but i think i was wrong. If its parent descriptor is indeed those "combo()" descriptors, then, there's no way you can import the descriptor's master public key pair of the master private key to Electrum due to its key derivation which entirely uses "hardened derivation". To make sure, use Bitcoin Core's console and use the command: getaddressinfo "address" and it'll show you its parent descriptor. If it's in any of the other descriptors (excluding "tr"), then you can do the instructions in my previous reply. Quote from: blapaz i just want a way to: If it's still in the combo() descriptors;- 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) 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 Electrum wallet in an offline machine, import its xpub to an online Electrum, then this'll fulfill your requirements. Link: https://electrum.readthedocs.io/en/latest/coldstorage.html (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. After confirming those, you can import its parent descriptor's extended public key to Electrum to restore that address and all of your (future) address of the same script type. You can double-check Electrum's 'Addresses' tab (View->Show Addresses) to see if it has same addresses you create in Bitcoin Core's 'Receive' tab. (same address type selected) Lastly, to send your current bitcoin to your selected destination without the blockchain (using Electrum and Bitcoin Core):
Title: Re: importing public keys, derivation paths and zero balance Post by: blapaz on May 07, 2024, 06:37:49 AM ok, then there's no easy way.
wonder if the devs or people who work on this never think about certain scenarios. i figured it would be easier (and safer for me) to get the full blockchain + bitcoin core (the same version i used previously) on a non connected laptop and just watch the addresses. thanks anyway a lot for the help. Title: Re: importing public keys, derivation paths and zero balance Post by: nc50lc on May 07, 2024, 07:12:46 AM ok, then there's no easy way. Problem is that's kind of unique to Bitcoin Core (at least "was").wonder if the devs or people who work on this never think about certain scenarios. Its legacy wallet uses a BIP32 derivation path that uses all hardened derivation from extended key-> account_index ->chain_index -> address_index. Wallets such as Electrum don't follow that standard. But in new wallets created in newer versions of Bitcoin Core, you see that it's possible to restore it Electrum in the way I've provided. Plus Bitcoin Core already stopped generating legacy wallet.dat and will soon drop support to it so implementing such feature could be a waste of effort. But it's certainly possible if Electrum's future version that supports descriptor can take full derivation path and hardened addresses. |