Learn how to deploy EVM equivalent smart contracts on Abstract.
Abstract natively uses the ZKsync VM to execute smart contract instructions, however an EVM bytecode interpreter system is also available to enable the deployment of unmodified EVM bytecode, commonly referred to as “EVM equivalent” smart contracts.
This enables smart contracts that rely on EVM logic (such as consistent address derivation) to be deployed on Abstract without modification. However, this approach is not recommended for most use cases due to comparatively higher gas fees.
There are two ways to deploy smart contracts on Abstract:
The EVM interpreter functions as a translation layer that converts EVM opcodes into ZKsync VM operations at runtime as part of the smart contract execution process.
As a consequence of this translation process, contracts deployed with EVM bytecode experience increased gas fees of between 150-400% compared to contracts deployed using the native ZKsync VM bytecode.
The code hash of smart contracts are stored in the AccountCodeStorage system contract, and upon deployment, are pre-fixed with either:
0x01
: Flag for Native ZKsync VM bytecode.0x02
: Flag for EVM bytecode (i.e. EVM equivalent smart contracts).When a contract function is called, the following steps occur:
Check code hash prefix
To determine the type of bytecode that this contract was deployed with,
first, a check is made to see if it is prefixed with 0x01
or 0x02
.
Translate & execute opcodes
If the contract is native ZKsync VM bytecode (prefix 0x01
), this step is skipped.
Otherwise, the EVM interpreter interprets and executes opcodes in a loop; translating EVM opcodes into ZKsync VM instructions; execution continues until completion, error, or out-of-ergs condition.
DELEGATECALL
between EVM and native ZKsync VM contracts will be reverted.GASLIMIT
opcode returns the same fixed constant as ZKsync VM and should not be used.The following opcodes are not supported due to underlying limitations of ZKsync VM:
CALLCODE
SELFDESTRUCT
BLOBHASH
BLOBBASEFEE
Learn how to deploy EVM equivalent smart contracts on Abstract.
Abstract natively uses the ZKsync VM to execute smart contract instructions, however an EVM bytecode interpreter system is also available to enable the deployment of unmodified EVM bytecode, commonly referred to as “EVM equivalent” smart contracts.
This enables smart contracts that rely on EVM logic (such as consistent address derivation) to be deployed on Abstract without modification. However, this approach is not recommended for most use cases due to comparatively higher gas fees.
There are two ways to deploy smart contracts on Abstract:
The EVM interpreter functions as a translation layer that converts EVM opcodes into ZKsync VM operations at runtime as part of the smart contract execution process.
As a consequence of this translation process, contracts deployed with EVM bytecode experience increased gas fees of between 150-400% compared to contracts deployed using the native ZKsync VM bytecode.
The code hash of smart contracts are stored in the AccountCodeStorage system contract, and upon deployment, are pre-fixed with either:
0x01
: Flag for Native ZKsync VM bytecode.0x02
: Flag for EVM bytecode (i.e. EVM equivalent smart contracts).When a contract function is called, the following steps occur:
Check code hash prefix
To determine the type of bytecode that this contract was deployed with,
first, a check is made to see if it is prefixed with 0x01
or 0x02
.
Translate & execute opcodes
If the contract is native ZKsync VM bytecode (prefix 0x01
), this step is skipped.
Otherwise, the EVM interpreter interprets and executes opcodes in a loop; translating EVM opcodes into ZKsync VM instructions; execution continues until completion, error, or out-of-ergs condition.
DELEGATECALL
between EVM and native ZKsync VM contracts will be reverted.GASLIMIT
opcode returns the same fixed constant as ZKsync VM and should not be used.The following opcodes are not supported due to underlying limitations of ZKsync VM:
CALLCODE
SELFDESTRUCT
BLOBHASH
BLOBBASEFEE