EEVM.Precompiles.ECRecover (eevm v0.1.0)

Copy Markdown View Source

ECRecover precompile — address 0x01.

Takes a message hash and ECDSA signature tuple (v, r, s), recovers the signer public key, and converts it into an Ethereum address. Callers infer validity from output shape: successful recovery returns an address; invalid signature data returns empty bytes.

Gas schedule (Yellow Paper §E.1)

Flat 3000 gas, independent of input size.

Input format

Parsed as a normalized 128-byte frame hash(32) || v(32) || r(32) || s(32); shorter input is right-padded with zeros.

Output format

On success, returns a 32-byte word containing the recovered 20-byte address left-padded with 12 zero bytes.

On failure (invalid v/r/s, invalid signature, or recovery failure), returns an empty binary <<>> while still consuming the fixed 3000 gas.

Summary

Functions

Executes the ECRecover precompile.

Functions

execute(input, gas_limit)

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

Executes the ECRecover precompile.

Input is interpreted as hash(32) || v(32) || r(32) || s(32). If shorter than 128 bytes, the input is right-padded with zeros before parsing.