Bitcoin Forum

Bitcoin => Bitcoin Technical Support => Topic started by: kohlanta on January 24, 2013, 10:55:31 PM



Title: [10 btc reward] protocol, wallet and client version mismatch errors
Post by: kohlanta on January 24, 2013, 10:55:31 PM
I am running 2 bitcoind instances on ubuntu 12.04.1 LTS server, wallet a and wallet b.  The version info from getinfo() for wallet a is
Code:
    "version" : 60300,
    "protocolversion" : 60001,
    "walletversion" : 60000,

The version info from getinfo() for wallet b is
Code:
    "version" : 70200,
    "protocolversion" : 60002,
    "walletversion" : 60000,

If I try to export wallet.dat from wallet a, put it in an empty .bitcoin directory and run it with the latest client version (7.0.2) I get the following error
Code:
Bitcoin: wallet.dat corrupt, salvage failed

Obviously wallet b will run with the latest client as seen in the version output.  This leads me to believe that the issue is the protocol version.  For some reason 60001 is incompatible with the latest client, and 60002 is.

So, here is the 10 btc question:
How can I get wallet a to run on the latest client?  It doesn't work for me to just transfer the balance to a new wallet, because I need the addresses in wallet a.  Also, wallet a has a bunch of addys.  It's around 1 gb in size.

First person to post a solution that I can get to work wins the 10 btc.  Thanks in advance!


Title: Re: [10 btc reward] protocol, wallet and client version mismatch errors
Post by: Raoul Duke on January 24, 2013, 11:04:11 PM
Try to detach databases on shutdown and then replace the wallet.
You have to do that when upgrading from 0.6.x to 0.7.x

Not sure if you should also copy the blockchain data, to make it think you are upgrading.

BTW, this is a wild guess ;D


Title: Re: [10 btc reward] protocol, wallet and client version mismatch errors
Post by: kohlanta on January 24, 2013, 11:06:57 PM
Try to detach databases on shutdown and then replace the wallet.
You have to do that when upgrading from 0.6.x to 0.7.x

Not sure if you should also copy the blockchain data, to make it think you are upgrading.

BTW, this is a wild guess ;D

a wild guess is better than none.  how do I "detach databases on shutdown"?


Title: Re: [10 btc reward] protocol, wallet and client version mismatch errors
Post by: Raoul Duke on January 24, 2013, 11:10:14 PM
On the options window there is a checkbox with that text. Check it. Close the client. It will take a few minutes to completely close while it detaches the DB's.

Your best option will be to probably copy the entire bitcoin data dir to the new location, instead of copying just the wallet.dat.
Don't forget to backup any data before replacing it. <--- can't be said enough times :)


Title: Re: [10 btc reward] protocol, wallet and client version mismatch errors
Post by: kohlanta on January 24, 2013, 11:15:55 PM
On the options window there is a checkbox with that text. Check it. Close the client. It will take a few minutes to completely close while it detaches the DB's.

I'm using the headless client on a server, so there must be a flag or something.  I usually shutdown by doing
Code:
bitcoind stop


Title: Re: [10 btc reward] protocol, wallet and client version mismatch errors
Post by: Raoul Duke on January 24, 2013, 11:17:12 PM
Start bitcoind with
Code:
bitcoind -detachdb=1
and after shut it down as usual.


EDIT: Reading further I found that the wallet.dat is always detached at shutdown.



Title: Re: [10 btc reward] protocol, wallet and client version mismatch errors
Post by: kohlanta on January 24, 2013, 11:28:05 PM
Start bitcoind with
Code:
bitcoind -detachdb=1
and after shut it down as usual.


Let me make sure I have this straight.  I start wallet a with bitcoind -detachdb=1, then stop it with bitcoind stop, then take the wallet.dat for wallet a and try to run the latest client with it?


Title: Re: [10 btc reward] protocol, wallet and client version mismatch errors
Post by: Raoul Duke on January 24, 2013, 11:33:28 PM
Yup, that would be it.

Also: Read my edit above.


Title: Re: [10 btc reward] protocol, wallet and client version mismatch errors
Post by: nethead on January 24, 2013, 11:52:26 PM
Ideas i got:

1. import your wallet.dat to blockchain, and extract it from there (maybe it will fix it)
2. There is a program somewhere around here, that extracts the private keys from the wallet.dat file (and then you import them to the other wallet)
3. I tried googling how to get private keys from old wallet, and got manyyy results, i think you will too  :P


Hope i helped a little, and even a little part of those 10 btc would make me very happy :)

(im trying to find the program name)


EDIT: blockchain.info can also hand you your private keys after you imported the wallet.dat
see https://blockchain.info/wallet/import-wallet



Title: Re: [10 btc reward] protocol, wallet and client version mismatch errors
Post by: Raoul Duke on January 25, 2013, 12:00:53 AM
nethead, blockchain.info My Wallet has a limit of 400 private keys in each wallet. That's probably an important detail to keep in mind.
I would need 10 or more My Wallet accounts to be able to import my 15MB wallet.dat with 4000+ addresses.
OP says his wallet.dat is 1GB in size.


Title: Re: [10 btc reward] protocol, wallet and client version mismatch errors
Post by: kjj on January 25, 2013, 12:02:25 AM
The stop RPC command can also take an optional argument to force (or prevent) a full database detach.

Code:
bitcoind stop true


