# Convert an eth key to a geth key

I need to convert my eth key to a geth key.

eth put the key in %appdata%\roaming\Web3\keys, and I see it as a .json file. If I move that to the %appdata%\roaming\Ethereum\keystore directory, geth still doesn't recognize it. If I try to do geth account import keyname.json, that fails with:

Fatal: Could not create the account: encoding/hex: invalid byte: U+007B '{'"


I also tried altering the .json file to look more like the geth key by adding "address":"[address]" to no avail.

Backstory: I created an account using eth, moved some ether into it (verified using etherchain.org), but my eth install was always broken, wouldn't connect to peers, etc., so I want to move the account to geth. The account was generated from eth 0.9.41. I haven't tried to reinstall eth yet in case there is something that needs to be preserved in order to proceed. Safety first...

It's possible but not recommended and therefore a not documented feature.

1. Get the UUID of the account:

 ~ $ethkey listbare 8766c082-432f-5548-608c-6eec600757f9  2. Display the private key:  ~$ ethkey inspectbare --show-me-the-secret 8766c082-432f-5548-608c-6eec600757f9
Enter passphrase for key 8766c082-432f-5548-608c-6eec600757f9:
Key 8766c082-432f-5548-608c-6eec600757f9:
ICAP: XE871TJEHQTCYKGJ2ETMECEX4AVZLMG4MZ
Raw hex: 006ed403807ae87b9f958f25c33862927ba1b57b
Secret: 7b275146cbb8da08xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxe10da42934fa2f01

3. Import the plain key into geth:

 ~ $echo 7b275146cbb8da08xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxe10da42934fa2f01 > delete-me.prv ~$ geth account import delete-me.prv
Passphrase:
Repeat passphrase:

4. Don't forget to remove the plain key from disk again:

 ~ $rm -f delete-me.prv  After some digging, I found a comment by Stephan Tual, stating it is designed to prevent you from extracting the (unencrypted) private keys, and never exposes them to the user. The idea is that this will remove the risk of leaving the keys on a USB stick for example. The best would be to generate new keys in geth and simply transfer the funds to the new account. • There is absolutely no need to create new keys. You can still import the secret key to geth via ethkey. – Lefteris Feb 8 '16 at 9:05 • i could not figure out how. do you mind posting an answer? – Waqar Lim Feb 8 '16 at 9:06 • Thanks a lot. Saved me 5 eth out of a bad eth installation with a problematic database. – Paul May 21 '16 at 4:19 The way to do this is risky but it is doable. It involves showing your private key on screen which is generally a REALLY bad thing to do. ethkey listbare 462352b14-0121-0454-5a4f-15f791233f1a  So let's say that this is your json key file. Then you would do: ./ethkey inspectbare --show-me-the-secret 462352b14-0121-0454-5a4f-15f791233f1a  And ethkey should show you the private key. • Is that the reason why it is undocumented? – Waqar Lim Feb 8 '16 at 11:17 • I suppose so. The c++ client has minimal support at the moment as compared to geth. – Lefteris Feb 8 '16 at 12:43 • Lefteris - thanks for all the current hard work on Raiden Network! : ) I noticed on the Raiden website transactions will be Confidential, does this mean to some degree they will be essentially anonymous/private too? – SHA256 Feb 4 '17 at 2:09 • hello! Let's please comments relevant to the topic. For raiden ask me in twitter/gitter/github. Short answer is no :) – Lefteris Feb 7 '17 at 12:24 • How can I run ethkey? The command is unavailable on my geth console. – étale-cohomology May 24 '17 at 8:18 The json files that eth uses are not the same as the keystore (json) files that geth uses. In order to successfully switch between clients, you must re-import the accounts via the unencrypted private key. 1. Make a backup...just in case The first step is to make a backup of your eth JSON files, just in case anything goes wrong. These should already be backed up externally, like on a USB drive, but if they aren't, please take the time to do so now. 2. Get your unencrypted private key for your eth accounts. Please reference the StackExchange answers found on this thread. 3. Import these new, unencrypted private keys into geth. Please use the instructions found on this thread. 4. Confirm that you accounts have successfully transferred to the new geth account $ geth account list


5. Make a backup of your new geth keystore files.

Personally, I would keep the old eth backup...just in case. Throw it in an "old_eth_backup" folder and call it a day. The geth keystore files are found at the locations below. Back these files up.

Mac: ~/Library/Ethereum/keystore

Linux: ~/.ethereum/keystore

Windows: %APPDATA%/Ethereum/keystore


6. Delete the unencrypted private keys from where ever you saved them.

Now that we have successfully backed up the geth keystore files, which are encrypted, it is time to get rid of the unencrypted private keys. Yay!