Bitcoin Forum
November 10, 2024, 11:21:58 AM *
News: Latest Bitcoin Core release: 28.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: What happens when you load an old .dat?  (Read 1104 times)
danster82 (OP)
Newbie
*
Offline Offline

Activity: 43
Merit: 0


View Profile
July 30, 2012, 08:37:35 PM
 #1

What happens when you load an old wallet.dat into a new client where some bitcoins still exist but some dont, does the network simply work out the new balance and correct the .dat?
someguy123
Sr. Member
****
Offline Offline

Activity: 336
Merit: 254


CEO of Privex Inc. (www.privex.io)


View Profile WWW
July 30, 2012, 09:10:38 PM
 #2

Where some bitcoins exist, but some don't?
I'm confused, do you mean you've spent bitcoins from a newer wallet, and you're wishing to restore a wallet from before you've spent them?
Generally, with the latest bitcoin, it will automatically re-scan the blockchain in order to correct the balance displayed. If not, you can append the "-rescan" switch to your Bitcoin shortcut.

Gabi
Legendary
*
Offline Offline

Activity: 1148
Merit: 1008


If you want to walk on water, get out of the boat


View Profile
July 30, 2012, 09:14:40 PM
 #3

Wallet.dat just contain your private keys, then the client check the blockchain and check how many bitcoins do these keys have.

(yes it contains more info than that, but what matter are the private keys, the rest are useful things to speed up things if i'm right)

Epoch
Legendary
*
Offline Offline

Activity: 922
Merit: 1003



View Profile
July 30, 2012, 09:27:14 PM
 #4

What happens when you load an old wallet.dat into a new client where some bitcoins still exist but some dont, does the network simply work out the new balance and correct the .dat?
Short answer: yes. However, there is nothing to 'correct'.

The wallet.dat file does not record your coin balance; it contains (secret) keys associated with your public bitcoin addresses. The transaction history of all bitcoins (and, by extension, your current balance) is kept in the public blockchain, separate from your wallet.dat file.

Simply, the bitcoin client scans the blockchain and finds transactions associated with the keys in your wallet.dat. It then 'knows' your current balance and transaction history.

Loading an old wallet.dat into a new client will not affect any of this, since both new and old wallet.dat files contain the same keys. Thus the client will come to the same result when it scans the blockchain.

One caveat is that if you had generated many (100+) new addresses in your new wallet.dat, some of those new addresses may not exist in your old wallet.dat file. Thus if you were to load the old one, transactions associated with the new addresses would not be counted properly. My details may be off, but it works something like this: a 'fresh' wallet.dat contains keys for 100 or so addresses. After you exhaust those, another block of 100 keys/addresses is automatically generated. If this is triggered, the new wallet.dat file will contain the new addresses, but your old one won't.

Thus it is good practice to regularly backup your wallet.dat file to ensure you always have all your addresses.
danster82 (OP)
Newbie
*
Offline Offline

Activity: 43
Merit: 0


View Profile
July 30, 2012, 10:47:22 PM
 #5

Ok got it, so all bitcoins are stored on the network, the .dat stores your keys to the associated bitcoins. If I load an old .dat with keys to bitcoins ive spent those keys are now useless and so it will automativccaly readjust the client wallet balance?

I assume it deletes the useless keys also?
Gabi
Legendary
*
Offline Offline

Activity: 1148
Merit: 1008


If you want to walk on water, get out of the boat


View Profile
July 30, 2012, 10:52:49 PM
 #6

useless keys? spent keys?

no key is "useless" and it will never automatically delete a key! An empty key can still be used as a receiving address, so if you delete it and someone you previously gave that address send you bitcoins to that address, bad bad thing, you don't have the key to use them...

If you have a chest and empty it, you don't trash it, or trash its key  Cheesy it can still be useful...

Epoch
Legendary
*
Offline Offline

Activity: 922
Merit: 1003



View Profile
July 30, 2012, 11:48:32 PM
 #7

Ok got it, so all bitcoins are stored on the network, the .dat stores your keys to the associated bitcoins. If I load an old .dat with keys to bitcoins ive spent those keys are now useless and so it will automativccaly readjust the client wallet balance?

I assume it deletes the useless keys also?
Keys are not associated with bitcoins directly; they are associated with your receiving addresses. The Client uses those keys to determine which addresses in the blockchain (and thus which transactions) belong to your wallet.dat. You can have numerous transactions going to (or coming from) the same address. Whether you have sent, or received, however many bitcoins in the past does not affect those keys. You will always have them.
FAKE daniel daniel
Newbie
*
Offline Offline

Activity: 10
Merit: 0


View Profile
July 31, 2012, 02:59:42 AM
 #8

good question i was wonder same thing
Dargo
Legendary
*
Offline Offline

Activity: 1820
Merit: 1000


View Profile
July 31, 2012, 03:56:47 AM
 #9

Whatever happens, I'm pretty sure it's better than when you date and old load.
DanielVG
Sr. Member
****
Offline Offline

Activity: 266
Merit: 250

I want free lunch, i'm gonna go with this guy.


View Profile
July 31, 2012, 05:46:40 AM
 #10

good info, thanks guys
stepkrav
Full Member
***
Offline Offline

Activity: 188
Merit: 100



View Profile
July 31, 2012, 09:35:54 AM
 #11

if i download a new client version, does it overwrite the old .dat file or just use the existing?
John (John K.)
Global Troll-buster and
Legendary
*
Offline Offline

Activity: 1288
Merit: 1227


Away on an extended break


View Profile
July 31, 2012, 09:38:03 AM
 #12

if i download a new client version, does it overwrite the old .dat file or just use the existing?
Not too sure about that, but it's a good practice that you backup your wallet.dat file religiously, and keep it encrypted. If a new wallet.dat file is installed, just overwrite it with your existing one.
DanielVG
Sr. Member
****
Offline Offline

Activity: 266
Merit: 250

I want free lunch, i'm gonna go with this guy.


View Profile
August 01, 2012, 05:29:27 PM
 #13

pretty obvious
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!