Author

Topic: How recoverable is a wallet? (Read 1734 times)

member
Activity: 88
Merit: 10
March 08, 2012, 07:05:52 PM
#16
If I understand correctly (someone please correct me if not) any address you have used before copying the wallet will be perfectly accessible from either copy. As will any coins sent to those addresses, regardless of whether they were sent before or after the split. Speaking as a fairly new user myself, this I think is all most new users would expect, and that part is fine. What is not immediately apparent is that the wallet contains an additional 100 addresses pregenerated for later use. This means when you "add" a new address, it actually takes it from the pregenerated pool. The first 100 address* you add to one wallet will already exist in the copy. Handy, but not perfect. After you go through the 100 address*, then it has to start creating new ones, which won't be in the copy. That's still not terrible, but if you burn through 100 address* on both the original and the copy, then neither wallet will contain a complete set of addresses, that means some Bitcoins will only be available in one or the other (and some will be in both), which does sound like a rather confusing situation.
*I understand some are used up for behind-the-scenes purposes, so you shouldn't expect a full 100 to use directly yourself.

So (again, assuming I've understood all this right myself) it looks like all you would need to avoid these problems is to make one copy your "Primary" wallet, and regularly replace the others with fresh copies of it.

But there's another problem it won't fix. That pregenerated address pool can be helpful, but it can also get you in trouble. Because when you add a "new" address in one copy of the wallet it might already be one you used in a different copy. That could be confusing, e.g. if you unknowingly give the same address to but both Alice and Bob to accept a 5 BTC payment from each, and 5 BTC appears, you might at first thing they both paid, but then you realize it's the same address and you've only been paid once... but by whom?

All correct.

Another thing to take into account is that with the Satoshi client, a new key is used for sending as well as when you generate a new receiving address.

Example: You have 1 BTC on a key, which we'll call key #1.  You send .8 BTC to Bob, who has key #2. With the Satoshi client, you are actually making two exchanges:
  • from key #1 to key #2 for .8 BTC
  • from key #1 to key #3 for .2 BTC
Afterwards, key #1 is empty, key #2 (Bob's key) has an additional .8 BTC, and your client pulls an address out of pool to use as key #3, which gets the "change" of .2 BTC from the transaction.

I'm not really sure why this design decision was made - I suppose it does add some small amount of obscurity, since there is no way to tell if the transaction was for .8 BTC or for .2 BTC, but it doesn't seem worthwhile to me. The mobile client I use, Bitcoin Spinner, uses one address from start to finish.  To accept payments, I'll sometimes pop onto instawallet and make a new wallet for the transaction.  Once it goes through, I forward the proceeds on to my primary address, to avoid the "who just paid me?" issue, above.

Bitcoin is complex, but not complicated (if that makes sense).
newbie
Activity: 30
Merit: 0
March 08, 2012, 04:01:29 PM
#15
If I understand correctly (someone please correct me if not) any address you have used before copying the wallet will be perfectly accessible from either copy. As will any coins sent to those addresses, regardless of whether they were sent before or after the split. Speaking as a fairly new user myself, this I think is all most new users would expect, and that part is fine. What is not immediately apparent is that the wallet contains an additional 100 addresses pregenerated for later use. This means when you "add" a new address, it actually takes it from the pregenerated pool. The first 100 address* you add to one wallet will already exist in the copy. Handy, but not perfect. After you go through the 100 address*, then it has to start creating new ones, which won't be in the copy. That's still not terrible, but if you burn through 100 address* on both the original and the copy, then neither wallet will contain a complete set of addresses, that means some Bitcoins will only be available in one or the other (and some will be in both), which does sound like a rather confusing situation.
*I understand some are used up for behind-the-scenes purposes, so you shouldn't expect a full 100 to use directly yourself.

So (again, assuming I've understood all this right myself) it looks like all you would need to avoid these problems is to make one copy your "Primary" wallet, and regularly replace the others with fresh copies of it.

But there's another problem it won't fix. That pregenerated address pool can be helpful, but it can also get you in trouble. Because when you add a "new" address in one copy of the wallet it might already be one you used in a different copy. That could be confusing, e.g. if you unknowingly give the same address to but both Alice and Bob to accept a 5 BTC payment from each, and 5 BTC appears, you might at first thing they both paid, but then you realize it's the same address and you've only been paid once... but by whom?
full member
Activity: 184
Merit: 100
March 08, 2012, 01:50:28 PM
#14
Thx for the reply.
I asume this also implies that you cant use the same wallet on different computers.

It's not recommended to use the same wallet in multiple computers at the same time though. Without going into a long explanation, you can end up with coins that can't be spent on other copies of the wallet, meaning your backups would not hold all of your funds.

is there a further explanation? link maybe?
legendary
Activity: 3066
Merit: 1147
The revolution will be monetized!
March 08, 2012, 09:35:48 AM
#13
Thx for the reply.
I asume this also implies that you cant use the same wallet on different computers.
That is correct. The wallet.dat is like a real wallet. Lose it and you have lost the money inside. Put it in another install of the client, and it is like putting it into a different pocket.

Sorta Smiley

The wallet.dat actually contains a collection of private keys - every key that you have with coins attached, and a pool of about 100 "future" keys. Each time you send money, you burn a key. If you copied your wallet.dat to another PC, at first both PCs would be in sync. After 100 transactions on one or both PCs, though, the keys being used would not be in the other's wallet.dat, thereby branching your PCs into two distinct wallets, with only those coins that had not moved since the original pool of 100 keys was used up in common.

Thus, you can safely back up your wallet and restore to another PC - but you should back up regularly, as an old wallet doesn't have your new keys in it.

I despise the concept of a "wallet" - it's just a file of private keys. From the context of the bitcoin network, "wallets" don't exist - only transactions, which are based on the application of a private key.
All true. But I didn't want to get into the weeds and confuse a simple question with a alien answer. I try to imagine I'm explaining it to my Mom.  Wink
newbie
Activity: 24
Merit: 0
March 07, 2012, 08:56:03 PM
#12
Quote
Great instructions.

I'll also add that your wallet.dat is the file containing your private keys - everything else is just the blockchain, which you can download again if necessary.

When I used the Satoshi client, I kept my wallet.dat in a small truecrypt container, which I then uploaded to Dropbox.

That's absolutely correct.  The wallet.dat file is the only file you need to backup and protect. The symlinks facilitating a single blockchain and index are basically for speed and resource optimization.
member
Activity: 88
Merit: 10
March 07, 2012, 07:27:27 PM
#11
It might be worth noting that, if you are running a dual-boot machine (linux & windows), you can have both use a common wallet and blockchain using symbolic links.

1)  Setup bitcoin-qt on your Windows install and create (and encrypt!) your wallet.  Allow your bitcoin client time to FULLY synchronize and download the entire blockchain (look for the green check-mark in the bottom-right corner of the bitcoin client).

2)  Reboot into linux and install bitcoin-qt.

