Bitcoin Forum

Bitcoin => Bitcoin Technical Support => Topic started by: clochard on May 21, 2014, 11:53:02 AM



Title: Importing private key back-up into Bitcoin-QT
Post by: clochard on May 21, 2014, 11:53:02 AM
Hey guys,

I am technically a bit a Bitcoin noob, so I hope you guys can help me.

I have some back-ups on usb's (wallet.dat file) of an old Bitcoin QT wallet of a pc that is not working/starting anymore.

I have another computer now, I downloaded the Bitcoin-QT wallet, removed the wallet.dat that belonged to that new Bitcoin-QT from the folder where it was stored, imported the backed-up wallet.dat file, opened in the same folder a command window and typed: "bitcoin-qt.exe -rescan". Btw, When I made the back-up I changed the name of the wallet.dat file in another name, imagine it being called 'wolverine.dat'.

Bitcoin client started rescanning all the blocks and is now still 20 weeks away from being synchronized (it takes a shitload of time).

Have I done everything correctly? And when it finished rescanning, will my old bitcoin balance of the other wallet that was in the other pc appear? Until now my balance is 0.

Btw, one thing you should know is that the wallet on the other pc was encrypted. I am not sure if this will give any problems?

It would be great if some of you guys could clarify this for me.

Thanks in advance!

Best,

Clochard


Title: Re: Importing private key back-up into Bitcoin-QT
Post by: Light on May 21, 2014, 12:14:54 PM
Pretty sure you shouldn't have any problems if you've done exactly as you've posted. You just need to wait patiently for the client to sync. Your encryption shouldn't give you any problems as long as you remember the password. If your impatient (like I am occasionally) you could download pywallet and have a play around it on an offline comp to see if you can extract the private keys. From there you could import them into a lightweight client (which doesn't need to download the whole chain) to ensure you have your balance. Or you could just wait...


Title: Re: Importing private key back-up into Bitcoin-QT
Post by: clochard on May 21, 2014, 12:21:25 PM
Thanks for the reply! It is really appreciated :)

I do remember the password and I have it written down. Will it ask for the password ones it is synchronized?

I am wondering about this, because I also ecnrypted this wallet with another password (which I also remember and wrote down).

Best,

Clochard


Title: Re: Importing private key back-up into Bitcoin-QT
Post by: Light on May 21, 2014, 12:28:32 PM
IIRC, you will be asked for your password when you try to do things that have serious ramifications (ie sending a new tx or trying to change your old password). Until then it'll simply watch for any incoming transactions and reflect that in your balance. It's been a while since I've used Qt so if anyone could confirm that would be nice.


Title: Re: Importing private key back-up into Bitcoin-QT
Post by: DannyHamilton on May 21, 2014, 12:31:02 PM
When I made the back-up I changed the name of the wallet.dat file in another name, imagine it being called 'wolverine.dat'.

When you imported it, you changed the name back to "wallet.dat", right?

It has to be named exactly "wallet.dat".  If you left it named "wolverine.dat", or changed the name to "Wallet.dat", or "wallet.dat.dat", or "wallet", or "wallet.txt", or "wallet.dat.txt" or "wallet.txt.dat", then you'll need to re-do the -rescan.

I've seen other people accidentally rename the file in any of these ways in the past.


Title: Re: Importing private key back-up into Bitcoin-QT
Post by: clochard on May 21, 2014, 12:44:36 PM
Oooh fuck, no  :'(  I did not change it back into wallet.dat

I was not aware that this was necessary.

Right now I do not feel like rescanning the entire blockchain. Do you guys think it is safe if I import the wallet.dat file to my wallet on blockchain.info? and how do I import the wallet.dat file into blockchain.info. Honestly I do not see the option?

From there I would like to transfer it to my electrum wallet. I am just wondering if I trust an online service with a reasonable sum of bitcoins.

Feedback appreciated :)

Best,

Clochard


