Introduction

Hi, I'm cardene, a software engineer and technical writer focused on blockchain and AI.

I've also authored Japanese technical books on specification-driven development with LLMs and decentralized application (DApp) development.

I also build and publish a variety of tools, libraries, and open-source projects.

EIP-7951 introduces a precompile for verifying secp256r1 (P-256) signatures in Ethereum. It makes it practical for smart contracts to verify signatures produced by hardware-backed keys and WebAuthn authenticators, including devices such as iPhones.

This article translates, summarizes, and explains the original proposal.

Other EIP, BIP, SLIP, CAIP, ENSIP, RFC, and ACP proposals are covered here.

Overview

EIP-7951 introduces a precompile for efficient ECDSA signature verification on the secp256r1 elliptic curve, also known as P-256 or prime256v1. A precompile exposes a predefined operation implemented directly by the Ethereum client, rather than requiring the same computation to be performed entirely in EVM bytecode.

This makes it possible to verify the cryptographic signatures produced by Apple's Secure Enclave, Android Keystore, and FIDO2/WebAuthn authenticators on Ethereum. It also addresses correctness issues identified in RIP-7212 while preserving the calling interface used by existing Layer 2 implementations.

The precompile verifies the P-256 signature itself. Applications using WebAuthn must still validate the authenticator data, client data, challenge, and other relevant authentication conditions.

Motivation

The secp256r1 curve is widely used in modern secure hardware and authentication systems. Standardized by the US National Institute of Standards and Technology (NIST), it has been deployed for many years.

Examples of systems that support the curve include:

  • Apple Secure Enclave
  • Android Keystore
  • Hardware security modules (HSMs)
  • Trusted execution environments (TEEs)
  • FIDO2 and WebAuthn authenticators

Native support for P-256 verification allows users to authorize Ethereum smart account operations using compatible devices they already own. Biometric authentication or other local authentication mechanisms can authorize use of hardware-backed keys, reducing the burden of managing conventional wallet keys.

Potential use cases include:

  • Device-native signing Authorizing Ethereum operations using keys already available on a user's device.
  • Multifactor authentication Combining multiple devices or authentication mechanisms to enforce additional authorization requirements.
  • Simpler key management Reducing some of the risks and operational burden associated with traditional private-key management.

These use cases generally require an account or contract that explicitly accepts P-256 signatures; they do not replace the signature rules for conventional Ethereum transactions sent from EOAs.

P-256 is already supported by various blockchains and protocols. Supporting it in Ethereum also improves interoperability with those systems.

Specification

Precompile

The new precompile, P256VERIFY, is located at address 0x100. It performs ECDSA signature verification on secp256r1 and costs 6900 gas.

Curve parameters

The NIST-standardized secp256r1 curve is defined by the following parameters.

Parameter Value
Base field modulus (p) 0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff
Curve equation y² = x³ + ax + b (mod p)
Coefficient a 0xffffffff00000001000000000000000000000000fffffffffffffffffffffffc
Coefficient b 0x5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b
Generator G (x-coordinate) 0x6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296
Generator G (y-coordinate) 0x4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5
Subgroup order n 0xffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551
Cofactor h 0x1

These parameters are specified in NIST SP 800-186.

Field and group

  • Finite field Fp The finite field of order p, represented by integers from 0 through p−1.
  • Group G The points (x, y) over Fp satisfying the curve equation, together with the point at infinity.

Points and encoding

  1. Field element encoding Each field element is represented as a 32-byte big-endian integer strictly less than p.
  2. Group point encoding The x- and y-coordinates are encoded as 32 bytes each and concatenated to form a 64-byte value.
  3. Point at infinity encoding Since (0, 0) is not on the curve, 64 zero bytes represent the point at infinity.
  4. Scalar encoding Scalars are encoded as 32-byte big-endian integers. The general encoding need not restrict values to the subgroup order n, but the ECDSA signature components have the stricter bounds specified below.

Invalid inputs

For invalid inputs, including malformed encodings or points not on the curve, the precompile returns empty output rather than reverting due to the invalid input.

P256VERIFY ABI

Input format

The input consists of exactly 160 bytes, obtained by concatenating the following fields in order.

Size Content
32 bytes Message hash h
32 bytes Signature component r
32 bytes Signature component s
32 bytes Public key x-coordinate qx
32 bytes Public key y-coordinate qy

Output format

Result Output
Valid signature 32-byte value 0x...01
Invalid signature or input Empty output

Input validation

The precompile checks the following conditions and returns failure if any is violated.

  1. The input must be exactly 160 bytes.
  2. Signature components r and s must satisfy 0 < r < n and 0 < s < n.
  3. Public key coordinates qx and qy must satisfy 0 ≤ qx < p and 0 ≤ qy < p.
  4. The point (qx, qy) must satisfy the curve equation.
  5. The point (qx, qy) must not be the point at infinity.

Signature verification algorithm

python
# 入力検証
if input_length != 160:
    return
if not (0 < r < n and 0 < s < n):
    return
if not (0 ≤ qx < p and 0 ≤ qy < p):
    return 
if qy^2 ≢ qx^3 + a*qx + b (mod p):
    return
if (qx, qy) == (0, 0):
    return

# 署名検証
s1 = s^(-1) (mod n)

# 署名時のランダム点を再計算
R' = (h * s1) * G + (r * s1) * (qx, qy)

# 無限遠点チェック
if R' is the point at infinity:
    return

# x座標を抽出
r' = R'.x

# rとの比較
if r' ≡ r (mod n):
    return 0x...01
else:
    return

Error cases

  • Input length other than 160 bytes.
  • Field element encoding representing a value greater than or equal to p.
  • Out-of-range r or s.
  • Invalid public key or point at infinity.
  • Signature verification failure.

