How to migrate wallet from namecoin to namecore?

4

Today I updated namecoin by building the new "namecore" reimplementation but when starting namecoind I got this message:

Error opening block database.

Do you want to rebuild the block database now?

and before I could do anything namecoind crashed. So I moved away the Namecoin folder and let it regenerate everything, blockchain included. This time it started without errors, so I copied my wallet.dat into the folder and restarted namecoind but I got an Error: and it crashed again. The debug.log shows this:

2015-06-29 15:36:51 Using wallet wallet.dat
2015-06-29 15:36:51 init message: Verifying wallet...
2015-06-29 15:36:51 CDBEnv::Open: LogDir=/home/michele/Library/Application Support/Namecoin/database ErrorFile=/
2015-06-29 15:36:51 Renamed wallet.dat to wallet.1435592211.bak
2015-06-29 15:36:51 CDBEnv::Salvage: Database salvage found errors,     all data may not be recoverable.
2015-06-29 15:36:51 Salvage(aggressive) found no records in wallet.1435592211.bak.
2015-06-29 15:36:51 Error:

I figured the wallet format has changed somehow, so using the old client I dumped the private keys and I succefully imported them using importprivkey. I can see the address, the balances and all but name_list shows nothing.

How do I get back my names now?

Rnhmjoj

Posted 2015-06-29T16:07:50.323

Reputation: 91

Answers

2

Meanwhile I've answered this question at reddit.

You have already taken the first 2 out of 3 steps necessary for your wallet migration: (1) cleaned up the data directory that contained old incompatible files, (2) dumped and imported the private keys from the old wallet (alternatively, depending on how old the wallet is, one could try starting the new namecore client with the -upgradewallet parameter).

The internal bookkeeping hasn't had a chance to detect the old transactions that belong to the newly imported private keys, yet. This is the missing third step: (3) Restart namecore (i.e. namecoind) with the -rescan parameter.

In short: Now you need to restart the new client with the -rescan parameter.

EDIT: Generally I recommend using namecore's new -upgradewallet parameter:
namecoind -upgradewallet -rescan -reindex
as the dumpprivkey/importprivkey approach always bears the risk of confusing the relevant name_update transactions and addresses with older ones. If you do not know how to use the (deprecated) name_debug1 command in Namecoin-Qt then you most likely get it wrong.

cassini

Posted 2015-06-29T16:07:50.323

Reputation: 176

Thanks. I have already tried that: name_list stays empty.Rnhmjoj 2015-07-08T00:49:49.987

This is what happens when I use -rescan: hastebin.com/axixerizefRnhmjoj 2015-07-08T04:01:08.960

How many private keys did you import? hastebin shows in line 3 a transfer of NMCs to N3zSdWjXJwtnZHYdRXymSzVzgooDMpAvEw, and at line 4 the operation "name_new id/rnhmjoj" related to NH4FJp1fEMFfE2Jh1dpnAMga7YaQwyL954. The private keys for the name_firstupdate and the name_update operations are missing so far. Most important would be the latest name_update which arrived at MxeWiWXr9U9jwG2KHWyBNKg9uHbiiqZjW6. Are you sure you imported the private key for this address?cassini 2015-07-08T14:04:39.897

Quite sure. I have imported every address I had.Rnhmjoj 2015-07-08T15:20:55.400

Just had a quick conversation with domob, the namecore developer. He recommends also adding the -reindex parameter: namecoind -rescan -reindex (takes about 1 hour on an i5 with SSD. Much longer when run on a harddisk, I guess. -printtoconsole and -dbcache=400 may help)cassini 2015-07-08T18:29:17.297

This sounds like a bug, @cassini would you mind opening a ticket on Github?Indolering 2015-07-08T22:29:43.253

@cassini That took a while to run however everything seems to be unchanged: name_list is still empty.Rnhmjoj 2015-07-09T00:03:23.300

@Rnhmjoj There are several things that could have gone wrong during your dump/importprivkey attempts, also the old wallet.dat may be partially damaged, or your namecore build had issues during compiling. And as indolering already indicated there could still be a bug in namecore. I think it would be easiest if you send the old wallet file to one of the Namecoin devs. First ask phelix or me for encryption instructions. You could also try domob, biolizard or indolering. Not sure if they have time at the moment.

cassini 2015-07-09T20:23:07.680

The wallet is working fine on another machine that is running namecoin 0.3.80. I did the whole thing several times: compiling namecore, dumping and importing the keys. I also updated the wallet to the latest format from 0.3.80. I don't think is damaged.Rnhmjoj 2015-07-09T23:29:43.173