Title: Re: Importing private key back-up into Bitcoin-QT
Post by: DannyHamilton on May 21, 2014, 12:50:27 PM
Oooh fuck, no  :'(  I did not change it back into wallet.dat

I was not aware that this was necessary.

Right now I do not feel like rescanning the entire blockchain. Do you guys think it is safe if I import the wallet.dat file to my wallet on blockchain.info? and how do I import the wallet.dat file into blockchain.info. Honestly I do not see the option?

From there I would like to transfer it to my electrum wallet. I am just wondering if I trust an online service with a reasonable sum of bitcoins.

Feedback appreciated :)

Best,

Clochard

If you decide you trust blockchain.info, here's the import page:
https://blockchain.info/wallet/import-wallet


Title: Re: Importing private key back-up into Bitcoin-QT
Post by: clochard on May 21, 2014, 01:04:57 PM
Yes I have seen that link as well. Problem is, it says: 'create a new wallet'.

I don't want to create a new wallet, I already have one on blockchain.info

I cannot find the option to import the wallet.dat file to my existing wallet. Or is that impossible?


Title: Re: Importing private key back-up into Bitcoin-QT
Post by: Light on May 21, 2014, 01:07:17 PM
Right now I do not feel like rescanning the entire blockchain. Do you guys think it is safe if I import the wallet.dat file to my wallet on blockchain.info? and how do I import the wallet.dat file into blockchain.info. Honestly I do not see the option?

From there I would like to transfer it to my electrum wallet. I am just wondering if I trust an online service with a reasonable sum of bitcoins.

Feedback appreciated :)

Best,

Clochard

So far Blockchain has been fine (although its inadvisable for long term storage) so if you were worried, you should be fine for a quick import and subsequent transaction. Just make sure that you triple check the address you're sending your coins to is the one in your Electrum wallet - it's happened to countless people in the past.

Alternatively if you don't trust Blockchain, then you could follow the route I specified in my earlier post with pywallet. Just remember to decrypt the wallet as part of the command (specified below - don't recall if it was in the README).
Code:
--passphrase=PASSPHRASE 

If you need anymore help, I should be around tomorrow - meanwhile I'll leave in you in Danny's more than capable hands.


Title: Re: Importing private key back-up into Bitcoin-QT
Post by: Foxpup on May 21, 2014, 01:13:07 PM
Why is everybody making this more complicated than it needs to be? ::)

If you decide you trust blockchain.info, here's the import page:
https://blockchain.info/wallet/import-wallet
This not necessary, because neither was the rescan. Close Bitcoin-Qt if it's still running (and be sure to wait for it to fully shut down), delete (or rename, if you're paranoid) the empty wallet.dat created by Bitcoin-Qt when you first attempted to start it, rename wolverine.dat back to wallet.dat, and restart Bitcoin-Qt. Your balance should be displayed immediately; there is normally absolutely no need for a rescan when restoring a wallet backup.


Title: Re: Importing private key back-up into Bitcoin-QT
Post by: clochard on May 21, 2014, 01:28:09 PM
When I do that, it opens again and continues scanning. Still 15 weeks behind ;)



Title: Re: Importing private key back-up into Bitcoin-QT
Post by: DannyHamilton on May 21, 2014, 01:40:22 PM
there is normally absolutely no need for a rescan when restoring a wallet backup.

Really?

Odd.  I thought a rescan was often necessary after restoring a backup.  I'll have to search through threads and see if I can find evidence of that.

EDIT:
Ok, I suspect that the reason I thought a -rescan might be necessary was because I had previously read some of these posts (and others like them):

- snip -
Place the November 7th backup in place and try the rescan.

just replace the wallet.dat file in the bitcoin folder with the backed up version, then use -rescan

Yes, a rescan has solved the problem.
- snip -

just copy back and spend

might be good idea to start the bitcoin client with the -rescan switch
- snip -

Do a rescan.
Start it from the command line with the -rescan option.
Also, make sure you have your most recent wallet.dat on the data folder.

