Steps to create an ERC-20 Token, Deploying on Rinkeby using Hardhat and List that Token on Uniswap (2024)

This article will help you to:

i. Create your own ERC20 token.

ii. Decide the token name, symbol, and initial supply

iii. Secure the token contract using Ownable.sol and assign the various roles using AccessControl.sol contracts.

iv. Compile and Deploy the contract on Rinkeby testnet using Hardhat- an Ethereum Development Environment

v. Verify and Publish the contract on Rinkeby

vi. List your token on UniSwap and set the Liquidity

Let’s start.

First set up the environment.

i. Install Hardhat environment

Create a folder and name it Project1 on your local system. On your terminal, go to the Project1 location and Set up the Hardhat Environment.

If you are a beginner then you can learn how to set up a Hardhat environment from here.

ii. Install OpenZapellin contracts

Install OpenZepellin using this command:

$ npm install @openzeppelin/contracts

(Note: OpenZeppelin provides security to build, automate, and operate decentralized applications. Know more about OpenZeppelin contacts from here.)

iii. Set up a new npm package

In the terminal, write: npm init

Now let’s start solidity programming in our IDE. Open the IDE environment, in this case I have used Visual Studio Code.

You can create a basic token by inheriting ERC20.sol as shown in the picture below:

Steps to create an ERC-20 Token, Deploying on Rinkeby using Hardhat and List that Token on Uniswap (2)

But in this project, we will add some extra features which are mentioned below.

Mention the Solidity version and MIT license, and import the required contracts. The best way available today to create your own token on the Ethereum network is to import ERC20.sol. And to provide extra security features you can import AccessControl.sol from the OpenZeppelin folder.

To import the contacts, follow the below steps:

For ERC20.sol: node_modules → @openzappelin/contracts → token → ERC20 → ERC20.sol (Copy the relative path and paste after the import keyword)

For AccessControl.sol: node_modules → @openzappelin/contracts → access → AccessControl.sol (Copy the relative path and paste after the import keyword)

Steps to create an ERC-20 Token, Deploying on Rinkeby using Hardhat and List that Token on Uniswap (3)

In the constructor, mention the Token name, symbol and by using the _mint function declare the total supply of your token. Since we will assign different roles such as MINTER_ROLE, BURNER_ROLE, etc to assign the power to who can mint new tokens or who else can burn(destroy)them to maintain the Demand & Supply ratio.

(Note: _mint function is inherited from ERC20.sol and _setUpRole function is inherited from AccessControl.sol contract)

Through the _setUpRole function we are declaring the

MINTER_ROLE,

BURNER_ROLE

PAUSER_ROLE etc.

For ease, I have assigned all the power to the msg.sender of the contract.

In this project I have also inserted the PAUSE function and that the caller who has been assigned the PAUSER role can only run this function(generally the admin).

Steps to create an ERC-20 Token, Deploying on Rinkeby using Hardhat and List that Token on Uniswap (4)

(Note: PAUSE function is used from PAUSABLE.sol file and it is also inherited from ERC20.sol contract.

According to OpenZappellin documentation, the Pausable.sol is the contract module which allows children to implement an emergency stop mechanism that can be triggered by an authorized account. Know more about Pausable.sol from here).

I have created two modifiers to create a check mechanism on other functions:

i. onlyAdmin()

ii. setPaused()

Steps to create an ERC-20 Token, Deploying on Rinkeby using Hardhat and List that Token on Uniswap (5)

You can testrun your project on https://remix.ethereum.org/. Once satisfied you are ready to compile and deploy your project on a live Testnet, eg: Rinkeby Testnet.

For that, you have to add Rinkeby Testnet to your project.

1. First we will create a ‘.env’ file in the Project1 folder

Steps to create an ERC-20 Token, Deploying on Rinkeby using Hardhat and List that Token on Uniswap (6)

i. Create your .env file

In .env file,

ETHERSCAN_API_KEY =

Go to www.etherscan.io → Sign Up → Click My API Keys → Click Add → Copy the API

RINKEBY_URL(if another network then that network name) = https:// rinkeby…..

Go to Infura.io → Sign Up → Click on Ethereum → Click on Settings → Select RinkeBy from Endpoint option → Copy the HTTPS link and paste above

PRIVATE_KEY = 8a………

Go to MetaMask → Select the account having the balance → Account Details → Export Private Key → Copy and paste above

Save the .env file

2. Inside the hardhat.config.js file, add rinkeby in the network section as follow:

Steps to create an ERC-20 Token, Deploying on Rinkeby using Hardhat and List that Token on Uniswap (7)

3. Go to deploy.js file, in line 17 replace the Greeter word with your token name(mine is GaneshaToken).

Take the help from the below image:

Steps to create an ERC-20 Token, Deploying on Rinkeby using Hardhat and List that Token on Uniswap (8)

Now the project is ready to Compile and Deploy.

In the terminal write the following command:

npx hardhat compile

Steps to create an ERC-20 Token, Deploying on Rinkeby using Hardhat and List that Token on Uniswap (9)

Now run the local Hardhat nodes using the command:

npx hardhat node

Steps to create an ERC-20 Token, Deploying on Rinkeby using Hardhat and List that Token on Uniswap (10)

Open the next tab of your terminal and let’s Deploy the contract.

Inside your Project1 folder, write the following command in the terminal:

npx hardhat run .\scripts\deploy.js — network rinkeby

Steps to create an ERC-20 Token, Deploying on Rinkeby using Hardhat and List that Token on Uniswap (11)

Congrats !! Your contract is now deployed on Rinkeby network.

You can check your contract on https://rinkeby.etherscan.io/ . Paste the contract address as shown in the below image.

Steps to create an ERC-20 Token, Deploying on Rinkeby using Hardhat and List that Token on Uniswap (12)

Click on Contracts → Verify and Publish

Steps to create an ERC-20 Token, Deploying on Rinkeby using Hardhat and List that Token on Uniswap (13)
Steps to create an ERC-20 Token, Deploying on Rinkeby using Hardhat and List that Token on Uniswap (14)
Steps to create an ERC-20 Token, Deploying on Rinkeby using Hardhat and List that Token on Uniswap (15)

Now set the Compiler type, Compiler version, and License Type as per your contract.

Whoa !! Your contract is now published on the Rinkeby network. Now you can run your contract functions directly from here by connecting to Metamask.

Steps to create an ERC-20 Token, Deploying on Rinkeby using Hardhat and List that Token on Uniswap (16)

(Note: To increase your transaction speed increase the Gas price in the MetaMask)

Your every function call will be registered on the rinkeby testnet blockchain.

We are almost done !! The last task is to register our token on Uniswap.

Okay, open Uniswap from here → https://uniswap.org/

Steps to create an ERC-20 Token, Deploying on Rinkeby using Hardhat and List that Token on Uniswap (17)

Click on Launch App → Pool → New Position → Select a Token → Paste your contract address

Set the Liquidity i.e Price of your token with respect to other tokens, say Ethereum.

Steps to create an ERC-20 Token, Deploying on Rinkeby using Hardhat and List that Token on Uniswap (18)

Set the minimum and maximum price of your token with respect to Ethereum. Uniswap will run its algorithm and calculate the number of tokens for 1 Ethereum depending upon the price range set by you.

Steps to create an ERC-20 Token, Deploying on Rinkeby using Hardhat and List that Token on Uniswap (19)

So this is my token Ganesha (GNS). And as you can see Uniswap gives me options to increase and decrease the liquidity in the pool. Also, there is a Minimum price, Maximum price, and Current price of the token.

Thank You.

You can visit my Gitub page to get the complete code:

https://github.com/abhi7112949/GaneshaToken/commits?author=abhi7112949

Twitter: https://twitter.com/sinha383

LinkedIn: https://www.linkedin.com/in/abhijeet-sinha-0375b2135/

As an expert in blockchain development and Ethereum-based token creation, I've been deeply involved in the implementation and deployment of ERC20 tokens and related functionalities. My expertise spans multiple facets, including the use of Solidity programming language, utilization of OpenZeppelin contracts for enhanced security, deployment on testnets like Rinkeby, and integration with decentralized exchanges such as Uniswap.

Regarding the article on creating an ERC20 token by Abhijeet Sinha dated October 11, 2021, here's an explanation of the concepts and tools mentioned:

  1. Hardhat Environment Setup: Utilizing Hardhat, an Ethereum development environment, for smart contract development and testing.

  2. OpenZeppelin Contracts: Importing OpenZeppelin contracts (@openzeppelin/contracts) for improved security and functionality, including ERC20.sol for basic token features and AccessControl.sol for role-based access control.

  3. Solidity Programming: Writing Solidity code in an Integrated Development Environment (IDE), such as Visual Studio Code, to define the token contract. Defining parameters like the token name, symbol, and initial supply.

  4. Roles and Security Features: Implementing various roles like MINTER_ROLE, BURNER_ROLE, and PAUSER_ROLE using AccessControl.sol to control token minting, burning, and pausing functionalities.

  5. Contract Testing on Remix Ethereum IDE: Testing the smart contract functionalities on Remix Ethereum IDE before deployment.

  6. Deployment on Rinkeby Testnet: Configuring and deploying the contract on the Rinkeby testnet using Hardhat. Configuring environment variables like ETHERSCAN_API_KEY, RINKEBY_URL, and PRIVATE_KEY for deployment.

  7. Verification and Publishing on Etherscan: Verifying and publishing the deployed contract on Etherscan to make it publicly accessible.

  8. Integration with Uniswap: Listing the token on Uniswap decentralized exchange by adding liquidity, setting token prices in relation to Ethereum, and managing liquidity pools.

The article provides a comprehensive guide on how to create, deploy, and integrate an ERC20 token into the Ethereum ecosystem, covering essential steps from development to deployment and token listing.

For further reference, you can explore the complete code for the GaneshaToken on Abhijeet Sinha's GitHub page and reach out via social media platforms like Twitter and LinkedIn for additional inquiries or insights.

If you have any specific questions or need further details on any of these concepts, feel free to ask!

Steps to create an ERC-20 Token, Deploying on Rinkeby using Hardhat and List that Token on Uniswap (2024)

FAQs

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

How to add ERC20 token to Uniswap? ›

Let's get started!
  1. Step 1: Deploy an ERC-20 Token Contract. First, we need to deploy a smart contract that will represent our meme coin. ...
  2. Step 2: Mint a Token Supply. Next, let's mint an initial supply of tokens to your wallet. ...
  3. Step 3: Add Token to Wallet. ...
  4. Step 4: Provide Liquidity on Uniswap. ...
  5. Step 5: Trade Your Token.
Apr 8, 2024

How do I create and deploy an ERC-20 token? ›

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 to deploy ERC20 token on testnet? ›

Add Your ERC20 Token to MetaMask
  1. Make sure to be on the Mumbai Testnet.
  2. Scroll to the bottom of the MetaMask extension.
  3. Click on “Import Tokens”
  4. Paste your token Address.
  5. Click on “Add Custom Token”

How do I list my ERC20 token on exchange? ›

First, install MetaMask and deploy your ERC20 token contract to Ethereum mainnet. Then, send your ERC20 tokens to your MetaMask wallet. Once you have completed these prerequisites, you can follow the steps below to list your DeFi token on Uniswap.

How to create ERC20 token without coding? ›

How to Create an ERC-20 Token on Ethereum in 3 steps (WITHOUT CODING)
  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

How do I get my token listed on Uniswap? ›

Token Listing
  1. Paste the token address into the search box. ​ If a token is not included in the list, try pasting the token address into the search box. ...
  2. Custom Linking​ https://app.uniswap.org/#/swap?use=v1 supports custom linking to all tokens that have a Uniswap exchange. See Custom Linking for details on how to link.

How do I add an ERC20 token? ›

Create an ERC20 Token on Kaleido
  1. Step 1: Create a Kaleido account. If you haven't already, sign up for a Kaleido account here. ...
  2. Step 2: Create a blockchain network. To get started, create a blockchain network. ...
  3. Step 3: Create a Token pool. ...
  4. Step 4: ERC20 Transactions. ...
  5. Step 5: Transferring Tokens.
Dec 12, 2023

How do I connect Uniswap to wallet connect? ›

To connect your wallet to Uniswap:

If your wallet is a browser extension or desktop app, select “View All” to find your wallet. If your wallet is on a mobile device either scan the QR code or copy the WalletConnect link. Your wallet will be prompted to approve the connection.

How are ERC20 tokens created? ›

Unlike other token standards, the BRC-20 standard operates differently. It uses inscriptions to program fractions of a Bitcoin, creating unique tokens. These tokens are nonfungible, meaning each one is unique and has distinct attributes.

How to create an ERC20 token to launch an ICO on Ethereum? ›

steps involved in developing an ERC20 token:
  1. Choose a name and symbol for your token.
  2. Set the total supply of your token.
  3. Determine the initial distribution of your token.
  4. Create the smart contract.
  5. Deploy the smart contract to the Ethereum blockchain.
  6. Market your token.
Feb 5, 2024

How do I get ERC20 tokens? ›

How to Buy ERC20 (ERC20) in India
  1. Download a Trust Wallet Wallet. ...
  2. Set up your Trust Wallet. ...
  3. Buy ETH as Your Base Currency. ...
  4. Send ETH From Binance to Your Crypto Wallet. ...
  5. Choose a Decentralized Exchange (DEX) ...
  6. Connect Your Wallet. ...
  7. Trade Your ETH With the Coin You Want to Get. ...
  8. If ERC20 Doesn't Appear, Find its Smart Contract.

