dev-resources.site
for different kinds of informations.
How MetaMask Creates Accounts
Published at
4/13/2022
Categories
web3
ethereum
metamask
blockchain
Author
chandrapenugonda
Author
16 person written this
chandrapenugonda
open
How MetaMask Creates Accounts
-
when you install MetaMask, you were shown a list of 12 words known as the Secret Recovery Phrase.
- Note: The order of the words in the secret recovery phrase is important.
- MetaMask uses a specification known as the BIP39 to generate these 12 words.
- BIP39(Bitcoin Improvement Proposals) recommends use of a mnemonic phrase to recover accounts in the event your accounts are compromised or lost.MetaMask calls this mnemonic phrase as the Secret Recovery Phrase.
- 12 words are chosen from a list of 2048 words.The complete list of 2048 words can be found from here
Each word in the secret recovery phrase has a number associated with it. These numbers are used to form a seed integer, which is then used to create a set of public/private keys
Generating the public/private key pair and the Ethereum address using seed interger
- a private key is generated using the seed integer using the SHA256 hash function
- public key is generated from private key using ECDSA(Elliptic Curve Signature) algorithm
- from the public key derived, compute a keccak256 hash
- from the keccak256 hash, take the last 20 bytes (which is 40 hexadecimals), prefix it with β0xβ and this is your Ethereum address.
Creating the Default Account
With the public/private key pair created from the seed integer, MetaMask will now be able to create your first account.As explained, your first account is generated from the keccak256 hash.
Internally, MetaMask encrypts your private key using the password that you supplied during the installation stage, and stores it in your browserβs data store. It does not store them on the cloud.
Creating Additional Accounts
- MetaMask makes use of the private key of the first account and hashes it to get the next private key.Using the newly created private key, the same procedure applies (as described earlier) to get the public key and subsequently the account address. And the next account is always the hash of the previous private key.
- This is the reason why your accounts can be recovered as long as you have your secret recovery phrase.
- And this brings us to this very important point you have to know β protect your secret recovery phrase under lock and key! - Once you compromised your secret recovery phrase, your accounts can be accessed by anyone who has them. Needless to say, your cryptocurrencies will be gone in a heartbeat!
Credits: Wei-Meng Lee
metamask Article's
30 articles in total
Your First Steps in Web3: A Simple Demo
read article
I hacked web3 wallet!
read article
Survival guide to DevConnect Istanbul MetaMask bounties
read article
How To Set a Custom Node URL in MetaMask - Tokenview
read article
Metamask Snaps
read article
Add Hearverse Chain in your Metamask
read article
How to Restore multiple Meta Mask Accounts: Tips and Tricks no one tells you !
read article
Fix : TokenService Error: ChainId 0x539 is not supported :(
read article
Sign in with Metamask using LiveView
read article
Introduction to Blockchain Wallet
read article
How to Load Unlimited Free Ethers to Metamask Wallet
read article
Signing data with MetaMask
read article
What are meta transactions, the EIP-712 standard, and how to sign a message with Metamask?
read article
Understanding MetaMask RPC methods and errors
read article
How to add Web3 Authentication using NEXT JS & MetaMask?
read article
What Is Web3?
read article
Dating site for developers
read article
plopchain
read article
How to use Gitcoin
read article
Signing message using Metamask in Flutter
read article
How to Add Polygon (MATIC) Network to MetaMask
read article
Create connect wallet button with React + Web3.js + Bootstrap
read article
Building with Flutter and Metamask
read article
React Hook for Add/Switch Chain to any Ethereum Network in MetaMask
read article
ETH Dubai 2022 Recap
read article
Tutorial: Connect to MetaMask using vanilla JavaScript
read article
Connect MetaMask wallet #JavaScript
read article
How MetaMask Creates Accounts
currently reading
Understand Metamask: the basics.
read article
How to setup a Metamask account.
read article
Featured ones: