EEVM.Precompiles (eevm v0.1.0)

Copy Markdown View Source

Dispatcher for EVM precompiled contracts.

Precompiled contracts are built-in functions at fixed addresses that provide cryptographic and utility operations too expensive to implement in EVM bytecode. When a CALL targets one of these addresses, execution is routed here instead of interpreting bytecode.

Supported Precompiles

AddressNameEIP
0x01ECRECOVER — elliptic curve signature recoveryYellow Paper
0x02SHA256 — SHA-256 hashYellow Paper
0x03RIPEMD160 — RIPEMD-160 hashYellow Paper
0x04IDENTITY — data copy (no-op)Yellow Paper
0x05MODEXP — big integer modular exponentiationEIP-198, EIP-2565, EIP-7883 (Osaka)
0x06BN256 ADD — elliptic curve point addition on alt_bn128EIP-196
0x07BN256 MUL — elliptic curve scalar multiplication on alt_bn128EIP-196
0x08BN256 PAIRING — bilinear pairing check on alt_bn128EIP-197
0x09BLAKE2F — BLAKE2b compression functionEIP-152
0x0AKZG Point Evaluation — verify KZG commitmentEIP-4844
0x0BBLS12 G1ADD — add two BLS12-381 G1 pointsEIP-2537
0x0CBLS12 G1MSM — multiscalar multiplication over BLS12-381 G1EIP-2537
0x0DBLS12 G2ADD — add two BLS12-381 G2 pointsEIP-2537
0x0EBLS12 G2MSM — multiscalar multiplication over BLS12-381 G2EIP-2537
0x0FBLS12 PAIRING — pairing check over BLS12-381EIP-2537
0x10BLS12 MAP_FP_TO_G1 — map Fp element into BLS12-381 G1EIP-2537
0x11BLS12 MAP_FP2_TO_G2 — map Fp2 element into BLS12-381 G2EIP-2537
0x100P256VERIFY — secp256r1 ECDSA signature verificationEIP-7951 (Osaka)

Summary

Functions

execute(address, input, gas_limit)

@spec execute(non_neg_integer(), binary(), non_neg_integer()) ::
  {:ok, binary(), non_neg_integer()} | {:error, atom()}

execute(address, input, gas_limit, config)

@spec execute(non_neg_integer(), binary(), non_neg_integer(), EEVM.Config.t()) ::
  {:ok, binary(), non_neg_integer()} | {:error, atom()}

precompile?(address)

@spec precompile?(non_neg_integer()) :: boolean()

precompile?(address, config)

@spec precompile?(non_neg_integer(), EEVM.Config.t()) :: boolean()

precompile_addresses(config)

@spec precompile_addresses(EEVM.Config.t()) :: [non_neg_integer()]

registry(config)

@spec registry(EEVM.Config.t()) :: %{optional(non_neg_integer()) => module()}