<p>There are different possible approaches.</p>

<p>Most current wallet software uses HD wallets, where keys and addresses are generated as needed from a master seed.  In this case, a change address would likely not be generated until it is needed.  A new address would be generated for each new transaction as this is better for privacy.</p>

<p>With Bitcoin Core, prior to the implementation of HD wallets, the default was to pre-generate 100 addresses and store the keys in wallet.dat as a "keypool". Change addresses would then be taken from the keypool, again using a new one for each transaction.  This was done so that each time you backed up wallet.dat, you would also be able to protect the keys for transactions you hadn't yet made.  Without this behavior, you would have to back up wallet.dat immediately after every new transaction - and if your disk crashed between the transaction and the backup, you would lose coins.</p>

<p>Some wallet software used to only generate one address and use it for all incoming transactions as well as change.  This is no longer common, though some wallets still provide it as an option.</p>

CC BY-SA 3.0
2018-01-16T15:25:11.183Z
2018-01-16T15:25:11.183Z
Nate Eldredge
<p>What is the precedence in terms of generating new addresses?</p>

<p>Do wallets generate 10 on the go, then switch them out or do they generate a new one, each time the old one has been used?</p>

<p>Also, do they generate new change addresses as soon as they see that a transaction will need a change address?</p>

<blockchain><bitcoin-core>
Are change addresses generated on the fly or pre-generated with wallets?
Kyle Graham
# Are change addresses generated on the fly or pre-generated with wallets?

(Asked by: username_0 on 2018-01-16)

What is the precedence in terms of generating new addresses?

Do wallets generate 10 on the go, then switch them out or do they generate a new one, each time the old one has been used?

Also, do they generate new change addresses as soon as they see that a transaction will need a change address?

**Tags:** blockchain, bitcoin-core


---

## 1 answers

### Answer by username_1 on 2018-01-16. Score: 2

There are different possible approaches.

Most current wallet software uses HD wallets, where keys and addresses are generated as needed from a master seed. In this case, a change address would likely not be generated until it is needed. A new address would be generated for each new transaction as this is better for privacy.

With Bitcoin Core, prior to the implementation of HD wallets, the default was to pre-generate 100 addresses and store the keys in wallet.dat as a "keypool". Change addresses would then be taken from the keypool, again using a new one for each transaction. This was done so that each time you backed up wallet.dat, you would also be able to protect the keys for transactions you hadn't yet made. Without this behavior, you would have to back up wallet.dat immediately after every new transaction - and if your disk crashed between the transaction and the backup, you would lose coins.

Some wallet software used to only generate one address and use it for all incoming transactions as well as change. This is no longer common, though some wallets still provide it as an option.


---