3)  Start up your linux bitcoin client (which will create the .bitcoin dir and the initial data files).  Don't bother waiting for the blockchain to sync this time; Just wait until the program fully loads, and then exit.

4)  Now open up a terminal and change to the .bitcoin dir:
Code:
draco49@vps1:~$ cd .bitcoin/

5)  Get rid of the data files in the .bitcoin dir (wallet.dat, blk0001.dat, blkindex.dat):
Code:
draco49@vps1:~/.bitcoin$ rm *.dat

6)  Create the symbolic links to the data files from your Windows install:
Code:
draco49@vps1:~/.bitcoin$ ln -s /media/OS/Users//AppData/Roaming/Bitcoin/wallet.dat ./wallet.dat
draco49@vps1:~/.bitcoin$ ln -s /media/OS/Users//AppData/Roaming/Bitcoin/blk0001.dat ./blk0001.dat
draco49@vps1:~/.bitcoin$ ln -s /media/OS/Users//AppData/Roaming/Bitcoin/blkindex.dat ./blkindex.dat

7)  Re-launch the bitcoin client. After a fast startup (since we already downloaded the blockchain in the Windows install), you should be greeted with the wallet you created earlier in Windows.  Now, you can switch back and forth from your Windows install to your linux install while maintaining a single wallet and blockchain.

