Precompiled Contracts

Introduction

On top of having a set of opcodes to choose from, the EVM also offers a set of more advanced functionalities through precompiled contracts. These are a special kind of contracts that are bundled with the EVM at fixed addresses, and can be called with a determined gas cost. The addresses start from 1, and increment for each contract. New hardforks may introduce new precompiled contracts. They are called from the opcodes like regular contracts, with instructions like CALL. The gas cost mentioned here is purely the cost of the contract, and does not consider the cost of the call itself nor the instructions to put the parameters in memory. The precompiled contracts are also available in the playground.

For all precompiled contracts, if the input is shorter than expected, it is assumed to be virtually padded with zeros at the end. If the input is longer than expected, surplus bytes at the end are ignored.

After the hardfork Berlin, all the precompiled contracts addresses are always considered warm. See section access sets.

Precompiled Contractsshanghai

Name
Alt+K
Address
Name
Minimum Gas
0x01
ecRecover
3000
0x02
SHA2-256
60
0x03
RIPEMD-160
600
0x04
identity
15
0x05
modexp
200
0x06
ecAdd
150
0x07
ecMul
6000
0x08
ecPairing
45000
0x09
blake2f
0

Have ideas to make evm.codes better?