Gas schedule

P256VERIFY costs 6900 gas, compared with 3000 gas for the existing ECRECOVER precompile. The higher cost reflects benchmark results indicating that P-256 verification requires more computation.

Gas consumption on failure

Invalid inputs and invalid signatures produce empty output rather than a revert caused by the verification result. They incur the same precompile gas charge as successful verification, providing consistent gas accounting.

Rationale

Security fixes

EIP-7951 addresses two correctness issues in the earlier RIP-7212 proposal.

Checking for the point at infinity

RIP-7212 did not explicitly check whether the point R′ derived during signature verification was the point at infinity.

The point at infinity requires special handling in elliptic curve arithmetic. Without an explicit check, different implementations could interpret the result differently. If Ethereum clients disagree on whether the signature is valid, the discrepancy could lead to a consensus divergence.

EIP-7951 explicitly requires verification to fail when R′ is the point at infinity.

Correcting the modular comparison

The earlier RIP-7212 verification rule used a direct comparison, r' == r. The correct ECDSA comparison is r' ≡ r (mod n), because the x-coordinate of R′ may exceed the subgroup order n.

Reducing the coordinate modulo n before comparison makes the algorithm consistent with ECDSA and avoids incorrectly rejecting otherwise valid signatures in those boundary cases.

Verification versus recovery

Unlike ECRECOVER, EIP-7951 takes a public key and verifies a signature against it rather than recovering a public key or address from the signature.

The proposal gives several reasons for this choice.

  • Compatibility with existing implementations Hardware and software supporting secp256r1 generally expose standard signature-generation and verification mechanisms rather than public-key recovery.
  • Standards compliance NIST FIPS 186-5 specifies ECDSA signature verification, not a public-key recovery interface.
  • Efficiency Verification can avoid the additional work and recovery-specific information required by public-key recovery.
  • Hardware support Systems such as Apple's Secure Enclave and FIDO2 devices use ordinary P-256 key pairs and signatures, making verification against a known public key a natural fit.

Why 6900 gas?

The proposed gas cost of P256VERIFY is 6900 gas.

This differs from both ECRECOVER at 3000 gas and the original RIP-7212 gas schedule. Benchmarks indicated that P-256 signature verification imposes a substantially higher computational cost than ECRECOVER in the measured implementations.

The cost is therefore based on implementation measurements rather than simply copying the gas charge of another signature-related precompile.

Compatibility

EIP-7951 retains the calling interface of RIP-7212 implementations already deployed on Layer 2 networks. The address, input layout, output format, and meaning of the result remain compatible, allowing existing calling bytecode to use the precompile without changing its ABI.

However, callers must account for the different gas charge and the corrected behavior in edge cases. Code that forwards only the original RIP-7212 gas allowance may need to be adjusted.

Interface compatibility

The main compatibility properties are summarized below. The calling interface remains the same, while the gas schedule changes to reflect the implementation benchmarks.

Property EIP-7951 RIP-7212 Compatibility
Precompile address 0x100 0x100 Identical
Input format 160 bytes (h‖r‖s‖qx‖qy) 160 bytes Identical
Output format 32 bytes on success 32 bytes on success Identical
Result 0x…01 on success; empty on failure Same Identical interface
Gas cost 6900 gas 3450 gas Different; reflects benchmarks

Security considerations

Cryptographic security

The secp256r1 curve provides approximately 128-bit classical security, comparable to the security level of secp256k1, which Ethereum conventionally uses.

Its parameters are standardized in NIST SP 800-186 and have been subject to extensive cryptographic analysis. RIP-7212 deployments on Layer 2 networks also provide practical experience with P-256 verification.

Malleability

Signature malleability means that a signature can be modified into another representation that still validates.

For ECDSA, the signatures (r, s) and (r, n−s) can both be valid for the same message and public key. Ethereum transaction signatures on secp256k1 use a low-S restriction, but ordinary ECDSA verification under FIPS 186-5 does not require this restriction.

Applications requiring a canonical signature representation must implement their own additional rule, such as requiring s ≤ n/2. This can be enforced by the calling contract or authentication layer.

EIP-7951 provides standard verification rather than imposing an application-specific non-malleability policy. Applications should not rely on signature bytes alone as a unique identifier for an authorization.

Side-channel resistance

A side-channel attack attempts to infer sensitive information from observable properties such as execution time or power consumption rather than from the intended output.

One mitigation is a constant-time algorithm, designed to avoid data-dependent execution timing for sensitive operations.

EIP-7951 does not require every operation to use a constant-time implementation. Its precompile processes public verification inputs, and the specification focuses on the observable verification behavior rather than prescribing a particular implementation strategy.

Implementers may consider additional safeguards according to their threat model, including appropriate isolation or rate controls in surrounding services. Secret-key operations performed by signing devices have separate side-channel security requirements.

Citation

Carl Beekhuizen (@carlbeek), Ulaş Erdoğan (@ulerdogan), Doğan Alpaslan (@doganalpaslan), "EIP-7951: Precompile for secp256r1 Curve Support [DRAFT]," Ethereum Improvement Proposals, no. 7951, May 2025. [Online serial]. Available: https://eips.ethereum.org/EIPS/eip-7951.

Conclusion

EIP-7951 makes P-256 signature verification available through an EVM precompile, enabling compatible smart accounts to use hardware-backed keys and WebAuthn signatures without implementing the entire elliptic curve verification algorithm in Solidity.

The article describes the specification covered in the original September 2025 article. Its historical draft citation is retained; deployment status and availability on a particular chain should be checked separately.

Questions are welcome through Twitter direct messages.

Twitter @cardene777

I also publish on the following platforms.

https://chaldene.net/