Bitcoin Forum

Bitcoin => Bitcoin Technical Support => Topic started by: BookLover on November 26, 2011, 11:02:52 PM



Title: Disappearing Bitcoins[Solved by updating the client]
Post by: BookLover on November 26, 2011, 11:02:52 PM
Today I unencrypted a wallet to send some BTC but when I booted up the client some of my BTC coins were missing. ???

Here is the background/technical information:

I had previously used the wallet and not bothered to make a new encrypted backup because I figured I could just use the rescan function.
I only used it two or three times without making a new encrypted backup, so I doubt the key pool ran out.
The version is 0.3.15.4 beta
I did the math on the transactions and it doesn't add up.
The client is on a Windows7 computer.
I didn't create any new addresses.

I have no idea what went wrong and I hope there is a simple answer to this.

P.S. Before you ask I have all the blocks. ;)


Title: Re: Disappearing Bitcoins
Post by: JoelKatz on November 27, 2011, 12:07:04 AM
Unless you know exactly what you're doing (or are using a deterministic wallet), you need to make a new backup of your wallet after every time you send bitcoins. Otherwise, you may not have the private keys necessary to claim the change from your previous transactions.


Title: Re: Disappearing Bitcoins
Post by: BookLover on November 27, 2011, 12:33:02 AM
I'm missing something here.  Doesn't the wallet key pool prevent this from happening unless you have over 100 transactions since you last backup??

Could you please give me your definition of a deterministic wallet?

Feel free to ask questions or give opinions, I need all the help I can get.


Title: Re: Disappearing Bitcoins
Post by: Stephen Gornick on November 27, 2011, 01:50:26 AM
I did the math on the transactions and it doesn't add up.

Are you saying when you add up the transactions that the client shows, they do not result in the balance that the bitcoin client shows?  Or are you saying the client isn't showing transactions that you know were made?


Title: Re: Disappearing Bitcoins
Post by: BookLover on November 27, 2011, 01:58:23 AM
Both :o


Title: Re: Disappearing Bitcoins
Post by: gmaxwell on November 27, 2011, 08:17:20 AM
Here is the background/technical information:

Please provide clear step by step details of what you did.  It's completely unclear to me from what you've described why you believe that your backup practices had anything to do with this. Did you delete your wallet at any step or restore from backup at any step?


Title: Re: Disappearing Bitcoins
Post by: BookLover on November 27, 2011, 02:38:32 PM
I copied the encrypted wallet.  Put the encrypted wallet back in the safe.  Unencrypted the copy.  Put the wallet copy in an empty client.  Sent some coins.  Wrote down how many coins were in my wallet. Deleted the copy.  A couple weeks later I got the encrypted wallet back out.  Copied the encrypted wallet again.  Put the encrypted wallet back in the safe.  Unencrypted the second copy.  Put the second wallet copy in an empty client with the rescan function.  Updated the block chain and noticed some coins were missing.

Edit: Realized I left some information out and that it could be misread.


Title: Re: Disappearing Bitcoins
Post by: rebel on November 27, 2011, 09:46:59 PM
I didn't create any new addresses.

Personally I think that nothing should be missing - neither transactions nor btc. Even if you did not make that frequent backups.

Please create a new address to see if the missing transactions reappear


Title: Re: Disappearing Bitcoins
Post by: FreeMoney on November 27, 2011, 10:00:11 PM
have you made more than 100 sends since last backup? 


Title: Re: Disappearing Bitcoins
Post by: FreeMoney on November 27, 2011, 11:00:35 PM
You created a new address every time you sent coins and automatically sent the change back to yourself. The first 100 times you did this by sending to an address that was in your backup, but eventually those run out.


Title: Re: Disappearing Bitcoins
Post by: paraipan on November 28, 2011, 12:22:08 AM
I copied the encrypted wallet.  Put the original back in the safe.  Unencrypted the copy.  Put the wallet copy in an empty client.  Sent some coins.  Deleted the copy.

