Bitcoin Forum

Bitcoin => Bitcoin Technical Support => Topic started by: Mark Oates on April 01, 2013, 01:10:15 PM



Title: Question about backup
Post by: Mark Oates on April 01, 2013, 01:10:15 PM
Ok, so I backup my wallet and store it somewhere.

Then in my client, I create a new address to receive coins and have some money sent my way.

Do I need to backup my wallet again because I have created a new address?


Title: Re: Question about backup
Post by: DannyHamilton on April 01, 2013, 02:38:01 PM
Ok, so I backup my wallet and store it somewhere.

Then in my client, I create a new address to receive coins and have some money sent my way.

Do I need to backup my wallet again because I have created a new address?

That depends on which wallet program you are using, but in most cases the answer is no.

If you are using Bitcoin-Qt with the default configuration, it pre-generates the next 100 addresses that it will use and stores them in the wallet.dat file.  This means that new address that you "created" was already in the wallet.dat when you backed it up (as will be the next 99 addresses "created" after that).  Each time Bitcoin-Qt pulls an address from the pool of pre-generated addresses, it pre-generates another address and adds it to the pool so that there are always 100 "future" addresses in any new backup.

There are 2 things to be aware of if you are going to rely on this pre-generation of addresses.

First, when you add (or change) a password to the wallet it tosses out all 100 of the pre-generated addresses and generates 100 new ones.  This means that if you back-up the wallet, then add a password, and then "create" a new address to receive coins, the backup will not have the address and will be unable to access those coins.

Second, Bitcoin-Qt uses one of those pre-generated addresses without telling you about it every time you create a transaction to send bitcoins.  This address is kept hidden from you, and is used to store the "change" from the transaction.  Bitcoin-Qt will generally try to choose to use more bitcoins from your wallet than are needed for the transaction you are creating, then it will send the excess back to your wallet using this "change" address.  This means you can't just count up the addresses in the "receive coins" tab of the wallet, since additional addresses were used up each time you sent a transaction as well.


Title: Re: Question about backup
Post by: Mark Oates on April 01, 2013, 04:55:32 PM
Awesome.  Great answer, thanks.  :)