<p>When a wallet is created, it contains 100 keys in its "key pool". Only one of them is made visible, but when you create a new address, it actually just takes one key from the pool. The reason for this is so you don't need to backup your wallet.dat file after every transaction or new address,</p>

<p>New keys are generated every time one is pulled from the key pool, if possible, to keep the key pool at size 100. In an encrypted wallet, the passphrase is required to store new keys, so the key pool is only filled when the wallet gets unlocked.</p>

CC BY-SA 3.0
2012-11-25T18:08:01.677Z
So then, is it a certainty that one private key has just one public key associated with it?
smickles
CC BY-SA 3.0
2012-11-27T11:03:47.710Z
Every EC private key has exactly one EC public key associated with it. This public key can be serialized in compressed or uncompressed form, though, and as the address is derived from the hash of the serialized public key, there are really two addresses for every private/public key. In Bitcoin we solve this by separating all of them: the private keys get a marker byte, and we consider the compressed and uncompressed public key to be separate.
Pieter Wuille
CC BY-SA 3.0
2016-05-31T11:25:57.520Z
what does EC stand for?
knocte
CC BY-SA 3.0
2016-05-31T12:00:33.973Z
Elliptic Curve.
Pieter Wuille
CC BY-SA 3.0
2012-11-25T10:57:27.143Z
2012-11-25T10:57:27.143Z
Pieter Wuille
<p>I'm just assuming that the wallet.dat file created by the reference client contains just one private key. (Correct me if I'm wrong here)</p>

<p>I want to know if the client generates additional private keys and if so, under what circumstances? Does a keypoolrefill affect the quantity of private keys? Does generating a given number of addresses cause an additional private key to be generated? etc...</p>

<address><private-key><keypool>
Once a wallet file is initially created, does the reference client generate additional private keys?
smickles
# Once a wallet file is initially created, does the reference client generate additional private keys?

(Asked by: username_0 on 2012-11-25)

I'm just assuming that the wallet.dat file created by the reference client contains just one private key. (Correct me if I'm wrong here)

I want to know if the client generates additional private keys and if so, under what circumstances? Does a keypoolrefill affect the quantity of private keys? Does generating a given number of addresses cause an additional private key to be generated? etc...

**Tags:** address, private-key, keypool


---

## 1 answers

### Answer by username_1 on 2012-11-25. Score: 7

When a wallet is created, it contains 100 keys in its "key pool". Only one of them is made visible, but when you create a new address, it actually just takes one key from the pool. The reason for this is so you don't need to backup your wallet.dat file after every transaction or new address,

New keys are generated every time one is pulled from the key pool, if possible, to keep the key pool at size 100. In an encrypted wallet, the passphrase is required to store new keys, so the key pool is only filled when the wallet gets unlocked.

> **Comments:**
> **username_0**: So then, is it a certainty that one private key has just one public key associated with it?  
> **username_1**: Every EC private key has exactly one EC public key associated with it. This public key can be serialized in compressed or uncompressed form, though, and as the address is derived from the hash of the serialized public key, there are really two addresses for every private/public key. In Bitcoin we solve this by separating all of them: the private keys get a marker byte, and we consider the compressed and uncompressed public key to be separate.  
> **username_2**: what does EC stand for?  
> **username_1**: Elliptic Curve.  

---

