EIPs Explained

EIP-7951 · Final · Core · 2025-05-27

EIP-7951: Precompile for secp256r1 Curve Support

Adds a P256VERIFY precompile at 0x100 that verifies secp256r1 (P-256) ECDSA signatures for 6900 gas, letting smart accounts use passkeys, Secure Enclave and WebAuthn keys directly on Ethereum L1.

What problem does it solve?

Ethereum accounts sign with secp256k1, but the secure hardware in phones and laptops (Apple Secure Enclave, Android Keystore, FIDO2/WebAuthn passkeys, many HSMs) uses a different curve: secp256r1, also called P-256. Verifying a P-256 signature in Solidity is possible but costs hundreds of thousands of gas, which makes "sign with Face ID" style smart wallets expensive on L1.

Many L2s already shipped a precompile for this under RIP-7212. EIP-7951 brings the same interface to L1 and fixes two edge-case bugs found in that earlier spec.

How it works

  • Address: 0x100. Gas: 6900, charged whether verification succeeds or not.
  • Input: exactly 160 bytes: hash (32) | r (32) | s (32) | qx (32) | qy (32).
  • Output: 32 bytes 0x…01 if the signature is valid; empty output for an invalid signature or any malformed input. The precompile never reverts.
  • It checks that 0 < r, s < n, that the public key coordinates are below p, that the point is on the curve and is not the point at infinity.
  • Compared with RIP-7212 it adds a check that the computed point R' is not at infinity, and compares R'.x ≡ r (mod n) instead of plain equality.

It performs verification, not public-key recovery like ECRECOVER, because that is what P-256 hardware and the NIST standard provide. It was included in the Fusaka upgrade (EIP-7607).

Sample code

Verifying a passkey signature from a contract:

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

library P256 {
    address internal constant VERIFIER = address(0x100);

    function verify(bytes32 hash, bytes32 r, bytes32 s, bytes32 qx, bytes32 qy)
        internal view returns (bool)
    {
        (bool ok, bytes memory out) =
            VERIFIER.staticcall(abi.encodePacked(hash, r, s, qx, qy));
        // Empty output means "invalid"; a chain without the precompile also returns empty.
        return ok && out.length == 32 && abi.decode(out, (uint256)) == 1;
    }
}

Things to know

  • Status is Final.
  • Same address, input and output as RIP-7212, so contracts written for L2s work unchanged; only the gas cost differs (6900 on L1 versus 3450 in RIP-7212).
  • An empty return value is ambiguous: it also happens if the precompile does not exist on that chain. Check the chain supports it before relying on it.
  • P-256 signatures are malleable (both s and n - s verify). If your app uses signatures as unique identifiers, enforce low-s yourself.
  • WebAuthn wraps the signed challenge in authenticatorData and clientDataJSON; your wallet contract must rebuild that hash before calling the precompile. It pairs naturally with ERC-4337 accounts and EIP-7702 delegated EOAs.

#precompile #secp256r1 #passkeys #webauthn #account-abstraction

Details

Authors
Carl Beekhuizen (@carlbeek), Ulaş Erdoğan (@ulerdogan), Doğan Alpaslan (@doganalpaslan)
Status
Final
Type
Standards Track / Core
Created
2025-05-27
Required by

Machine-readable: Markdown · JSON