Build and Deploy ERC20 Token in 3 Steps
Tags: web3, blockchain, crypto, tutorial
Published: 2022-05-06 22:09:00

Approximately 90% of US and European banks have begun investigating blockchain's possibilities, with financial institutions alone investing $552 million in blockchain-based projects.

Apart from documenting financial transactions, blockchain may also store medical information, reach binding agreements, trace the flow of commodities, keep personal credit records, track the provenance of artwork, verify payments across a supply chain, and much more.

Cryptocurrencies have recently gained popularity, providing limitless opportunities for businesses, individuals, and DAOs.

This post will teach us how to build and deploy the ERC20 token in 3 steps.

## What is ERC20 Token?

The ERC-20 token is one of the essential Ethereum tokens. ERC-20 has emerged as the technical standard for token implementation on the Ethereum blockchain; it contains a set of rules that all Ethereum-based tokens must follow.

The ERC-20 introduces a standard for [Fungible Tokens](https://www.pcmag.com/encyclopedia/term/fungible-token), which means they have a characteristic that makes each token identical to another in terms of type and value. 

>An ERC-20 token, for example, functions similarly to ETH, meaning that one token is and will always be equal to all other Tokens... Eth Org


## Step 1: Build an ERC20 Token Smart Contract with Solidity using the remix IDE

We'll learn how to utilize [https://remix.ethereum.org/](https://remix.ethereum.org/), a free, easy-to-use IDE with a solidity-compatible IntelliJ feature and decent compile-time errors, to build and deploy an ERC20 Token Smart Contract.

Next, we will navigate to the [Remix](https://remix.ethereum.org/) site and create a new file called `MyToken.sol` as shown below.

![Build and Deploy ERC20 Token in 5 Steps](https://cdn.hashnode.com/res/hashnode/image/upload/v1651835359395/YRooYU6rJ.png)

Let's update the `MyToken.sol` file with the following code snippet.

```js
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

// Using the openzepplin contract standard
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";

// Token contract
contract OlanetsoftToken is ERC20, Ownable {
    constructor() ERC20("OlanetsoftToken", "OLT") {
        _mint(msg.sender, 500 * 10 ** decimals());
    }

    function mint(address to, uint256 amount) public onlyOwner {
        _mint(to, amount);
    }
}
```

In the code snippet above, we:

- Import the OpenZeppelin ERC20 contract
- Initialize the Token, inheriting from the ERC20.sol contract
- Declare a new contract called `OlanetsoftToken,` using the Solidity keyword contract, while inheriting the ERC20 OpenZeppelin's contract using the `is` keyword.
- Create an initial amount of tokens `500` for the deployer.
- Give access to Privileged accounts to create more supply using the `mint` function.

Next, we will compile our contract and get it ready for deployment.

![Build and Deploy ERC20 Token](https://cdn.hashnode.com/res/hashnode/image/upload/v1651836954560/cl2a9x-Kv.png)


## Step 2: Deploy ERC20 Token Smart Contract

In this step, we will deploy our smart contract to the Polygon Mumbai testnet. Deployment is not restricted to only Mumbai testnet, as we can deploy to any of our preferred chains.


![Build and Deploy ERC20 Token](https://cdn.hashnode.com/res/hashnode/image/upload/v1651837316176/xPvqV7xkM.png)

Next, we will select the contract to deploy.

![Build and Deploy ERC20 Token](https://cdn.hashnode.com/res/hashnode/image/upload/v1651837352347/-Ullm6q0z.png)

Finally, we can deploy our ERC20 token.

![Build and Deploy ERC20 Token](https://cdn.hashnode.com/res/hashnode/image/upload/v1651837693215/E07nrF94H.png)

![Build and Deploy ERC20 Token](https://cdn.hashnode.com/res/hashnode/image/upload/v1651837716417/iZ_0hC6s0.png)

Voila 🥳 

![Build and Deploy ERC20 Token](https://cdn.hashnode.com/res/hashnode/image/upload/v1651837731197/-Flr5f9sm.png)

## Step 3: Verify and Import Token using Metamask

Let us import and verify the token we just deployed. We will head over to Metamask or by just clicking on the icon as shown below.

![Build and Deploy ERC20 Token](https://cdn.hashnode.com/res/hashnode/image/upload/v1651837988576/I33poalQF.png)


![Build and Deploy ERC20 Token](https://cdn.hashnode.com/res/hashnode/image/upload/v1651838871922/WgaYmpvSY.png)

View on the block explorer.

![Build and Deploy ERC20 Token](https://cdn.hashnode.com/res/hashnode/image/upload/v1651838887973/zA2Yf1YSY.png)

We will be redirected to the Mumbai Polygon [site](https://mumbai.polygonscan.com/tx/0x1ea188105621a29809daf19bcf208d93db59fc04c2fb9cf3da6eaf16e888b499) where we can verify the transaction with contract details.

Next, we will import our token.


![Build and Deploy ERC20 Token](https://cdn.hashnode.com/res/hashnode/image/upload/v1651839447174/NE2vCd3xy.png)


![Build and Deploy ERC20 Token](https://cdn.hashnode.com/res/hashnode/image/upload/v1651839464783/KekizQjUO.png)

Import token.

![Build and Deploy ERC20 Token](https://cdn.hashnode.com/res/hashnode/image/upload/v1651839503041/uLHIIaHI4.png)


View token.

![Build and Deploy ERC20 Token](https://cdn.hashnode.com/res/hashnode/image/upload/v1651839537814/3juKx74Po.png)


## Conclusion

This post addresses how to build and deploy the ERC20 Token in 3 steps as part of the token series I created. Watch this space for the upcoming ones.

I'd love to connect with you at [Twitter](https://twitter.com/olanetsoft) | [LinkedIn](https://www.linkedin.com/in/olubisi-idris-ayinde-05727b17a/) | [GitHub](https://github.com/Olanetsoft) | [Portfolio](https://idrisolubisi.com/)

See you in my next blog article. Take care!!!