Bitcoin Forum

Other => Beginners & Help => Topic started by: hayek on November 13, 2013, 06:58:22 PM



Title: Public Keys & Wallet Backup
Post by: hayek on November 13, 2013, 06:58:22 PM
Weird question

1.) I backup my wallet.
2.) I generate a new address
3.) Send BTC to the new address
4.) Delete current wallet
5.) Restore from backup

Will I lose the BTC I sent in step 3? Even if I generate a new address it won't be the same public key since a new address generates a new keypair. Or does the keypool address this problem? So I would have to generate enough new addresses to get a new key pair from a new keypool not in my backup wallet?


Title: Re: Public Keys & Wallet Backup
Post by: panck4beer on November 13, 2013, 07:00:27 PM
Will I lose the BTC I sent in step 3?


No, 100 addresses are always pregenerated in wallet.dat


Title: Re: Public Keys & Wallet Backup
Post by: panck4beer on November 13, 2013, 07:03:18 PM
So I would have to generate enough new addresses to get a new key pair from a new keypool not in my backup wallet?


Yes, over 100, including using change addresses when you send BTC


Title: Re: Public Keys & Wallet Backup
Post by: odolvlobo on November 13, 2013, 07:06:56 PM
Will I lose the BTC I sent in step 3?
No, 100 addresses are always pregenerated in wallet.dat

That is how Bitcoin-QT works, but other wallet software works differently.


Title: Re: Public Keys & Wallet Backup
Post by: DannyHamilton on November 13, 2013, 07:17:23 PM
does the keypool address this problem? So I would have to generate enough new addresses to get a new key pair from a new keypool not in my backup wallet?

It depends on the wallet (Bitcoin-Qt? Electrum? MultiBit?).  Different wallets result in different behavior.

In the case of Bitcoin-Qt you are correct, the keypool addresses this problem, and you'd have to generate enough new addresses to get a new key pair that is not in the keypool of your backup wallet.

Keep in mind that Bitcoin-Qt uses a new address from the keypool every time you send a transaction.  Therefore, you need to count not only the times you click the "New Address" button, but also how many transactions you've sent since your last backup.  When the sum of both those things together exceeds 100, you will then have addresses in your wallet that are not stored in the backup.