Some important notes about these instructions...
The code examples are just that - examples.  You will need to make sure that you use your windows username where appears in the code, and also make sure that you correctly reference your Windows drive.  /media/OS/ is where my specific Windows(NTFS) drive is mounted, but yours could be different.  If you're not sure, use your GUI file browser to navigate to your Windows drive and note its full path.

To reduce the risk of wallet corruption, always make sure to allow bitcoin to fully shutdown and exit before rebooting your system.  Also, and I can't stress this enough, backup your wallet.dat file on a regular basis and after large transactions to an offline device (eg. USB drive, old netbook, cloud storage, etc...). 

Great instructions.

I'll also add that your wallet.dat is the file containing your private keys - everything else is just the blockchain, which you can download again if necessary.

When I used the Satoshi client, I kept my wallet.dat in a small truecrypt container, which I then uploaded to Dropbox.
newbie
Activity: 24
Merit: 0
March 07, 2012, 07:16:39 PM
#10
It might be worth noting that, if you are running a dual-boot machine (linux & windows), you can have both use a common wallet and blockchain using symbolic links.

1)  Setup bitcoin-qt on your Windows install and create (and encrypt!) your wallet.  Allow your bitcoin client time to FULLY synchronize and download the entire blockchain (look for the green check-mark in the bottom-right corner of the bitcoin client).

2)  Reboot into linux and install bitcoin-qt.

3)  Start up your linux bitcoin client (which will create the .bitcoin dir and the initial data files).  Don't bother waiting for the blockchain to sync this time; Just wait until the program fully loads, and then exit.

4)  Now open up a terminal and change to the .bitcoin dir:
Code:
draco49@vps1:~$ cd .bitcoin/

5)  Get rid of the data files in the .bitcoin dir (wallet.dat, blk0001.dat, blkindex.dat):
Code:
draco49@vps1:~/.bitcoin$ rm *.dat

6)  Create the symbolic links to the data files from your Windows install:
Code:
draco49@vps1:~/.bitcoin$ ln -s /media/OS/Users//AppData/Roaming/Bitcoin/wallet.dat ./wallet.dat
draco49@vps1:~/.bitcoin$ ln -s /media/OS/Users//AppData/Roaming/Bitcoin/blk0001.dat ./blk0001.dat
draco49@vps1:~/.bitcoin$ ln -s /media/OS/Users//AppData/Roaming/Bitcoin/blkindex.dat ./blkindex.dat

7)  Re-launch the bitcoin client. After a fast startup (since we already downloaded the blockchain in the Windows install), you should be greeted with the wallet you created earlier in Windows.  Now, you can switch back and forth from your Windows install to your linux install while maintaining a single wallet and blockchain.

Some important notes about these instructions...
The code examples are just that - examples.  You will need to make sure that you use your windows username where appears in the code, and also make sure that you correctly reference your Windows drive.  /media/OS/ is where my specific Windows(NTFS) drive is mounted, but yours could be different.  If you're not sure, use your GUI file browser to navigate to your Windows drive and note its full path.

To reduce the risk of wallet corruption, always make sure to allow bitcoin to fully shutdown and exit before rebooting your system.  Also, and I can't stress this enough, backup your wallet.dat file on a regular basis and after large transactions to an offline device (eg. USB drive, old netbook, cloud storage, etc...). 
member
Activity: 88
Merit: 10
March 07, 2012, 05:22:48 PM
#9
Thx for the reply.
I asume this also implies that you cant use the same wallet on different computers.

