ERC20 Tokens

Written by shaanray | Published 2017/12/17
Tech Story Tags: erc20 | ethereum | token | ico | smart-contracts

TLDRvia the TL;DR App

Popular ERC-20 tokens today.

Cryptocurrencies vs Tokens

Cryptocurrencies and tokens are related but separate concepts. The terms cryptocurrency and token should not be used interchangeably.

Cryptocurrencies are the latest, and thus far the most successful, form of digital money. They are digitized currencies, encrypted through cryptography. Copies of their ledgers exist in distributed form on decentralized blockchains around the world. Cryptocurrencies run on their own blockchains.

Tokens represent an asset or utility and exist on top of a blockchain. They are tradeable goods and can represent coins, loyalty points, in-game assets, and so on. They can even be redeemable for a service an issuer will provide at a later date. Tokens can be issued on blockchains like Ethereum and Waves. The most widely used token standard is Ethereum’s ERC20. Ethereum also recently proposed two other standards: ERC223 and ERC721.

ERC-20 is a technical standard issued by Ethereum.

ERC20 Tokens

In 2015, Ethereum issued technical specifications for tokens on the Ethereum blockchain. Tokens that conform to these specifications are known as ERC20 tokens. (ERC stands for Ethereum Request for Comments.)

In essence, ERC20 tokens are smart contracts that run on the Ethereum blockchain. While ERC20 tokens function within the framework set by the Ethereum team, the framework is broad enough to simultaneously allow developers considerable flexibility in the design and function of the tokens. Most tokens created through ICOs on Ethereum are ERC20 compliant.

The ERC20 standard has 6 functions and 2 events. The standard was created to enable interoperability across applications, exchanges, and interfaces. The functions describe how tokens can be transferred and how token-related data can be accessed. The events lay out formatting guidelines for transfers and approvals. Smart contracts on Ethereum, including all ERC20 contracts, are written in Solidity.

My description of the 8 various components that make up the ERC-20 token smart contract. Each contract includes 6 functions and 2 events.

Tools and Testing

To better understand the ERC20 framework, and how it can be adapted to various uses and strategies, it is helpful to experiment on Testnets by creating and testing tokens with different attributes. A great place to start is Etherescan.io, which allows users to visually understand Ethereum’s blockchain and review various ERC20 tokens. Etherscan users can create their own tokens on one of three Testnets: Ropsten, Kovan, or Rinkeby.

In my experiments, I used Rinkeby to create an ERC20 token called Raycoin — take a look here.

The RayCoin ERC-20 Token I created in the Rinkeby Testnet.

Customization

ERC20 tokens can be customized to enable to following features:

1. Automatic buying and selling: you can peg the token’s value to that of another token or currency by creating a fund that automatically buys or sells tokens to maintain the balance.

2. Auto refill: transactions on the Ethereum blockchain require payments to miners in ‘gas’. You can program your token to auto-refill gas for future transactions once if it falls below a certain level.

3. Adding a central mint that can change the number of tokens in circulation: this could be useful if your token mirrors or simulates government currencies.

4. Freezing tokens: if instructed to do so by a regulatory body, you can freeze the tokens owned by that user and unfreeze them when required.

5. Proof of work: you can tie your token supply to the supply of Ether by programing a contract to run “merged mining” with Ethereum. A miner who finds a block in Ethereum then also gets a predetermined number of your tokens as a Block Reward.

The ERC223 and ERC721 Proposals

In some situations, ERC20 tokens can pose difficulties for users. For instance, someone who uses an ERC20 token to send 5 ETH to a contract that is not ERC20 compatible, the transaction will not be rejected because the contract will not recognize the incoming transaction. The ETH could therefore get stuck in limbo and essentially be lost by the user.

A new token standard (the proposed ERC223) solves this problem by rejecting a transaction if it is not ERC compatible.

Tokens conforming to another new token standard (the proposed ERC721) will be non-fungible: unique and not interchangeable during utility and exchange. (For example, a chocolate bar is non-fungible with a pizza, because their differing characteristics result in each of the them having different value.) An ERC721 token will have value due to its uniqueness and rare qualities (think limited edition baseball gloves autographed by Jordan).

Upshot

Ethereum released ERC20 token guidelines in the wake of increased interest in Initial Coin Offerings. The primary benefit of an ERC20 token is interoperability with other compliant tokens and decentralized applications on Ethereum. ERC20 tokens can also be traded on all platforms that support Ethereum standards. Some popular ERC20 tokens are Augur, Bancor Network, Civic, Gnosis, and Golem. Given that the majority of ICOs on Ethereum have been ERC20 compliant, thought leaders and entrepreneurs in the blockchain space should seek to understand ERC20 and other Ethereum token standards.

Next: Find out what ERC-1190 Tokens are!


Written by shaanray | Emerging Tech Blog
Published by HackerNoon on 2017/12/17