How to Create and Deploy an ERC20 Token | QuickNode (2024)

9 min read

Overview

Ethereum network’s launch in 2015 created a lot of buzz in the developer community and sprouted a lot of tokens on the network. Initially, there weren’t any templates or guidelines for token development. This resulted in a variety of tokens quite different from each other. To bring this diversity to order, the community came up with an ERC-20 standard to make all tokens more or less uniform.

Prefer a video walkthrough? Follow along with Radek and learn how to create and deploy an ERC20 Token in 15 minutes.

Subscribe to our YouTube channel for more videos!

Subscribe

What You Will Do


  • Learn about ERC-20 tokens and their use cases
  • Create and deploy an ERC-20 token using Remix.IDE

What You Will Need


  • A web3 wallet (e.g., MetaMask, Coinbase Wallet, Phantom, or a WalletConnect-compatible wallet)
  • Test ETH (You can get some at the Multi-Chain QuickNode Faucet)
  • A modern web browser (e.g., Chrome)

What is an ERC-20 Token?

ERC stands for Ethereum Request for Comment, and 20 is the proposal identifier number. ERC-20 was designed to improve the Ethereum network.

ERC-20 is one of the most significant ERCs. It has emerged as the technical standard for writing smart contracts on the Ethereum blockchain network, used for token implementation. ERC-20 contains a set of rules that all Ethereum based tokens must follow.

ERC-20 defines tokens as blockchain-based assets that can be sent/received and have value. ERC-20 tokens are similar to Bitcoin and Litecoin in many aspects. However, the most significant difference is that instead of running on their own blockchain network, ERC-20 coins run on Ethereum’s blockchain network and use gas as the transaction fee.

Before the emergence of ERC-20, everyone who created tokens had to reinvent the wheel, which means all tokens were different from each other. For example, if a developer wanted to work with another token, they had to understand the entire smart contract code of that token due to the lack of any specific structure or guidelines for building new tokens. This was particularly painful for wallets and exchange platforms - adding different types of tokens required developers to go through the code of each and every token and understand it in order to handle those tokens on their platforms. Needless to say, it was rather difficult to add new tokens to any app. Today, wallets and exchanges use the ERC-20 standard to integrate various standardized tokens onto their platforms and also facilitate easy exchange between ERC-20 tokens and other tokens. The ERC-20 token standard has made interaction between tokens almost seamless and painless.

Key Points about ERC-20 Tokens

Standardized Functions: ERC-20 tokens follow a specific set of standards, which means they have a common list of rules and functions. This includes how the tokens can be transferred, how transactions are approved, how users can access data about a token, and the total supply of tokens.

Smart Contracts and DeFi: The use of smart contracts in ERC-20 tokens enables the automation and enforcement of complex financial operations. This is crucial for DeFi platforms, where these tokens can represent various financial instruments, like loans or stakes in a liquidity pool.

Interoperability: Since ERC-20 tokens follow the same standard, they are easily interchangeable and can work seamlessly with other ERC-20-compliant tokens and applications on the Ethereum network. This standardization simplifies the process of creating new tokens and makes them instantly compatible with existing wallets, exchanges, and other services.

Use Cases: ERC-20 tokens can represent a wide range of assets or utilities. For example, ERC-20 tokens can serve various roles, such as collateral for loans, interest-bearing assets in yield farming, and governance tokens granting voting rights in decentralized autonomous organizations (DAOs).

Transferability and Exchange: These tokens can be transferred from one account to another as payment, similar to cryptocurrencies like Bitcoin, and can be traded on various cryptocurrency exchanges.

ERC-20 is a standard or guideline for creating new tokens. The standard defines six mandatory functions that a smart contract should implement and three optional ones.

The mandatory functions are listed below with explanations.


  • totalSupply: A method that defines the total supply of your tokens; when this limit is reached, the smart contract will refuse to create new tokens.
  • balanceOf: A method that returns the number of tokens a wallet address has.
  • transfer: A method that takes a certain amount of tokens from the total supply and gives it to a user.
  • transferFrom: Another type of transfer method that is used to transfer tokens between users.
  • approve: This method verifies whether a smart contract is allowed to allocate a certain amount of tokens to a user, considering the total supply.
  • allowance: This method is exactly the same as the approved method except that it checks if one user has enough balance to send a certain amount of tokens to another.

