What Are the Key Functions Defined in the ERC-20 Standard?

The ERC-20 standard defines a set of six mandatory functions that a compliant smart contract must implement. These include totalSupply() to get the total number of tokens, balanceOf() to get a user's balance, and transfer() to send tokens to another address.

It also includes approve() and transferFrom() which allow a user to authorize another contract to spend tokens on their behalf. The allowance() function checks how many tokens a spender is allowed to withdraw from an owner's account.

These functions ensure all ERC-20 tokens behave in a predictable way.

How Does a Token Standard like ERC-20 Differ from ERC-721?
What Are the Key Differences between ERC-721 and the Newer ERC-1155 Standard?
How Does ERC-1155 Improve Gas Efficiency over ERC-20 and ERC-721?
Why Is a Two-Step Approve and Transferfrom Process Often Cheaper in the Long Run for Frequent Interactions?
What Is the Purpose of the “Approve” Function in the ERC-20 Standard?
What Is the Transferfrom() Function and How Does It Relate to Approve() ?
What Is the Role of the ERC-20 Standard’s Approve() Function in Setting a Token Allowance?
How Do Lending Protocols Utilize ERC-20 Standards for Collateral?

Glossar