How To Deploy an ERC-20 Token (Using OpenZeppelin, Remix and Metamask) [Guide]

By candlevalley | for the commons | 11 Apr 2022


This is a step by step guide to launching a basic token on Ethereum using the following tools:

  • Metamask
  • Openzeppelin Contract Wizard
  • Remix

Launching on the main net will of course require gas, but these steps are equally applicable for an EVM (Ethereum Virtual Machine) test net.

 

Go to the Openzeppelin contract wizard (https://wizard.openzeppelin.com/)

You will be required to provide 3 things: the token’s name, the token’s symbol, and the initial and total initial supply. 

Replace these with your values.

An OpenZeppelin contract wizard with the default configuration.

 

Open the contract in Remix

The option to open the token contract in the Remix IDE.

This will transfer the contract into the Remix IDE where you will actually deploy it.

Remix File Explorer

It will show up on the left-hand side as a solidity contract. You will need to compile it to proceed forward. This happens in the Solidity Compiler, the second tab on the left.

Remix Compiler

Switch the Compiler version to match the one on the top line of the contract, in this case, 0.8.4. Leave the other values on default.

Let it compile (which might take a while) and proceed to the deploy tab (third tab on the left).

Remix Deploy and Run Transaction Environment Injected Web3

Switch environment to Injected Web3. This will require that you have a browser-based wallet such a Metamask.

Connecting Remix to Metamask

Remix will make a request to connect with Metamask which you will have to approve.

Remix Contract Selection

Select your token in the contract section since it is not selected by default.

Metamask Network Selector

In Metamask check that the network you are deploying to is the correct one, whether it is the Ethereum Main-net or any of the test-nets, such as Ropsten, Kovan, Rinkeby or Goerli. They are not visible by default and can be accessed by going to the setting and toggling on show test networks.

Metamask Test Networks

Just as deploying to the mainnet will require gas, so does deploying to the test-nets.

Ether for the test-nets can be acquired from faucets all over the internet.

 

Deploy

Token Deploy Button

With the correct contract and network selected, click Deploy.

Remix Deploy Confirm Modal

A pop-up asking you to confirm the transaction will appear. Proceed by selecting confirm and the transaction request will appear in your metamask browser wallet. 

Metamask deploy request

Here you will be given an estimate of how much ether will be required depending on current conditions. You can reject it, wait until later and try again.

Successful Deployment

After pressing confirm and waiting for the transaction to go through, you should see something similar to this in the lower console of remix and all the tokens will be deposited in your browser wallet.

More

This guide is barely scratching the surface of tokens (erc-20 or otherwise), Solidity, and smart contracts. But it is a simple a-to-b process and for some people who aren't looking to create anything too complex and don't want to hire a dedicated solidity developer, it is enough, and if anything a launchpad for further research.

 

How do you rate this article?


13

0

candlevalley
candlevalley

I'm a developer who is skeptical but curious about the promises web3 is making in a global and local context. My content will be varied with a focus on the impact of DeFi on emerging markets, and simple how-to guides for web3 basics.


for the commons
for the commons

Short step-by-step explanations and how-to guides to common web3 operations.

Send a $0.01 microtip in crypto to the author, and earn yourself as you read!

20% to author / 80% to me.
We pay the tips from our rewards pool.