How to create your own Ethereum ERC20 token

From CoinWiki
Revision as of 18:00, 23 March 2019 by QuintonP (talk | contribs)
Jump to: navigation, search

An ERC20 token is a protocol for proposing improvements to the Ethereum (ETH) network. The token can have value as well as be sent and received just like any other cryptocurrency.

The first step to creating a ERC20 token is to decide what you want the token to be. You'll need to choose the following:

  • A name for your token
  • Your token's symbol (generally 3-4 characters long)
  • The number of tokens you will have in circulation
  • How many decimal places your token will have (Most tokens have 18 decimal places but you can have any number you like)

For my token KiwiCoin, I chose: - KiwiCoin - KIWI - 180000000 - ​18

  • The next step is to code your ERC20 contract. You can copy this contract code below courtesy of TokenFactory and paste it into your favorite code editor. I use Atom.

  • You'll need to change the values in lines 119-123 to that of your tokens as seen here.
Erc20-function.png
  • Things to keep in mind. There is a correlation between the decimals you set and your tokens supply. For example, if you want 1,000 tokens and you have your decimal set at 5, you will need to set the total supply to be 100000000 (5 zeros added to the amount).
  • The next step is to test your token on the test net. If don't have it already, you will need to download MetaMask]. Log in and set up MetaMask so that you are in the Ropsten Test Network as shown.
Erc20-meta1.png
  • Next head over to Remix Solidity IDE]. It is where we will be publishing our Smart Contract to the blockchain. Copy and paste your code into Remix and you should see something like this.
Erc20-remix.png
  • Click on the 'Run' tab and hit 'Deploy' under 'ERC20Token'. A MetaMask tab will pop up and you will have to hit 'Submit' to pay for the transaction. Remember since you are using test Ether so it won't cost you any real money.
Erc20-remix-run.png
  • If you go into MetaMask under the sent tab and press your 'Contract Deployment' you will be brought to a page that looks like this that displays your transaction information.
Erc20-remix-success.png
  • To add your token to MetaMask, copy your contract code and go into MetaMask and click on the 'Add Token' button and paste in your contract address. Your token symbol and decimals of precision should appear automatically. Press the 'add' button and your token will be added to your list of tokens.
Erc20-metamask-add.png