- snip -
Restoring of a wallet backup is supported since 0.3.20 with -rescan
- snip -

You can simply rename the wallet.dat on your current Bitcoin installation, and temporarily put a copy of this old backup wallet.dat there. When you launch bitcoin with the -rescan option, it will update the wallet to show the correct balance.
- snip -

- snip -
the client can become confused when you start switching keyrings back and forth is not a problem - just run -rescan.

- snip -
Whenever you copied your wallet from backup place, you should start bitcoin-qt with rescan option:
- snip -

- snip -
So assuming that you using the backup of the encrypted wallet and that no errors are occurring you might need to run bitcoin with the -rescan option.

- snip -
So the old backup could still have some or all of the coins yet.

Of course, the encrypted wallet should not be missing anything, so like CIYAM suggested,  -rescan
- snip -


Title: Re: Importing private key back-up into Bitcoin-QT
Post by: clochard on May 21, 2014, 01:45:09 PM
Okay, another question then.

I currently changed the name back to wallet.dat

If I continue scanning the blocks (15 weeks behind), will the bitcoins appear on my balance after completing the scan, or should I have changed the name of the file before doing the entire rescan?

Because simply closing Bitcoin client and restarting it (with the name changed to wallet.dat), does not give me my balance.

Thanks!

Clochard


Title: Re: Importing private key back-up into Bitcoin-QT
Post by: DannyHamilton on May 21, 2014, 01:58:18 PM
If I continue scanning the blocks (15 weeks behind), will the bitcoins appear on my balance after completing the scan, or should I have changed the name of the file before doing the entire rescan?

Because simply closing Bitcoin client and restarting it (with the name changed to wallet.dat), does not give me my balance.

The wallet will not display any balance until it finds the block transactions where you first started receiving bitcoins with this wallet.  It will not show the correct balance until it has finds the last (most recent) block transaction where you received or spent bitcoins from this wallet.


Title: Re: Importing private key back-up into Bitcoin-QT
Post by: clochard on May 21, 2014, 02:01:45 PM
But this wallet is new, I just downloaded it a few days ago on a new pc.

So in other words, it will not show my bitcoins?

How do I get them in this wallet in that case?



Title: Re: Importing private key back-up into Bitcoin-QT
Post by: turvarya on May 21, 2014, 02:05:51 PM
But this wallet is new, I just downloaded it a few days ago on a new pc.

So in other words, it will not show my bitcoins?

How do I get them in this wallet in that case?

I think, you misunderstood something.
Sure, your bitcoin will Show in your wallet, when you have imported your wallet.dat right and when it has downloaded/scanned the last block.


Title: Re: Importing private key back-up into Bitcoin-QT
Post by: clochard on May 21, 2014, 02:11:16 PM
Allright, I guess I will just wait until it is finished scanning. If the bitcoins don't appear, I will let you guys know.

Thanks for all the help till now :)

Best,

Clochard


Title: Re: Importing private key back-up into Bitcoin-QT
Post by: Foxpup on May 21, 2014, 02:13:06 PM
When I do that, it opens again and continues scanning. Still 15 weeks behind ;)
Clarify: does it say it's "rescanning", or "synchronising"? It can't continue scanning if you swapped the wallet files. It can only resume a rescan if it's still using the same wallet file. And if it's synchronising, a rescan is not useful anyway.

Odd.  I thought a rescan was often necessary after restoring a backup.  I'll have to search through threads and see if I can find evidence of that.
The wallet.dat file stores the height of the most recent block, and blocks beyond that (if any) are automatically scanned for new transactions on startup. A full rescan is normally unnecessary and pointless.

Because simply closing Bitcoin client and restarting it (with the name changed to wallet.dat), does not give me my balance.
That's damned unusual. Are you sure you renamed the file correctly? How large is the wallet.dat file?

