How to create your own token and start ICO in Ethereum network

How to create your own token and start ICO in Ethereum network

I wondering how many information on blockchain in the Internet you can find and how many of this information are really useless, especially when it is all about technical aspects. Will try to solve this problem in a series of articles and will start from this one. Pretty sure it’s a hot topic.

So, what I going to do is to provide step by step guide how to create your own token and start selling it on “Initial Coin Offering” event in the Ethereum Network. For this I deployed two different smart-contracts to test Ethereum Network – first one for creating a new token and second one for “ICO”. I used standard contracts from the official site and changed it a bit to cover my needs. So, how it works step by step.

 

Download an Ethereum wallet and sync with a network

First of all you need to install an Ethereum Wallet and synchronize it with network. To do it simply download the latest release of Ethereum Wallet for your platform, install it using installation wizard and start it on your computer. It will take some time to synchronize with network, so you can make some coffee and take your time for reading some interesting book, or watching film, or learning how to write smart-contracts using Solidity.

Create your token

When you synchronized with an Ethereum Network you can start using your wallet. Usually it’s looks like this:

 

Here you can see your accounts, balance and list of latest transactions. Also You can see buttons to send page, where you can easily transfer ethers in the network and between your accounts.

 

Also you can see information about network and button “Contracts” which leads to the page, where you can deploy new contracts or observe already created:

 

After you installed a wallet, I’m pretty sure you really want to start creating new tokens and start your own ICO. Fortunately for us we can use test networks or even our own local network for testing. To switch to your own local network you need to click on: Develop->Network->Solo Network. And then click start mining simulation by clicking on Develop->Start mining.

 

And now your own network is running and mining an Ethereum in your network. Note that this is not real network and all generated tokens and addresses are not public and can’t be used for transfers in the real Ethereum Network.

 

Creating tokens

Now, when you started local Ethereum Network and it’s works – mining ethers and generating new blocks, we can have some fun by creating a token. To create token you need to go to the contracts page in your wallet and click on button “Deploy New Contract”. You will se the page where you can write down the code of contract, set up it with params and deploy to the network:

 

To create your own token you need a smart-contract for that. As suggestion, you can take a simplest one from official site which will be enough for learning (I will use it for example) or use more advanced Zeppelin Solidity (there is a bunch of different examples of smart-contracts for different needs). So, just copy code from official site for creating token and past in the field “SOLIDITY CONTRACT SOURCE CODE”. It will be compiled and prepared for deployment. You need to pick a contract to deploy in the select box on right sidebar. In this example pick “Token ERC 20” in the list.

 

As you can see on screenshot you need to set some parameters:

 

  • Initial supply – amount of tokens you want to create
  • Token name
  • Token symbol – symbolic alias for your token (as example BTC, ETH, DASH, DAO etc.)

 

When you set values for needed params you can deploy your contract. Created tokens will be transferred to account yo pick in field “FROM” on contract creation page. For this example I created 3000000 tokens, with name “Dmytro Medvid Coin” and token symbol DMC. After contract deployed all newly created tokens was transferred to my account.

 

Crowdsale Contract

After you created your tokens, you can start an ICO (Initial Coin Offering) by creating a new contract. The process is similar for previous one – copy and past contract into the “SOLIDITY CONTRACT SOURCE CODE” field on new contract deployment page. Set params and deploy it. For example I also took a simples contract for ICO from official site. After you insert a code of contract you need to select which one to deploy – Crowdsale contract in this case.

 

As you can see here a little bit more fields to fill:

 

  • If successful send to – beneficiary account, where funds will be transferred after successful ICO
  • Funding goal in ethers – the funding goal, an amount of ETH coins you need to collect
  • Duration in minutes – duration of ICO, currently in minutes (1440 minutes for 24 hours ICO period)
  • Finney cost of each token – the price per token. I changed original smart-contract to use finneys instead of entire ETH coin for more flexibility.
  • Address of token used as reward – address of smart contract, which we used for creating the token

 

After you set all those params – deploy the contract. As deployment finished you need to transfer some of created coins (or all of it) to the ICO contract. After you did it, users can send ETH coins to that contract and get your coins as reward by price you set in contract.

 

After ICO finished you can have two scenarios:

 

  1. You reached an ICO your goal: if so, you need to go on the Crowdsale contract page and execute “safeWithdraw” function from contract using beneficiary account (which you set in contract settings) for that. After function will be executed – raised funds will be transferred to your account.
  2. You don’t reached an ICO goal: in this case you won’t be able to take raised funds from contract, but all of investors can execute “safeWithdraw” function to get their investments back.

 

That is all. Just this simple. Of course it goes a bit complicated if you have specific needs, but using Solidity and smart contracts, you probably could cover any scenario. Have a nice day and stay tuned for new articles.

 

If you have any questions, you can contact us using the form.

 

Also you can subscribe for a news using the form below: