Easy: How to Add a Custom ERC-20 Token to Metamask
Metamask is the easiest way to get started with a custom ERC-20 token. As an application developer, it is the best way to interact with decentralized applications (dapps) built on the Ethereum network. You will be able to send and receive tokens on any smart contract.
We will walk you through how to set up Metamask on your browser and your iPhone or android mobile device.
Metamask Browser Extension
The Metamask browser extension is available on Chrome, Firefox, Brave, and Edge (at the time of writing.) To get started, go to https://metamask.io/download.html
Once installed, the extension should be available in the navigation bar. The icon is the Metamask fox. You should see a welcome screen in your browser. The fox head follows your mouse. So cute!
Here, you have two options. If you have an existing Ethereum wallet, you may import it into Metamask with your seed phrase. If you don’t, click “create a wallet” to get one.
Create a password, a strong one that you will remember. After you click “Next.” you’ll see your secret backup phrase. This is the 12 word phrase and it is unique to only you and your account. Please copy it and save it somewhere safe. It is good practice to save it in multiple places. Do not share it with anybody else.
WARNING This phrase is the equivalent of a private key. If you lose it, you will not be able to access your wallet again.
Now you should be able to see your account balance. You can always access your wallet by going to the extension on the right hand corner.
Great, you have the metamask extension in your browser. Let’s get familiar with it! Ethereum has several networks. There is a main network (frequently referred to as simply “mainnet”) and several test networks (Ropsten, Rinkeby, Kovan, Goerli.) You can toggle between networks with the drop down at the top. If you are a developer, Metamask can also connect to blockchain running on your localhost machine; and Metamask can also connect to non-Ethereum blockchains as long as it has an RPC API.
Add a custom token
Let’s say you have a custom ERC-20 token on the Kovan test network. How do you connect your account so you can send and receive tokens? To do that, you will need the token’s contract address. For this tutorial, you can use my test token’s information. It’s a basic ERC-20 token that I deployed on the Kovan network.
Decimal Places: 18
Contract address: 0xef3d2fd93126bbee4f0cd6a8beb16b2cfd1e0056
View the contract here: https://kovan.etherscan.io/token/0xef3d2fd93126bbee4f0cd6a8beb16b2cfd1e0056
Let’s add it to our account!
First, switch to the Kovan network. It’s the dropdown next to the fox.
Scroll down to click on “Add Token” and then go to the “Custom Token” tab.
Paste the contract address. Metamask should auto-populate the rest for you (Token Symbol and Decimals of Precision) Select “Add Tokens” one more time and you will see the JULIE token added to your account.
I have no tokens =( How do I get some?
You will need someone to send tokens to your account. Give them your account address. Your account is the hash that starts with “0x” at the top. Hover over your account and you should see an option to copy to clipboard. Make sure you copy it correctly. If there is an error, the token transfer may be unsuccessful and tokens may be unrecoverable.
Transactions take up somewhere between 5 to 10 seconds to complete. If successful, you will see tokens populate in your wallet.
So easy, right? :)
Every transaction you make on the Ethereum blockchains requires you to pay a gas fee in Ethereum. It is a “pay to play” model. It can get quite expensive especially when Ethereum is at a high price (approximately $1800 at the time of writing) While developing on test networks, we can use fake Ethereum to power our transactions. Every test network has a “faucet.” A faucet is where you can load up your account with fake ETH. To prevent spamming, some faucets limits your IP to access once every 24 hours. Other faucets require a social media post to authenticate you.
The Kovan Faucet: https://faucet.kovan.network/
The Rinkeby Faucet: https://faucet.rinkeby.io/
The Goerli Faucet: https://faucet.goerli.mudit.blog/
The Ropsten Faucet: https://faucet.ropsten.be/
Metamask Mobile Wallet
The Metamask mobile wallet is also a seamless experience. Download the app which is available both on the iPhone App store and the Android Play store. You’ll come up to a screen like the one below. If you followed the steps above, you’ll be able to import with your 12 word phrase OR sync with the Metamask extension.
To add a custom token in the mobile app is the same process as above. If you already added it above, then it will show up here.
Metamask: Under the Hood
With the web3 library, you can interact with smart contracts to call and invoke smart contract methods. You can use great blockchain providers like Infura or run a local blockchain with Ganache.
The dapp world has come a long way in the last two years. It’s so easy to get started and building. So have fun developing!