Sure, your bitcoin will Show in your wallet, when you have imported your wallet.dat right and when it has downloaded/scanned the last block.
The last part is incorrect. It is not necessary to even have any blocks at all for your balance to be displayed (though it will be displayed as "unconfirmed" in that case).


Title: Re: Importing private key back-up into Bitcoin-QT
Post by: clochard on May 21, 2014, 02:24:52 PM
Well, I renamed it to 'wallet.dat'

The file itself is 72kb of size.

p.s. I meant synchronizing.


Title: Re: Importing private key back-up into Bitcoin-QT
Post by: Foxpup on May 21, 2014, 02:41:07 PM
The file itself is 72kb of size.
So, it didn't actually contain any transactions at the time you made the backup? That explains a few things... Nothing to do but wait until it finishes synchronising and (hopefully) your transactions will start appearing one by one. If not... didn't you say you have multiple backups? You really ought to be trying the most recent (or largest) file first.


Title: Re: Importing private key back-up into Bitcoin-QT
Post by: clochard on May 21, 2014, 02:47:34 PM
Well I only copied the wallet.dat file which was a small file.

It is supposed to be much bigger though? There had only been one transaction, when I imported a bunch of bitcoins I still had online on MtGox last October to my Bitcoin client. Afterwards I immediately made back-ups on multiple usb's copying the wallet.dat file.

So this file cannot be correct?


Title: Re: Importing private key back-up into Bitcoin-QT
Post by: Foxpup on May 21, 2014, 03:09:07 PM
A single transaction won't make much difference to the file size, but in either case if Bitcoin-Qt is 15 weeks behind and the transaction was made more than 15 weeks ago, it definitely should be displayed. So I'm guessing something's gone horribly wrong somewhere... Don't panic, wait for it to finish synchronising, then close and restart with -rescan (wallet backups are supposed to work without a rescan, but in this case it doesn't seem to be doing what it's supposed to), and if it still doesn't work, resume panicking, I guess. :-\


Title: Re: Importing private key back-up into Bitcoin-QT
Post by: turvarya on May 21, 2014, 03:11:59 PM
The file itself is 72kb of size.
So, it didn't actually contain any transactions at the time you made the backup? That explains a few things... Nothing to do but wait until it finishes synchronising and (hopefully) your transactions will start appearing one by one. If not... didn't you say you have multiple backups? You really ought to be trying the most recent (or largest) file first.
The wallet.dat doesn't include transactions. Just the address. (transactions are in the blockchain)


Title: Re: Importing private key back-up into Bitcoin-QT
Post by: clochard on May 21, 2014, 03:29:31 PM
Guys I fixed it! Apperently with windows 8 it saved the peers.dat and wallet.dat files in another place than with 7 and vista, so I copied the wallet.dat in the wrong folder and that is why I could not see them in the Bitcoin client. Now I am still lagging behind 7 weeks, but the transactions are there at least.

Quite a relief I should say.

I was already thinking, what on earth could have gone wrong...

Thanks for all the help! Really appreciated :)

Best,

Clochard


Title: Re: Importing private key back-up into Bitcoin-QT
Post by: Foxpup on May 22, 2014, 04:01:04 AM
The wallet.dat doesn't include transactions. Just the address. (transactions are in the blockchain)
Of course it does. The blockchain's currently about 16GB. You think Bitcoin-Qt reads the entire blockchain every time it needs to display a transaction? Try this: close Bitcoin-Qt, remove everything from the data directory except wallet.dat, then restart. All your transactions are still there (albeit unconfirmed), even though the blockchain is gone. So how does it know?

Guys I fixed it! Apperently with windows 8 it saved the peers.dat and wallet.dat files in another place than with 7 and vista, so I copied the wallet.dat in the wrong folder and that is why I could not see them in the Bitcoin client.
Wait a minute. You said you removed the empty wallet.dat that was created by the new Bitcoin-Qt installation? So how could you have been using the wrong folder the whole time? That doesn't... ah, never mind. Glad you fixed it in the end.


