- ERC-20 provides standards for smart contracts to interact with each other on Ethereum blockchain.
- A standardized set of smart contract functions and events were developed by Ethereum team.
- Most of the tokens on the Ethereum blockchain have implemented ERC20-Standard.
- Ethereum smart contracts involving tokens must implement these functions and events in order to be ERC20-compliant.
- Basic token transaction features like transferring tokens between accounts, checking balances, approvals and allowances are addressed in ERC-20 Standard.
- ERC20-compliant Smart contracts on Ethereum blockchain can interact with each other via these standards and expect to work consistently.
- ERC-223 is being developed to improve further smart contract interactions.
What is ERC-20?
ERC-20 is a set of function and event definitions/interfaces developed by the Ethereum team. These standards will provide a framework for seamless interoperability between the contracts with tokens on Ethereum blockchain. In order to be ERC-20 compliant, these standards must be implemented by token smart contracts. Majority of the tokens on Ethereum blockchain are ERC-20 compliant already.
Tokens are basically a predefined integer number assigned to a variable in a smart contract. This data along with other contract data exists on the ethereum blockchain and is managed by a set of functions implemented in the smart contract. Ethereum team created a setup of predefined function and event declarations to manage this token variable number on the contract. Contract creator can just inherit from this contract and implement predefined functions in their code and expect it to conform to ERC-20 Standards. This code can be reused over and over again without reinventing the wheel on basic token transactions and balance checks.
Developers building smart contracts can implement these functions and expect others do the same as part of this standard. Code reusability for routine tasks will improve development workflow significantly for the better.
Ethereum token contracts can implement these functions to:
- transfer tokens to other addresses on the blockchain.
- check balances on the contracts.
- Allowance’s for spending tokens.
- Event notifications for transfers and approvals.
Further details can be found here. In a nutshell, below listed 6 functions and 2 events are all there is to it. As you can see, the input and output parameters are obvious to understand. Functions names are very well defined and self-explanatory.
Code Standards from Ethereum Team:
ERC-223 is being developed to address certain issues related to contract token loss and to further enhance these standards.