How To Create an ERC-20 Token on Ethereum (ETH): GetBlock’s Step-by-Step Manual

GetBlock
5 min readSep 15, 2022

The team at GetBlock describes the quickest method for creating ERC20 tokens in this short guide. As the most popular token standard on the Ethereum blockchain, implementing the Ethereum Virtual Machine or EVM is usually the first step when creating ERC20 tokens.

What are smart contracts?

For anyone who knows a little about Ethereum, blocks, crypto tokens and blockchain technology, continue reading the guide below. Smart contracts are small software programs stored in blockchains. They are signed by at least two addresses from the blockchain when a specific condition is met. When this occurs, the contract is automatically executed. Smart contracts are contractual agreements performed by the blockchain. Each smart contract contains specific business logic for the blockchain to implement. An example of a simple smart contract would be one that states “if Alice’s account has 100 coins, she should send 5 coins to Bob.” Furthermore, cryptocurrencies exchanged on the blockchain are referred to as “coins” in the contract. Additionally, “Alice” and “Bob” are addresses on the blockchain. Decentralized financial protocols — also known as DeFis — use smart contracts as essential elements in their systems. Every decentralized cryptocurrency exchange, stablecoin module and liquidity pool uses smart contract architecture in their systems.

What is the ERC20 token?

The Ethereum Request for Comments, or ERC-20 token, are the most common type of subcoin on the Ethereum blockchain. These tokens follow a specific standard developed for certain uses of Ethereum; they’re called ERC-20 because they’re standardized tokens. Before ERC-20 tokens were formed, every developer working with Etherum — also known as ETH — had to create their own specific token standards. With the ERC-20 standard in place, more specific Ethereum-based protocols could be created in a more streamlined manner. ERC-20 tokens represent various things in the Ethereum world, including fiat currency in the form of USD. They also represent reputation points, lottery tickets and in-game currency.

How to create ERC20 token: Detailed guide

ERC-20 tokens are useful general-purpose tools for digital economies. Now is the appropriate time to learn how to make a token on the Ethereum blockchain, ETH.

1. Start with Remix

For this tutorial, we’ll be using Remix, a web interface commonly used to write and deploy Ethereum smart contracts. First, we need to open an integrated development environment.

In Remix, we start by selecting the “Start coding online” option. This creates a GetBlock_Token workspace in the upper left corner.

2. Sign up on GetBlock and connect to Goerli

To get our code to work, we need to connect it to a blockchain. Connecting our code to a blockchain requires establishing a bridge between application nodes and blockchain nodes. Since we’re creating ERC20 tokens on the Ethereum blockchain, Etheruem’s nodes are the appropriate connection point.

Ethereum has multiple testnets, which are essentially sandbox networks that resemble the technical specifications of the Ethereum mainnet. We decided to use one of these testnets in our experiment to make it more affordable. The name of the testnet we used was Kovan.

GetBlock provides a secure connection to the Ethereum testnet, known as Goerli, in 2019. The ETH team launched Goerli as a testnet.

Before using GetBlock, you must create an account and sign in. Next, choose the ‘Shared Nodes’ menu option and select ‘Ethereum’. Switch the button to ‘Testnet’ and choose ‘Goerli’ as the test network name.

In the ‘Endpoint’ list, we need to choose https-endpoint; here’s our endpoint to Ethereum’s testnet Goerli.

3. Connect Metamask to Goerli Testnet

The Metamask wallet is the most popular option for Ethereum tokens. First, people need to install the wallet through a Chrome browser plug-in. Then they need to add Goerli to their Metamask wallet.

Before adding Goerli as a network, you must select ‘Add Network’ from the list of available networks. Then you can specify the parameters for Goerli in the following fields:

In the list of networks available, we need to choose ‘Add Network’ and set the parameters of Goerli:

That’s it, now the wallet supports Goerli as one of its chains.

After you need testnet money from a faucet. A Paradigm XYZ faucet is available at https://faucet.paradigm.xyz/. However, you need to have a verified Twitter account to obtain funds from this faucet.

4. Import the code from OpenZepellin

In order to streamline the process of development, we can take almost ready-made code standards for ERC-20 tokens from OpenZepellin. OpenZepellin Contracts is a library for smart contracts building: its collection of code templates features a plethora of patterns for various use-cases.

Here’s how the standard for ERC-20 token looks like (‘GLDToken’, ‘GLD’, and ‘Gold’ are the names for the token we’re experiment with):

// contracts/GLDToken.sol

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import “@openzeppelin/contracts/token/ERC20/ERC20.sol”;

contract GLDToken is ERC20 {

constructor(uint256 initialSupply) ERC20(“GETBLOCK_TEST”, “GBT”) {

_mint(msg.sender, initialSupply);

}

}

We can take it and run it in Remix:

Clicking the button in the bottom left of the screen labeled with the Solidity programming language logo launches a compiler program. This program converts source code from other programming languages into machine or byte code. Then, this data can be stored on the blockchain and accessed whenever necessary.

Now we can deploy our code. To do this, we can enter the Deployment menu next to the compiler menu. In the Environment field, we should select Injected Provider; this is because we’re working with the Goerli testnet. Additionally, we should enter the address of our account in the field labeled Account Address.

Etherscan is an example of an Ethereum explorer where you can track your token.

Now we can track our token (contract) 0x4E8fBD0d754a9D06D7B202DA18458FDE1Ba9487f in Goerli testnet.

--

--

GetBlock

GetBlock is a service that provides fast and easy API connection to blockchain nodes of 50+ cryptocurrencies.