Author

Topic: What data exactly is stored in a wallet.dat file? (Read 4708 times)

sr. member
Activity: 266
Merit: 250
https://en.bitcoin.it/wiki/Wallet

A Bitcoin wallet contains[1]:

    your keypairs for each addresses
    transactions done from/to your addresses
    user preferences
    default key
    reserve keys
    accounts
    a version number
    Key pool
    Since 0.3.21: information about the current best chain, to be able to rescan automatically when restoring from a backup.


So a Wallet file contains all your transaction history (which is also stored in the Block Chain).  Of course, the Block Chain's version is the "official" version of the transaction history (so people can't modify their wallet to suddenly have more money).

It's possible to run bitcoin with the -rescan option to recreate your transaction history (a great way to recover lost coins), but this will only work based on what keypairs you have in your wallet.  So if you execute 200 transactions and then restore an old wallet, and then -rescan, you could be missing a lot of Bitcoins.
member
Activity: 111
Merit: 10
The bitcointools made by Gavin has an utility to parse your wallet.dat and parse the data stored in there.
hero member
Activity: 767
Merit: 500
get db_dump from e.g. here (or Google it)

then you can dump your database as hex strings, but you'll want to massage the data a bit to make it anything meaningful.  Be very careful when playing with your wallet.dat as it contains all your keys and you will lose all your BTC sent to those keys if you corrupt your wallet (always take backups!)

Will
sr. member
Activity: 280
Merit: 252
How does one read the wallet.dat in plain text?  Say I wanted to print out the keys and recreate it later in digital form, is that possible?

It is possible to do. You have to encode the wallet.dat file to some kind of alpha-numeric format first however instead of binary code I believe.
legendary
Activity: 1762
Merit: 1011
How does one read the wallet.dat in plain text?  Say I wanted to print out the keys and recreate it later in digital form, is that possible?
legendary
Activity: 2506
Merit: 1010
Also: will the "format" of a wallet ever change? Will it ever need to? Even in 50+ years?

We can't know what will happen in the future but we know that software changes and improves.  There will likely always be a way to import either the binary wallet data file itself or to export wallet data and import that data into the new system.

Related:
  - http://forum.bitcoin.org/?topic=2348.0
full member
Activity: 140
Merit: 100
Thanks for that.

O.K. so I just loaded up my "backed up" wallet to a new ubuntu install and began downloading the blockchain.

How does my bitcoin client "know" that I have a balance on that wallet but that it is still "unconfirmed"? Doesn't it need to download the block chain to know that first? Or is individual transaction information associated with each address encoded in the wallet.dat file each time a transaction is made?

You dont ahve any balance on the wallet. You have addresses. What the addresses contain is visible for everyonne in the blockchain.
sr. member
Activity: 280
Merit: 252
Thanks for that.

O.K. so I just loaded up my "backed up" wallet to a new ubuntu install and began downloading the blockchain.

How does my bitcoin client "know" that I have a balance on that wallet but that it is still "unconfirmed"? Doesn't it need to download the block chain to know that first? Or is individual transaction information associated with each address encoded in the wallet.dat file each time a transaction is made?
full member
Activity: 196
Merit: 101
And why is it not necessary to backup any of the other files in your bitcoin folder in order to re-create your wallet?

Also: will the "format" of a wallet ever change? Will it ever need to? Even in 50+ years?

The wallet contains the public/private key pairs. The public keys are your addresses. These key pairs are matched with the blocks the client downloads from the network, I believe, to see how much money you have.

The format could change if everyone "agrees" on a new one and all the clients are modified. It might need to because SHA-2 could be broken, or other maybe there are other protocol deficiencies we don't know about yet.
sr. member
Activity: 280
Merit: 252
And why is it not necessary to backup any of the other files in your bitcoin folder in order to re-create your wallet?

Also: will the "format" of a wallet ever change? Will it ever need to? Even in 50+ years?
Jump to: