August 7, 2018

Ethereum ERC-20 Standard Token Breakdown

Most of the major tokens based on Ethereum are ERC-20 compliant. If you plan to launch your own cryptocurrency based on this blockchain, it would probably be the best option to assure that you are compliant with this standard.

What is ERC-20?

It is a standard which describes how one interacts with your token – a set of default functions which are basically a language to communicate with your tokens.

Why do I need it in my ICO?

It is extremely important when you plan to get your cryptocurrency into the crypto exchange. If you have standardised interaction, adding your currency to one of them is very easy, and doesn’t require additional technical backup or reviews.

There are more Ethereum standards. For example, take a look at ERC-721 created for non-fungible tokens. You can read more on this topic in our recent post:
>> ERC-721 Ethereum Standard

ERC-20 example

Every Ethereum token based on the standard includes this code:

contract ERC20Interface {
   function totalSupply() public constant returns (uint);
   function balanceOf(address tokenOwner) public constant returns (uint balance);
   function allowance(address tokenOwner, address spender) public constant returns (uint remaining);
   function transfer(address to, uint tokens) public returns (bool success);
   function approve(address spender, uint tokens) public returns (bool success);
   function transferFrom(address from, address to, uint tokens) public returns (bool success);

   event Transfer(address indexed from, address indexed to, uint tokens);
   event Approval(address indexed tokenOwner, address indexed spender, uint tokens);

Token functions

Let’s take a look at the standardised set of functions. It includes:

  • totalSupply – returns the total amount of existing tokens
  • balanceOf – returns number of tokens stored by the defined address
  • transfer – adds a chosen number of tokens to a chosen address, and remove them from the account of the sender
  • transferFrom – sends a request to transfer a chosen amount of tokens from a chosen account
  • approve – authorizes the transfer of a defined amount or number of tokens from the account of the sender to the defined address
  • allowance – returns the number of tokens that the sender is still able to withdraw from the defined account

As we wrote in our epic post on how to launch an ICO, this is basically all you need to create a cryptocurrency that you can call your own, but…

Where do we go from here?

The story doesn’t end here. If you simply accept the standard code, add your new cryptocurrency name and deploy the Smart Contract, you end up with a template.

If it does not have unique functions, there’s no point in creating it. It’s just a pure interface.

After copy-pasting the standard code, the most interesting part starts – what do you do to make the token unique, utilize the blockchain features and put it to work on your business project?

August 7, 2018