Network
Launch Date
Consensus
Note
Sepolia
Oct 2021
PoW
Like-for-like representation of Ethereum
Görli
Jan 2019
PoA
Proof-of-Authority
Kiln
Mar 2022
PoS
Post-Merge (for ETH2), shadow fork of the mainnet
Kintsugi
Dec 2021
PoS
DEPRECATED, use Kiln; post-Merge (for ETH2)
Ropsten
Nov 2016
PoW
DEPRECATED, use Sepolia; the Merge to happen on Jun 8, 2022
Rinkeby
Apr 2017
PoA
DEPRECATED, use Görli and Görli Faucet
Kovan
Mar 2017
PoA
DEPRECATED, use Sepolia or Görli
List of active and deprecated Ethereum testnets, including Kintsugi.
Features
Optimistic rollup 
ZK-rollup 
Proof
Uses fraud proofs to prove transaction validity. 
Uses validity (zero-knowledge) proofs to prove transaction validity. 
Capital efficiency
Requires waiting through a 1-week delay (dispute period) before withdrawing funds. 
Users can withdraw funds immediately because validity proofs provide incontrovertible evidence of the authenticity of off-chain transactions. 
Data compression
Publishes full transaction data as calldata to Ethereum Mainnet, which increases rollup costs. 
Doesn't need to publish transaction data on Ethereum because ZK-SNARKs and ZK-STARKs already guarantee the accuracy of the rollup state. 
EVM compatibility
Uses a simulation of the Ethereum Virtual Machine (EVM), which allows it to run arbitrary logic and support smart contracts. 
Doesn't widely support EVM computation, although a few EVM-compatible ZK-rollups have appeared. 
Rollup costs
Reduces costs since it publishes minimal data on Ethereum and doesn't have to post proofs for transactions, except in special circumstances. 
Faces higher overhead from costs involved in generating and verifying proofs for every transaction block. ZK proofs require specialized, expensive hardware to create and have high on-chain verification costs. 
Trust assumptions
Doesn't require a trusted setup. 
Requires a trusted setup to work. 
Liveness requirements
Verifiers are needed to keep tabs on the actual rollup state and the one referenced in the state root to detect fraud. 
Users don't need someone to watch the L2 chain to detect fraud. 
Security properties 
Relies on cryptoeconomic incentives to assure users of rollup security. 
Relies on cryptographic guarantees for security. 
Start building
on Alchemy.
Sign up for free
Start building on Optimism.
Sign up for free
Start building on Arbitrum.
Sign up for free
Start building on Ethereum.
Sign up for free
Start building on Polygon.
Sign up for free
Start building on Starknet.
Sign up for free
Start building on Flow.
Sign up for free
kiln faucet
Get free Kiln ETH.
Start building today
Goerli faucet
Get free Goerli ETH.
Start building today
mumbai faucet
Get free Mumbai Matic.
Start building today
rinkeby faucet
Get free Rinkeby
ETH.
Start building today
Start building on Ethereum.
Get started for free
Start building on Ethereum.
Get started for free
Start building on Flow.
Get started for free
Start building on Polygon.
Get started for free
Start building on Starknet.
Get started for free
Start building on Optimism.
Get started for free
Start building on Solana.
Get started for free
Start building on Solana.
Sign up for beta access
Start building on Solana.
Join the waitlist
Arbitrum logo
Start building on Arbitrum.
Get started for free
Learn
Solidity at
Alchemy
University
Get started today
curl 
https://release.solana.com/v1.10.32/solana-install-init-x86_64-pc-windows-msvc.exe 
--output 
C:\solana-install-tmp\solana-install-init.exe 
--create-dirs
Learn Solidity
SOLIDITY ERC-20 OVERVIEW

The Complete Guide to ERC-20 Tokens and Solidity (2023)

What the Solidity ERC20 Standard is, How it Works, and When to Use it
Last Updated:
October 4, 2022
Table of Contents
Table of Contents
Table of Contents

{{learn-solidity}}

The Ethereum ecosystem contains a wide variety of standards that represent the functionality of smart contracts from creation to deployment. The most common standards are ERC-20, ERC-721, ERC-777, and ERC-1155 with each serving its own main objective.

This article defines ERC-20 tokens, gives some of their uses, and outlines some of the mandatory functions in the Solidity programming language developers need to use to stay in line with the standard. If you want to create your own ERC-20 token using Solidity, the guidelines and definitions within this article will give you a better understanding of how to do that.  

What is an ERC-20 token?

The ERC-20 is a popular fungible cryptocurrency token compatible with Ethereum or EVM-compatible blockchains. It serves as a digital asset that can represent anything on the blockchain, which enables flexibility for many use cases.

This preset smart contract contains a specific interface that allows it to be used as a technical standard for development. Developers can leverage the ERC-20 token and its associated token rules for an easier developer experience. Popular decentralized exchange protocols like Uniswap and SushiSwap both leverage the ERC-20 token standard as building blocks for its seamless compatibility and integration into their ecosystems.

How are ERC-20 tokens used?

As the ERC-20 token has no restrictions on what it can represent, it can expand further beyond a typical cryptocurrency (i.e. ETH). As a requirement, ERC-20 assets are fungible, transferable, and can be limited to a max supply. This is useful when creating rewards, physical objects, shares of a company, and much more.

Designed to standardize the development of tokens, the ERC-20 token can represent any fungible asset on the Ethereum blockchain. By providing a few variables to represent a particular asset (e.g. name, symbol and supply) anyone can launch an ERC20 token with the standard behavior and interface.

ERC-20 tokens are fungible as each token is exactly equal to any other token. With no special rights or behavior associated with any individual token, this equality of value among ERC-20 tokens makes them useful in such applications as a medium of exchange, currency, voting rights, and staking.

Why is the ERC-20 token standard important?

The ERC-20 token standard introduces a specific approach for fungible tokens, ensuring that they all share similar properties. 

‚ÄćSince its proposal in 2015, the development of the ERC-20 token standard allows for other protocols, platforms, and developers to create smart contracts that can use any token following the standard without creating special logic for each new token. The standardization for smart contracts enhances the development process and in turn, greatly benefits the entire crypto ecosystem.

What Solidity functions are mandatory for all ERC-20 tokens?

The ERC-20 standard contains a set of methods and events that must be present in every implementation of the standard, including methods to transfer value, lookup balances for addresses and retrieve other metadata.

An understanding of the distinctions of the Solidity language and a practical knowledge of how to use functions to create ERC-20 tokens on Ethereum can accelerate your journey to become a Solidity developer.

1. totalSupply

The totalSupply method denotes the current circulating total supply of the tokens. Here is an example:



function totalSupply() external view returns (uint256);

2. balanceOf

The balanceOf method calculates the number of tokens contained in a particular wallet address. Here is an example:



function balanceOf(address account) external view returns (uint256);

3. transfer

The transfer method sends tokens from one address to another, where the sender is the origin of the transaction. Here is an example:



function transfer(address recipient, uint256 amount) external returns (bool);

4. approve

The approve method allows another address to spend tokens on your behalf. This is useful when interacting with smart contracts that need access to your tokens. A popular use case for the approve method is a decentralized exchange. Here is an example:



function approve(address spender, uint256 amount) external returns (bool);

5. transferFrom

‚ÄćThe transferFrom method is useful together with the approve method. Once you approve someone to spend your tokens, they can transferFrom your account to another account as part of a transaction. A good use case is a decentralized exchange.¬†Here is an example:



function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);

6. allowance

The allowance method is the amount one address can spend on behalf of another address. Here is an example:



function allowance(address owner, address spender) external view returns (uint256);

What Solidity functions are optional for all ERC-20 tokens?

Names, symbols, and decimals are all optional functions serving as an extension to the base interface of the ERC-20 token contract. Although these functions are not required, they provide additional details to the contract beneficial to understanding its objective. This core interface can serve as the base for additional customization and extensions to the smart contract.

1. Name‚Äć

The name is a human-readable name that defines the purpose of the contract. Here is an example:



string public constant name = "ERC20Basic";

2. Symbol

The symbol is a human-readable ticker of the token that can be used to represent it. Similar to ETH, BTC, etc. Here is an example:



string public constant symbol = "ERC";

3. Decimals

Decimals define the denomination of the smallest unit of the currency. It is most commonly 18, which is the same denomination for ether (the smallest unit of ether is wei: one ether is 1e18 wei).



uint8 public constant decimals = 18;balances (owner_address => balance_amount)