Besides the mandatory functions listed below, functions are optional, but they improve the token's usability.


  • name: A method that returns the name of the token.
  • symbol: A method that returns the symbol of the token.
  • decimals: A method that returns the number of decimals the token uses. It is used to define the smallest unit of the token. For example, if an ERC-20 token has a decimals value of 6, this means that the token can be divided up to six decimal places.

If you know something about object-oriented programming, you can compare ERC-20 to an Interface. If you want your token to be an ERC-20 token, you have to implement the ERC-20 interface, and that forces you to implement these 6 methods.

Creating Our Own Token

Now that we know what ERC-20 tokens are and how they work, let’s see how we can build and deploy our own token.

Getting Test ETH

To begin deploying your contract on the Ethereum Sepolia testnet, you'll need to install the MetaMask browser extension or use another web3 compatible wallet like Phantom or WalletConnect. Once your wallet is set up, you'll need to acquire some test ETH. This can be obtained from the QuickNode Multi-Chain Faucet specifically for the Ethereum Sepolia network. Simply navigate to their website, connect your wallet or enter your wallet address, and proceed. You'll have an option to share a tweet for an additional bonus. If you choose not to, you can just select the option "No thanks, just send me 0.05 ETH" to receive your test ETH.

Note: You will need a Ethereum mainnet balance of at least 0.001 ETH in order to be eligible to use the faucet.

How to Create and Deploy an ERC20 Token | QuickNode (1)

Writing the Smart Contract

There are a multitude of ERC20-compliant tokens already operational on the Ethereum blockchain, developed by different groups. These implementations vary, with some focusing on reducing gas costs and others prioritizing enhanced security. For a robust and secure implementation, many developers opt to use OpenZeppelin's ERC20 token standard. OpenZeppelin provides a well-tested, community-audited library of reusable smart contracts, which includes a reliable and secure framework for ERC20 tokens, making it a preferred choice for ensuring compliance and security in token development.

For ease and security, we’ll use the OpenZeppelin ERC-20 contract to create our token. With OpenZeppelin, we don’t need to write the whole ERC-20 interface. Instead, we can import the library contract and use its functions.

Head over to the Ethereum Remix IDE and make a new Solidity file, for example - MyToken.sol.

Paste the following code into your new Solidity script:

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

import "@openzeppelin/contracts/token/ERC20/ERC20.sol";

contract MyToken is ERC20 {
constructor() ERC20("MyToken", "MT") {
_mint(msg.sender, 1000000 * (10 ** uint256(decimals())));
}
}

Explanation of the code above:


  • The SPDX-License-Identifier comment specifies the license under which the contract is released.
  • The pragma directive states the compiler version to use.
  • The ERC20 contract from OpenZeppelin is imported and used as a base.
  • MyToken is the name of your contract, and it extends the ERC20 contract.
  • The constructor function initializes your token with a name ("MyToken") and a symbol ("MTK").
  • The _mint function in the constructor mints an initial supply of tokens. In this example, 1 million tokens are minted and assigned to the address that deploys the contract. The number of tokens is adjusted by the decimals value, which defaults to 18 in the OpenZeppelin implementation.

Since we import the ERC20 smart contract from OpenZeppelin and the MyToken contract inherits the ERC20 contract, it is not necessary to define all functions. All functions that are defined in the ERC20 contract are imported into the MyToken contract. If you would like to see the full ERC-20 code which is more in-depth, check it out the file here

Now, take a minute to customize the smart contract with your own details if you'd like. You can update the token name and symbol by updating the following part - ERC20("MyToken", "MT").

Deployment

Once you've completed customizing the smart contract, proceed to compile it.

Step 1: Click on the Solidity compiler button. Check the compiler version and the selected contract. The compiler version should be at least 0.8.20 because of the line pragma solidity ^0.8.20; in the smart contract. Then, click the Compile MyToken.sol button. If everything goes well, you will see a green check mark on the Compile button.

