What is the Ethereum Request for Comment?
ERC is not a technology or program, but an Ethereum General Request for Comments (RFC).
ERC provides developers with technical guidance for construction. Developers can submit new ERC standard proposals to the Ethereum community by submitting EIP (Ethereum Improvement Proposal).
Submissions include agreement specifications and contract standards. Once the EIP is approved by the Ethereum Committee and finalized, it will become a new ERC.
List of EIPs can be found at this link: https://github.com/ethereum/EIPs
The new ERC provides a set of standards that can be implemented for Ethereum developers. Developers can use these standards to build smart contracts.
The ERC20 is the standard specification used by most people in Ethereum. This specification can improve the interchangeability of ERC20-based Tokens and perform the same operation on Dapp.
ERC20 avoids the problems of users of the Ethereum community creating unique Tokens and functions, solving the problem of destroying smart contracts and hacking attacks when Token transfers.
The common function token (Utility Token) is also an application type based on ERC20.
ERC20 contains 6 functions, 2 events, and 3 token information functions. As long as it is written in the smart contract, it can be regarded as the Token based on ERC20.
totalSupply(): Total supply of Token.balanceOf(address _owner): The balance in the _owner address.Transfer(address _to, uint256 _value): Sends a token of _value to address_to, triggering the Transfer event.transferFrom(address _from, address _to, uint256 _value): Sends a pass from the address_from _value to address_to, triggering the Transfer event.Approve (address _spender, uint256 _value): Approve _spender to extract a certain amount of money.Allowance(address _owner, address _spender): Returns the amount that _spender extracted from _owner.
These functions will trigger the following events:
Transfer(address indexed _from, address indexed _to, uint256 _value): Triggered when the token is transferred.Approval(address indexed _owner, addressindexed _spender, uint256 _value): Triggered when the approve method is successfully called.
Token needs to set the following 3 kinds of information.
Name: Name of the issued Token.Symbol: The name of the Token is issued. For example, StarBitEx releases Token for SBT, and Symbol can query for https://etherscan.io/Decimals: Set how many digits this token can reach after the small digits. Generally, the set value is 18, which means that it can reach 18 digits after the decimal point.
ERC721 is a popular specification other than ERC20. The biggest difference between ERC721 and ERC20 is that, ERC721 defines non-interchangeable Tokens, which means that each token has an independent ID, so the independence of ERC721 can be used in the transaction of assets and tracking.
The most representative case is the casual game CryptoKittes, which runs on the Ethereum. Each cat represents an independent product. The card in a game which called Gods Unchained recently claimed to be a card auction to 146ETH, is also based on the ERP721 Dapp.
ERC721 is compatible with the following rules in the ERC20 (for detailed code, please refer to https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md)
name：name() constant returns (string name)symbol：symbol() constant returns (string symbol)totalSupply：totalSupply() constant returns (uint256 supply)balanceOf：(address _owner) external view returns (uint256)
And the following rules have been added:
constant returns (address owner)takeOwnership：takeOwnership(uint256 _tokenId)
In addition rewrite:
approve：approve(address _approved, uint256 _tokenId)transfer： transfer(address _to, uint256 _tokenId)
Even though the two most popular ERC20 and ERC721 specifications on the market still have their defects, such as the low threshold for ERC20 entry that make the excessive number of Tokens, there is no doubt about the entire encryption market have been activated with 2 aspect of “financial products” and “asset independence” .
The next article will introduce the ERC223/ERC621/ERC827 based on two specifications.
See you next time.