On Ethereum, precompiled smart contracts are contracts embedded into the EVM at predetermined addresses that typically perform computationally expensive operations that are not already included in EVM opcodes.

Abstract has support for these EVM precompiles and more, however some have different behaviour than on Ethereum.

CodeOracle

Emulates EVM’s extcodecopy opcode.

CodeOracle source code

View the source code for the CodeOracle precompile on GitHub.

SHA256

Emulates the EVM’s sha256 precompile.

SHA256 source code

View the source code for the SHA256 precompile on GitHub.

KECCAK256

Emulates the EVM’s keccak256 opcode.

KECCAK256 source code

View the source code for the KECCAK256 precompile on GitHub.

Elliptic Curve Precompiles

Precompiled smart contracts for elliptic curve operations are required to perform zkSNARK verification.

EcAdd

Precompile for computing elliptic curve point addition. The points are represented in affine form, given by a pair of coordinates (x,y).

Emulates the EVM’s ecadd precompile.

EcAdd source code

View the source code for the EcAdd precompile on GitHub.

EcMul

Precompile for computing elliptic curve point scalar multiplication. The points are represented in homogeneous projective coordinates, given by the coordinates (x,y,z).

Emulates the EVM’s ecmul precompile.

EcMul source code

View the source code for the EcMul precompile on GitHub.

EcPairing

Precompile for computing bilinear pairings on elliptic curve groups.

Emulates the EVM’s ecpairing precompile.

EcPairing source code

View the source code for the EcPairing precompile on GitHub.

Ecrecover

Emulates the EVM’s ecrecover precompile.

Ecrecover source code

View the source code for the Ecrecover precompile on GitHub.

P256Verify (secp256r1 / RIP-7212)

The contract that emulates RIP-7212’s P256VERIFY precompile.

This adds a precompiled contract which is similar to ecrecover to provide signature verifications using the “secp256r1” elliptic curve.

P256Verify source code

View the source code for the P256Verify precompile on GitHub.