How to Create and Deploy an ERC20 Token | QuickNode (2)

Step 2: Go to the Deploy & Run Transactions tab. For deployment, use the Injected Provider option under the Environment. Before the deployment, ensure that your MetaMask is set to the Sepolia testnet, and MyToken contract is the selected contract to be deployed. Finally, click on the Deploy button to deploy your contract.

If you are unsure how to change the network, open the MetaMask extension, click the Network Selector in the top-left corner, and then select Sepolia. If you don't see it, make sure that Show test networks option is enabled. If you would like to learn how to add your QuickNode RPC URL to MetaMask, check out this QuickNode Guide.

How to Create and Deploy an ERC20 Token | QuickNode (3)

If you receive an error message before deployment - “This contract may be abstract”, make sure to select the appropriate contract under the Contract tab.

Step 3: Confirm the transaction in MetaMask:

How to Create and Deploy an ERC20 Token | QuickNode (4)

That’s it! Your token contract is now deployed on Ethereum’s Sepolia testnet!

Now, let's interact with it. Click the arrow (>) near the contract's name under the “Deployed Contracts” section to see the functions of the contract. Then, click the name button, and you should see the name that you customize in your contract. Feel free to try other functions as well.


tip

On Remix.IDE, functions are color-coded in the interface based on their nature and effect:

  • Blue Button Functions: These represent constant or pure functions. Clicking these buttons won't initiate a new transaction or alter the contract's state. They only return a value from the contract and do not incur any gas fees.

  • Orange Button Functions: These are non-payable functions that change the state of the contract but do not accept Ether. Activating these functions generates a transaction, which means they will cost gas.

  • Red Button Functions: Functions with red buttons are payable and can create transactions that accept Ether. The value for these transactions is entered in the "Value" field, located beneath the "Gas Limit" field. These also incur gas fees upon execution.

How to Create and Deploy an ERC20 Token | QuickNode (5)

To see your contract on a blockchain explorer, a beginner-friendly useful tool used to analyze various blockchain data, go to the Etherscan Sepolia Explorer and search your contract's address.

You will see your token name and token symbol under the Token Tracker section.

How to Create and Deploy an ERC20 Token | QuickNode (6)

Now, click on the your token name. The page that opens displays the name, symbol, max total supply, and decimals information of your token.

How to Create and Deploy an ERC20 Token | QuickNode (7)

If you want to see your token in your MetaMask, copy the deployed contract’s address using the copy button near the contract’s name. Then, open MetaMask, click on the Import tokens button and paste the contract’s address in the Token contract address field. MetaMask will fetch the Token Symbol and decimals automatically. Click the Next and Import, and your token will be added to the wallet; it will be available under the assets section in Metamask.

How to Create and Deploy an ERC20 Token | QuickNode (8)

Conclusion

Congratulations on successfully creating your very own token on the Ethereum Sepolia testnet!

If you'd like to learn more about smart contract deployment contents, you may want to check out these QuickNode guides:


  • How to Create and Deploy an ERC-721 (NFT)
  • How to Create and Deploy an ERC-1155 NFT
  • How to Create a "Hello World" Smart Contract with Solidity
  • How to Create and Deploy a Smart Contract with Hardhat

You can also explore these different QuickNode guide sections:


  • Smart Contract Development
  • DeFi
  • Web3 Security

Subscribe to our newsletter for more articles and guides on Web3 and blockchain. If you have any questions, check out the QuickNode Forum for help. Stay up to date with the latest by following us on Twitter (@QuickNode) or Discord.

We ❤️ Feedback!

Let us know if you have any feedback or requests for new topics. We'd love to hear from you.

How to Create and Deploy an ERC20 Token | QuickNode (2024)

FAQs

How do I create an ERC20 token and deploy? ›

How to Create an ERC-20 Token
  1. Set Up your Developer Environment. First, create an Alchemy account, and set up Metamask, HardHat, and Solidity for this project. ...
  2. Write ERC-20 Token Smart Contract. ...
  3. Write a Deployment Script for your ERC-20 Token. ...
  4. Deploy your ERC-20 Token to Goerli. ...
  5. Step 4: Send Some Tokens!

