1

I want to know if an address is spendable by an HD seed and for that purpose I am using the following command:

> bitcoin-cli getaddressinfo 3LFc64RRd96ejjYvm14KaogBF9fmeNmePW | jq '.solvable'
false

However as mentioned here and here it's impossible to know with 100% certainty that an HD seed can't spend from a certain address as one would need to generate infinite addresses. To counterbalance that I discovered a command that increases the 'search space':

> bitcoin-cli keypoolrefill 1000

However, I am not sure getaddressinfo is sentitive to this keypoolinfo parameter or is just checking the addresses so far generated (the ones that can be obtained via bitcoin-cli listreceivedbyaddress 0 true). I could test this with a second node but my other node might be using another seed to generate new addresses. Even though I used sethdseed, I see a different xpriv when dumping the wallet.

2

Trying to enumerate all private keys using Bitcoin Core's wallet is extremely inefficient. Furthermore, any address that you generate in Bitcoin Core will inherently come from a HD seed because Bitcoin Core is a HD wallet and uses a HD seed. You also aren't going to get any information for a HD address that is not part of your wallet.

However, I am not sure getaddressinfo is sentitive to this keypoolinfo parameter or is just checking the addresses so far generated (the ones that can be obtained via bitcoin-cli listreceivedbyaddress 0 true).

It is "sensitive" to the keypool. When you add keys to the keypool, they are actually generated and saved to the wallet file along with some metadata. getaddressinfo looks up whatever metadata is available regardless of the associated key being in the keypool or not.

I could test this with a second node but my other node might be using another seed to generate new addresses.

Unless you have explicitly set a specific seed, then it most definitely is. Otherwise that would be a security vulnerability and anyone could steal anyone else's coins if they all used the same seed.

Even though I used sethdseed, I see a different xpriv when dumping the wallet.

You need to provide the seed of your first wallet. Otherwise it will generate a new random seed and use that.

| improve this answer | |
  • Thanks for the quick answer, good to know getaddressinfo is 'sensitive to keypoolrefill. Is there any way to read the information contained inside wallet.dat (or fee_estimates.dat for that matter?) Regarding the last the last topic, yes, I know every new wallet will have a random new seed by default, it just seemed that I was not 'overriding' this new seed with the sethdseed command that I used to import – Pedro Nov 28 '19 at 16:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.