Title: Re: Importing private key back-up into Bitcoin-QT
Post by: turvarya on May 22, 2014, 05:58:36 AM
The wallet.dat doesn't include transactions. Just the address. (transactions are in the blockchain)
Of course it does. The blockchain's currently about 16GB. You think Bitcoin-Qt reads the entire blockchain every time it needs to display a transaction? Try this: close Bitcoin-Qt, remove everything from the data directory except wallet.dat, then restart. All your transactions are still there (albeit unconfirmed), even though the blockchain is gone. So how does it know?

That is just not true. I downloaded the blockchain 3 times. The Transaction are not shown in Bitcoin-QT until it has downloaded the blockchain to the Point, where the Transaction was made.
Have you tried what you suggest your self? I don't think so.


Title: Re: Importing private key back-up into Bitcoin-QT
Post by: Foxpup on May 22, 2014, 07:19:17 AM
That is just not true. I downloaded the blockchain 3 times. The Transaction are not shown in Bitcoin-QT until it has downloaded the blockchain to the Point, where the Transaction was made.
Have you tried what you suggest your self? I don't think so.
I have. Several times, in fact. I've no idea why it's not working for you. Irregardless, transactions are stored in the wallet. What do you suppose the -rescan and -zapwallettxes options are for?


Title: Re: Importing private key back-up into Bitcoin-QT
Post by: clochard on May 22, 2014, 04:18:43 PM
Okay guys, new problem, new question :(

I tried to send my Bitcoins today from my Bitcoin client to electrum, but it requested a password. On the old Bitcoin wallet I had a password that I wrote down and I have used and it worked.

When I installed the new Bitcoin client, I felt a bit insecure and put a new password on it. I typed it twice and wrote it down and I am pretty sure that it is correct.

Today when I was going to transfer the coins, I was confused which password I had to use. So I have tried them both multiple times, but the Bitcoin client keeps repeating that it is the wrong password.

What is happening here? Both passwords I am more than 100% certain about.

Many thanks!

Best,

Clochard


Title: Re: Importing private key back-up into Bitcoin-QT
Post by: escrow.ms on May 22, 2014, 04:22:15 PM
Okay guys, new problem, new question :(

I tried to send my Bitcoins today from my Bitcoin client to electrum, but it requested a password. On the old Bitcoin wallet I had a password that I wrote down and I have used and it worked.

When I installed the new Bitcoin client, I felt a bit insecure and put a new password on it. I typed it twice and wrote it down and I am pretty sure that it is correct.

Today when I was going to transfer the coins, I was confused which password I had to use. So I have tried them both multiple times, but the Bitcoin client keeps repeating that it is the wrong password.

What is happening here? Both passwords I am more than 100% certain about.

Many thanks!

Best,

Clochard

If you are sure it's same, try with caps,without caps or if you used special characters that are on numerical keypad, try numbers, sometimes due to bad keyboard people enter 2 instead of @

Oh btw, if you have old wallet backup, you can use that one.


Title: Re: Importing private key back-up into Bitcoin-QT
Post by: DeathAndTaxes on May 22, 2014, 04:27:03 PM
there is normally absolutely no need for a rescan when restoring a wallet backup.

Really?

Odd.  I thought a rescan was often necessary after restoring a backup.  I'll have to search through threads and see if I can find evidence of that.

It was needed at one time.  It hasn't for some time now.  The wallet file maintains a copy of all txs it knows and it also maintains the block height (and best chain hash) of the last block it saw.  With those two pieces of info the wallet can update itself by just checking all "new" blocks. I can confirm this works as expected.  I use it on an almost daily basis.  Now the older the backup the more blocks it will need to parse but this will always be less than a full rescan and often it will be significantly less. If the backup was from yesterday it only needs to scan one day's worth of blocks instead of four years.

As for why do people keep recommending -rescan? I don't know.  Urban legends never die?   The only time a rescan should be needed is if something "breaks".   Now that you know you can join the fight against superstition and false solutions. :)


Title: Re: Importing private key back-up into Bitcoin-QT
Post by: DannyHamilton on May 22, 2014, 04:34:02 PM
As for why do people keep recommending -rescan? I don't know.  Urban legends never die?   The only time a rescan should be needed is if something "breaks".   Now that you know you can join the fight against superstition and false solutions. :)

Thanks, will do.


Title: Re: Importing private key back-up into Bitcoin-QT
Post by: clochard on May 22, 2014, 04:45:49 PM
If you are sure it's same, try with caps,without caps or if you used special characters that are on numerical keypad, try numbers, sometimes due to bad keyboard people enter 2 instead of @

Oh btw, if you have old wallet backup, you can use that one.

I tried already capslock and stuff, but nothing is working. Should I now be using my old password btw, or the new one that I put yesterday?

And I do still have the old back up. Does this mean that if I remove this Bitcoin client from my pc and I install a new one it will use my old password that I used to have? Because in that case, that would be the solution :)

Thanks in advance!

Best,

Clochard


Title: Re: Importing private key back-up into Bitcoin-QT
Post by: escrow.ms on May 22, 2014, 04:55:31 PM
If you are sure it's same, try with caps,without caps or if you used special characters that are on numerical keypad, try numbers, sometimes due to bad keyboard people enter 2 instead of @

Oh btw, if you have old wallet backup, you can use that one.

I tried already capslock and stuff, but nothing is working. Should I now be using my old password btw, or the new one that I put yesterday?

And I do still have the old back up. Does this mean that if I remove this Bitcoin client from my pc and I install a new one it will use my old password that I used to have? Because in that case, that would be the solution :)

