What is a token in the Ethereum Ecosystem?
In Ethereum, tokens are simply digital assets that are being built on top of the network. They benefit from Ethereum’s existing infrastructure instead of developers having to build an entirely new blockchain. They are usually digital abstractions of fungible coins, that can be used for exchanging and payments. There are a lot of types of tokens, from stable coins like USDT and USDC, covering NFTs and coins with volatility.
The ERC20 standard
Check this post if you don’t understand what are ERCs and EIPs in the Ethereum Ecosystem.
ERC-20 is one of the most widely-used standards for smart contracts on the Ethereum platform. The fact that nearly all Ethereum tokens are issued to the same standard brings vast benefits for users of the Ethereum ecosystem. It means that ERC-20 tokens are interoperable with one another and with any ERC-20 supported contract, exchange, marketplace, or wallet.
If you have previous experience with Object-Oriented Programming, you can think of ERC20 as an interface. The standard is just a collection of methods that a token contract in Solidity should implement.
What are the Methods of the ERC-20 Token Standard Interface?
The ERC-20 token standard is relatively straightforward, comprising nine rules for issuing tokens. Six of them are mandatory and must be applied in all instances. Three are optional, although at least two of these are generally used.
Optional Rules
The three optional rules are:
- name: Despite being optional, this is almost always used as token owners want users to be able to identify their tokens.
- symbol: Again, almost always used as exchanges list token pairs using tickers.
- decimal: Each ERC-20 token can be denominated in fractional units of up to one-eighteenth.
Mandatory Rules
Mandatory rules are categorized as either functions or events. The first two functions don’t modify the state of the contract. They define some core features of the token, and if queried, will return already-defined information.
- totalSupply: the total number of the tokens issued.
- balanceOf: answers a query regarding how many tokens any given address is holding.
The rest of the functionalities modifies the contract state except the allowance method.
- transfer: allow a holder account to transfer its balance to another account.
- approve: approves the movement of tokens in a transferFrom by a third party.
- allowance: the amount of tokens approved to be transfered by a third party.
- transferFrom: once approved, this function instructs the contract to move a defined value of tokens from a sender address to a recipient address (checking the allowance).
Summarizing
ERC-20 is one of the most widely-used standards for smart contracts on the Ethereum platform. All ERC-20 tokens are issued to the same standard. This ability to integrate has acted as a positive reinforcement cycle for Ethereum, with the existing ecosystem pulling in more developers and users who want to join in.
Leave a Reply