Initial Coin Offerings (ICOs) have become extremely popular ways to raise funds while avoiding the regulatory restrictions of fiat financing. In 2017, ICOs raised around $6.5 billion. And as of March 2018, they’d already raised $2 billion this year.
The majority of ICOs are based on Ethereum as a platform, and more specifically on Ethereum’s smart contracts. Shares in ICO projects are usually sold for ETH or BTC, and awarded in the form of tokens (also known as ERC-20 tokens).
So while we’re used to seeing and dealing with ERC-20 tokens, few people know exactly what they are, how they work, or even what ERC-20 means. (In case you’re wondering, ERC stands for Ethereum Request Comment, and 20 is the arbitrary number assigned to the proposal.)
The ERC-20 Basics
As the name implies, the native currency of Ethereum blockchain is ether (ETH). But ERC-20 tokens also act as coins on Ethereum. Ethereum is the heart and mind of ERC-20 tokens. Its blockchain processes their transactions, and its virtual machine runs their smart contracts.
Ethereum.org’s depiction of an ICO or “trustless” crowdsale:
1) Customers pay the smart contract (the robot in the center).
2) The robot forwards the money to the contract owner.
3) The robot returns the owner’s ICO tokens to the customers. Neat!
Remember that these tokens aren’t independent. They reside on Ethereum’s blockchain, and depend on its distributed computing abilities.
Smart Contract Risks
While smart contracts are very efficient, they do come with risks. For instance, a smart contract can’t be changed once it’s initiated by the ICO’s developers. If a smart contract contains bugs or vulnerabilities, you could easily lose your funding, tokens, or both.
Such misdeeds have frequently occurred throughout Ethereum’s history. The most notable example was the $55 million DAO hack, and correcting it required a hard fork of the Ethereum network (which is how Ethereum Classis was created).
Why the Need for the ERC-20 Standard?
Before the ERC-20 standard came about, there were many compatibility issues among the various forms of Ethereum tokens. Each token had a completely unique smart contract. In other words, it had to write completely new code for each exchange or wallet, in order to host a new token. And supporting the increasing array of tokens was becoming excessively problematic and time-consuming.
As a solution, the industry came up with a standard protocol for all tokens to follow, which is now known as ERC-20.
The ERC-20 Token Standard has six obligatory parameters for any smart contract, plus three optional (but recommended!) ones. Optionally, you can set the maximum number of decimals that a token supports. To compare, Bitcoin allows for eight numerals after the decimal point, as well as its symbol (usually a 3- or 4-digit code) and its name. (So choose something inspiring!)
The six compulsory functions deal with the number and transfer of tokens. The first two are used to allocate the initial state of token distribution:
- The totalSupply function of the token must be set. After the maximum is reached, no more tokens may be created by the smart contract.
- The balance0f function assigns an initial number of tokens to any given address, usually the owners of the ICO.
Two transfer methods are also needed for additionally distributing to users and sending tokens between users. They’re vital for secondary market functions:
- The transfer function moves tokens from the total supply to any individual user who purchases during the ICO phase.
- The transferFrom function is used to send tokens from one person to another.
Two further functions are required to verify functions 3 and 4:
- The approve function checks that a smart contract can distribute tokens, based on the remaining supply.
- Lastly, the allowance function makes sure that an address has enough of a balance to send tokens to another address.
These 6 simple steps have allowed wallet providers and exchanges to create a single codebase, which can interact with any ERC-20 smart contract.
ERC-20 Token Applications
ERC-20 tokens have many uses. For example, they can act as project shares, asset-ownership certificates, loyalty points, or even just pure cryptocurrencies. It’s also possible for ERC-20 tokens to simultaneously fulfill several of these roles.
ERC-20 Token Creation
All tokens are created by smart contracts. These smart contracts handle the token’s transactions, and account for the balance of every token holder. For example, CoinLaunch’s CoinCreator page lets you easily create your own ERC-20 tokens!
While an ICO is active, you should receive the ICO’s tokens back at the agreed-upon exchange rate, if you send crypto funds and your details (most importantly, your mailing address) to its smart contract.
Problems with ERC-20 Tokens
The ERC-20 protocol alone isn’t always sufficient for a token’s purposes. It’s only a standard for creating Ethereum-based tokens, and it doesn’t ensure useful, valuable, or even functional tokens.
A token may still be further customized, as long as it meets the ERC-20 basics. One downside of the ERC-20 standard is that it makes deploying a token trivial on a technical level. As a result, many teams who would have been otherwise incapable of releasing an ICO have been able to. The sheer number of deployed tokens (47,454 and counting!) leads to an abundance of very similar tokens, which makes the selection process harder and more confusing for prospective investors.
Another problem is that some projects implement the guidelines in an idiosyncratic way, which creates more confusion about the way their tokens operate. For example, tokens are sometimes sent to the smart contracts of other ICOs. If that contract hasn’t allowed for this eventuality, then the tokens will be lost. By the end of 2017, over $3 million was lost this way! The ERC-223 proposal seeks to counter this flaw.
The creation of the ERC-20 Token Standard has accelerated growth across the entire ICO space by standardizing functions that make it easier for projects to develop tokens. The protocol has also brought an enhanced synergy among ICO projects, exchanges, and wallet providers. As a response to common problems and vulnerabilities in ICO tokens, the ERC-20 protocol will probably be enhanced and extended in the future.