One of the most significant differences between the Bitcoin and Ethereum blockchains is that Bitcoin functions as a cryptocurrency positioned as an alternative to traditional fiat.
It does not have many use cases besides a payment mechanism or a store of value. Ethereum, on the other hand, is an entire platform on its own and allows developers to build their blockchain-based programs, known as dapps (decentralized applications).
Apps built on the Ethereum blockchain include payment services, advertising networks, video streaming platforms, and more.
What they have in common, however, is that they’re entirely decentralized and use some form of Ethereum token to enable transactions and raise the initial capital for the project.
While each Ethereum token can create its own cryptocurrency, the Ethereum platform charges developers for the right to use its computing power, which can only be paid in Ether, the cryptocurrency of the Ethereum network itself.
ERC-20 has emerged as the technical standard for all smart contracts on the Ethereum blockchain. It provides a list of rules that all Ethereum-based tokens must comply with, such as how to transfer the tokens, how transactions are approved, how users can access data about the token, and the total supply of tokens.
Hence, ERC-20 tokens are essentially blockchain-based assets that have their own value and can be sent and received. But rather than exist on a separate blockchain of their own, ERC-20 tokens are issued on the Ethereum blockchain.
While ERC-20 is the token standard for Ethereum-based smart contracts, that doesn’t mean it’s the only token available on the Ethereum blockchain. There are others, such as ERC-223 and ERC-777, but ERC-20 remains the most popular one for now.
ERC-20 tokens can also be used for things other than trading digital assets. Developers can utilize them to grant users the right to vote or issue rewards for completing certain tasks.
The most important issue that ERC-20 addresses is standardization. In the early days of the Ethereum blockchain, developers worked on their own tokens with different functions and rules, which led to compatibility issues. If not addressed, the execution of smart contracts would have required complex mathematical equations and would have caused scalability issues.
ERC-20 makes it much more convenient to build decentralized apps on the Blockchain, list tokens on cryptocurrency exchanges, and store tokens in hardware wallets. It also makes them far more secure. Furthermore, since ERC-20 provides a standardized list of rules, it’s far easier for developers to follow instead of starting from scratch.
Standardization helps with the overall health of the ecosystem. The lower the costs and barriers to entry, the more vibrant the ecosystem. That’s part of the reason why the price of Ether has been hitting record highs recently.
A smart contract executed on the Ethereum blockchain must incorporate certain rules for it to be ERC-20 compliant. There are a total of six mandatory rules and two optional rules. The six mandatory rules are:
This identifies the total number of ERC-20 tokens created for that particular application and is used to determine the number of tokens on the ecosystem.
This rule helps understand the number of tokens held by a particular address.
The approve function ensures that the contract owner approves the user to collect tokens from the contract’s address. This also checks the transaction with the total supply of tokens to ensure that there’s nothing fraudulent about the transaction.
Once all the checks are complete, the transfer function finishes the transaction by executing the exchange. This is similar to a wire payment in a traditional fiat account.
The transfer from function is for recurring transfers, like a monthly payment or e-billing. It assists with automating payment transfers to a specific account.
The sixth and final rule is allowance—this is used to determine whether the user has the minimum amount of tokens required to do the transaction. If the address doesn’t have that, the transaction will be cancelled.