Bitcoin Forum
December 12, 2017, 09:44:27 PM *
News: Latest stable version of Bitcoin Core: 0.15.1  [Torrent].
 
   Home   Help Search Donate Login Register  
Pages: [1]
  Print  
Author Topic: What happens when you load an old .dat?  (Read 990 times)
danster82
Jr. Member
*
Offline Offline

Activity: 43


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?
1513115067
Hero Member
*
Offline Offline

Posts: 1513115067

View Profile Personal Message (Offline)

Ignore
1513115067
Reply with quote  #2

1513115067
Report to moderator
1513115067
Hero Member
*
Offline Offline

Posts: 1513115067

View Profile Personal Message (Offline)

Ignore
1513115067
Reply with quote  #2

1513115067
Report to moderator
1513115067
Hero Member
*
Offline Offline

Posts: 1513115067

View Profile Personal Message (Offline)

Ignore
1513115067
Reply with quote  #2

1513115067
Report to moderator
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
someguy123
Sr. Member
****
Offline Offline

Activity: 335


PHP Coder, Bitcoin enthusiast, Litecointalk admin


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.

1SoMGuYknDgyYypJPVVKE2teHBN4HDAh3
Administrator/owner of LTC Forum | LTC Block Explorer | Someguy123 Web Development
Gabi
Legendary
*
Offline Offline

Activity: 1092


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: 887



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.

BTC: 1DJVUnLuPA2bERTkyeir8bKn1eSoRCrYvx
NMC: NFcfHSBBnq622pAr1Xoh9KtnBPA5CUn6id
danster82
Jr. Member
*
Offline Offline

Activity: 43


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: 1092


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: 887



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.

BTC: 1DJVUnLuPA2bERTkyeir8bKn1eSoRCrYvx
NMC: NFcfHSBBnq622pAr1Xoh9KtnBPA5CUn6id
FAKE daniel daniel
Newbie
*
Offline Offline

Activity: 10


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

good question i was wonder same thing

http://bitcoin-otc.com/viewratingdetail.php?nick=danieldaniel&sign=ANY&type=RECV
Dargo
Legendary
*
Offline Offline

Activity: 1820



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

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: 182



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: 1190


Will read PM's. Have more time lately


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.

My BTC Tip Jar: 1Pgvfy19uwtYe5o9dg3zZsAjgCPt3XZqz9 , GPG ID: B3AAEEB0 ,OTC ID: johnthedong
Escrow service is available on a case by case basis! (PM Me to verify I'm the escrow!)

DanielVG
Sr. Member
****
Offline Offline

Activity: 266

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:  

Sponsored by , a Bitcoin-accepting VPN.
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!