Import Private Key to "geth" Account

This section describes how to import a private key from MetaMask wallet to a 'geth' account.

With the private key exported from my MetaMask wallet, I want to import it my "geth" account before I destroy MetaMask wallet.

1. Insert the memory stick that has the private key file.

2. Run "geth account import" command in a command window:

C:\>\local\bin\geth --datadir \herong\Ethereum\personal 
   account import "E:\MetaMask Herong's Wallet Private Key"
   
Your new account is locked with a password. Please give a password. 
Do not forget this password.
Passphrase: ******
Repeat passphrase: ******
Address: {ef6ea9f8bd78ac42fb2617ba90846d5785bb320c}

Good. The MetaMask account is restored on the "geth" node now. The account address (the public key) is calculated correctly.

3. Check Account balance on "geth" console:

> eth.accounts
["0x05d4e1a499775ce9d681abd50bda655c7b5ccb90", 
 "0x485410d2e7b8bfb6f78e5e5acf7d1057cb853fce", 
 "0xef6ea9f8bd78ac42fb2617ba90846d5785bb320c"]

> third = eth.accounts[2]
"0xef6ea9f8bd78ac42fb2617ba90846d5785bb320c"

> eth.getBalance(third)
97999979000000000000

> web3.fromWei(eth.getBalance(third),"ether")
97.999979

Excellent. The balance is correct too. That is expected, because the balance is always calculated from transactions stored in the network blockchain.

Last update: 2018.

Table of Contents

 About This Book

 Introduction of Ethereum

 Ethereum Blockchain

 Ethereum Mist Wallet

 geth - Go Ethereum

 Testnet - Ropsten network

 Private Ethereum Network

 64-Bit "geth" for Private Ethereum Network

 Private Network with Custom Genesis Block

 Transferring Funds between Ether Accounts

MetaMask - Browser Based Ethereum Wallet

 What Is MetaMask

 Install MetaMask Extension for Chrome

 Setup MetaMask Extension for Chrome

 One Account for All Ethereum Networks

 Get Free Ether from faucet.ropsten.be

 Get Free Ether from faucet.metamask.io

 Connect MetaMask to Local "geth" Node

 Transfer Ether Fund to MetaMask Account

 Send Ether from MetaMask to Private Network Failed

 Private Network ID Must Match "chainId"

 Send Ether from MetaMask to Private Network

 Process MetaMask Transsfer Transaction

 Download and Read MetaMask State Logs

 View Account QR Code in MetaMask

 Export Private Key and Retire MetaMask

Import Private Key to "geth" Account

 Managing Ethereum Account

 ethereumfaucet.info - Mining Ether with Browser

 References

 PDF Printing Version