4

I'd like to do the following:

  • I use dumpprivkey to get the private key from Litecoin wallet.
  • I import this private key into Dogecoin wallet
  • Which will generate a new Dogecoin address. Both will share the same private key.

The most related post I found is: What happens if you send Bitcoin to a Litecoin address?

However, when I try to directly import, it will give me the error:
{"code":-5,"message":"Invalid private key encoding"}

So now, how can I dump the private key and decode into hex and move the prefix from "L" to "D" and regenerate a WIF for dogecoin?

Is there any existing solution for it?

temple
  • 163
  • 1
  • 7

1 Answers1

8

Let's assume we have this compressed Litecoin WIF private key: T4DRLwPgnkg9jyivjbbnmqJZjHRxeYTy4idAV5uwEuFdyJBGuxXE.

% echo T4DRLwPgnkg9jyivjbbnmqJZjHRxeYTy4idAV5uwEuFdyJBGuxXE | bx base58check-decode

wrapper { checksum 625264444 payload 22b207aa76eb058876c667dc64ab8eeaa0a073bc018561c2463d438a0444b70501 version 176 }

ANSWER for Doge WIF Key:

% bx base58check-encode -v 158 22b207aa76eb058876c667dc64ab8eeaa0a073bc018561c2463d438a0444b70501

QPn542uVdzBgCfV6nEViShboFTpDd1at8mQpQugEQHgpuLbsgcZe

VALIDATION CHECK:

% echo QPn542uVdzBgCfV6nEViShboFTpDd1at8mQpQugEQHgpuLbsgcZe | bx base58check-decode

wrapper { checksum 2298567751 payload 22b207aa76eb058876c667dc64ab8eeaa0a073bc018561c2463d438a0444b70501 version 158 }

Examine 158, base58check-decode and base58check-encode for more details.

skaht
  • 3,017
  • 1
  • 12
  • 23
  • it is awesome, it really help. and also need the altcoin mapping url is here: https://github.com/libbitcoin/libbitcoin/wiki/Altcoin-Version-Mappings#bip44-altcoin-version-mapping-table , However, it is not quite complete, anyone knows how to get the extra WIF version value? – temple Sep 28 '16 at 18:50