Skip to main content

Precompile Contracts

On top of a set of opcodes, EVM also offers advanced functionalities through precompiled contracts. These are special contracts bundled with EVM at fixed addresses that can be called with a determined gas. The gas is purely the contractual cost, neither the cost of the call itself nor the instructions to put the parameters in memory.

Precompiled contract addresses start from 1 and increment for each contract. New hardforks may introduce new precompiled contracts. Similar to the regular contracts, new contracts are called from opcodes with instructions, such as CALL.

For all precompiled contracts, inputs that are shorter than expected are assumed to be virtually padded with zeros at the end, whereas any surplus bytes at the end of inputs that are longer than expected are ignored.

The address precompile contract is described by the last 2 bytes:

Byte range [0..18]Byte range [18..20]
0000000000000000addr

EcRecover

ADDRESSMINIMUM GASINPUTOUTPUT
0x000000000000000000013000hash, v, r, spublicAddress

Elliptic curve digital signature algorithm (ECDSA) public key recovery function.

Click here to view ABI

Inputs

Output

SHA2-256

ADDRESSMINIMUM GASINPUTOUTPUT
0x0000000000000000000260datahash

Hash function used in Bitcoin.

Click here to view ABI

Inputs

Output

RIPEMD-160

ADDRESSMINIMUM GASINPUTOUTPUT
0x00000000000000000003600datahash

Hash function

Click here to view ABI

Inputs

Output

Identity

ADDRESSMINIMUM GASINPUTOUTPUT
0x0000000000000000000415datadata

It returns the input.

Click here to view ABI

Inputs

Output

Modexp

ADDRESSMINIMUM GASINPUTOUTPUT
0x00000000000000000005200Bsize, Esize, Msize, B, E, Mvalue

Arbitrary-precision exponentiation under modulo.

Click here to view ABI

Inputs

Output

EcAdd

ADDRESSMINIMUM GASINPUTOUTPUT
0x00000000000000000006150x1, x2, y1, y2x, y

Point addition (ADD) on the elliptic curve alt_bn128.

Click here to view ABI

Inputs

Output

EcMul

ADDRESSMINIMUM GASINPUTOUTPUT
0x000000000000000000076000x1, x2, sx, y

Scalar multiplication (MUL) on the elliptic curve alt_bn128.

Click here to view ABI

Inputs

Output

EcPairing

ADDRESSMINIMUM GASINPUTOUTPUT
0x0000000000000000000845000x1, y1, x2, y2, …, xk, yksuccess

Bilinear function on groups on the elliptic curve alt_bn128.

Click here to view ABI

Inputs

Output

Blake2f

ADDRESSMINIMUM GASINPUTOUTPUT
0x000000000000000000090rounds, h, m, t, fh

Compression function F used in the BLAKE2 cryptographic hashing algorithm.

Click here to view ABI

Inputs

Output

Metadata

ADDRESSMINIMUM GASINPUTOUTPUT
0x000000000000000001010rounds, h, m, t, fMetadata

Compression function F used in the BLAKE2 cryptographic hashing algorithm.

Click here to view ABI

Inputs

Output

GetHeader

ADDRESSMINIMUM GASINPUTOUTPUT
0x000000000000000001020rounds, h, m, t, fHeaderInfo

Compression function F used in the BLAKE2 cryptographic hashing algorithm.

Click here to view ABI

Inputs

Output

GetCell

ADDRESSMINIMUM GASINPUTOUTPUT
0x000000000000000001030rounds, h, m, t, fcellInfo

Compression function F used in the BLAKE2 cryptographic hashing algorithm.

Click here to view ABI

Inputs

Output

CallCkbVm

ADDRESSMINIMUM GASINPUTOUTPUT
0x00000000000000000104300rounds, h, m, t, fdata

Compression function F used in the BLAKE2 cryptographic hashing algorithm.

Click here to view ABI

Inputs

Output

VerifyInCkbVm

ADDRESSMINIMUM GASINPUTOUTPUT
0x00000000000000000105600rounds, h, m, t, fresult

Compression function F used in the BLAKE2 cryptographic hashing algorithm.

Click here to view ABI

Inputs

Output