Ethereum 101 - Part V - Tokenization
Part V - Tokenization
In the most condensed explanation, tokens are digital assets. Perhaps the most significant aspect of tokens is that they are both globally interoperable across the Ethereum network and easy for new developers to create.
Tokens described within this section refer to digital assets that use Ethereum as its ledger. To provide a few examples, a token could be a governance stake in an emerging technology protocol, a parcel of property or land, or even a non-fungible Cryptokitty token.
The popularity of tokens prompted the development and introduction of token standards that contracts and developers could rely on. ERC20 is the current standard, and it introduces a set of rules that offer a good bit of flexibility to developers, as long as they remain within those rules. Although ERC20 is currently seen as the de facto token standard, there are additional standards to consider: ERC223, ERC721.
The ERC20 Token Standard
There is a set of six functions present in most ERC20 standard tokens: totalSupply(), balanceOf(), allowance(), transfer(), approve(), and transferFrom(). The motivation behind the ERC20 was to create a standard interface that could be reused by other applications (e.g. wallets to exchanges, exchanges to wallets, and so forth). Reference to documentation: https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md
The ERC223 Token Standard
The ERC223 standard modifies three primary characteristics of ERC20 tokens: it eliminates issues surrounding lost tokens when ERC20 tokens are mistakenly sent to a wallet instead of the token contract, it allows developers to accept and reject incoming token transactions, and it introduces energy savings through decreased gas costs. ERC223 tokens are backwards compatible with ERC20 tokens. Reference to documentation: https://github.com/ethereum/EIPs/issues/223
The ERC721 Standard
UPDATE: A circa August 2018 Non-Fungible Token Tutorial Series is available on Kauri: https://beta.kauri.io/collection/5b8fe388e727370001c942e4/non-fungible-token-tutorial-series
Lastly, the ERC721 standard introduces non-fungible tokens on top of the ERC20 and ERC223 tokens. Cryptokitties is a good example of non-fungible tokens. Cryptokitties have wide ranging values that are derived solely based off of public opinion. Reference to documentation: https://github.com/ethereum/eips/issues/721
Sending and Receiving Tokens
Users should be cognizant when sending tokens. When sending tokens you are interacting directly with the Token’s smart contract. MetaMask and MyEtherWallet offer the functionality to and safety to ensure you transfer your tokens correctly from address to address. Please reference: https://support.metamask.io/kb/article/19-sending-tokens-with-metamask-and-myetherwallet
Make Your Own Token
The ERC20 smart contract is publicly available. The code can be modified to fit your token requirements, and can be deployed rapidly using Truffle. Courtesy of Token Factory, you can find the source code containing only the standard functions for the ERC20 token at: https://github.com/ConsenSys/Token-Factory/blob/master/contracts/StandardToken.sol
The smart contract code is self explanatory, as the code you need to change is pointed out for all to see. Developers simply need to remain cognizant of their token supply. Using our newfound knowledge of Truffle, we can quickly compile and deploy this token contract to a ganache instance.
Perhaps you don’t want to make your own token. Instead you want to take ownership of some of the tokens of your favorite protocols or projects.
Ethereum-based tokens are available on both decentralized (Etherdelta, IDEX, AirSwap, Radar Relay) and centralized (Binance, Kraken, Liqui) exchanges.
Decentralized exchanges operate closest to the Ethereum protocol, as they are often peer-to-peer or contain at minimum a partially-decentralized backend. Decentralized exchanges typically allow their users to trade through their browser, using MetaMask to approve and reject transactions.
Centralized exchanges tend to maintain the client / centralized server relationship, without much of a decentralized backend. Tokens are held centrally by the exchange, and withdrawal fees are enacted to entice users to keep their tokens on the exchange.
Additional reading: https://www.ethereum.org/token “ERC standards to move Ethereum forward? ERC-20, ERC-223, ERC-721,” https://medium.com/wepower/erc-standards-to-move-ethereum-forward-erc-20-erc-223-erc-721-e1712456449d