I can only find instructions for geth, but cannot find anything about doing it using eth which is part of cpp-ethereum.


I will answer my own question. In short, the answer is ethkey tool that comes with cpp-ethereum.

As a demonstration, I will create some eth wallet on www.myetherwallet.com, import it into cpp-ethereum, and then display its private key.

1. Create some dummy eth wallet on www.myetherwallet.com

I created eth address 0x698042d6233042632711C86452A53a8E9637F585 with private key: a2fc86c38a1a7fb6c0eaea9696d6434cd977dbef46fba3183ac99ad42d2f62ef.


enter image description here

2. Import it into cpp-ethereum

./ethkey importbare a2fc86c38a1a7fb6c0eaea9696d6434cd977dbef46fba3183ac99ad42d2f62ef

You will be asked for password. Give some.

Enter a passphrase with which to secure account 698042d6…: 
Please confirm the passphrase by entering it again: 
Successfully imported a2fc86c38a1a7fb6c0eaea9696d6434cd977dbef46fba3183ac99ad42d2f62ef as 1c15859c-c3eb-0328-36bc-1ac17792d986

Not that the private key was imported as 1c15859c-c3eb-0328-36bc-1ac17792d986. This means that file ~/.web3/keys/1c15859c-c3eb-0328-36bc-1ac17792d986.json was created.

3. Display private key

Using the ethkey, show the private key:

./ethkey --show-me-the-secret  inspectbare 1c15859c-c3eb-0328-36bc-1ac17792d986

The result is:

Enter passphrase for key 1c15859c-c3eb-0328-36bc-1ac17792d986: 
Key 1c15859c-c3eb-0328-36bc-1ac17792d986:
  Raw hex: 698042d6233042632711c86452a53a8e9637f585
  Secret: a2fc86c38a1a7fb6c0eaea9696d6434cd977dbef46fba3183ac99ad42d2f62ef

where Secret is our private key, while Raw hex is our address.

  • Why do you use myetherwallet? The private key is just a random number, which you can get through much more secure means... For example, openssl rand -hex 32 if you have openssl, or you can use /dev/urandom on unix systems – Tjaden Hess Jun 26 '17 at 15:53
  • @TjadenHess No particular reason as only to show this example and that the the private key from myetherewallet agrees with ethkey results. – NewTwoEth Jun 26 '17 at 23:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.