Create your own ERC20 Blockchain Token
Last year ICOs were overhyped, but this year ICOs have started becoming more mature with clear regulatory frameworks & venture capital interest.
In the first five months of 2018, over 500 new coins or tokens were launched raising more than $13 billion, which means on an average 100 ICOs are launched every month raising an average of $2.6 million.
So what exactly is happening in the ICO market? Why are investors so keen on new cryptocurrencies? Well, the reality is, ICOs have in part replaced the way many startups are being funded by investors. With built-in safeguards such as smart contracts & proof of work, it has become easier for investors to work with startups & release payments in tranches based on certain milestones achieved by the startup.
I will share a story of one of our clients who has successfully raised investments through an ICO from venture investors shortly. But for today, we are going to learn how to create your very own ERC20 Blockchain Token & How you can launch it on the Ropsten Ethereum Network so that you don’t have to spend real ether in the process.
Step 1:- Create your Ethereum Address
To get started, go to https://www.myetherwallet.com/. It is a popular, open-source, client-side interface to interact with the ethereum blockchain.
Once on the website, click on the top right-hand side corner to change the network to ROPSTEN (MyEtherWallet). Make sure you are on the Ropsten Network.
To create the new wallet, enter a password of your choice, continue and download your keystore file and your private key.
Here I am saving it in a text file. We will be using it to open and access our wallet.
You can then enter into your account using your private key. Once you open your wallet you can see we do not have any Ether in our wallet right now. Save your wallet address in a text file as we would be needing it later.
Let’s get some ropsten ether which we would be needing to deploy the contract.
Step 2:- Get Ropsten Ether
Goto the link https://faucet.ropsten.be. Here we can get some ethers by entering our wallet address.
Once on the site, copy your wallet address and paste it here and click on send me 1 ether.
After a few minutes, go back to myetherwallet =>View wallet info, and enter your wallet using your private key. As you can see we have successfully received the ropsten ether and we can proceed towards the next step.
Step 3:- Editing the contract code
We do not have to program the contract from scratch as we can download the code from https://pastebin.com/WdheKmJn. Now select the entire code, copy and paste it in your favorite text editor. I am using sublime text editor here.
If you scroll to the top, you can see in the comment section that there are few predefined variables like a name of the token, symbol, total supply and decimals.
Let’s start by changing the name of the token. You can choose any name as you like but make sure there are no spaces. I am going to choose My new Token here.
Keep the symbol short. I am choosing it as MNT.
Now let’s scroll down to make changes in the actual code. On line 102, we have to change the token name to what we choose earlier. So My new token.
On line 116, we will change the symbol name to the one you did in the comment section.
We are keeping the total supply of tokens as 100 tokens. Decimals represent the number of parts a token can be broken down into. The standard length is 18. We are using 0 here.
Now we are going to define the address through which the contract is going to be deployed.
Let’s copy our ethereum address from the text file and paste it in line 120 and line 121 and also in line 6. In this way, we are making sure that we are the owners of the tokens and we receive them after the contract is deployed.
We are done editing the contract. Now let’s go to the next step.
Step 4:- Compiling the code
Copy the edited code and head over to https://remix.ethereum.org. A remix is a web browser based IDE and we would be compiling our smart contract here.
Paste the code and click on start to compile.
Then under compile. select the name of your token, so in this case MynewToken and Click on Details.
We would be needing the bytecode to deploy the smart contract. Scroll down and you can see the bytecode section. Click on copy to clipboard and let’s head over to myetherwallet for the next step.
Step 5:- Deploying the contract
Head over to myetherwallet, click on the contracts section, select Deploy contract, and paste the bytecode that we had copied.
Now we are going to make some changes here. We only want to keep the object from the bytecode, so scroll over to the top, remove the initial code, and add 0x.
Scroll down to where the object ends, select all the code under it, and delete it.
Once you delete you can see the gas limit is automatically updated. Now scroll down
Enter your private key and Sign Transaction →Deploy Contract.
That’s it! Our contract has been successfully deployed. Now let’s check the transaction status.
On Myetherwallet, click on View wallet Info, Enter your wallet using your private key, and Click on the link under Transaction history.
If you do not see the transaction here, just hit refresh. As you can see our contract transaction has been created. Save the contract address in a text file.
Step 6:- Register the contract
This is going to be important for various reasons, mainly verifying the validity of your token to the public. Under Code, Click on Verify and Publish.
Enter the Contract Name which we used in the code. You can refer to line 8 here.
For the version of compiler, go to the remix page and look at the URL. Match the compiler version from the URL to the version in the list.
Select optimization as “No”. Copy the solidity code from the text editor and paste it here. Scroll down and click Verify and Publish. This may take a few moments.
Now the last step is adding the new token to you wallet. Head over to your wallet, In token balances, click on add custom token, Enter your token contract address, you can copy it from your text file in which you saved the address earlier.
Enter the symbol, decimals, click on save. Our new token has been added to our wallet.
That’s it! Now you have your own token. You can send the newly created token to any of your friends using their ropsten wallet address.