How much does it cost to deploy an ERC20 token? ›

On average, the cost to create ERC20 token lies between $5000 to $10,000, depending on the type of token developed and business requirements.

How are ERC20 tokens created? ›

BRC-20 tokens are a development in the cryptocurrency space. They were created by a blockchain analyst. The BRC-20 token standard supports the creation and transfer of fungible tokens via a protocol. This protocol allows data to be inscribed onto individual fractions of a Bitcoin.

How to create ERC20 token without coding? ›

Creating ERC-20 Tokens on Ethereum
  1. Step 1: Visit CoinFactory Ethereum Token Generator.
  2. Step 2: Connect your wallet. Start by connecting your wallet to the CoinFactory Generator page. ...
  3. Step 3: Choose a contract template. ...
  4. Step 4: Define Token Details.
Mar 10, 2024

Can anyone create an ERC20 token? ›

Token Tool eliminates the need for coding expertise, allowing individuals with limited technical background to create their own ERC20 tokens quickly and easily. You can even try it for free on the Ethereum Sepolia Testnet.

How can I create my own token? ›

How to Create Your Own Crypto Token in 10 Easy Steps
  1. Define the purpose of your token. ...
  2. Choose a blockchain platform for your token. ...
  3. Select a token standard for your token. ...
  4. Design the token's name, symbol, supply, and distribution. ...
  5. Write the token's smart contract code. ...
  6. Test and deploy the token's smart contract.
Feb 26, 2024

How long does it take to create an ERC20 token? ›

If you want to learn how to create and deploy an ERC20 Token In 20 minutes, that's the right place to be. In this tutorial, you're going to understand how to create a cryptocurrency using Solidity and the ERC20 Token standard (Ethereum request of comment) maintained by OpenZeppelin.

How much does it cost to launch an ERC token? ›

The cost to create ERC20 token will be anywhere between $500 and $2,000, as the exact price will depend on certain variables that will be discussed further in this article. Before considering those factors, we must first understand what is meant by ERC20 tokens.

Why is it so expensive to send ERC20? ›

Sending ERC-20 tokens involves interacting with smart contracts, which requires more gas than a simple ETH transfer. Gas Price: Gas fees are determined by the gas price, which is denoted in Gwei (which itself is a denomination of ETH). The gas price represents the amount you're willing to pay per unit of gas.

How many ERC-20 tokens exist? ›

ERC-20 tokens are custom user cryptocurrencies created on Ethereum, based on the successful ERC-20 Token Standard. Currently, there are over 500,000 ERC-20 tokens in existence, most of which have no market value. See the full list here.

How are ERC-20 tokens mined? ›

Mining: Tokens cannot be mined. When a contract is launched, the supply is distributed according to the organization's plans and roadmap through an ICO, an IEO, or a STO. Choosing: On the Ethereum blockchain, there are over 200,000 ERC-20-compatible tokens, however only 2,600 of these ERC-20 tokens are tradable.

How to deploy tokens on base? ›

The steps below explain how to get your token on the Base Token List.
  1. Step 1: Deploy your token on Base​ Select your preferred bridging framework and use it to deploy an ERC-20 for your token on Base. ...
  2. Step 2: Submit details for your token​ ...
  3. Step 3: Await final approval​

How much does it cost to create a token on Ethereum? ›

The cost to create ERC20 token will be anywhere between $500 and $2,000, as the exact price will depend on certain variables that will be discussed further in this article. Before considering those factors, we must first understand what is meant by ERC20 tokens.

How do you deploy an ERC20 contract on remix? ›

Let's proceed with the contract deployment process in the order below.
  1. Step 1 : Access the Remix and Create a file.
  2. Step 2 : Write ERC-20 Contract.
  3. Step 3 : Move to SOLIDITY COMPILER tap, Set the version, and Compile.
  4. Step 4 : Set DEPLOY & RUN TRANSACTIONS.
  5. Step 5 : Set Gas fee and Sign at MetaMask.
