MetaMask for beginners

Khang Vu Tien
7 min readMar 31, 2021
Photo by Dong Xie on Unsplash

Context

  • Imagine a kind of Facebook where any person-in-need may post one’s profile, activity, need, or contribution to the community. Using an old cellular phone.
  • Imagine that this data is published on a blockchain and remains owned by each person who posted it instead of belonging to one single (private and greedy) operator.
  • Imagine that this data is available to all humanitarian organisations or commercial companies that target these persons-in-need, to design efficiently their help programs and to report transparently to donors.

This is Machu-Picchu, an open source collaborative project that won several prizes in 2020 and 2021 in 2 international hackathons (ETH Online and ETH Denver). Machu Picchu is designed to be a ready-to-use toolset that any organisation that helps the person-in-need can combine to achieve the objectives stated above.

Why MetaMask?

We want to make available early enough to the public Machu Picchu blockchain hands-on demos. The persons who experiment with these demos may have heard about the blockchain, but they need not be fluent in this matter. For this we need to make them feel comfortable with MetaMask to perform blockchain operations. This article aims to explain simply MetaMask to these persons.

MetaMask is a browser extension with which the user may perform operations on the blockchain.

This article is for you if…

  • you have some experience using a browser and visit web applications such as FaceBook, Twitter, LinkedIn etc.
  • you know vaguely about blockchains, meaning that they are Internet protocols to share worldwide consensus on information, comparable to what was done for centuries in rural villages: who owns what, who has borrowed what from whom, who has contributed to the common chores etc.
  • or simply you are curious about MetaMask and a blockchain project like Machu Picchu that is not immediately about crypto currencies.

This article is not for you if…

  • you already do blockchain programming, in other technologies than Ethereum, or
  • you already knew and practiced MetaMask.

At the end of this article, you should understand enough about MetaMask to follow the many tutorials on the Internet to install MetaMask on your browser, ready to exercise the Machu Picchu demos that are coming soon.

MetaMask in short

MetaMask is often called a “wallet” but it is not equivalent to a physical wallet in the sense that it doesn’t contain any money nor important papers.

MetaMask is an extension to the Internet browser. Its purpose is to simplify access to blockchains. To do so, it integrates 4 distinct and very different functions. On the Internet, you can find many MetaMask tutorials for newcomers, but they become quickly confusing because these 4 functions are mixed. Once we make the difference between them, it becomes easier to understand the explanations of the tutorials.

MetaMask in detail

1. Authenticate

Below is a typical login screen the first time you open MetaMask in a browser. We see here the background browser window and the MetaMask popup login with the (cute) fox.

This login dialog mentions 2 secrets: the login “password” and the “account seed phrase”. The login password is what authenticates the owner of the wallet and allows the use of the MetaMask functions. We’ll see later below the meaning of the “seed phrase”.

If you plan to store valuable crypto currencies in your “wallet”, you MUST use a VERY strong login password. Here is how 5.7 MUSD worth of cryptos has been stolen in March 16th, 2021: https://uk.finance.yahoo.com/news/5-7m-stolen-roll-crypto-141924662.html . The hack happened despite the key was stored in a “cold wallet” (a crypto wallet not connected to the Internet). The problem was that this person used a same password for test in a “hot wallet” (connected to the Internet).
This sad story shows that a blockchain developer has better use 2 distinct wallets: one for connecting to the test blockchain networks (“testnets”) and a distinct one for connecting to the main network (“mainnet”), where valuable cryptos assets are traded.

2. Connect to blockchain

In the drawing above, we see the mainnet and the testnets. They are blockchain networks. Each blockchain network is like an on-going Monopoly party at a world scale.

Here is for example a typical MetaMask popup dialog to choose between networks to connect to.

The screen shot above shows 6 on-going Monopoly parties: the Ethereum Mainnet, the Ropsten Test Network, the Kovan Test Network, the Rinkeby Test Network, the Görli Test Network, and “truffle” that is a name I gave to my local test network. The last line “Custom RPC” is a placeholder of MetaMask to let the user add any other blockchain network by setting specific parameters.

MetaMask allows the user to join a “Monopoly party” and do transactions. The money used in one party is IGNORED in any other party.

3. Query owned amounts

A “crypto wallet” doesn’t hold money nor important papers like a physical wallet. It is more like “web banking”, where your bank is a blockchain network. On blockchains, ownership is an attribute of a virtual “account” and universally accepted as valid.

A virtual account is represented by a cryptographic “private key”. From it, an algorithm derives a “public key”. This public key serves as the “account number” of the virtual account.

Anybody who knows a public account number can query the blockchain to know the data attributes of this account, including the amount in crypto currencies owned by this account. But a public key doesn’t allow anything else from this account.

In the screen shot below, we see that my account named “Rinkeby-1” owns “2.9881” ETH on the “Rinkeby Test Network”.

4. Authorize spendings

A person who knows a private key of a virtual account becomes in practice the owner of the account and is able to command this account to perform blockchain actions such as transferring its virtual currencies somewhere else and modifying its recorded data.

What have we learned?

To summarize:

  • A “virtual account” is a blockchain entity that has attributes. An attribute is any kind of information, including an amount in a virtual currency that it owns (there is an unlimited variety of virtual currencies).
  • Owning a “private key” means owning a virtual account. A private key is the unique representative of an account.
  • Modifying the attributes of the account requires using the private key to “sign the transaction message” sent to the blockchain to do the change.
  • There are many cryptographic methods to generate a valid private key associated with a virtual account. MetaMask uses a method called HDWallet (Hierarchical Deterministic Wallet) invented by the bitcoin. This method uses a “seed phrase” that is also called a “mnemonic” or “passphrase”.
  • Knowing a seed phrase means knowing (owning) all private keys generated from this seed phrase, and therefore owning all accounts associated to each of these private keys.

The drawing below shows a MetaMask extension on a browser that manages 3 accounts generated from a same seed phrase and one account directly imported. If the browser is re-installed and the MetaMask extension also, it is able to regenerate by itself the first 3 accounts, while the 4th one must be imported again.

Back to the initial login screen copy, we understand now that

  • The password and the seed phrase serve 2 different purposes.
  • The password of a MetaMask wallet protects this specific MetaMask installation on this specific browser and specific computer. Knowing the password allows to use the accounts known to this MetaMask on this browser, either generated by its seed phrase or imported later
  • The seed phrase of a MetaMask wallet protect all the accounts that are generated by this seed phrase, whatever the browser and the computer on which this MetaMask is installed.

Now you are ready to follow the Internet tutorials and install your MetaMask extension. Stay tuned. You’ll be able soon to run on your browser the very first Machu Picchu demo: Pepito Disguise. This demo won 4 hackathon prizes in February 2021.

What does this have to do with Machu Picchu?

Machu Picchu uses mainly the function “Connect to blockchain”. In the Ethereum blockchain it uses MetaMask as a whole, to simplify development. Ultimately, it will keep only the function “connect to blockchain” and simplify the 3 other functions to be better suited for the purpose.

The version of Machu Picchu that is ported to CELO, a derived clone of Ethereum, is an example of how it can be done without MetaMask. Keeping in mind the 4 functions will help make best use of the Valora “wallet” of CELO.

--

--