Home

precompiles

Precompiles are fixed, native routines exposed to the Ethereum Virtual Machine at predetermined addresses. They are implemented in the client software and run as native code rather than as EVM bytecode, allowing cryptographic and other computationally intensive operations to be performed more efficiently. Calls to a precompile look like a contract call, but execution occurs outside the EVM interpreter, with gas costs defined by the protocol and typically related to input size or operation type.

Common precompiles cover a range of cryptographic and data-processing tasks. Examples include ecrecover, which recovers an

The set of precompiles is defined by the protocol and is not typically upgraded through ordinary contract

Ethereum
public
key
from
a
signature;
sha256
and
ripemd160,
which
perform
standard
hash
functions;
and
identity,
a
no-op
that
returns
its
input.
The
modular
exponentiation
precompile
supports
large
integer
exponentiation.
On
the
BN128
(alt_bn128)
curve,
there
are
precompiles
for
addition,
multiplication,
and
a
pairing
check,
which
are
especially
useful
for
zk-SNARK
and
other
cryptographic
protocols.
These
primitives
are
used
by
smart
contracts
to
verify
signatures,
perform
proofs,
or
process
data
efficiently
without
incurring
the
higher
costs
of
equivalent
operations
in
pure
EVM
code.
deployment;
changes
require
protocol
hard
forks.
As
a
result,
precompiles
provide
predictable
gas
behavior
and
cross-network
interoperability
within
a
given
blockchain
client
implementation.
They
play
a
central
role
in
enabling
efficient
cryptographic
verification
and
other
heavy
computations
within
smart
contracts
and
layer-2
systems.