try running with -rescan parameter one time using your main (original) wallet, the transactions are saved in the wallet file so if the original didn't see one of them but has the priv key from reserve then it should appear and balance updated correctly


Title: Re: Disappearing Bitcoins
Post by: simonk83 on November 28, 2011, 12:37:12 AM
Sorry to hijack, but I'm actually having a bit of an issue getting a transaction to go through.  It's only 1BTC so not a huge deal right now, but I'll be annoyed in the future if 1BTC is suddenly worth $500 or something daft :D

Anyway, I have a secure version of Ubuntu that I use just for my wallet (I'm a Windows guy generally, and Linux confuses me for the most part, but I can just about find my way around Ubuntu).   So the blockchain was halfway through downloading the other day, when I decided to send 1BTC to an address.    Once the blockchain finished (took forever by the way, we really need a way around that) the transaction is unconfirmed.     On Windows it's easy enough to use the rescan option, but I couldn't figure out how to do it in Ubuntu :(

I deleted everything aside from the wallet, and it's in the slloooooow process of downloading the blockchain again.  I'm not confident it'll confirm this time though either.

Is anyone able to tell me how I add the rescan flag to Bitcoin 0.5 in Ubuntu?   I'm not even sure how to navigate to wherever the bitcoin "executable" is located in the terminal to be honest :)


Title: Re: Disappearing Bitcoins
Post by: paraipan on November 28, 2011, 12:55:49 AM
Sorry to hijack, but I'm actually having a bit of an issue getting a transaction to go through.  It's only 1BTC so not a huge deal right now, but I'll be annoyed in the future if 1BTC is suddenly worth $500 or something daft :D

Anyway, I have a secure version of Ubuntu that I use just for my wallet (I'm a Windows guy generally, and Linux confuses me for the most part, but I can just about find my way around Ubuntu).   So the blockchain was halfway through downloading the other day, when I decided to send 1BTC to an address.    Once the blockchain finished (took forever by the way, we really need a way around that) the transaction is unconfirmed.     On Windows it's easy enough to use the rescan option, but I couldn't figure out how to do it in Ubuntu :(

I deleted everything aside from the wallet, and it's in the slloooooow process of downloading the blockchain again.  I'm not confident it'll confirm this time though either.

Is anyone able to tell me how I add the rescan flag to Bitcoin 0.5 in Ubuntu?   I'm not even sure how to navigate to wherever the bitcoin "executable" is located in the terminal to be honest :)

sorry to answer the hijack :) if you know how to open a terminal you're already halfway there, so open one up and type "bitcoin -rescan", minimize the terminal and the client should start after taking a bit more time than usual.
When it starts you should see "lost" transactions and balance updated correctly. Close it gracefully from the menu and when you see the prompt again in the terminal window you know bitcoin has closed completely.
Now start it from your usual icon and enjoy having resolved the problems.


Title: Re: Disappearing Bitcoins
Post by: simonk83 on November 28, 2011, 01:54:50 AM
Sorry to hijack, but I'm actually having a bit of an issue getting a transaction to go through.  It's only 1BTC so not a huge deal right now, but I'll be annoyed in the future if 1BTC is suddenly worth $500 or something daft :D

Anyway, I have a secure version of Ubuntu that I use just for my wallet (I'm a Windows guy generally, and Linux confuses me for the most part, but I can just about find my way around Ubuntu).   So the blockchain was halfway through downloading the other day, when I decided to send 1BTC to an address.    Once the blockchain finished (took forever by the way, we really need a way around that) the transaction is unconfirmed.     On Windows it's easy enough to use the rescan option, but I couldn't figure out how to do it in Ubuntu :(

I deleted everything aside from the wallet, and it's in the slloooooow process of downloading the blockchain again.  I'm not confident it'll confirm this time though either.

Is anyone able to tell me how I add the rescan flag to Bitcoin 0.5 in Ubuntu?   I'm not even sure how to navigate to wherever the bitcoin "executable" is located in the terminal to be honest :)

sorry to answer the hijack :) if you know how to open a terminal you're already halfway there, so open one up and type "bitcoin -rescan", minimize the terminal and the client should start after taking a bit more time than usual.
When it starts you should see "lost" transactions and balance updated correctly. Close it gracefully from the menu and when you see the prompt again in the terminal window you know bitcoin has closed completely.
Now start it from your usual icon and enjoy having resolved the problems.

Thanks Para.  So there's no need to navigate to the bitcoin directory?  Is Linux smart enough to just understand the Bitcoin entry no matter where I type it in a terminal?


Title: Re: Disappearing Bitcoins
Post by: paraipan on November 28, 2011, 02:29:44 AM
Sorry to hijack, but I'm actually having a bit of an issue getting a transaction to go through.  It's only 1BTC so not a huge deal right now, but I'll be annoyed in the future if 1BTC is suddenly worth $500 or something daft :D

Anyway, I have a secure version of Ubuntu that I use just for my wallet (I'm a Windows guy generally, and Linux confuses me for the most part, but I can just about find my way around Ubuntu).   So the blockchain was halfway through downloading the other day, when I decided to send 1BTC to an address.    Once the blockchain finished (took forever by the way, we really need a way around that) the transaction is unconfirmed.     On Windows it's easy enough to use the rescan option, but I couldn't figure out how to do it in Ubuntu :(

I deleted everything aside from the wallet, and it's in the slloooooow process of downloading the blockchain again.  I'm not confident it'll confirm this time though either.

Is anyone able to tell me how I add the rescan flag to Bitcoin 0.5 in Ubuntu?   I'm not even sure how to navigate to wherever the bitcoin "executable" is located in the terminal to be honest :)

sorry to answer the hijack :) if you know how to open a terminal you're already halfway there, so open one up and type "bitcoin -rescan", minimize the terminal and the client should start after taking a bit more time than usual.
When it starts you should see "lost" transactions and balance updated correctly. Close it gracefully from the menu and when you see the prompt again in the terminal window you know bitcoin has closed completely.
Now start it from your usual icon and enjoy having resolved the problems.

Thanks Para.  So there's no need to navigate to the bitcoin directory?  Is Linux smart enough to just understand the Bitcoin entry no matter where I type it in a terminal?

actually yes, but only if you installed bitcoin from an ubuntu ppa (repository) through a packet manager (apt-get for ex.). If you compiled bitcoin for yourself or downloaded an already made binary you will have to navigate to that dir before launching. To fix that just copy the binary file to "/usr/bin" and you should be able to launch it anywhere.


Title: Re: Disappearing Bitcoins
Post by: Revalin on November 28, 2011, 02:51:18 AM
If you have Bitcoin on your desktop, do "cd Desktop", then "cd whatever your bitcoin dir is", then "./bitcoin -rescan".


Title: Re: Disappearing Bitcoins
Post by: simonk83 on November 28, 2011, 03:39:19 AM
Thanks guys, I'll try that when I get home.   


Title: Re: Disappearing Bitcoins
Post by: JoelKatz on November 28, 2011, 06:13:45 AM
I'm missing something here.  Doesn't the wallet key pool prevent this from happening unless you have over 100 transactions since you last backup??
Yes, if the pool isn't empty. But if you've never sent any bitcoins, the pool will be empty. (The client creates 100 *extra* keys when it creates a key for a transaction.) Because these rules are complicated to understand and easy to get wrong, I make my advice clear and simple -- unless you understand the rules exactly, always backup your wallet after sending.

Quote
Could you please give me your definition of a deterministic wallet?
A deterministic wallet is a wallet that generates new keys in a way that is repeatable, rather than creating random new keys. With a deterministic wallet, there is no need to back it up after sending because the new keys it would generate can always be regenerated based solely on the previous wallet.


Title: Re: Disappearing Bitcoins
Post by: gmaxwell on November 28, 2011, 06:17:14 AM
I'm missing something here.  Doesn't the wallet key pool prevent this from happening unless you have over 100 transactions since you last backup??
Yes, if the pool isn't empty. But if you've never sent any bitcoins, the pool will be empty.

That was never true, at least not since there was a pool—prior to 0.3.23 the pool remained empty until you hit the getaddress button for the first time. Since then, however bitcoin fills the pool instantly on startup even if you've never gotten an address out of it.


Title: Re: Disappearing Bitcoins
Post by: gmaxwell on November 28, 2011, 06:20:58 AM
I copied the encrypted wallet.  Put the original back in the safe.  Unencrypted the copy.  Put the wallet copy in an empty client.  Sent some coins.  Deleted the copy.

Are you able to find the transaction for the coins you sent in block explorer? (I don't need to see it, but if you can find it we can check to see if you have the keys for the account used to collect the change from that transaction).

Also, as others asked— how many times did you send+ hit getnewaddress since you made the encrypted copy?  A few or potentially as many as 100?


Title: Re: Disappearing Bitcoins
Post by: BookLover on November 28, 2011, 02:36:35 PM
have you made more than 100 sends since last backup?  
No.

I copied the encrypted wallet.  Put the original back in the safe.  Unencrypted the copy.  Put the wallet copy in an empty client.  Sent some coins.  Deleted the copy.

try running with -rescan parameter one time using your main (original) wallet, the transactions are saved in the wallet file so if the original didn't see one of them but has the priv key from reserve then it should appear and balance updated correctly
The original wallet is gone, and I tried rescanning the unencrypted wallet multiple times.

I'm missing something here.  Doesn't the wallet key pool prevent this from happening unless you have over 100 transactions since you last backup??
Yes, if the pool isn't empty. But if you've never sent any bitcoins, the pool will be empty. (The client creates 100 *extra* keys when it creates a key for a transaction.) Because these rules are complicated to understand and easy to get wrong, I make my advice clear and simple -- unless you understand the rules exactly, always backup your wallet after sending.
I've sent coins before.

I copied the encrypted wallet.  Put the original back in the safe.  Unencrypted the copy.  Put the wallet copy in an empty client.  Sent some coins.  Deleted the copy.

Are you able to find the transaction for the coins you sent in block explorer? (I don't need to see it, but if you can find it we can check to see if you have the keys for the account used to collect the change from that transaction).

Also, as others asked— how many times did you send+ hit getnewaddress since you made the encrypted copy?  A few or potentially as many as 100?


I found it. How do I check if I have the keys?


Title: Re: Disappearing Bitcoins
Post by: Gavin Andresen on November 28, 2011, 08:10:15 PM
The version is 0.3.15.4 beta

0.3.15 is pretty old, and the way you're spending from a copy of the wallet is, I suspect, confusing it.  Pieter updated the wallet code to handle transactions with partially spent outputs a while back.

Try upgrading to version 0.4.1 or 0.5 and running -rescan and see if your missing bitcoins reappear.


Title: Re: Disappearing Bitcoins
Post by: BookLover on November 28, 2011, 11:18:10 PM
Updated to version 0.3.21-beta and all my coins reappeared!!! Hurray!!! :) :D ;D Thanks everyone!!!


Title: Re: Disappearing Bitcoins[Solved by updating the client]
Post by: simonk83 on November 28, 2011, 11:50:05 PM
Good to hear :)

As for my issue, nothing I did got that 1BTC to confirm.  I rescanned the wallet several times, and I redownloaded the blockchain again (takes about 30 hours, horrible).   It just wouldn't confirm.

I ended up restoring my backup of the wallet and that txn has now gone (as expected, as it wasn't registered anywhere).   Whatever, I'll chalk that one up to randomness, and I'll remember not to issue a transaction midway through the blockchain download in future.