Join leaders from MIT and Vizio for a Remote IoT Development Virtual Summit.

Subscribe to our blog to get the latest articles straight to your inbox.

There are three main things needed when authoring an ICO smart contract. First is your ERC20 token; the cryptocurrency that will be distributed to purchasers that represent their contribution. Second is your ICO or crowdsale smart contract, which will be responsible for calculating the token distribution based on the amount of ETH it receives. The third is the actual deployment of these smart contracts onto the Ethereum network.

The Tools We Use

We build smart contracts using a new programming language called Solidity. This code is then compiled into Ethereum bytecode, which is then used to run on the Ethereum Virtual Machine.

To help facilitate development, we use Truffle, Ganache, and OpenZeppelin. Be warned that these tools are still in their infancy and are quite rough. They require a lot of technical competency to work with. At a high level, Truffle will help you organize and test your code, Ganache will help you run a local Ethereum network on your machine, and OpenZeppelin will give you great templates to base your contracts off of.

Building an ERC20 Token


An ERC20 token is, at its core, just another smart contract that follows a community standard. Out of the box, ERC20 tokens can be transferred from person to person and can be listed on cryptocurrency exchanges for sale (after you apply).

Once your basic ERC20 token is completed, you can begin to add additional features like making them:

  • Mintable (new tokens can be created can be created on the fly, usually by the owner)
  • Burnable (reducing the total supply)
  • Pausable (allowing you to keep the tokens from being traded or transferred)

These additional features will be driven by your business needs in addition to how you want your ICO to function.

How Do ICO Smart Contracts Work?

A basic ICO contract can be found in OpenZeppelin here. These smart contracts have a fairly high complexity, so I will try to give a simple overview. The contract allows people to send ETH directly to the ICO contract’s address, then after determining the purchase is valid, it transfers an amount of ERC20 tokens that you specify. People commonly add the ability to provide refunds, set a limit to the number of tokens allowed to be sold, and allowing the owner to finalize and end the sale.

Once these contracts are built and tested, the final step is to deploy them onto a network. You can use the main network or one of the test networks like Rinkeby. The general steps required are:

  • Connect to a network from your local machine using an application like geth.
  • Create an account on the Ethereum network.
  • Add Ether to your account.
  • Unlock your account to allow Truffle to deploy your contracts.
  • Deploy your contracts using “truffle migrate”

There are a plethora of nuances involved in this deployment that aren’t detailed here as well as steps to be taken after to watch and manage your contracts. Be sure to fully consider the implications before launching an ICO, such as the growing costs of deployment and KYC/AML considerations.