[Dev] What is EVM version?

When compiling solidity contracts, you are able to set evm version. What does this mean and what are its implications?

TLDR:

  • evm version specifies what opcodes are allowed to be used by specifiying the hardfork name.

  • For example, selecting shanghai as the evm version will make use of the push0 opcode along with opcodes introduced in previous hardforks.

    • This opcode enables significant gas savings, making both deployments and execution cheaper.
  • On ethereum mainnet, you can safely use the latest hardfork as the evm version. However, other L1s and L2s may not support those opcodes

  • Its important to understand if the EVM equivalent chain you are deploying to supports all the opcodes specified at your evm version. Deploying with an evm version you chain does not support will lead to failed deployments

  • Note: you are able to set the highest version of solidity on whatever chain you are deploying to as long as you specify the correct evmVersion supported on that chain

What is the latest evm version I can use per chain?

  • Dencun → Fork from Mar 13, 2024

    • Ethereum
  • Shanghai → Fork from Apr 12, 2023

    • Arbitrum

    • Avalanche

    • Base

    • Optimism

    • Polygon

  • Paris (POW to POS) → Fork from Sep 15, 2022

    • Blast

    • Binance

    • (Nearly all EVM chains support paris hardfork)

Additional readings

Subscribe to Shushant
Receive the latest updates directly to your inbox.
Mint this entry as an NFT to add it to your collection.
Verification
This entry has been permanently stored onchain and signed by its creator.