0

When I create a new blank wallet and set the seed with both newkeypool as True and False...I do not see a difference in the resulting dumped wallets.

The cli help states:

Arguments:
1. newkeypool    (boolean, optional, default=true) Whether to flush old unused addresses, including change addresses, from the keypool and regenerate it.
                 If true, the next address from getnewaddress and change address from getrawchangeaddress will be from this new seed.
                 If false, addresses (including change addresses if the wallet already had HD Chain Split enabled) from the existing
                 keypool will be used until it has been depleted.

I am using testnet

My process:

bitcoin-cli createwallet "mytestwallet" false true
bitcoin-cli -rpcwallet=mytestwallet sethdseed false c...
bitcoin-cli getnewaddress

Then I delete the wallet rm -R .bitcoin/testnet3/wallets/mytestwallet and recreate with:

bitcoin-cli createwallet "mytestwallet" false true
bitcoin-cli -rpcwallet=mytestwallet sethdseed true c...
bitcoin-cli getnewaddress

The resulting new address is the same regardless of the newkeypool boolean

The dumpwallet looks the same but the keys and addresses are in difference order...

Why with bitcoin-core is the address generated after a sethdseed command is the same m/0'/0'/0' whether newkeypool is set to True or False?

2

newkeypool only applies to wallets which already have a keypool. If it is true, the current keypool will be emptied and filled with keys generated with the new seed. If it is false, then it will not be emptied, but new keys that are added to the keypool will be generated with the new seed.

With a blank wallet, there are no keys in the wallet, so there are also no keys in the keypool. Thus the newkeypool option has no effect on a blank wallet. If you set it to true, the keypool is already empty and it gets filled by keys produced by the new seed. If you set it to false, new keys will be added to the keypool generated from the new seed, and because it is empty, the first key you request from it will be a new key.

You will be able to see the difference if you make a wallet that isn't blank, or if you use sethdseed again.

2
  • Ok, if you use sethdseed again - it has to be a different seed. Just to note for other readers.
    – stephen
    Aug 17 '21 at 18:05
  • 1
    sethdseed can be used without a seed argument and a randomly generated seed will be used.
    – Andrew Chow
    Aug 17 '21 at 18:32

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.