What are ERC-20 data structures?

ERC-20 data structures like tables of balances and allowances facilitate the organization and implementation of operations on the blockchain. 

Balances

An internal table of token balances is used to track total ownership by a wallet address. Each transfer is a deduction from one balance and an addition to another balance.



mapping(address => uint256) balances;

Allowances

An internal table of token allowances are used to track delegated spending by a wallet address. Using nested mapping, the primary key is the address of the token owner which maps to a spender address and provides the delegated amount to spend.



function allowance(address owner, address spender) external view returns (uint256);

Start Building with Alchemy

The ERC-20 standard is the most important standard to emerge from the Ethereum ecosystem as it is widely adopted and used across the most important smart contract protocols. As a developer, it is highly recommended you spend time getting to know this standard and deploy your own ERC-20 token.

To learn about ERC-20 tokens and other Solidity programming fundamentals, secure your spot in Alchemy University's Ethereum Developer Bootcamp.

ALCHEMY SUPERNODE - ETHEREUM NODE API

Scale to any size, without any errors

Alchemy Supernode finally makes it possible to scale blockchain applications without all the headaches. Plus, our legendary support will guide you every step of the way.

Get started for free
Supernode footer
Learn Solidity
SOLIDITY ERC-20 OVERVIEW

The Complete Guide to Solidity ERC20 Tokens (2023)

What the Solidity ERC20 Standard is, How it Works, and When to Use it
Last Updated:
October 4, 2022
Don't miss an update
Sign up for our newsletter to get alpha, key insights, and killer resources.
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.
Table of Contents

The Ethereum ecosystem contains a wide variety of standards that represent the functionality of smart contracts from creation to deployment. The most common standards are ERC-20, ERC-721, ERC-777, and ERC-1155 with each serving its own main objective.

This article defines ERC-20 tokens, gives some of their uses, and outlines some of the mandatory functions in the Solidity programming language developers need to use to stay in line with the standard. If you want to create your own ERC-20 token using Solidity, the guidelines and definitions within this article will give you a better understanding of how to do that.  

What is an ERC-20 token?

The ERC-20 is a popular fungible cryptocurrency token compatible with Ethereum or EVM-compatible blockchains. It serves as a digital asset that can represent anything on the blockchain, which enables flexibility for many use cases.

This preset smart contract contains a specific interface that allows it to be used as a technical standard for development. Developers can leverage the ERC-20 token and its associated token rules for an easier developer experience. Popular decentralized exchange protocols like Uniswap and SushiSwap both leverage the ERC-20 token standard as building blocks for its seamless compatibility and integration into their ecosystems.

How are ERC-20 tokens used?

As the ERC-20 token has no restrictions on what it can represent, it can expand further beyond a typical cryptocurrency (i.e. ETH). As a requirement, ERC-20 assets are fungible, transferable, and can be limited to a max supply. This is useful when creating rewards, physical objects, shares of a company, and much more.

Designed to standardize the development of tokens, the ERC-20 token can represent any fungible asset on the Ethereum blockchain. By providing a few variables to represent a particular asset (e.g. name, symbol and supply) anyone can launch an ERC20 token with the standard behavior and interface.

ERC-20 tokens are fungible as each token is exactly equal to any other token. With no special rights or behavior associated with any individual token, this equality of value among ERC-20 tokens makes them useful in such applications as a medium of exchange, currency, voting rights, and staking.

Why is the ERC-20 token standard important?

The ERC-20 token standard introduces a specific approach for fungible tokens, ensuring that they all share similar properties. 

‚ÄćSince its proposal in 2015, the development of the ERC-20 token standard allows for other protocols, platforms, and developers to create smart contracts that can use any token following the standard without creating special logic for each new token. The standardization for smart contracts enhances the development process and in turn, greatly benefits the entire crypto ecosystem.

What Solidity functions are mandatory for all ERC-20 tokens?

The ERC-20 standard contains a set of methods and events that must be present in every implementation of the standard, including methods to transfer value, lookup balances for addresses and retrieve other metadata.

An understanding of the distinctions of the Solidity language and a practical knowledge of how to use functions to create ERC-20 tokens on Ethereum can accelerate your journey to become a Solidity developer.

1. totalSupply

