Take the 2-minute tour ×
Bitcoin Stack Exchange is a question and answer site for Bitcoin crypto-currency enthusiasts. It's 100% free, no registration required.

I am doing some test, and am getting weird behavior with keypool.

In the 0.4.0rc1 bitcoin client:

If I set keypool=1, how many times should I be able to do getnewaddress?

Are there any resources where I can read about keypool, and how it works?

share|improve this question
1  
Presumably you are referring to the default Bitcoin client? If so you should probably specify in the post, as it otherwise is devoid of context. –  Michael McGowan Sep 8 '11 at 19:26
    
I have edited the question to show that I mean the 0.4.0rc1 client –  Alex Waters Sep 8 '11 at 19:31
1  
Others have provided the explanation on what keypool=1 does. I would strongly recommend not using a small kelpool unless you perform backs after each transaction. When the client creates an address it does so randomly. So if an address is created AFTER a backup then that address will be lost if wallet is lost. With keypool of 100 (the default) you could make 100 new addresses (via new transactions) and the backup would still be valid. –  DeathAndTaxes Nov 5 '11 at 20:01
add comment

2 Answers 2

up vote 10 down vote accepted

You can do getnewaddress as many times as you want. The keypool parameter just sets how many extra keys the client creates when it needs to create keys. With keypool set to 1, the client will create one extra key every time it needs to create a key.

Setting keypool low will keep your wallet smaller. But it will mean you have to backup your wallet more often to avoid losing the keys to newly-created addresses.

share|improve this answer
add comment

The keypool is a collection of unused addresses in your wallet. The keypool parameter tells the client how many unused addresses to keep in its pool.

Almost every time you send a Bitcoin payment, some change is generated and sent to a previously unused address. If you have a keypool, then each time a new address is needed one of the keypool addresses is used, and a new address is created and placed in the keypool to replace the one that was just used.

The purpose of the keypool is to allow you to backup your wallet file less frequently and still have access to all your funds in the event of a hard drive failure. If you didn't have a keypool, and made a backup of your wallet, then made a payment, and then suffered a disk crash, you would lose the change which came from that payment because it would have been sent to a new address that wasn't in the backup.

With a keypool of 100 addresses, you can make up to 100 payments between backups and still be able to access all your funds.

https://en.bitcoin.it/wiki/Key_pool

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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