I have an account created with Metamask - there is 12 words backup phrase.

I'd like to import that account into Ethereum Wallet.

I believe that in order to do so, I need to put a keystore file into a special directory.

What is the easier / most convenient way to convert 12 words mnemonic phrase into keystore?

Some Google search: https://www.reddit.com/r/ethereum/comments/5zzwh0/can_mnemonics_currently_be_used_to_create_a_utf/

It would be nice to have a crypto test suite allowing guys like me to experiment / better understand / play with the keys.

Related: Export Metamask account to JSON file


1 Answer 1


It must be a better way but here's how I did it.

Firstly it's important to understand that the mnemonic phrase could be used to generate an infinite number of private keys and the JSON Keystore format stores just one private key. That means that you'll need to do the following procedure for each private key you want to import on the Ethereum Wallet.

First you need to find the private key for a specific address:

  1. Go to MyEtherWallet.com
  2. Select the appropriated network on the upper right corner
  3. Click on 'View Wallet Info'
  4. Choose 'Mnemonic Phrase'
  5. Paste/type your mnemonic
  6. Type your password and unlock the account
  7. Select the correct derivation path. If the case of MetaMask that should be first one: m/44'/60'/0'/0
  8. Select the desired address
  9. You should see your private key under under field 'Private Key (unencrypted)' after you click on the 'eye' icon

Now that you have the private key you need to covert it to JSON Keystore file. You can do this using geth but in my case I've used a javascript library called ethereumjs-wallet as the following:

const fs = require("fs")
const wallet = require("ethereumjs-wallet")

const pk = new Buffer.from('c87509a1c067bbde78beb793e6fa76530b6382a4c0241e5e4a9ec0a0f44dc0d3', 'hex') // replace by correct private key
const account = wallet.fromPrivateKey(pk)
const password = 'something' // will be required to unlock/sign after importing to a wallet like MyEtherWallet
const json = JSON.stringify(account.toV3(password))

// writes to a file
const address = account.getAddress().toString('hex')
const file = `UTC--${new Date().toISOString().replace(/[:]/g, '-')}--${address}`
fs.writeFileSync(file, content)

Finally, to import into Ethereum Wallet, copy the file to they keystore directory and restart the wallet. In macOS it is located at /Users//Library/Ethereum//keystore

Hope somebody has a better alternative out there.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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