Create Your Own Crypto Token!

Create Your Own Crypto Token!

Learn how to create your own erc-20 token step-by-step on Polygon Mainnet!

What are crypto tokens?

The term crypto token refers to a special virtual currency token or how cryptocurrencies are denominated. These tokens represent fungible and tradable assets or utilities that reside on their own blockchains. Crypto tokens are often used to fundraise for crowd sales, but they can also serve as a substitute for other things. These tokens are usually created, distributed, sold, and circulated through the standard initial coin offering (ICO) process, which involves a crowdfunding exercise to fund project development.

Why Polygon blockchain?

Polygon combines the best of Ethereum and sovereign blockchains into a full-fledged multi-chain system.

Polygon solves pain points associated with Blockchains, like high gas fees and slow speeds, without sacrificing on security. This multi-chain system is akin to other ones such as Polkadot, Cosmos, Avalanche etc, but with at least three major upsides:

  • It is able to fully benefit from Ethereum’s network effects

  • It is inherently more secure

  • It is more open and powerful

Configuring Metamask to Polygon Mainnet

Open your Metamask wallet and click on ‘Ethereum Mainnet’ as shown below (Ethereum mainnet is configured on Metamask by default, so if you are using different chain, just click on your network)

Next, click on ‘Add Network’ button

IMPORTANT! Input very carefully this data!

Network Name: Polygon Mainnet

Network RPC URL: https://polygon-rpc.com

Chain ID: 137

Currency Symbol (Optional): MATIC

Block Explorer URL (Optional): https://polygonscan.com/

When you input all the date given above, just click on the ‘Save’ button to continue. Your Metamask wallet is now configured to the Polygon Mainnet. To start using the mainnet you will need some MATIC tokens for gas. You can bridge them from Ethereum, Arbitrum and Optimism, or you can simply top-up your wallet via centralized exchanges.

Deploying our smart contract

Go to https://remix.ethereum.org, and click on the ‘Create New File’ button as shown below

Name your file as you wish (in this example we are going to name our project test.sol)

Now you need to copy-paste the contract given below

ERC-20 Token Smart Contract:

pragma solidity ^0.8.0;

import “https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/ERC20.sol";

contract TokenName is ERC20 { constructor(uint256 initialSupply) public ERC20 (“TokenName”, “TokenSymbol”){ _mint(msg.sender,initialSupply); } }

Paste it at the file that you just created. Screen should look like this:

Now we need to edit some things in the contract before it is ready for deployment.

  • Line 3 - ‘TokenName’ - here we need to name our token

  • Line 4 - ‘TokenName’ - here we need to name our token (again)

  • Line 4 - ‘TokenSymbol’ - here we need to set symbol for our token (for example, if we make token that is called ‘Test’, our symbol will be ‘TST’)

When you are ready with this step, your smart contract should be looking like that:

Now on the left click on the ‘Solidity Compiler’ button

Now select ‘0.8.1+commit.df193b15’ compiler version as shown below

Now, click on ‘Compile .sol’ (it is usually processed within seconds)

Go to ‘Deploy and run transactions’ section

Select ‘Injected Web3’ (You need your wallet connected with https://remix.ethereum.org)

Now we need to set our token’s initial supply. IMPORTANT! After you type the initial supply amount, input 18 zeroes after that! If you want your token to have 10 million initial supply:

Initial Supply is 10,000,000 -> 10000000000000000000000000

When you type in the intitial supply of your token, just click on the ‘Deploy’ button, then confirm the Metamask transaction. That’s it! You have just learned how to create your own ERC-20 token on Polygon Mainnet!

Where to find my token?

When the transaction is confirmed, visit the ‘Activity’ section in your Metamask wallet and click on the last transaction which should be named “Contract Deployment”

Next, click on ‘Transaction Confirmed’ as shown

You will be redirected to https://polygonscan.com (the official Polygon blockchain tracker) The you have been redirected to, should look like this:

Click on the token that you have just created

Here it is! Your token is live on the blockchain! Congratulations!