0

Question:

How do I use Mist to extract the Raw private key of an account. The account is password protected (if that makes a difference I don't know).


Elaborating:

  • I made an account with mist that has a a password associated to it
  • I already backed up the JSON file which can be used to import the account into another mist wallet

What I want however is the RAW private key. I understand I don't need it since I have the JSON file, though I still want to at least know how to get it if I do want it.

Ideally there would be some easy UI option in Mist, though I recognize that there might be a geth command as well. All help is really appreciated.

Webeng
  • 895
  • 2
  • 12
  • 26
  • You might also find the answer with the highest votes (from Nicolas Massart) to the following question to be helpful: https://ethereum.stackexchange.com/questions/3720/how-do-i-get-the-raw-private-key-from-my-mist-keystore-file – Ajoy Bhatia May 14 '18 at 22:00

1 Answers1

0

just a few hours ago i tried to find an easy solution. the python way is not extremely easy but easy enough.

you can use web3.py
http://web3py.readthedocs.io/en/stable/web3.eth.account.html#extract-private-key-from-geth-keyfile

from web3.auto import w3
with open('~/.ethereum/keystore/UTC--...--5ce9454909639D2D17A3F753ce7d93fa0b9aB12E') as keyfile:
    encrypted_key = keyfile.read()
    private_key = w3.eth.account.decrypt(encrypted_key, 'correcthorsebatterystaple')
    # tip: do not save the key or password anywhere, especially into a shared source file

in mist go to file->backup->accounts
to copy paste the location of the keyfile

note for windows:
installing web3.py on windows can be a bit tricky i suggest using precompiled whls for lru_cache and cytoolz
https://www.lfd.uci.edu/~gohlke/pythonlibs/

swisswiss
  • 147
  • 1
  • 7
  • Good answer except for the part that says that installing web3 is tricky, you just need to do pip3 install web3. Install the C++ compiler 2015 if you do not have it already. – Jaime May 14 '18 at 22:19
  • @Jaime i thought that maybe not everyone willing to give this answer a try is very familiar with python and from experience it can be quite annoying having to install all sorts of compilers and stuff just to do a pip install. – swisswiss May 14 '18 at 22:25