Aug 1, 2023

How do I issue an ERC20? ›

Here's a step-by-step guide on how to create an ERC20 contract using Solidity:
  1. Find Mapping Objects To Create Token. ...
  2. Set The Number Of ICO Tokens & Transfer Tokens. ...
  3. Get The Total Token Supply To Build ERC20 Token. ...
  4. Approve Delegates To Withdraw Tokens. ...
  5. Get The Tokens Approved For Withdrawal. ...
  6. Add The Safe Math Solidity Library.
Oct 28, 2023

How to deploy ERC20 token using hardhat? ›

Deploying ERC20 Token With Hardhat: A Step-by-Step Guide
  1. Setting Up the Development Environment. ...
  2. Creating the ERC20 Token. ...
  3. The Code Structure. ...
  4. Configuring the Solidity. ...
  5. Compiling Hardhat. ...
  6. Writing Unit Test for the ERC20 Token. ...
  7. The Test Code Structure. ...
  8. Running The Test Script.
Sep 7, 2023

Top Articles
Which Branch of the Armed Forces Is Most Important?
When to Use a High ISO (+ Tips for High-ISO Photography)
English Bulldog Puppies For Sale Under 1000 In Florida
Katie Pavlich Bikini Photos
Gamevault Agent
Pieology Nutrition Calculator Mobile
Hocus Pocus Showtimes Near Harkins Theatres Yuma Palms 14
Hendersonville (Tennessee) – Travel guide at Wikivoyage
Compare the Samsung Galaxy S24 - 256GB - Cobalt Violet vs Apple iPhone 16 Pro - 128GB - Desert Titanium | AT&T
Vardis Olive Garden (Georgioupolis, Kreta) ✈️ inkl. Flug buchen
Craigslist Dog Kennels For Sale
Things To Do In Atlanta Tomorrow Night
Non Sequitur
Crossword Nexus Solver
How To Cut Eelgrass Grounded
Pac Man Deviantart
Alexander Funeral Home Gallatin Obituaries
Energy Healing Conference Utah
Geometry Review Quiz 5 Answer Key
Hobby Stores Near Me Now
Icivics The Electoral Process Answer Key
Allybearloves
Bible Gateway passage: Revelation 3 - New Living Translation
Yisd Home Access Center
Home
Shadbase Get Out Of Jail
Gina Wilson Angle Addition Postulate
Celina Powell Lil Meech Video: A Controversial Encounter Shakes Social Media - Video Reddit Trend
Walmart Pharmacy Near Me Open
Marquette Gas Prices
A Christmas Horse - Alison Senxation
Ou Football Brainiacs
Access a Shared Resource | Computing for Arts + Sciences
Vera Bradley Factory Outlet Sunbury Products
Pixel Combat Unblocked
Movies - EPIC Theatres
Cvs Sport Physicals
Mercedes W204 Belt Diagram
Mia Malkova Bio, Net Worth, Age & More - Magzica
'Conan Exiles' 3.0 Guide: How To Unlock Spells And Sorcery
Teenbeautyfitness
Where Can I Cash A Huntington National Bank Check
Topos De Bolos Engraçados
Sand Castle Parents Guide
Gregory (Five Nights at Freddy's)
Grand Valley State University Library Hours
Holzer Athena Portal
Hello – Cornerstone Chapel
Stoughton Commuter Rail Schedule
Nfsd Web Portal
Selly Medaline
Latest Posts
Article information

Author: Corie Satterfield

Last Updated:

Views: 6563

Rating: 4.1 / 5 (42 voted)

Reviews: 81% of readers found this page helpful

Author information

Name: Corie Satterfield

Birthday: 1992-08-19

Address: 850 Benjamin Bridge, Dickinsonchester, CO 68572-0542

Phone: +26813599986666

Job: Sales Manager

Hobby: Table tennis, Soapmaking, Flower arranging, amateur radio, Rock climbing, scrapbook, Horseback riding

Introduction: My name is Corie Satterfield, I am a fancy, perfect, spotless, quaint, fantastic, funny, lucky person who loves writing and wants to share my knowledge and understanding with you.