bitcoin core v25 setting hdseed

5 replies 312 views
Posts: 6 · Reputation: 64
#1May 5, 2022, 08:08 AM
hey everyone, I need some help with the new bitcoin-cli. - I created a wallet a while back using an older bitcoin core version. - I have the dump file. - I saved the private key 'L...' with 'hdseed=1' for address 'bc1...'. - I transferred some sats to an address from the dump file. - switched to a new PC. - installed bitcoin core v25. - running `bitcoin-cli getdescriptorinfo "wpkh(<seedtakenbefore, the one with hdseed=1 mentioned on the 3rd point>)"` - then did `bitcoin-cli importdescriptors '[{"desc":"wpkh(<seedtakenbefore>)#<checksumfrompreviouscommand>","timestamp":"now"}]'`. so here’s the issue: I want to check my addresses. When I use 'getaddressinfo' on one of the addresses where I sent money, it says 'ismine: false'. question: - how can I find my old addresses? meta question: - is it okay to save the key with hdseed=1? - would it have been better to use the extended master key in the dump instead of the one with hdseed=1? p.s. nothing's lost, I still have the old wallet on a hard drive. rant: why isn’t this backward compatible? this whole legacy wallet thing is kinda frustrating. the network is super solid, but the docs, guides, and software compatibility... not so much. at least that’s how I feel. appreciate any help!
2 Reply Quote Share
ryan_nodeSenior Member
Posts: 204 · Reputation: 859
#2May 5, 2022, 12:12 PM
The HD seed cannot be used in a descriptor as a seed. Using it in a descriptor as you have results in an address with the seed as the private key, not the seed as a seed and then doing derivation on it. If you want to use the seed in a descriptor wallet, then you will need to compute the BIP 32 master key from it, then specify the derivation paths for deriving the child keys from that master key. Note that the seed is a BIP 32 seed (S in this diagram: https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki#user-content-Master_key_generation), not a BIP 39 seed phrase or mnemonic. In general, Bitcoin Core does not intend the seeds that it produces to be handled by people directly since they are incomplete information for restoring a wallet. You should instead be backing up entire wallet files and restoring them when you need to restore backups, rather than trying to find an individual component of the wallet. If you insist on using the seed, you need to create a legacy wallet and use the sethdseed command. Then you will get the addresses that you expect. Then you should migrate that to a descriptor wallet. However, after migration, the seed will not be used by the wallet anymore. New descriptors are generated which essentially replace that seed.
4 Reply Quote Share
Posts: 6 · Reputation: 64
#3May 5, 2022, 05:36 PM
so would that mean that a paper wallet can't be done anymore? what are other solutions that do not imply saving a file? plus, i read the legacy wallet option is going to be removed from the bitcoin core, so that wouldn't be a long term solution. i wanted to stamp the hd seed in some metal washers, and this is a bummer. maybe now i find a solution, then in two year that won't work. consider i want to do something that would last forever. what would you do?
3 Reply Quote Share
ryan_nodeSenior Member
Posts: 204 · Reputation: 859
#4May 5, 2022, 07:13 PM
Bitcoin Core has never supported paper wallets. In any case, single key paper wallets will work with descriptor wallets since they are single private keys. A HD seed is not that. Exporting and storing the descriptors of a descriptor wallet. Yes, it will be. However there are plans to reintroduce sethdseed in some form so you could still store just the seed. But that's still not exactly sufficient as you don't have information about derivation paths and scripts. Descriptors contain all of that information, so I recommend you store those. Nothing is guaranteed to last forever, but something that follows published standards is certainly more likely. The legacy wallet's HD seed stuff most certainly does not follow the existing standards. I would suggest using a descriptor wallet and writing down the descriptors. While it's a lot more verbose, it is also much more complete and will not rely on guesswork in the future. You could also just do a standard BIP 39 mnemonic, but keep in mind that these do not contain derivation path or script information, and they are not (currently) supported by Bitcoin Core.
1 Reply Quote Share
Posts: 6 · Reputation: 64
#5May 5, 2022, 08:34 PM
ok clear, will try things out. i guess i need to save the xpriv from the `listdescriptors` command, right? if i may take advantage of your generosity, can you explain this (i take my previous points): - i sent some sats to some address that were in the dumpfile, *bc1..abcd* - if i do 'getaddressinfo' of the *bc1..abcd* address i sent money to it tells me 'ismine: false' i don't have a full node to test this at the moment: - is the money gone? - or will it have the ability to 'see' that address balance if i run a node? thank you again
2 Reply Quote Share
ryan_nodeSenior Member
Posts: 204 · Reputation: 859
#6May 6, 2022, 01:43 AM
You need to save everything, not just the private key. Otherwise you are throwing away information that is necessary for restoration. If you do not save the entire descriptor, you lose the derivation path information and the address types and will have to guess those in the future. Backups are much better when they contain all of the information necessary in order to rediscover your funds. That address is derived from the master private key that itself is derived from the seed. Since you have not done sethdseed but rather just imported the seed as a normal private key, these derivation steps have not been done. The wallet does not know that the private key you imported is actually a seed and that it needs to do derivation on it. So all addresses that are derived from it are not known by your wallet. It is not gone. However you need to make the wallet aware of the fact that you have a seed and not just a single private key.
2 Reply Quote Share

Related topics