Creating ERC20 Token on Ethereum Network

Creating ERC20 Token on Ethereum Network

With the ICO craze, I have wondered the amount of effort required to launch my own ICO. This endeavor is for academic purposes only of course. It turns out creating a fully functional ERC20 token that can be sent around the network is pretty trivial. You can create your own within an hour and about 10 USD. Credit to the original author this post is based on. This walkthrough will highlight the import aspects of maxnachamkin tutorial and does not attempt to completely rewrite it.This is the start of a series where I will investigate the creation of assets on other networks, ie BitCoin and Ripple.

1. Contract Attributes

To create the token, we will be creating a smart contract that will be deployed to the ethereum network. The first step is to determine how you want your token to behave.

For first out, I am starting off with a simple token. The token will be completely premined with all tokens being sent to the contract creators address (me). No decimal points, so tokens must be transacted in whole units. The source for the smart contract that will achieve this is here.

AttributeValue
Contract NameGrimmjow8Token
Display NameGrimmjow8 Token
Total Supply10 million
Decimals0
Mined/Preminedpremined
SymbolGRIMM

FUTUREImplement a mineable token

2. Deploy to Testnet

The hard part is done. We now will test out the token on the test net before deploying to the main net. Below is a high level of the steps required to deploy to the test net:

  1. Download and create a wallet using MetaMask
  2. Fund your new test wallet utilizing the MetaMask faucet
  3. Compile and publish the token smart contract to the Ropsten test network using browser-solidity
  4. Confirm contract creation on https://ropsten.etherscan.io
  5. Add contract to MetaMask to display newly created tokens
  6. Import MetaMask wallet private key into a wallet that supports sending tokens, such as myetherwallet
  7. Transfer tokens between addresses

Download MetaMask

Download MetaMask. MetaMask is an online wallet that allows the creation and publication of tokens easily to the network.

  1. Make up a password to create your first address
  2. Make sure to change the network to the Ropsten Test net
  3. Document the public and private key for this first address

NOTE: The address generated is valid on both the test and main net. Be careful with your private key from the test net in the event you use the same address to generate the tokens on the main net.

Fund Wallet

After creating the wallet, we need to fund the wallet so that we can create the contract and send tokens.

With the test net selected, click ‘Buy’ to get some either. You should be presented with a link to the MetaMask faucet. From there, you can request to have some ether sent to your wallet.

Compile and Publish

With your wallet funded, we just need to compile and publish the contract to the blockchain.

  1. Load the Solidity Remix Compiler
  2. Copy and paste smart contract code into editor
  3. If you have not already, update the contract details near the bottom the contract file
  4. On the right panel, disable auto compile
  5. Click ‘Settings’ menu item, change compiler to ‘v0.4.18+commit.9cf6e910’, deselect ‘Enable Optimization’
  6. Click ‘Compile’ menu item, click compile. Hopefully, the contract compiles with no errors
  7. Click ‘Run’ menu item, populate the ‘At Address’ with your MetaMask wallet address and click ‘Create’
  8. When presented with a popup to confirm the transaction, click ‘Submit’

Now you just wait for the test net to verify the contract creation.

Confirm Contract Creation

Search for your MetaMask address within ropsten.etherscan.io. You should have a ‘Contract Creation’ transaction. Clicking the ‘To’ link will take you to the contract information page. From here you can upload and verify your contract source code with etherscan. If you want the full experience, you can create a website and get your token added to exchanges and the etherscan registry.

Test Sending Tokens

The final step is to try to send some of these tokens to another address.

  1. Create a second wallet within MetaMask
  2. Export the private key of your first address (current owner of all tokens)
  3. Open myetherwallet
  4. Import your private key
  5. Click ‘Send Ether & Tokens’ menu item
  6. On the right panel, click ‘Add Custom Token’ button and enter the contract address
  7. Available tokens to send should now be viewable. Enter an amount to send and change the type from Ether to your token type
  8. Click ‘Generate Transaction’ and ‘Send Transaction’

The transaction should be broadcast to the network. You should be able to see your tokens appear in your send address within the MetaMask wallet.

3. Deploy to Mainnet

The steps to deploy to the main network are exactly the same as deploying to the test net. The only differences are the following:

  1. Must change the network to Main within MetaMask
  2. Transactions and contracts must be view on the main explorer
  3. You will need to actual ether (ie through Coinbase)

For those interested, here is a link to the Grimmjow8Token created during this exercise.

4. Conclusion

The process for creating an ERC20 token was incredibly easy. Within about an hour, I had the token deployed to the main net for only about 10 USD. Next steps will be to look at creating more complex smart contracts (including a mineable one) and attempt to create assets on other networks.

NOTE: The actual cost of create a token on the mainnet is the transaction fee.

  • Marcus Scorebot

    Hi, Thanks for your great input. I have tried to use it to run on remix in Ropsten test network, and the token is created successfully.

    However, when i deploy it in real Main network, it takes more than half hour and no progress. (i have sufficient ETH & up the GWEI.

    Anything could go wrong?

    • ryan

      Does the transaction ever clear?

      • Marcus Scorebot

        Hi Ryan,

        After many attempts, it is finally created !

        Thanks !

        p/s: Are you familiar with ERC20 wallets, can one create own wallet ?

        • ryan

          I’ve used MEW and MetaMask for playing around with ERC20 tokens.

  • Omar Omar

    can create a token with few ether 10 usd

    • ryan

      That is correct. The cost to create the token on the mainnet was 0.02504112 ETH, which was just the transaction fee. At the time it was 10 USD, currently the cost is around 1 USD.

      Thanks for pointing that out!

  • Jimmy

    you can also create ERC-20 Token Without any coding skills in 4 min via MyWish platform
    https://mywish.io/eth-token

Comments are closed.