Solidity Support
Arbitrum Nitro chains are Ethereum compatible, and therefore allow you to trustlessly deploy Solidity contracts (as well as Vyper or any other language that compiles to EVM bytecode).
Differences from Solidity on Ethereum
Although Arbitrum supports Solidity code, there are differences in the effects of a few operations, including language features that don't make much sense in the Layer 2 context:
blockhash(x)
returns a cryptographically insecure, pseudo-random hash forx
within the rangeblock.number - 256 <= x < block.number
. Ifx
is outside of this range,blockhash(x)
will return0
. This includesblockhash(block.number)
, which always returns0
just like on Ethereum. The hashes returned do not come from L1.block.coinbase
returns the designated internal address 0xA4b000000000000000000073657175656e636572 if the message was posted by a Sequencer. It it's a delayed message, it returns the address of the delayed message's poster (Note: the handling of delayed message'sblock.coinbase
will likely be changed in ArbOS v11).block.difficulty
andblock.prevrandao
returns the constant 1block.number
return an "estimate" of the L1 block number at which the Sequencer received the transaction (see Block Numbers and Time)msg.sender
works the same way it does on Ethereum for normal L2-to-L2 transactions; for L1-to-L2 "retryable ticket" transactions, it will return the L2 address alias of the L1 contract that triggered the message. See retryable ticket address aliasing for more.- OPCODE
push0
is not yet supported, but will soon be available. This means that solidity version0.8.20
or higher can only be used with an evm-version lower than the defaultshanghai
(see instructions here to change that parameter in solc, or here to set thesolidity
orevmVersion
configuration parameters in hardhat). Versions up to0.8.19
(included) are fully compatible.