Bitcoin Forum

Bitcoin => Bitcoin Technical Support => Topic started by: RB25 on May 28, 2014, 09:58:35 PM



Title: Question about wallet.dat
Post by: RB25 on May 28, 2014, 09:58:35 PM
Hello-

  If I have a copy of my wallet.dat file, no matter how old, if I reformat my computer and replace the wallet file, will the wallet re-sync with the most recent balance of coins? Example: I saved a copy of my wallet.dat file 3 months ago on a flash drive. Yesterday, I reformatted and made the mistake of not updating the wallet.dat file with the latest coin balance. If I put the old wallet.dat file in the folder and re-sync the wallet, will the newer coins populate to the wallet address, despite the file being 3 months old?

Thank you


Title: Re: Question about wallet.dat
Post by: shorena on May 28, 2014, 10:04:51 PM
Hello-

  If I have a copy of my wallet.dat file, no matter how old, if I reformat my computer and replace the wallet file, will the wallet re-sync with the most recent balance of coins? Example: I saved a copy of my wallet.dat file 3 months ago on a flash drive. Yesterday, I reformatted and made the mistake of not updating the wallet.dat file with the latest coin balance. If I put the old wallet.dat file in the folder and re-sync the wallet, will the newer coins populate to the wallet address, despite the file being 3 months old?

Thank you

The short answer is: maybe. I assume you use bitcoin core (because wallet.dat), which pregenerates private keys for you. If you have only used "new keys" that where allready pre generated for you 3 month ago, you have no problem. If you however used a lot of new addresses within these 3 month you might have bad luck.


Title: Re: Question about wallet.dat
Post by: DannyHamilton on May 28, 2014, 10:13:32 PM
But if some coins were ++ into your account and you didn't backup those private keys - then those will be gone.

Correct me if I am wrong.

You are wrong.

shorena was correct.

The wallet pre-generates the next 100 addresses (and private keys) that it will use.  Each time you request a new address the wallet gets the address from this pre-generated pool.  Each time you send a transaction, the wallet sends the change from the transaction to a new address from this pre-generated pool.

As long as your wallet hasn't used more than 100 addresses since your last backup, you will still be able to recover the bitcoins that were received AFTER the wallet was backed up.



Title: Re: Question about wallet.dat
Post by: roslinpl on May 28, 2014, 10:23:40 PM
But if some coins were ++ into your account and you didn't backup those private keys - then those will be gone.

Correct me if I am wrong.

You are wrong.

shorena was correct.

The wallet pre-generates the next 100 addresses (and private keys) that it will use.  Each time you request a new address the wallet gets the address from this pre-generated pool.  Each time you send a transaction, the wallet sends the change from the transaction to a new address from this pre-generated pool.

As long as your wallet hasn't used more than 100 addresses since your last backup, you will still be able to recover the bitcoins that were received AFTER the wallet was backed up.



well :) we are learning all the time :) Thanks for your answer and for correcting my words. I must say I totally forgot about this feature as I indeed heard about it before.
Now I will remember this till the end of my life :)

100 transactions is a lot so perhaps OP will be able to recover all of his coins in this case.



Title: Re: Question about wallet.dat
Post by: RB25 on May 28, 2014, 10:35:03 PM
So, if I understand this right, the wallet.dat file connects the wallet address to the blockchain so it can update the coins associated with that address? As long as I have a wallet.dat backup file with a single wallet address, I should be able to "download" all the coins associated with that address to the wallet regardless of the age of the back-up file?


Title: Re: Question about wallet.dat
Post by: roslinpl on May 28, 2014, 10:39:25 PM
So, if I understand this right, the wallet.dat file connects the wallet address to the blockchain so it can update the coins associated with that address? As long as I have a wallet.dat backup file with a single wallet address, I should be able to "download" all the coins associated with that address to the wallet regardless of the age of the back-up file?

Yes. And according to infos posted above - if you didn't made more than 100s transaction from a day of backup you will have all of your coins back to your wallet after importing your wallet.dat and synchronizing wallet with a blockchain.
It doesn't matter how old it is. Time doesn't matter as blockchain will recognize all of the private keys from the past.


Title: Re: Question about wallet.dat
Post by: DannyHamilton on May 28, 2014, 10:49:08 PM
As long as I have a wallet.dat backup file with a single wallet address,

