---
eip: 7951
label: EIP-7951
title: Precompile for secp256r1 Curve Support
status: Final
type: Standards Track
category: Core
created: 2025-05-27
official: https://eips.ethereum.org/EIPS/eip-7951
source: https://github.com/ethereum/EIPs/blob/master/EIPS/eip-7951.md
canonical: https://eips.huatuo.xyz/eip-7951/
lang: en
tldr: 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.
tags: [precompile, secp256r1, passkeys, webauthn, account-abstraction]
---

# EIP-7951: Precompile for secp256r1 Curve Support

> Add precompiled contract for secp256r1 ECDSA signature verification with proper security checks

**TL;DR:** 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](/eip-7607/)).

## Sample code

Verifying a passkey signature from a contract:

```solidity
// 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](/eip-4337/) accounts and [EIP-7702](/eip-7702/) delegated EOAs.


---

This is an unofficial plain-language summary. Read the full specification: https://eips.ethereum.org/EIPS/eip-7951
