I had version uped my metamask on firefox. this version up makes my metamask account renewed. I want to login my old metamask accout. I dont have my old acccunt private key or JSON for import old account. but I have my old account seeds phrase. please tell me how to login my old account. I think my metamask(firefox) is already installed and no way to input seeds phrase. should I remove metamask and reinstall on firefox , then , input my old account seed ? (and seed phrase is enought to login my old account?)
3 Answers
In MetaMask login screen, under the "Unlock" button, there is a message that says "Restore account?". If you click the message "Import account using seed phrase" you can import your old account.
If you are logged on and want to close in the account's menu in the top right there is a button "Lock" that will bring your to the login screen, where you can click the "Import account using seed phrase".
If you want only logout metamask, click on metamask icon, click on 'my accounts' icon in the top right, and within this window you'll find the logout button.
You can restore the private keys of your accounts without metamask. Based on the mnemonics just execute the following node code:
// Dependencies
const {mnemonicToSeedSync} = require('@rsksmart/rif-id-mnemonic')
const Wallet = require('ethereumjs-wallet').default
const EthUtil = require('ethereumjs-util');
const {fromSeed} = require('bip32');
const {entropyToMnemonic} = require("bip39");
// m' / purpose' / coin_type' / account' / change / address_index
//
// https://medium.com/myetherwallet/hd-wallets-and-derivation-paths-explained-865a643c7bf2
//
// Ethereum — m/44'/60'/0'/0
let PATH = "m/44'/60'/0'/0";
// Number of accounts generated
let NUMBER_OF_ACCOUNTS = 3;
let run = async () => {
function generatePrivateKeys() {
let mnemonic = "concert ladder decline crumble mention because pepper address scan volco pulse pig"
if (mnemonic.length > 0) {
try {
// generate the first N accounts
for (let accountIndex = 0; accountIndex < NUMBER_OF_ACCOUNTS; accountIndex++) {
// 1) mnemonic -> privateKey
let seed = mnemonicToSeedSync(mnemonic)
let hdKey = fromSeed(seed).derivePath(PATH)
let privateKey = '0x' + hdKey.derive(accountIndex).privateKey.toString('hex')
// 2) privateKey -> account
let value = EthUtil.toBuffer(privateKey);
let wallet = Wallet.fromPrivateKey(value)
let address = '0x' + wallet.getAddress().toString('hex')
console.log()
console.log("address #" + accountIndex + " :", address)
console.log("privateKey #" + accountIndex + ":", privateKey)
}
} catch (error) {
console.log(error)
}
}
}
generatePrivateKeys();
}
run().then(() => console.log(''))
/*
Ganache CLI v6.12.2 (ganache-core: 2.13.2)
Available Accounts
==================
(0) 0xbD004d9048C9b9e5C4B5109c68dd569A65c47CF9 (100 ETH)
(1) 0x11BdE3126f46Cfb3851a9102c60b510B1305aF5b (100 ETH)
(2) 0x02EfFf6494Ed3aa231857a2ACeDb9A1B0211d7C7 (100 ETH)
(3) 0xDaF8C1eE78c25D8320836fcEDa1Cf600846e9217 (100 ETH)
(4) 0x7C7211e3b82820484D5F653808f0471B74BF1994 (100 ETH)
(5) 0x6F569F7c369545cB265267Af1D46C36DF19a9633 (100 ETH)
(6) 0xcbfC221c36C56Cc0B418eDC78682213a23C41EBE (100 ETH)
(7) 0xDdf5C39CC56bf01374AD5D596D2C636352D870c6 (100 ETH)
(8) 0x2Eb6acE815412edEE005164a1aEcbB24FE0571B6 (100 ETH)
(9) 0x94334a3261961b3EdD13D72cfd7E9651789E1217 (100 ETH)
Private Keys
==================
(0) 0x91fd4e8a060cceff00ae5cde99d5b167179f724d9a424e24672e4200c7679c98
(1) 0x6926ce01074106dcf4456a4e2cd744cf21fb062901494cc85141c9082659a7b1
(2) 0xfed50f28357330e9244756376db521b0a90e5b6160eb0eb643dc8c2784fba213
(3) 0x63da16f1241d130e98fc7245ece0e200d7d40f8d7a8f7344f728b8ae9ad9a95b
(4) 0xab2614ba1798f4603181f121d8c80da1ba0db7f3b31a7fe30b68db407f131222
(5) 0xcdc9f71e8a5e6b8ec0825a36ddb9c8d1406f9c78c06278939da836e2d21f337b
(6) 0x7d76116139c9d733deb97b3c583221ddd944fe798b5998536b1d0d812f181696
(7) 0x4fddacb56d254f433de2aee3ff011f586a76c3974dd83757c66c1a191bc7343f
(8) 0x61906ba815cf115edbcfb6855161633f98f6791250ae369f8dd23e8168d69c94
(9) 0xf0c3bcc5f51a1ac8e3114cd42aa84d3d559c1dd0cb15e60b3d1b95d1f1e24c31
HD Wallet
==================
Mnemonic: concert ladder decline crumble mention because pepper address scan volco pulse pig
Base HD Path: m/44'/60'/0'/0/{account_index}
*/
You will need the following dependencies (package.json file):
{
"name": "decoder",
"version": "1.0.0",
"license": "MIT",
"dependencies": {
"fs": "^0.0.1-security",
"web3": "3.0.0-rc.5",
"@rsksmart/rif-id-mnemonic": "^0.1.1",
"ethereumjs-wallet": "^1.0.2",
"ethereumjs-util": "^7.1.4",
"ini": "^3.0.0",
"bip32": "2.0.6"
}
}
Expected output is:
% node account_from_mnemonics.js
address #0 : 0xbd004d9048c9b9e5c4b5109c68dd569a65c47cf9
privateKey #0: 0x91fd4e8a060cceff00ae5cde99d5b167179f724d9a424e24672e4200c7679c98
address #1 : 0x11bde3126f46cfb3851a9102c60b510b1305af5b
privateKey #1: 0x6926ce01074106dcf4456a4e2cd744cf21fb062901494cc85141c9082659a7b1
address #2 : 0x02efff6494ed3aa231857a2acedb9a1b0211d7c7
privateKey #2: 0xfed50f28357330e9244756376db521b0a90e5b6160eb0eb643dc8c2784fba213
As you can see the three created accounts are the same as the default ganache accounts. After generating the private keys, just import them into metamask.