Understanding ERC-20 Tokens
Ethereum is one of the most popular blockchains around, second only to Bitcoin. Bitcoin may get the hype, but Ethereum enables you to deploy your own token for free on the Ethereum blockchain. This is called an ERC-20 token. What is an ERC-20 token, why is it called an ERC-20 token, why is it so cool? All of your questions are about to be answered.
Note: I’m assuming that you have a basic understanding of blockchain technology. If not, I recommend my previous article, Blockchain and The Impact On Our Future. However, most of what you need to know about ERC-20 tokens is explained here.
What is Ethereum?
Ethereum is a blockchain that is unique among its kind. This is due to the fact that Ethereum does not only have a cryptocurrency, Ether, but it also allows you to deploy smart contracts on to the Ethereum blockchain. A smart contract is coded in Solidity (the Ethereum programming language), and can be used to transfer any form of data, from Ether to pictures to just a token worth absolutely nothing.
An ERC-20 token is just a token coded in Solidity that is deployed on the Ethereum blockchain as a smart contract. Anyone can create an ERC-20 token as long as they have a device. However, ERC-20 tokens have a specific set of functions that they must include in order to actually be considered ERC-20 tokens, and not just tokens.
ERC-20 tokens are coded with specific guidelines in mind. These guidelines were created by the Ethereum community, and require the token to have six functions to be considered ERC-20. These requirements were created because people were deploying tokens on to the Ethereum blockchain, but function names and what they actually did differed with each token. This caused a lot of problems when transferring tokens and adding them to wallets. As such, the community created these guidelines to help new and old coders create understandable code.
The required functions:
- transfer — Transfers a specified amount of the token from the current account to a specified account.
- transferFrom — Transfers a specified amount of the token from a specified account to another specified account(this is used on behalf of another person).
- totalSupply — Checks the total amount of the token currently in existence, across all accounts.
- balanceOf — checks how much of the token an account has
- approve — Checks a transaction against the total supply, makes sure there are no missing or extra tokens.
- allowance — Before a transaction takes place, allowance makes sure the account has the number of tokens required for the transaction.
Now, there is a universal standard for ERC-20 tokens, and they can be automatically transferred to wallets or exchanged without any extra hassle to accommodate for different code. This is one of the reasons why Ethereum has become the most popular platform for ICOs(although the SEC might have a different opinion).
MonkeyCoin
I have built my own ERC-20 token, which I called MonkeyCoin. Here is a video explaining
ERC-20 tokens are one of the most useful things you can build on the Ethereum blockchain. They are also a great way to start coding in Solidity and deploying contracts on the Ethereum blockchain. ERC-20 tokens are extremely versatile, and they will hopefully continue to enable secure data transfers. (Until the SEC gets to them.)
If you enjoyed this article: