Solidity Support

As Layer4 Network is EVM compatible, you can deploy any contract written in Solidity, Vyper, or any other contract development language as long as it can be compiled to EVM bytecode. There are some key differences in Solidity opcode behavior on L1 Ethereum and L2 Layer4 VM. This can impact certain operations and features when deploying your dApps on Layer4. The following table lists the opcodes that behave differently accompanied with a description.

Opcode Differences

OpcodeSolidity EquivalentBehaviour

PUSH0

N/A

Not supported currently, and so Solidity version 0.8.20 and higher cannot be used with the default shanghai EVM version. Configuring the EVM version: For Solc, refer here For Hardhat, refer here

COINBASE

block.coinbase

Returns a constant address 0x4200000000000000000000000000000000000011 Refers to the BVM_SequencerFeeVault contract that collects L2 gas fees

DIFFICULTY

block.difficulty

Returns constant 0

L1BLOCKNUMBER

N/A

Added in Layer4 VM to query the L1 block number. Use iBVM_L1BlockNumber with address 0x4200000000000000000000000000000000000013 to call getL1BlockNumber()

NUMBER

block.number

Returns latest L2 block number

BASEFEE

block.basefee

Not supported currently, will be available with EIP-1559 update

Last updated