Bitcoin-Qt (or as the newer version is called, Bitcoin Core) uses a new address for change that it keeps hidden from you and doesn't tell you about every time you send bitcoins in a transaction.  Therefore, if you have ever sent any bitcoins anywhere, then your wallet is already using more than one address (you just don't know it).

As long as the total sum of both the bitcoin addresses that you generated for receiving bitcoins AND the number of transactions that you've sent since your last backup is less than 100, then your wallet should have all the information it needs to recover access to all your bitcoins in the blockchain.


Title: Re: Question about wallet.dat
Post by: RB25 on May 28, 2014, 10:52:15 PM
As long as I have a wallet.dat backup file with a single wallet address,

Bitcoin-Qt (or as the newer version is called, Bitcoin Core) uses a new address for change that it keeps hidden from you and doesn't tell you about every time you send bitcoins in a transaction.  Therefore, if you have ever sent any bitcoins anywhere, then your wallet is already using more than one address (you just don't know it).

As long as the total sum of both the bitcoin addresses that you generated for receiving bitcoins AND the number of transactions that you've sent since your last backup is less than 100, then your wallet should have all the information it needs to recover access to all your bitcoins in the blockchain.

Does this also hold true for altcoins? I am not trying to make this an off-topic reply, but just asking since it seems all of the altcoin wallets are based off of the bitcoin wallet.


Title: Re: Question about wallet.dat
Post by: DannyHamilton on May 28, 2014, 10:56:30 PM
Does this also hold true for altcoins? I am not trying to make this an off-topic reply, but just asking since it seems all of the altcoin wallets are based off of the bitcoin wallet.

That really depends on how the developer of the alt-coin chooses to write the program.  If it is exactly the same as Bitcoin-Qt (now called Bitcoin Core) with a new genesis block, or a few extremely minor tweaks, then yes it would be true for the alt-coin.

However, an altcoin developer can create an entirely new system that, while based on the same concept of distributed consensus, may not use much of the same wallet code as Bitcoin at all.


Title: Re: Question about wallet.dat
Post by: bigdave on May 28, 2014, 11:45:42 PM
As long as I have a wallet.dat backup file with a single wallet address,

Bitcoin-Qt (or as the newer version is called, Bitcoin Core) uses a new address for change that it keeps hidden from you and doesn't tell you about every time you send bitcoins in a transaction.  Therefore, if you have ever sent any bitcoins anywhere, then your wallet is already using more than one address (you just don't know it).

As long as the total sum of both the bitcoin addresses that you generated for receiving bitcoins AND the number of transactions that you've sent since your last backup is less than 100, then your wallet should have all the information it needs to recover access to all your bitcoins in the blockchain.

I use the latest Bitcoin Core and this statement does not make me feel all warm in fuzzy inside if my hard drive ever takes a shit and I have to restore from my backup wallet.dat.


Title: Re: Question about wallet.dat
Post by: DannyHamilton on May 29, 2014, 12:03:41 AM
As long as I have a wallet.dat backup file with a single wallet address,

Bitcoin-Qt (or as the newer version is called, Bitcoin Core) uses a new address for change that it keeps hidden from you and doesn't tell you about every time you send bitcoins in a transaction.  Therefore, if you have ever sent any bitcoins anywhere, then your wallet is already using more than one address (you just don't know it).

As long as the total sum of both the bitcoin addresses that you generated for receiving bitcoins AND the number of transactions that you've sent since your last backup is less than 100, then your wallet should have all the information it needs to recover access to all your bitcoins in the blockchain.

I use the latest Bitcoin Core and this statement does not make me feel all warm in fuzzy inside if my hard drive ever takes a shit and I have to restore from my backup wallet.dat.

Keep a regular schedule of backups, and you shouldn't have a problem.

If you think you'll go through 100 addresses to quickly for a reasonable duration between backups, then you can increase the size of the pool with a setting in bitcoin.conf


Title: Re: Question about wallet.dat
Post by: RB25 on June 01, 2014, 12:01:46 AM
Follow-up:

  It worked for Bitcoin Core 0.9.1 with an old wallet file and most of the altcoin wallet files I saved. The only one that didn't totally update was and altcoin wallet that is a dead coin anyway.

Thanks and I hope this helps others.


Title: Re: Question about wallet.dat
Post by: darlidada on June 01, 2014, 09:11:07 PM
guys, just stop with this wallet.dat non sense and go use a deterministic wallet such as electrum

there no need to backup any file, you just have to remember 12 words and you are done!