Thanks in advance!

Best,

Clochard

You don't need to reinstall anything,

Open this folder C:\Users\*UserName*\Appdata\Roaming\Bitcoin
Rename your current wallet.dat to wallet1.dat and then copy paste your old wallet.dat in same directory.

Once you have done that, your old password will work and you need to rescan it one by using -rescan option. (https://bitcointalk.org/index.php?topic=171390.msg1820287#msg1820287)



Title: Re: Importing private key back-up into Bitcoin-QT
Post by: DannyHamilton on May 22, 2014, 04:58:27 PM
you need to rescan it one by using -rescan option. (https://bitcointalk.org/index.php?topic=171390.msg1820287#msg1820287)

Apparently not.  (See the discussion from this thread)


Title: Re: Importing private key back-up into Bitcoin-QT
Post by: escrow.ms on May 22, 2014, 05:01:19 PM
you need to rescan it one by using -rescan option. (https://bitcointalk.org/index.php?topic=171390.msg1820287#msg1820287)

Apparently not.  (See the discussion from this thread)

Yeah just checked, he already did that I guess.


Title: Re: Importing private key back-up into Bitcoin-QT
Post by: clochard on May 22, 2014, 05:35:38 PM
Thanks for the replies guys.

I changed the name of the wallet.dat to wallet1.dat and I imported the old back-up wallet.dat to the folder and restarted the Bitcoin client.

I typed my old password to do a transaction, but it is still not working...

And I have used that password before, I have it here on a paper in front of me, and now it does not work anymore...

What the heck!?

Anyone has any idea?

Thanks!

Clochard


Title: Re: Importing private key back-up into Bitcoin-QT
Post by: turvarya on May 23, 2014, 10:04:07 AM
Thanks for the replies guys.

I changed the name of the wallet.dat to wallet1.dat and I imported the old back-up wallet.dat to the folder and restarted the Bitcoin client.

I typed my old password to do a transaction, but it is still not working...

And I have used that password before, I have it here on a paper in front of me, and now it does not work anymore...

What the heck!?

Anyone has any idea?

Thanks!

Clochard
You could write it in an Editor(Notepad) where you see it and not just *'s and copy it to be sure, you typed it right.