How Metamask works

6Wvd...HexF
26 May 2023
66

What is Metamask exactly? Metamask is a software that allows end users to view their crypto assets associated with an account. It also enables interaction with the blockchain, facilitating activities such as sending and receiving crypto assets like tokens or NFTs.

Metamask is often referred to as a wallet, but it's different from the traditional wallet you know that holds money and credit cards. In reality, Metamask doesn't hold any crypto assets; rather, it displays the status of your account on the blockchain and assists users in interacting with their accounts.

Have you ever heard of the non-custodial or self-custody wallet? Non-custodial or self-custody wallet means that you are the only one who control the keys of your account, that mean you have full control over your crypto assets. Unlike custodial wallets, which are managed by third-party service providers. 

Let's explore how MetaMask works step by step. Once you install the MetaMask extension in your browser, it will generate a seed phrase for you. This seed phrase, also known as Secret Recovery Phrase, mnemonic seed, or mnemonic phrase, is a collection of random words generated by MetaMask to secure your account keys. It's important to keep this seed phrase private and only known to you. 

seed phrase looks like this and has between 12 to 24 words: 

  1. Castle
  2. Sunshine
  3. Whisper
  4. Bamboo
  5. Harmony
  6. Meadow
  7. Twilight
  8. Serenade
  9. Galaxy
  10. Enchant
  11. Thunder
  12. Blossom
  13. Radiant
  14. Treasure
  15. Velvet
  16. Lullaby


This collection of random words is your seed phrase. It serves as a backup to restore your account if you ever lose your password or device, which is why it's important to write it down on a paper and keep it separate from your device.

The next step is to create a new password for your MetaMask. Once you've set it up, you'll be directed to your account.
MetaMask uses your seed phrase to generate the public key and private key for your account. This process is repeated every time you create a new account. Think of the seed phrase as a key ring that holds your house or office keys.

Now that you have an account on MetaMask and you're feeling excited, the next thing you might be wondering is how to use your account to send and receive crypto assets. Before we dive into that, let's first answer another important question:

How does MetaMask interact with the blockchain?


Metamask uses your account keys, with your permission of course, to interact with the blockchain, like sending your crypto assets to another account.
 
There are two types of keys as we mentioned before: the public key and the private key. The public key serves as your account number, such as this Ethereum example: 0x690B9A9E9aa1C9dB991C7721a92d351Db4FaC990. Others can use it to send you crypto assets, and Metamask uses it as well whenever you want to send crypto assets to another account. 

On the other hand, the private key is confidential and should only be known by you. It functions like a password for your bank account. Metamask securely stores it within your device.

When you decide to send a crypto asset to another account, have you ever wondered how MetaMask manages that behind the scenes?

What you see in the interface is simple: you enter the receiver's account address, choose the crypto asset and the amount you want to send, select the desired gas price to pay, and then you confirm the transaction. The total amount to be sent is the crypto asset amount + gas fees. 

However, in the backstage, the process is more complicated, with most of the work taking place on the blockchain. While I won't delve into the complexities of the blockchain in this article, I'll focus on explaining the role of MetaMask in facilitating these transactions.

Before MetaMask can send your crypto assets to another account, it needs to establish a connection with the blockchain. And here's where I will introduce you the engine responsible for powering all MetaMask actions, so ladies and gentlemen, please welcome the Ethereum Provider API, the powerhouse behind MetaMask's functionality.

The Ethereum Provider API is the driving force behind MetaMask, responsible for performing all the tasks you request. It connects metamask to the blockchain, initiates transactions to send your crypto assets, retrieves data from the blockchain to display your assets on the MetaMask interface, and handles various other actions.

When the connection is established, the Ethereum Provider API sends a transaction request to the blockchain with all the necessary information for the transaction, such as the sender's address, recipient's address, amount of crypto assets, gas limit, gas price, and any additional data.

After the blockchain receive this transaction request, it goes through a complicated process to complete the task, and once it’s done, it generates a response and sends it back.

The Ethereum Provider API receives the response from the blockchain, indicating the success or failure of the transaction. This response is then passed back to Metamask, which can notify you about the status of the transaction. 

That's what happens when you send crypto assets to another account. The same process is repeated in reverse when you receive crypto assets, this time it occurs from the other account to your account.  

I hope that I have provided a clear explanation of how Metamask works. If you found this article helpful, be sure to follow me for future articles where I delve into more exciting topics related to blockchain technology and decentralized applications. Stay tuned for more insightful content!

Get fast shipping, movies & more with Amazon Prime

Start free trial

Enjoy this blog? Subscribe to decentralized web

3 Comments