The totalSupply method denotes the current circulating total supply of the tokens. Here is an example:



function totalSupply() external view returns (uint256);

2. balanceOf

The balanceOf method calculates the number of tokens contained in a particular wallet address. Here is an example:



function balanceOf(address account) external view returns (uint256);

3. transfer

The transfer method sends tokens from one address to another, where the sender is the origin of the transaction. Here is an example:



function transfer(address recipient, uint256 amount) external returns (bool);

4. approve

The approve method allows another address to spend tokens on your behalf. This is useful when interacting with smart contracts that need access to your tokens. A popular use case for the approve method is a decentralized exchange. Here is an example:



function approve(address spender, uint256 amount) external returns (bool);

5. transferFrom

‚ÄćThe transferFrom method is useful together with the approve method. Once you approve someone to spend your tokens, they can transferFrom your account to another account as part of a transaction. A good use case is a decentralized exchange.¬†Here is an example:



function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);

6. allowance

The allowance method is the amount one address can spend on behalf of another address. Here is an example:



function allowance(address owner, address spender) external view returns (uint256);

What Solidity functions are optional for all ERC-20 tokens?

Names, symbols, and decimals are all optional functions serving as an extension to the base interface of the ERC-20 token contract. Although these functions are not required, they provide additional details to the contract beneficial to understanding its objective. This core interface can serve as the base for additional customization and extensions to the smart contract.

1. Name‚Äć

The name is a human-readable name that defines the purpose of the contract. Here is an example:



string public constant name = "ERC20Basic";

2. Symbol

The symbol is a human-readable ticker of the token that can be used to represent it. Similar to ETH, BTC, etc. Here is an example:



string public constant symbol = "ERC";

3. Decimals

Decimals define the denomination of the smallest unit of the currency. It is most commonly 18, which is the same denomination for ether (the smallest unit of ether is wei: one ether is 1e18 wei).



uint8 public constant decimals = 18;balances (owner_address => balance_amount)

What are ERC-20 data structures?

ERC-20 data structures like tables of balances and allowances facilitate the organization and implementation of operations on the blockchain. 

Balances

An internal table of token balances is used to track total ownership by a wallet address. Each transfer is a deduction from one balance and an addition to another balance.



mapping(address => uint256) balances;

Allowances

An internal table of token allowances are used to track delegated spending by a wallet address. Using nested mapping, the primary key is the address of the token owner which maps to a spender address and provides the delegated amount to spend.



function allowance(address owner, address spender) external view returns (uint256);

Start Building with Alchemy

The ERC-20 standard is the most important standard to emerge from the Ethereum ecosystem as it is widely adopted and used across the most important smart contract protocols. As a developer, it is highly recommended you spend time getting to know this standard and deploy your own ERC-20 token.

To learn about ERC-20 tokens and other Solidity programming fundamentals, secure your spot in Alchemy University's Ethereum Developer Bootcamp.

The Ethereum ecosystem contains a wide variety of standards that represent the functionality of smart contracts from creation to deployment. The most common standards are ERC-20, ERC-721, ERC-777, and ERC-1155 with each serving its own main objective.

This article defines ERC-20 tokens, gives some of their uses, and outlines some of the mandatory functions in the Solidity programming language developers need to use to stay in line with the standard. If you want to create your own ERC-20 token using Solidity, the guidelines and definitions within this article will give you a better understanding of how to do that.  

What is an ERC-20 token?

The ERC-20 is a popular fungible cryptocurrency token compatible with Ethereum or EVM-compatible blockchains. It serves as a digital asset that can represent anything on the blockchain, which enables flexibility for many use cases.

This preset smart contract contains a specific interface that allows it to be used as a technical standard for development. Developers can leverage the ERC-20 token and its associated token rules for an easier developer experience. Popular decentralized exchange protocols like Uniswap and SushiSwap both leverage the ERC-20 token standard as building blocks for its seamless compatibility and integration into their ecosystems.

How are ERC-20 tokens used?

As the ERC-20 token has no restrictions on what it can represent, it can expand further beyond a typical cryptocurrency (i.e. ETH). As a requirement, ERC-20 assets are fungible, transferable, and can be limited to a max supply. This is useful when creating rewards, physical objects, shares of a company, and much more.

