Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: TheMagikarp on June 01, 2011, 07:54:51 AM



Title: Backing up wallet.dat
Post by: TheMagikarp on June 01, 2011, 07:54:51 AM
I've created a backup of my wallet.dat (in a TrueCrypt container, of course) and have it stored in 7 or 8 different places.

I read somewhere that if you go too long without updating your wallet.dat that it can become out of date and won't work properly anymore, something to do with only 99 receiving addresses being stored in the file. Realistically, how often should I update my backups to make sure they stay functioning? I intended on updating them roughly once a month. Is this not often enough, or is it more often than I really need to worry about?

I receive 1-2 payments a day, on average, if that makes any difference.


Title: Re: Backing up wallet.dat
Post by: foo on June 01, 2011, 09:29:58 AM
Quote from the Wiki: https://en.bitcoin.it/wiki/Securing_your_wallet

Quote
The wallet contains a pool of queued keys. By default there are 100 keys in the key pool. The size of the pool is configurable using the "-keypool" command line argument. When you need an address for whatever reason (send, “new address”, generation, etc.), the key is not actually generated freshly, but taken from this pool. A brand new address is generated to fill the pool back to 100. So when a backup is first created, it has all of your old keys plus 100 unused keys. After sending a transaction, it has 99 unused keys. After a total of 100 new-key actions, you will start using keys that are not in your backup. Since the backup does not have the private keys necessary for authorizing spends of these coins, restoring from the old backup will cause you to lose Bitcoins.


Title: Re: Backing up wallet.dat
Post by: Pieter Wuille on June 01, 2011, 09:44:21 AM
The only actions that require fresh keys from the pool, are change sent back when sending a payment, and generations (mining). You can do at least 100 such actions before a new backup is required.


Title: Re: Backing up wallet.dat
Post by: vuce on June 01, 2011, 10:04:17 AM
The only actions that require fresh keys from the pool, are change sent back when sending a payment, and generations (mining). You can do at least 100 such actions before a new backup is required.
yesterday I tried restoring a wallet from backup and lost what was sent back with the previous transaction (shows as debit to the newly created address, which obviously isn't in the wallet). There was only one transaction difference between the two wallets. When was this "100 key pool by default" introduced?


Title: Re: Backing up wallet.dat
Post by: Pieter Wuille on June 01, 2011, 10:24:46 AM
The key pool was introduced in 0.3.14

Restoring of a wallet backup is supported since 0.3.20 with -rescan, in earlier versions you had to remove the block database and redownload it.

Since 0.3.21, -rescan is done automatically.


Title: Re: Backing up wallet.dat
Post by: TheMagikarp on June 01, 2011, 11:46:05 AM
So if I were to make 3 transactions a day, every day, I'd need to update my backup roughly every month, with no backup much older than that having all my Bitcoins in it.

Please correct me if I'm wrong.


Title: Re: Backing up wallet.dat
Post by: vuce on June 01, 2011, 12:32:58 PM
The key pool was introduced in 0.3.14

Restoring of a wallet backup is supported since 0.3.20 with -rescan, in earlier versions you had to remove the block database and redownload it.

Since 0.3.21, -rescan is done automatically.
this is weird then, I'm running 0.3.21beta


Title: Re: Backing up wallet.dat
Post by: Maged on June 01, 2011, 08:10:58 PM
So if I were to make 3 transactions a day, every day, I'd need to update my backup roughly every month, with no backup much older than that having all my Bitcoins in it.

Please correct me if I'm wrong.
That's correct, assuming that you are re-using your receiving addresses instead of manually generating a new one.