I am using Truffle to compile the contracts and by default it compiles the contracts with pragma solidity 0.5.7 to evm version petersburg. Is it possible to compile the same contract for evm version istanbul?

A second question is when we compile a contract with older evm version say byzantium and them deploy to mainnet which is running istanbul hardfork then is it true that the istanbul hardfork is running the bytecode compiled by byzantium evm verion? If not, then how exactly does it work?


2 Answers 2


Is it possible to compile the same contract for evm version istanbul?

  • No. You cannot compile contracts written using v0.5.7 to evm version istanbul.
  • As doing so will generate an error Invalid EVM version requested.
  • Why the above error?
    • Since the EVM versions (Target Versions) as specified in solidity docs for v0.5.7 is till petersburg and istanbul was added in v0.5.12

To answer your second question, YES.


Yes, it’s possible to compile a Solidity contract for a specific EVM version using Truffle. To compile for the Istanbul hard fork, you’ll need to update the pragma statement in your Solidity contract to match the desired version, such as pragma solidity ^0.6.0.

When you compile a contract with an older EVM version like Byzantium and deploy it on a network running a newer hard fork like Istanbul, the EVM will execute the bytecode based on the rules and features of the Istanbul hard fork. The bytecode itself does not change, but the behavior and interpretation of that bytecode are governed by the rules of the active hard fork.

Is there anything else you’d like to know about Ethereum development or Solidity?


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.