Designed to standardize the development of tokens, the ERC-20 token can represent any fungible asset on the Ethereum blockchain. By providing a few variables to represent a particular asset (e.g. name, symbol and supply) anyone can launch an ERC20 token with the standard behavior and interface.

ERC-20 tokens are fungible as each token is exactly equal to any other token. With no special rights or behavior associated with any individual token, this equality of value among ERC-20 tokens makes them useful in such applications as a medium of exchange, currency, voting rights, and staking.

Why is the ERC-20 token standard important?

The ERC-20 token standard introduces a specific approach for fungible tokens, ensuring that they all share similar properties. 

‚ÄćSince its proposal in 2015, the development of the ERC-20 token standard allows for other protocols, platforms, and developers to create smart contracts that can use any token following the standard without creating special logic for each new token. The standardization for smart contracts enhances the development process and in turn, greatly benefits the entire crypto ecosystem.

What Solidity functions are mandatory for all ERC-20 tokens?

The ERC-20 standard contains a set of methods and events that must be present in every implementation of the standard, including methods to transfer value, lookup balances for addresses and retrieve other metadata.

An understanding of the distinctions of the Solidity language and a practical knowledge of how to use functions to create ERC-20 tokens on Ethereum can accelerate your journey to become a Solidity developer.

1. totalSupply

The totalSupply method denotes the current circulating total supply of the tokens. Here is an example:



function totalSupply() external view returns (uint256);

2. balanceOf

The balanceOf method calculates the number of tokens contained in a particular wallet address. Here is an example:



function balanceOf(address account) external view returns (uint256);

3. transfer

The transfer method sends tokens from one address to another, where the sender is the origin of the transaction. Here is an example:



function transfer(address recipient, uint256 amount) external returns (bool);

4. approve

The approve method allows another address to spend tokens on your behalf. This is useful when interacting with smart contracts that need access to your tokens. A popular use case for the approve method is a decentralized exchange. Here is an example:



function approve(address spender, uint256 amount) external returns (bool);

5. transferFrom

‚ÄćThe transferFrom method is useful together with the approve method. Once you approve someone to spend your tokens, they can transferFrom your account to another account as part of a transaction. A good use case is a decentralized exchange.¬†Here is an example:



function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);

6. allowance

The allowance method is the amount one address can spend on behalf of another address. Here is an example:



function allowance(address owner, address spender) external view returns (uint256);

What Solidity functions are optional for all ERC-20 tokens?

Names, symbols, and decimals are all optional functions serving as an extension to the base interface of the ERC-20 token contract. Although these functions are not required, they provide additional details to the contract beneficial to understanding its objective. This core interface can serve as the base for additional customization and extensions to the smart contract.

1. Name‚Äć

The name is a human-readable name that defines the purpose of the contract. Here is an example:



string public constant name = "ERC20Basic";

2. Symbol

The symbol is a human-readable ticker of the token that can be used to represent it. Similar to ETH, BTC, etc. Here is an example:



string public constant symbol = "ERC";

3. Decimals

Decimals define the denomination of the smallest unit of the currency. It is most commonly 18, which is the same denomination for ether (the smallest unit of ether is wei: one ether is 1e18 wei).



uint8 public constant decimals = 18;balances (owner_address => balance_amount)

What are ERC-20 data structures?

ERC-20 data structures like tables of balances and allowances facilitate the organization and implementation of operations on the blockchain. 

Balances

An internal table of token balances is used to track total ownership by a wallet address. Each transfer is a deduction from one balance and an addition to another balance.



mapping(address => uint256) balances;

Allowances

An internal table of token allowances are used to track delegated spending by a wallet address. Using nested mapping, the primary key is the address of the token owner which maps to a spender address and provides the delegated amount to spend.



function allowance(address owner, address spender) external view returns (uint256);

Start Building with Alchemy

The ERC-20 standard is the most important standard to emerge from the Ethereum ecosystem as it is widely adopted and used across the most important smart contract protocols. As a developer, it is highly recommended you spend time getting to know this standard and deploy your own ERC-20 token.

To learn about ERC-20 tokens and other Solidity programming fundamentals, secure your spot in Alchemy University's Ethereum Developer Bootcamp.

Build web3 with Alchemy

Alchemy combines the most powerful web3 developer products and tools with resources, community and legendary support.

Get started for free