namecoin / namecoin-core

Namecoin full node + wallet based on the current Bitcoin Core codebase.
https://www.namecoin.org/
MIT License
462 stars 147 forks source link

I`m try to recover my old wallet version 0.3.8 #214

Closed djmcg closed 6 years ago

djmcg commented 6 years ago

Dear Namecoin Fans

I`m try to recover my old wallet version 0.3.8 with the script more details here:

https://forum.namecoin.org/viewtopic.php?f=7&t=2645&sid=b5f164e9bb8b5241159b5e83761d8af0

I`m wondering what the prefix should be in the line 79 now I have : x80

EncodeBase58Check('\x80'+data[pos+magiclen:pos+magiclen+32])

Could You advice what kind I do in this line?? Regards

JeremyRand commented 6 years ago

Hi,

The bitcoin branch uses 128 as the secret key prefix: https://github.com/namecoin/namecoin-core/blob/1340eda3b7b6ca2789d6ec65dad72ee4c3844661/src/chainparams.cpp#L141

The master branch uses 180: https://github.com/namecoin/namecoin-core/blob/710b056abec0800639a024ceb32d54098026df4c/src/chainparams.cpp#L173

So I suspect you want 180. Let us know if it works. :)

djmcg commented 6 years ago

Hello thank You for the reply. I wrote a script that generates all the "prefix" (256 possibilities), unfortunately none of them matches the prive key from the walllet.dat file that I generated for testing purposes in version 0.3.8. 180 or B4 (Hex) also. Any suggestion?

JeremyRand commented 6 years ago

I'm not sure. @domob1812 might possibly know, since he used to maintain the 0.3.80 codebase.

domob1812 commented 6 years ago

Note that this discussion should not take place on a Github issue, rather on the forum (linked to from your original post).

Is your old wallet perhaps encrypted? One thing to note is that encryption worked differently (in a non-standard way, different from Bitcoin) in 0.3.80: See https://github.com/namecoin/namecoin-core/blob/master/src/wallet/crypter.cpp#L148. Your recovery script likely needs to be adapted for this in case you had an encrypted wallet.

Other than that, I believe that the version byte is the only difference - and that actually only matters for the text format, not the privkey recovery itself. Besides that, until very recently, the new Namecoin client was actually able to import both privkeys with 0x80 and 0xB4 as version bytes.