Title: Re: [10 btc reward] protocol, wallet and client version mismatch errors
Post by: nethead on January 25, 2013, 12:13:30 AM
nethead, blockchain.info My Wallet has a limit of 400 private keys in each wallet. That's probably an important detail to keep in mind.
I would need 10 or more My Wallet accounts to be able to import my 15MB wallet.dat with 4000+ addresses.
OP says his wallet.dat is 1GB in size.

Didnt know that, and didnt see the 1gb part, sorry from my side.
The other way with the program that exports the keys so do it i guess, but still didnt find the name of it, im sure it here in the forum though


Title: Re: [10 btc reward] protocol, wallet and client version mismatch errors
Post by: Raoul Duke on January 25, 2013, 12:14:40 AM
The other way with the program that exports the keys so do it i guess, but still didnt find the name of it, im sure it here in the forum though

pywallet


Title: Re: [10 btc reward] protocol, wallet and client version mismatch errors
Post by: nethead on January 25, 2013, 12:16:36 AM
The other way with the program that exports the keys so do it i guess, but still didnt find the name of it, im sure it here in the forum though

pywallet

Yup thats it, i really hope that if the way you previously said does not work pywallet will, split reward :D


Title: Re: [10 btc reward] protocol, wallet and client version mismatch errors
Post by: kohlanta on January 25, 2013, 12:25:22 AM
ok, im looking into pywallet.


Title: Re: [10 btc reward] protocol, wallet and client version mismatch errors
Post by: Raoul Duke on January 25, 2013, 12:30:24 AM
ok, im looking into pywallet.

pywallet will only help you to retrieve/dump your private keys in bulk. You'll still need to find a way to import them on a new wallet, beacuse AFAIK pywallet only let's you import 1 private key at a time.

BTW, could you do one small thing, just to troubleshoot?
Can you rename your wallet a and let the 0.6.1 client create a new wallet.dat and try running that newly created wallet on the 0.7.2 client, just to see if it works?
Or maybe you already did that :)


Title: Re: [10 btc reward] protocol, wallet and client version mismatch errors
Post by: bitfarmer on January 25, 2013, 01:25:55 AM
A 1 gb wallet? Yikes! Dare I ask how and why?


Title: Re: [10 btc reward] protocol, wallet and client version mismatch errors
Post by: paraipan on January 25, 2013, 01:28:42 AM
...
Code:
Bitcoin: wallet.dat corrupt, salvage failed

...

First of all try running the wallet A with "-detachdb=1", as psy suggested, and then stop it so you have a consistent database file (wallet) before you copy it over.

If it doesn't work you can use the db4.8_dump and db4.8_load utilities to recover it completely. You may need to install db4.8-util package first.

Code:
db4.8_dump -p wallet.dat >wallet.txt

Import the purged dump again:

Code:
db4.8_load -f wallet.txt wallet.dat.new

Replace wallet.dat with wallet.dat.new, and start bitcoin.


Title: Re: [10 btc reward] protocol, wallet and client version mismatch errors
Post by: kohlanta on January 25, 2013, 01:31:44 AM
I think pywallet plus some scripting will do the trick.  I'll check back in here when/if I get it to work and hit you guys up for payment addresses for the bounty.


Title: Re: [10 btc reward] protocol, wallet and client version mismatch errors
Post by: kohlanta on January 26, 2013, 01:10:24 AM
ok, pywallet works well to get the privkeys from wallet a, but unfortunately it is not designed to work with wallets with versions later than 32500, so when I try to import into a new wallet, the wallet gets corrupted.

So, I am very close, and I like this bulk import/export method because I can prune this giant wallet I have, but I am at a loss how to import the addresses.  The new client has the importprivkey function, but it takes 1-2 minutes per address to import.

Does anyone know a way to import privkeys into a wallet quickly?


Title: Re: [10 btc reward] protocol, wallet and client version mismatch errors
Post by: kohlanta on January 26, 2013, 02:03:39 AM
found and confirmed a hack that takes the import time down to 6 seconds per key.

psy please provide an address for your 10 btc reward for helping me find pywallet.


Title: Re: [10 btc reward] protocol, wallet and client version mismatch errors
Post by: Raoul Duke on January 26, 2013, 02:56:18 AM
yay!  :o Thanks!

Maybe you could post the hack you used, in the Open Source spirit, you know :P, so it can help other users who face the same problem now or in the future. That would be really great.

Here's my address: 1PKyq6aMKcCwn8cmb9Jc5SkNydLsQb5n7K


Title: Re: [10 btc reward] protocol, wallet and client version mismatch errors
Post by: kohlanta on January 27, 2013, 02:43:34 AM
that part of the solution was actually on these forums:

https://bitcointalk.org/index.php?topic=43496.msg1065765#msg1065765


Title: Re: [10 btc reward] protocol, wallet and client version mismatch errors
Post by: chufchuf on April 13, 2013, 02:11:03 AM
ok, pywallet works well to get the privkeys from wallet a, but unfortunately it is not designed to work with wallets with versions later than 32500, so when I try to import into a new wallet, the wallet gets corrupted.

So, I am very close, and I like this bulk import/export method because I can prune this giant wallet I have, but I am at a loss how to import the addresses.  The new client has the importprivkey function, but it takes 1-2 minutes per address to import.

Does anyone know a way to import privkeys into a wallet quickly?

What did you mean by versions later than 32500?


Title: Re: [10 btc reward] protocol, wallet and client version mismatch errors
Post by: jackjack on April 13, 2013, 10:36:01 AM
He meant 0.3.25
BTW pywallet now works with last wallet versions