Create an ERC-20 Token Using Solidity

Welcome to this tutorial on how to create an ERC-20 token using Solidity. In this tutorial, we will be using the Fuji Testnet and the MetaMask wallet to create and interact with our token. We will also be using the Remix platform to deploy and manage our contract. Follow along with this tutorial to learn how to create your own mintable ERC-20 token on the Avalanche blockchain.

The first thing we should set is a metamask wallet. We are using Fuji Testnet in this tutorial

Click to metamask icon on the browser and select the network drop-down menu. Here we should connect to C-Chain.


Click to “Add Network”. and fill the details for testnet

After setting up all the parameters correctly, we should see this page. For now, we have 0 AVAX.


Fund Your C-Chain Address​

For funding on the Fuji Testnet, you can use the Test Network Faucet. Navigate to and paste your C-Chain address.

By requesting 2 AVAX you will get 2 AVAX in you wallet


Create Mintable Token

Now, we can create our mintable token on Remix. Open Remix on your browser or go to this link

You should view this page. On this page, first, click “SOLIDITY” from “Featured Plugins” and then click the “New File” button. When you click the New File button, you will see a pop-up that requires a file name. You can choose a name or leave the default.


Since we will use an ERC-20 contract from OpenZeppelin, just paste this line to the file and save.

import “”;
After saving the file, we will see a bunch of files that are imported to remix. This is a remix feature that allows us to import a GitHub contract repository to remix by just giving the URL-link with an import statement.

We have ERC20PresetMinterPauser.sol file in the presets. This file is written by OpenZeppelin according to ERC20 standards with minter functionality. After deploying this file, we will be the owner of the contract and thus have the authority and ability to mint the tokens.

Deploy the Contract​

Open the tab with label Solidity Compiler and select the solidity version that matches with the solidity version written in file as “pragma solidity …..”. The version should be equal to or higher than the file’s version. For example, in my file, “pragma solidity ^0.8.0” is written so the required version is 0.8.0 or higher. As shown, in the compiler the solidity version is 0.8.7, which is ok. After checking the solidity version click the compile button. If you did not change anything in the file, or the solidity version is not wrong, the contract should compile without any errors.

Then, let’s jump to the tab with label Deploy and Run transaction. Here before deploying our contract, we should change the environment. Click to the environment and select “Injected Provider – Metamask”. If a pop-up shows up and asks you to connect the account, click to connect. After, you should see the account address in the “ACCOUNT” textbox.

The last thing before the deployment process is to set the contract that will be deployed as a token. Above the Deploy Button, there is a drop-down menu to select a contract. Select the contract named “ERC20PresetMinterPauser” If not selected already.

Now, here enter the name and symbol of your token. I will name it “Test New” and the symbol will be “TN”. You can give it a and click to transact button.

After click on deploy it will show a metamask popup to confirm the transaction , press confirm button

once confirmed you will see the terminal


You have successfully deployed contract.

Interact with Token​

We can see our transaction that deployed on avalanche C-Chain via this c-chain explorer.

But firstly, let’s see our transaction hash from the remix console.

After deploying the contract, we should see a log in remix console. When you click to arrow and expand it, a transaction hash will come up. Copy it.

Just paste the transaction hash to the explorer I shared above and press enter.

Here we can see all details about the transaction and token contract.

Now, let’s mint some token to our own address.

Come back to the remix and after deploying, you should be able to see the contract in “Deployed Contracts” section.

Here, we have a bunch of functions that we can use to interact with our token contract. You can check all these methods from OpenZeppelin documentation to learn how to use them. But we will only use the mint method.

Click to arrow beside the mint method to read it.

Enter your address and an amount in WEI. For example, I will mint 1000 tst token so, I entered “1000000000000000000000”

Now we minted 1000 token to our contract, but you should not be able to see the tokens in your metamask wallet. In order to see our own token, we have to add it. On metamask, click to “Import token” on the bottom.


By pasting contract address you will automatically show the token symbol


Click on Add Custom token you will see your token here


Congratulations !!! you have successfully created an erc20 token.