This is such a basic question, but I can not figure out how to import a plain, unencrypted private key into geth or mist?
I tried geth account import 7[......]bla
but it seems this command is always looking for an unencrypted keyfile.
Any ideas?
Ethereum Stack Exchange is a question and answer site for users of Ethereum, the decentralized application platform and smart contract enabled blockchain. It only takes a minute to sign up.
Sign up to join this communityThis is such a basic question, but I can not figure out how to import a plain, unencrypted private key into geth or mist?
I tried geth account import 7[......]bla
but it seems this command is always looking for an unencrypted keyfile.
Any ideas?
Paste the key into a text file, save it to disk and use the path to that file with geth account import
. Here are some example Windows instructions that might help:
nothing_special_delete_me.txt
at C:\
geth account import C:\nothing_special_delete_me.txt
C:\nothing_special_delete_me.txt
If you do not have geth installed already, do the following steps after step 3, and the continue to step 4:
cd c:\Ethereum-Wallet-win64-0-7-3\resources\node\geth
(insert your correct path there)Fatal: keyfile must be given as argument
while doing the same. PS: I am running on linux macine.
– Prashant Prabhakar Singh
Oct 10 '16 at 9:02
Use the following command in the geth console
web3.personal.importRawKey("<Private Key>","<New Password>")
personal
methods. See ethereum.stackexchange.com/questions/1413/… for more info
– Tjaden Hess♦
Nov 14 '16 at 16:01
Mist has no way to import via GUI, so you need to import using command line (geth
). It will show up in your Mist immediately.
For Mac:
Open TextEdit
Paste key into TextEdit without any extra characters or quotations
Save the file as nothing_special_delete_me.txt
to your Desktop
Open Terminal, run command:
geth account import ~/Desktop/nothing_special_delete_me.txt
After successful import, delete the file from your desktop.
For Linux:
when you download the mist wallet, you'll get a folder. Inside the folder is where the mist wallet is. After you run the mist wallet, you need to get on cli.
Go to /whereveryousavedtheetherumfolder/node/resource/geth/
then run ./geth account import privekey-file.txt
.
Fatal: keyfile must be given as argument
> I am still unable to resolve it.
– Prashant Prabhakar Singh
Oct 21 '16 at 5:53
Noting the popularity of this question I went ahead and built a tool such that if you have your raw private key, you can easily convert it into its public key counterpart and the derived Ethereum address.
You can then export the key in the appropriate format as defined here such that it can be utilised with Geth or Parity.
That said, I think it is worth noting that you should not be working with your private key directly anyway. Your private key controls access to your account.
Only use this method for throw-away, testing accounts since your key will be stored in your shell's history (thanks to @tayvano).
Using bash
, where abcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabca
is your private key:
geth account import <(echo abcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabca)