How To Create An ERC20 Token From Scratch — It's Easier Than You Think

It’s way easy, anyone can do it. In this article, we are going to create an ERC20 token step by step on the Ethereum blockchain. You don’t need to install anything. All you need is Metamask and a simple tool.

First, you need to download Metamask. You can get this from the Chrome web store, it’s a simple Chrome extension. Metamask will enable us to talk to the blockchain so that we can deploy our token once we have made it. (Make sure you’re connected to the Ethereum main net on Metamask.)

Every smart contract costs real money to deploy on the blockchain. If you want to make a test run of your first token, I suggest using one of the Test Networks on Metamask like the Goerli Test Network. You can add free Ether on this network by going toand adding your contract address. This way you don’t have to spend real money the first time you try this out.

With Metamask downloaded and ready, you can start to code your new ERC20 token. The coding is used by the solidity programming language, which is the default programming language for all Ethereum smart contracts. All the coding and editing will be done with the Remix editor which you can find here.

Start by creating a new file by naming it anything you like as long as the name ends with .sol. For example Firtstoken.sol. Open your newly created empty file and verify which version of the compiler you want to use by typing “pragma solidity 0.8.7; (or the latest version)

Now we can start thinking about how our token should be structured. The Ethereum community has some guidelines that any good token should follow. You can find these guidelines at. It offers advice on what constitutes a good token. It could represent all sorts of things: reputation, points, lottery, tickets, an ounce of gold, a fiat currency. All good tokens will share some fundamental functionality, which is what ERC20 sets out. This guide details a few methods that we should implement.

Start by creating a link to above mentioned ERC20 token standard by typing “abstract contract ERC20Token {“

Go back to the ERC20 website guidelines and first copy and paste the Methods in the remix file. After that also copy and paste the Events. So these are all the functions that an ERC20 token is meant to implement. This is an abstract contract, meaning it’s a blueprint for what an ERC20 token should look like.

In order to make it easier for this tutorial, you can copy and paste the following complete smart contract created by CodeWithJoe at. There’s just a couple of edits you need to make to personalize your own token.

Line 34 – The contract name “CodeWithJoe” you can change to your own name.

Line 49 – At constructor

Line 50 – name = “CodeWithJoe” you can also change to your own name.

Line 51 – symbol = “CWJ” change to your own symbol

Go to the Solidity Compiler tab on the lefthand side of the Remix platform and make sure to change the solidity compiler to the latest version “pragma solidity 0.8.7”. After that click on the Compile button. When no errors show you can go to the Deploy Run Transactions tab on the Remix homepage to deploy your contract. Your token contract has been successfully deployed on Ethereum’s Goerli Test Network! To get the token in Metamask, navigate to the “Deployed Contracts” section of Remix and copy the address of the deployed contract using the copy button near the contract’s name. Open Metamask, click the assets option button, scroll to the bottom and click Import tokens. Paste the contract’s address into the first field. Metamask will automatically retrieve the Token Symbol and decimals.

Don’t worry too much if you get any errors. You are on the Goerli Test Network and this exercise won’t cost you anything. You can keep on testing and editing your smart contract until you’re ready for the Ethereum Mainnet. When you are ready for the real smart contract token you can change the network on your Metamask from the Goerli Testnet to the Ethereum Mainnet.

Congratulations on successfully launching your own ERC20 token!

Leave a Reply

Your email address will not be published.

Related Articles
Read More

EU Regulatory Authorities Issue Crypto Warning

A group of European Union financial regulators has warned consumers against the risky nature of cryptocurrencies, adding that they could lose all their money if they make crypto investments. Retail Consumers Could Lose Their Money in Crypto InvestmentsThe warning published on Thursday (March 17, 2022),...
Total
0
Share