تاريخ النشر Sep 14, 2020تاريخ التحديث Mar 22, 2022
Why should I bother reading this?
If you’re interested in the Ethereum ecosystem, you need an application like MetaMask. Far more than a simple wallet, it allows you to interact with websites that integrate Ethereum.
MetaMask will let you connect to decentralized applications from inside your browser (or through a mobile app). You can make trades without intermediaries and play games with fully-transparent code (so you know you aren’t being cheated).
With Ethereum came the promise of a distributed Internet – the long-awaited Web 3.0. A level playing field characterized by a lack of central points of failure, true ownership of data, and decentralized applications (or DApps).
For many Ethereum enthusiasts, MetaMask is the go-to wallet. Unlike your regular smartphone or desktop software, it comes packaged as a browser extension, allowing users to directly interact with supporting webpages. In this article, we’ll explain how MetaMask works and walk you through getting started with it yourself.
What is MetaMask?
MetaMask is an open-source Ethereum wallet that supports all kinds of Ethereum-based tokens (such as those following the ERC-20 standard, or non-fungible tokens). On top of that, you can receive them from others, or purchase/swap them with the built-in Coinbase and ShapeShift integrations.
What makes MetaMask so interesting is that it can interface with websites. With other wallets, you’d need to copy-paste payment addresses or scan a QR code on a separate device. With the MetaMask extension, the website simply pings your wallet, and you’re prompted to accept or reject the transaction.
The MetaMask wallet can be installed on Google Chrome, Firefox, or the Brave Browser. It’s also available on iOS and Android, but we won’t cover that in too much depth. We’re going to use Firefox throughout this tutorial, but your steps will be more or less identical, irrespective of the platform you’re using.
Head over to the official download page on metamask.io. Select your browser, which will take you to the Chrome web store or the Firefox add-ons site. Click on the button to add the extension to your platform. You may need to grant it some permissions before it’s up and running. Make sure you’re happy with the level of access it has to your browser – if you are, we’re good to go.
Initialize the wallet
You should now see a welcome message.
If you’re anything like us, you’ll probably spend a good bit of time trying to make this guy dizzy with your cursor.
Once you’re done pestering the fox on the welcome page, click on Get Started. This is where you’ll be prompted to either import a seed phrase or create a new one. Click on Create a Wallet. The next page asks whether you want to submit anonymized data to help the devs improve the app. Pick whichever option you prefer.
Back up your seed words!
The following point is enough to warrant its own subheading. MetaMask is a non-custodial service, meaning that no one else can access your funds – not even the MetaMask developers. Your tokens exist in a sort of encrypted vault within your browser, protected by your password. That means that if your computer is lost, stolen, or destroyed, nobody can help you recover the wallet. Your private keys will be forever lost in the void of cyberspace.
So, it’s crucial that you write down your backup phrase. This is the only way you can restore your account should something unfortunate happen. As suggested, we recommend that you write the words down and store them in two or three different locations. You don’t need to bury them in a fireproof safe deep in the forest, but hey, it can’t hurt.
Click on the grey box to reveal the phrase.
When you get to the next page, the program anticipates that you may have been lazy with the previous step, because it asks you to confirm the phrase. If you didn’t the first time, click Back and write it down!
Confirm the phrase, then proceed to the next step. Hit All Done, and you’ll see the wallet interface.
The boring part’s over, let’s get rich on (testnet) ether next.
Fund the wallet
In this tutorial, we’re going to be using the Ropsten testnet. It’s a network that functions almost exactly like the real Ethereum network, but its units have no value. These come in handy when you’re developing contracts and want to make sure that they don’t have vulnerabilities that allow attackers to drain $50m in value. Every step we perform on this network today will be replicable on the real thing (except for the part where they gift us free ether, unfortunately).
To tune into the Ropsten testnet, click on Main Ethereum Network in the top right corner and select Ropsten Test Network.
There are lots of different testnets on Ethereum. If you’re wondering about the differences, check out this comparison.
We’re going to use a faucet to get some fake money to play with. Navigate to this page on your Metamask-enabled browser to get some.
Woohoo! Free money!
You can click on the little fox icon at any time to get a pop-up with your MetaMask account information (as we’ve done in the GIF above). Hover over Account 1, and click to copy your Ethereum address to the clipboard. Paste it into the form and hit Send me test Ether.
Ethereum transactions are generally confirmed pretty quickly, but it might be a while before the 1 ETH lands in your wallet. Check to see whether you’ve got it by clicking on the fox in your toolbar.
Once that’s arrived, we can start to interact with DApps.
We’re going to use the DApp we demonstrated earlier. Uniswap is a decentralized exchange, or DEX, meaning that it allows us to place trades without relying on intermediaries. The mechanisms underpinning it are pretty neat – check out What Is Uniswap and How Does It Work? if you’re interested in how it works.
Go ahead and access it here. In the top right-hand corner, you should see a prompt to Connect to a wallet. You’ll see this in some form on all MetaMask-compatible sites, as it doesn’t automatically connect for security reasons. Click on it, and you’ll be asked to select which wallet you’re using. In case you haven’t been following, that wallet will be MetaMask.
When a site first attempts to connect, a MetaMask dialog will appear, asking you to confirm the action. You’ll be able to select an account (we only have one, for now, so leave that as is) before verifying what permissions you’re about to grant. In this case, as in many others, the site is requesting information on the wallet address your account controls.
On MetaMask and privacy
It’s important to be mindful of what you’re permitting. If a website knows your address, they can see all of the ether and token transactions to and from it. What’s more, they can correlate it with your IP address.
Some prefer to segregate their addresses to prevent any overlap, while others aren’t concerned with these risks (after all, the blockchain is public). The level of privacy you want to achieve ultimately depends on you. As a general rule, don’t grant access to websites you don’t trust.
Swapping ether for DAI
Time to make our first swap. We’ll be doing it for DAI, an ERC-20 token that serves as a stablecoin. Just like our ether, though, this DAI has no real-world value. Hit Select a token, add the Uniswap Default List, and then click on DAI. Alternatively, you could also pick WETH (wrapped ether).
All that’s left to do is to input the amount of ETH we want to swap. As we do that, we’ll get an estimate of how much DAI we’ll receive. And we’re good to go! Hit Swap.
Complete the swap with MetaMask.
You’re once again prompted to take action in MetaMask. In this case, you need to okay the transaction before it’s created. Make sure you’re happy with the fees when you’re doing this on the mainnet, as they can be significant.
After that, we just need to wait for the transaction to confirm!
So your ether’s gone, but your account doesn’t show your tokens. No need to panic – you have to add them manually.
For more popular tokens, you can select Add Token in your wallet and search for the name or ticker. For the less popular ones (or those on the testnet), we need to add the contract address – an identifier that tells MetaMask where to look for our balance.
Open your wallet by clicking on the extension.
Click on the three dots in the top bar.
Select View on Etherscan.
Under Overview, click on the Token dropdown and select DAI.
Under Profile Summary, you should see a contract address. Hover over it and copy the address.
Return to MetaMask and click on Add Token.
Click on the Custom Token tab.
Paste what you’ve just copied into the Token Contract Address form.
The rest should autofill. Click on Next, followed by Add Tokens.
Return to the main overview to see your full balance.
Congrats! You’ve just interacted with your first DApp by trustlessly swapping ether for DAI. Everything you’ve learned can now be done in the real world. When you’re ready to play with mainnet applications, remember to switch back from Ropsten to the main network.
What else should I know?
MetaMask has some other neat features that we haven’t covered today. You can also connect a hardware wallet (Trezor and Ledger are both supported), create a contact list, and, of course, receive and send funds as you would in a normal wallet. Check out the settings to customize the extension to suit your needs.
Other than that, the usual security principles apply: MetaMask is a hot wallet, meaning that it runs on an internet-connected device. This exposes you to more risk than a cold wallet, which is kept offline to reduce attack vectors.
Lastly, when using MetaMask, it stands to reason that you should be conscious of what websites you’re granting access to.
The MetaMask app
The MetaMask Android/iPhone app provides a neat solution for interfacing with Web3 apps on the go. Boasting much of the same functionality as the extension, it integrates a DApp browser so you can access various decentralized applications at the touch of a button.
The MetaMask app’s browser.
The workflow of the application is very similar to that of the browser extension. You can make direct transfers of ether or tokens from your wallet, or even interact with Uniswap as we saw above.
Connecting to PoolTogether via a prompt within the app.
MetaMask is a powerful tool for browsing the decentralized web. If you’ve followed along with the steps in this guide, then you’ve seen the wallet’s potential. Evidently, others have, too: it currently boasts over a million users.
As the Ethereum stack develops, applications like MetaMask will undoubtedly become integral components in the bridge between existing technologies and nascent cryptocurrency infrastructure.
Questions about MetaMask, Ethereum, or anything else? Head over to Ask Academy, where the community will answer them.