Ethereum Improvement Proposals (EIPs) and ERC20 standard example code

Published 2 years ago

Ethereum Improvement Proposals (EIPs) is a suite of protocols, standards, and specifications maintained by the core developers as well as the community to help us build Decentralized Apps on top of Ethereum Blockchain. Ethereum Request for Comments (ERC) is an EIP introduced in 2015 focusing on standardization of the development of the smart contracts. ERCs are completely open source and anybody can contribute to the ecosystem through Github. Even though these are just proposals it is highly recommended to follow these standards when developing smart contracts and DApps. This will help to avoid a lot of security problems along with simple human mistakes which can lead to funds loss because remember once the application is deployed on the blockchain - it's immutable and it's impossible to change it.

Today we are going to talk about ERC20 standard which is used for the most current Initial Coin Offerings (ICOs) token generation. ICOs are the blockchain way of crowdfunding. The ERC20 standard allows smart contracts to act as actual cryptocurrencies like Bitcoin or Ethereum itself. Usually, such cryptocurrency is called a token or an ERC20 token. Like conventional cryptocurrencies, an ERC20 token can be stored on a public address. We can check the balance and transfer tokens through a blockchain wallet. Developers can build smart contracts in Solidity programming language on Ethereum blockchain.

In order for a smart contract to be ERC20 compliant, it should implement a set of methods like balanceOf, totalSupply, transfer, transferFrom, approve, and allowance and two events which are fired to inform the outside world that some event occurred like Transfer and Approval. I created a Github repository to showcase an example of the ERC20 token code: Please use the code carefully and do your own investigation before using this code directly into your project. In this repository, you can see two main files, the interface and the smart contract itself. The interface is optional, just to illustrate which methods are required for your smart contract to abide. The ERC20 smart contract itself is er20-token-implementation.sol. Check the source code of these files in the repository along with the comments to get an overview of how this kind of token is looking like.

The next step will be to figure out how to test and deploy our smart contract on the Ethereum network, find out the price of the deployment and other technical details, so stick with us and you will get the information.