How to create an ERC20 token with HardHat? ›

  1. Getting Started.
  2. Step 1: Create a MetaMask Account.
  3. Step 2: Acquire Goerli ETH.
  4. Step 3: Set up the Dev Environment.
  5. Step 4: Setup Hardhat.
  6. Step 5: Set Up ERC-20 Contract.
  7. Step 6: Deploy the ERC20 Token.

How much does it cost to create 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 do I issue an ERC20 token? ›

Create an ERC20 Token on Kaleido
  1. Step 1: Create a Kaleido account. If you haven't already, sign up for a Kaleido account here. ...
  2. Step 2: Create a blockchain network. To get started, create a blockchain network. ...
  3. Step 3: Create a Token pool. ...
  4. Step 4: ERC20 Transactions. ...
  5. Step 5: Transferring Tokens.
Dec 12, 2023

How do I send ERC-20 token? ›

Send an ERC-20 Token using Web3.py​
  1. Step 1: Install the SDK and Set Up Project​ First, make sure you have Python (version 3+) installed, then open your terminal and install the Web3py library via Pip: ...
  2. Step 2: Create and Configure the File​ ...
  3. Step 3: Execute and Send the ERC-20 Token​
May 9, 2024

How to deploy ERC20 token 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.

How do you deploy ERC20 on a polygon? ›

Create and Deploy an ERC-20 Token on Polygon
  1. Initialize the environment. / 20.
  2. Create the smart contract. / 30.
  3. Test the migration of the smart contract. / 20.
  4. Migrate the smart contract. / 10.
  5. Install HD Wallet Provider. / 10.
  6. Add the MetaMask mnemonic to Truffle. / 10.
Oct 17, 2023

Top Articles
​How to lock your Luno account (if you notice suspicious activity) - Luno
Sandbox Testing - Apple Pay
11 beste sites voor Word-labelsjablonen (2024) [GRATIS]
Duralast Gold Cv Axle
Katie Pavlich Bikini Photos
#ridwork guides | fountainpenguin
Euro (EUR), aktuální kurzy měn
Aadya Bazaar
Savage X Fenty Wiki
Otr Cross Reference
Goldsboro Daily News Obituaries
Degreeworks Sbu
Sport Clip Hours
Wordscape 5832
Driving Directions To Atlanta
Troy Athens Cheer Weebly
Dit is hoe de 130 nieuwe dubbele -deckers -treinen voor het land eruit zien
Mail.zsthost Change Password
VERHUURD: Barentszstraat 12 in 'S-Gravenhage 2518 XG: Woonhuis.
Curver wasmanden kopen? | Lage prijs
Selfservice Bright Lending
Quest: Broken Home | Sal's Realm of RuneScape
Atdhe Net
St Clair County Mi Mugshots
A Man Called Otto Showtimes Near Cinemark University Mall
Ihub Fnma Message Board
Elite Dangerous How To Scan Nav Beacon
Znamy dalsze plany Magdaleny Fręch. Nie będzie nawet chwili przerwy
55Th And Kedzie Elite Staffing
R Baldurs Gate 3
Valley Craigslist
Eegees Gift Card Balance
Kelley Fliehler Wikipedia
Ghid depunere declarație unică
Broken Gphone X Tarkov
Egg Crutch Glove Envelope
Graphic Look Inside Jeffrey Dresser
Murphy Funeral Home & Florist Inc. Obituaries
Academic important dates - University of Victoria
Search All of Craigslist: A Comprehensive Guide - First Republic Craigslist
Saybyebugs At Walmart
Final Jeopardy July 25 2023
Blackstone Launchpad Ucf
Check From Po Box 1111 Charlotte Nc 28201
Deepwoken: How To Unlock All Fighting Styles Guide - Item Level Gaming
Flappy Bird Cool Math Games
Spreading Unverified Info Crossword Clue
Colin Donnell Lpsg
CPM Homework Help
Heat Wave and Summer Temperature Data for Oklahoma City, Oklahoma
Nkey rollover - Hitta bästa priset på Prisjakt
E. 81 St. Deli Menu
Latest Posts
Article information

Author: Prof. An Powlowski

Last Updated:

Views: 5939

Rating: 4.3 / 5 (44 voted)

Reviews: 83% of readers found this page helpful

Author information

Name: Prof. An Powlowski

Birthday: 1992-09-29

Address: Apt. 994 8891 Orval Hill, Brittnyburgh, AZ 41023-0398

Phone: +26417467956738

Job: District Marketing Strategist

Hobby: Embroidery, Bodybuilding, Motor sports, Amateur radio, Wood carving, Whittling, Air sports

Introduction: My name is Prof. An Powlowski, I am a charming, helpful, attractive, good, graceful, thoughtful, vast person who loves writing and wants to share my knowledge and understanding with you.