Understanding ERC20 & ERC223 Tokens(Learn 'Solidity' - Part 8)

in #ethereum6 years ago (edited)

ERC20 Tokens exist on the Ethereum blockchain. Ethereum consists of a blockchain which can store transactions and EVM(Ethereum Virtual Machine) that can run Smart Contracts. Tokens exist on the Ethereum blockchain. The native currency of Ethereum is 'Ether'. Besides Ether, the Ethereum blockchain can also support other tokens.

 
 

How Do Tokens Come Into Existence?

A token can be created by a Smart Contract. A Smart Contract not only brings the token into existence but also manages its transactions and keeps track of the balance.

 
 

To get some tokens, you have to send some 'Ethers' to the Smart Contracts and you get a certain amount of tokens in return. To create your own tokens, you can write a smart contract that can create tokens, transfer them and keep track of the balances of the token holders. It is important to note that, once you deploy a Smart Contract, you cannot change it anymore.

 

Security is a major concern while creating Smart Contracts and your own tokens. If there is a bug inside the Smart Contract code, it can make the token holders lose the tokens and your tokens will lose their value instantly.

 

On the Ethereum Blockchain, each Smart Contract can be entirely different from the other. It is impossible for an exchange to write custom codes for thousands of different types of tokens on the Ethereum blockchain. To solve these issues, ERC20 token exists for the standardization of different types of tokens.

 
 

ERC20

ERC stands for Ethereum Requests For Comments. ERC20 is a guideline or standard following which you can create your own token. ERC20 defines 6 mandatory functions that need to be implemented by your Smart Contract and three optional ones.

 

Optional Functions

  • Name
  • Symbol
  • Decimals

 
 

Mandatory Functions

  • Total supply
  • Keep track of balances.
  • Transfer of tokens from the total supply to a user.
  • Transfer of tokens from a user to another
  • 'Approve' method that verifies that your account can give a certain amount of tokens to a user.
  • 'Allowance' method checks that you have a certain amount of balance to give tokens to someone else.

 
 

Due to the standardization of the ERC20 tokens, an Ether wallet supports all kinds of tokens on the Ethereum blockchain.

 
 

ERC 223 Tokens

As you know, you need to send Ether to buy the ERC20 tokens of a Smart Contract. However, if you send ERC20 tokens of a Smart Contract to buy the ERC20 tokens of another Smart Contract and the contract has not been designed in such a way, you end up losing your tokens.

 

ERC223 standard solves this problem.

 
 

ERC223 standard is also eco-friendly as compared to ERC20 as the transfer of ERC223 tokens is a one-step process instead of two like the ERC20 tokens. It leads to energy savings and prevents the blockchain bloating.

 
 

 
 


 

Previous Posts

 

Introduction To 'Solidity'(Learn 'Solidity' - Part 1)

 

Ethereum & Smart Contracts(Learn 'Solidity' - Part 2)

 

Tips To Learn 'Solidity' On Your Own(Learn 'Solidity - Part 3)

 

Basic Smart Contract(Learn 'Solidity' - Part 4)

 

Smart Contract VsnDApp(Learn 'Solidity' - Part 5)

 

Variables In 'Solidity'(Learn 'Solidity' - Part 6)

 

Visibility & Structs In 'Solidity'(Learn 'Solidity' - Part 7)


 

Upcoming Posts

 

Installing testRPC/ganache-cli(Learn 'Solidity' - Part 9)