7

I'm wondering about what the best practices are around generating and maintaining key pools for a wallet.

  • What is the maximum number of keys/addresses that can be created for a single wallet? Phrased another way, what is the largest value one can safely put for the keypool option in bitcoin.conf?

  • If I generate some keys with bitcoind keypoolrefill then generate some new addresses and then call keypoolrefill again, will the original addresses still work, and will my private key now work for all addresses I've ever created?

  • Is there some way to determine how many keys are left in the current key pool?

  • The Bitcoin documentation says that this feature is actively being phased out. When will this happen and what will the new system be?

    This wallet type is being actively phased out and discouraged from being used due to the backup hassle.

Answers to any of these questions is greatly appreciated.


Gavin Andresen (Bitcoin's Chief Scientist) has to say on the topic:

Backup every 30 sendtoaddress or generatenewaddress and you'll be fine-- you should always have at least 3 backup copies of all your keys.

If you're running a very busy service so backing up every 30 is too often, then run with -keypool=1000 and backup at least every 300 sends/generates.

  • 3
    The new system is Hierarchical Deterministic Wallets, BIP 32. – Nayuki Nov 17 '15 at 17:48
1

What is the maximum number of keys/addresses that can be created for a single wallet? Phrased another way, what is the largest value one can safely put for the keypool option in bitcoin.conf?

The type of that parameter is int64_t so the maximum value is 2^(64-1)-1. In practice, you can put any number you want and it should not make the software break. However having a lot of keys (hundreds of thousands) will result in a very large wallet and potentially slow down the wallet loading phase.

If I generate some keys with bitcoind keypoolrefill then generate some new addresses and then call keypoolrefill again, will the original addresses still work,

Yes. Everything is stored in the wallet and keys are never deleted.

and will my private key now work for all addresses I've ever created?

That's not how private keys work. Each address has a private key, so if you have one private key, it corresponds to one address. Each address that is generated in the keypool will have its own private key which is stored in the wallet file.

Is there some way to determine how many keys are left in the current key pool?

bitcoin-cli getwalletinfo will tell you how many keys are left in the keypool. The keypool is automatically refilled when your wallet is unlocked.

The Bitcoin documentation says that this feature is actively being phased out. When will this happen and what will the new system be?

This system with the keypool is still in use and making periodic backups is still recommended as the wallet contains transaction data that is not backed up by deterministic wallets. The "new system" is to use BIP 32 Hierarchical Deterministic key derivation instead of randomly generated private keys. A seed is first randomly generated and then all private keys are derived from that seed. This means that only one backup is necessary in order to backup all of your private keys, but periodic backups are still recommended as stated above.

This feature was added to Bitcoin Core in Bitcoin Core 0.13.0. Most other modern wallets use BIP 32 HD wallets.

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.