It's not recommended to use the same wallet in multiple computers at the same time though. Without going into a long explanation, you can end up with coins that can't be spent on other copies of the wallet, meaning your backups would not hold all of your funds.

Uhhh... I think I went into the long explanation. Sorry Smiley
member
Activity: 88
Merit: 10
March 07, 2012, 05:19:45 PM
#8
Thx for the reply.
I asume this also implies that you cant use the same wallet on different computers.
That is correct. The wallet.dat is like a real wallet. Lose it and you have lost the money inside. Put it in another install of the client, and it is like putting it into a different pocket.

Sorta Smiley

The wallet.dat actually contains a collection of private keys - every key that you have with coins attached, and a pool of about 100 "future" keys. Each time you send money, you burn a key. If you copied your wallet.dat to another PC, at first both PCs would be in sync. After 100 transactions on one or both PCs, though, the keys being used would not be in the other's wallet.dat, thereby branching your PCs into two distinct wallets, with only those coins that had not moved since the original pool of 100 keys was used up in common.

Thus, you can safely back up your wallet and restore to another PC - but you should back up regularly, as an old wallet doesn't have your new keys in it.

I despise the concept of a "wallet" - it's just a file of private keys. From the context of the bitcoin network, "wallets" don't exist - only transactions, which are based on the application of a private key.
hero member
Activity: 588
Merit: 500
Hero VIP ultra official trusted super staff puppet
March 07, 2012, 04:04:30 PM
#7
Re: How recoverable is a wallet?

I found my wallet last week in my pants in the laundry.
legendary
Activity: 3066
Merit: 1147
The revolution will be monetized!
March 07, 2012, 03:23:59 PM
#6
Thx for the reply.
I asume this also implies that you cant use the same wallet on different computers.
That is correct. The wallet.dat is like a real wallet. Lose it and you have lost the money inside. Put it in another install of the client, and it is like putting it into a different pocket.
newbie
Activity: 4
Merit: 0
March 07, 2012, 03:16:17 PM
#5
Thx for the reply.
I asume this also implies that you cant use the same wallet on different computers.
newbie
Activity: 24
Merit: 0
March 06, 2012, 09:08:38 PM
#4
Quote
I installed bitcoin, it seems like no account is to be made anywhere...(unless for the miningpools)
So what happens if the computer crashes?
What happens is i get a new computer?

Assuming you are using the "official" bitcoin client from http://bitcoin.org, your wallet file (wallet.dat) is located in the following location:
Windows: 
Code:
C:\Users\\AppData\Roaming\Bitcoin\
Linux:       
Code:
/home//.bitcoin/

You should backup your wallet.dat file on a regular basis, and especially after large transactions.  I recommend backing up to a USB drive or other off-line storage.

If your computer crashes and you lose your wallet.dat, the Bitcoins it contains are gone forever unless you've taken the time to create backups.
newbie
Activity: 14
Merit: 0
March 06, 2012, 07:00:28 PM
#3
You have to backup the wallet.dat file.
If you don't have a backup, and lose the file or lose the keys contained in the file, your bitcoins are lost.

Also look on stackexchange: How should you backup your wallet?.

I don't know what happens if the computer crashes while having wallet.dat opened or while writing into wallet.dat file.
newbie
Activity: 95
Merit: 0
March 06, 2012, 05:57:08 PM
#2
I would like to know this too. Shocked
newbie
Activity: 4
Merit: 0
March 06, 2012, 05:41:56 PM
#1
Hi,


I installed bitcoin, it seems like no account is to be made anywhere...(unless for the miningpools)
So what happens if the computer crashes?
What happens is i get a new computer?

So how does this work then? How do i get the adresses back etc..

Regards
Jump to: