{"eip":8030,"title":"P256 algorithm support","description":"Adds an EIP-7932 algorithm type for P256 support of type `0x01`","authors":["James Kempton (@SirSpudlington)"],"status":"Draft","type":"Standards Track","category":"Core","created":"2025-09-20","requires":[7932,7951],"discussionsTo":"https://ethereum-magicians.org/t/discussion-topic-for-eip-8030/25557","repo":"EIPs","label":"EIP-8030","officialUrl":"https://eips.ethereum.org/EIPS/eip-8030","sourceUrl":"https://github.com/ethereum/EIPs/blob/master/EIPS/eip-8030.md","url":"https://eips.huatuo.xyz/eip-8030/","tldr":{"en":"Registers P256 (secp256r1) as signature algorithm type 0x01 under the EIP-7932 framework, reusing the P256 verification logic every client already ships for the EIP-7951 precompile.","ja":"EIP-7932 のフレームワークのもとで、P256（secp256r1）を署名アルゴリズムタイプ 0x01 として登録する。EIP-7951 のプリコンパイルのために、すべてのクライアントがすでに実装している P256 検証ロジックを再利用する。","ko":"EIP-7932 프레임워크 아래에서 P256(secp256r1)을 서명 알고리즘 타입 0x01로 등록하며, 모든 클라이언트가 EIP-7951 프리컴파일 때문에 이미 탑재한 P256 검증 로직을 재사용한다.","zh":"在 EIP-7932 框架下将 P256（secp256r1）注册为签名算法类型 0x01，复用每个客户端因 EIP-7951 预编译而已经实现的 P256 验证逻辑。"},"tags":["signatures","p256","secp256r1","cryptography","core"],"explainers":{"en":{"lang":"en","tldr":"Registers P256 (secp256r1) as signature algorithm type 0x01 under the EIP-7932 framework, reusing the P256 verification logic every client already ships for the EIP-7951 precompile.","tags":["signatures","p256","secp256r1","cryptography","core"],"related":[7932,7951,2],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/eip-8030/","markdown":"## What problem does it solve?\n\nEthereum accounts sign with secp256k1. [EIP-7932](/eip-7932/) proposes a framework for **secondary signature algorithms**, each identified by a one-byte type, so transactions and other objects could be signed with something else. A framework needs a first concrete algorithm to define and test against.\n\nP256 (also called secp256r1) is a widely used NIST curve, the one used by passkeys and many secure hardware chips. It is also already implemented in every execution client because of the P256 verification precompile in [EIP-7951](/eip-7951/). That makes it a low-risk first algorithm. EIP-8030 defines exactly how P256 plugs into EIP-7932.\n\n## How it works\n\nThe algorithm is registered with:\n\n| Constant | Value |\n| --- | --- |\n| `ALG_TYPE` | `0x01` |\n| `SIZE` | `129` bytes |\n\nA signature is `alg_type (1) || r (32) || s (32) || x (32) || y (32)`: the type byte, the signature, then the uncompressed public key.\n\nThe functions EIP-7932 requires:\n\n- **`verify(signature, signing_data)`**: if `signing_data` is not exactly 32 bytes it is first hashed with keccak256. The type byte is dropped, `s` must be at most `N/2` (low-s, to prevent malleability, as secp256k1 does since [EIP-2](/eip-2/)), and the EIP-7951 `P256Verify` logic must succeed. It returns the 64-byte public key `x || y`.\n- **`gas_cost(signing_data)`**: a base of 3,900 gas, defined as the EIP-7951 precompile cost minus 3,000 (the cost of the secp256k1 `ecrecover` precompile). Non-32-byte data adds keccak cost: `30 + 6 * words`.\n- **`validate`**: a no-op.\n- **`merge_detached_signature`**: concatenates `r || s` with `x || y`.\n\nUnlike secp256k1, P256 cannot recover the public key from a signature alone, which is why the key travels inside the 129 bytes.\n\n## Sample code\n\nBuilding the 129-byte signature in TypeScript with `@noble/curves`:\n\n```ts\nimport { p256 } from \"@noble/curves/p256\";\nimport { keccak_256 } from \"@noble/hashes/sha3\";\nimport { concatBytes } from \"@noble/hashes/utils\";\n\nconst priv = p256.utils.randomPrivateKey();\nconst pubUncompressed = p256.getPublicKey(priv, false); // 0x04 || x || y\n\nconst digest = keccak_256(message);                      // 32-byte signing data\nconst sig = p256.sign(digest, priv, { lowS: true });     // enforce s \u003c= N/2\n\nconst encoded = concatBytes(\n  new Uint8Array([0x01]),                                // ALG_TYPE\n  sig.toCompactRawBytes(),                               // r || s (64 bytes)\n  pubUncompressed.slice(1),                              // x || y (64 bytes)\n);\nconsole.log(encoded.length); // 129\n```\n\n## Things to know\n\n- **Status: Draft**, and it depends on [EIP-7932](/eip-7932/), which is also Draft. Nothing here is usable on mainnet until both are adopted.\n- The [EIP-7951](/eip-7951/) precompile, which this reuses, is separate: it lets contracts verify P256 signatures today. EIP-8030 is about P256 as a signature type at the protocol level.\n- The spec states its main purpose is to give EIP-7932 a known-safe algorithm for test cases.\n- Signatures must use low-s form; many P256 libraries do not normalise `s` by default.\n- Security considerations are still marked \"Needs discussion\".\n"},"ja":{"lang":"ja","tldr":"EIP-7932 のフレームワークのもとで、P256（secp256r1）を署名アルゴリズムタイプ 0x01 として登録する。EIP-7951 のプリコンパイルのために、すべてのクライアントがすでに実装している P256 検証ロジックを再利用する。","tags":["signatures","p256","secp256r1","cryptography","core"],"related":[7932,7951,2],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ja/eip-8030/","markdown":"## 何を解決するのか\n\nEthereum のアカウントは secp256k1 で署名します。[EIP-7932](/eip-7932/) は、1 バイトのタイプで識別される**セカンダリ署名アルゴリズム**のフレームワークを提案しており、これによりトランザクションやその他のオブジェクトを別のアルゴリズムで署名できるようになります。フレームワークには、定義とテストの対象となる最初の具体的なアルゴリズムが必要です。\n\nP256（secp256r1 とも呼ばれます）は広く使われている NIST 曲線で、パスキーや多くのセキュアハードウェアチップが使っています。また、[EIP-7951](/eip-7951/) の P256 検証プリコンパイルのおかげで、すべての実行クライアントにすでに実装されています。そのため、リスクの低い最初のアルゴリズムになります。EIP-8030 は、P256 を EIP-7932 にどう組み込むかを正確に定義します。\n\n## 仕組み\n\nこのアルゴリズムは次の値で登録されます。\n\n| 定数 | 値 |\n| --- | --- |\n| `ALG_TYPE` | `0x01` |\n| `SIZE` | `129` バイト |\n\n署名は `alg_type (1) || r (32) || s (32) || x (32) || y (32)` です。つまり、タイプバイト、署名、そして非圧縮形式の公開鍵の順に並びます。\n\nEIP-7932 が要求する関数は次のとおりです。\n\n- **`verify(signature, signing_data)`**: `signing_data` がちょうど 32 バイトでない場合は、まず keccak256 でハッシュされます。タイプバイトは取り除かれ、`s` は `N/2` 以下でなければならず（malleability を防ぐための low-s。secp256k1 では [EIP-2](/eip-2/) 以降同様）、EIP-7951 の `P256Verify` ロジックが成功する必要があります。64 バイトの公開鍵 `x || y` を返します。\n- **`gas_cost(signing_data)`**: 基本コストは 3,900 ガスで、これは EIP-7951 のプリコンパイルのコストから 3,000（secp256k1 の `ecrecover` プリコンパイルのコスト）を引いた値として定義されています。32 バイトでないデータには keccak のコスト `30 + 6 * words` が加算されます。\n- **`validate`**: 何もしません。\n- **`merge_detached_signature`**: `r || s` と `x || y` を連結します。\n\nsecp256k1 と違い、P256 は署名だけから公開鍵を復元できません。そのため、公開鍵が 129 バイトの中に含まれています。\n\n## サンプルコード\n\n`@noble/curves` を使って TypeScript で 129 バイトの署名を組み立てる:\n\n```ts\nimport { p256 } from \"@noble/curves/p256\";\nimport { keccak_256 } from \"@noble/hashes/sha3\";\nimport { concatBytes } from \"@noble/hashes/utils\";\n\nconst priv = p256.utils.randomPrivateKey();\nconst pubUncompressed = p256.getPublicKey(priv, false); // 0x04 || x || y\n\nconst digest = keccak_256(message);                      // 32-byte signing data\nconst sig = p256.sign(digest, priv, { lowS: true });     // enforce s \u003c= N/2\n\nconst encoded = concatBytes(\n  new Uint8Array([0x01]),                                // ALG_TYPE\n  sig.toCompactRawBytes(),                               // r || s (64 bytes)\n  pubUncompressed.slice(1),                              // x || y (64 bytes)\n);\nconsole.log(encoded.length); // 129\n```\n\n## 知っておくべきこと\n\n- **ステータス: Draft。** さらに、同じく Draft の [EIP-7932](/eip-7932/) に依存しています。両方が採用されるまで、メインネットでは何も使えません。\n- ここで再利用している [EIP-7951](/eip-7951/) のプリコンパイルは別物で、現時点でコントラクトが P256 署名を検証できるようにするものです。EIP-8030 は、プロトコルレベルでの署名タイプとしての P256 を扱います。\n- 仕様は、主な目的は EIP-7932 のテストケース用に、安全性が確認されたアルゴリズムを提供することだと述べています。\n- 署名は low-s 形式でなければなりません。多くの P256 ライブラリは、デフォルトでは `s` を正規化しません。\n- セキュリティに関する考慮事項は、まだ「Needs discussion」とされています。\n"},"ko":{"lang":"ko","tldr":"EIP-7932 프레임워크 아래에서 P256(secp256r1)을 서명 알고리즘 타입 0x01로 등록하며, 모든 클라이언트가 EIP-7951 프리컴파일 때문에 이미 탑재한 P256 검증 로직을 재사용한다.","tags":["signatures","p256","secp256r1","cryptography","core"],"related":[7932,7951,2],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ko/eip-8030/","markdown":"## 어떤 문제를 해결하나요?\n\n이더리움 계정은 secp256k1으로 서명합니다. [EIP-7932](/eip-7932/)는 1바이트 타입으로 식별되는 **보조 서명 알고리즘**의 프레임워크를 제안하며, 이를 통해 트랜잭션과 다른 객체를 다른 알고리즘으로 서명할 수 있게 됩니다. 프레임워크에는 정의하고 테스트할 첫 번째 구체적인 알고리즘이 필요합니다.\n\nP256(secp256r1이라고도 함)은 널리 쓰이는 NIST 곡선으로, 패스키와 많은 보안 하드웨어 칩이 사용합니다. 또한 [EIP-7951](/eip-7951/)의 P256 검증 프리컴파일 덕분에 모든 실행 클라이언트에 이미 구현되어 있습니다. 그래서 위험이 낮은 첫 번째 알고리즘이 됩니다. EIP-8030은 P256이 EIP-7932에 어떻게 끼워지는지를 정확히 정의합니다.\n\n## 어떻게 동작하나요?\n\n이 알고리즘은 다음 값으로 등록됩니다.\n\n| 상수 | 값 |\n| --- | --- |\n| `ALG_TYPE` | `0x01` |\n| `SIZE` | `129` 바이트 |\n\n서명은 `alg_type (1) || r (32) || s (32) || x (32) || y (32)`입니다. 타입 바이트, 서명, 그리고 압축하지 않은 공개 키 순서입니다.\n\nEIP-7932가 요구하는 함수는 다음과 같습니다.\n\n- **`verify(signature, signing_data)`**: `signing_data`가 정확히 32바이트가 아니면 먼저 keccak256으로 해시합니다. 타입 바이트는 제거되고, `s`는 `N/2` 이하여야 하며(가변성을 막기 위한 low-s로, secp256k1도 [EIP-2](/eip-2/) 이후 마찬가지입니다), EIP-7951의 `P256Verify` 로직이 성공해야 합니다. 64바이트 공개 키 `x || y`를 반환합니다.\n- **`gas_cost(signing_data)`**: 기본 비용은 3,900 가스이며, EIP-7951 프리컴파일 비용에서 3,000(secp256k1 `ecrecover` 프리컴파일의 비용)을 뺀 값으로 정의됩니다. 32바이트가 아닌 데이터에는 keccak 비용 `30 + 6 * words`가 추가됩니다.\n- **`validate`**: 아무 동작도 하지 않습니다.\n- **`merge_detached_signature`**: `r || s`와 `x || y`를 이어 붙입니다.\n\nsecp256k1과 달리 P256은 서명만으로는 공개 키를 복구할 수 없으며, 그래서 키가 129바이트 안에 함께 들어갑니다.\n\n## 샘플 코드\n\nTypeScript와 `@noble/curves`로 129바이트 서명 만들기:\n\n```ts\nimport { p256 } from \"@noble/curves/p256\";\nimport { keccak_256 } from \"@noble/hashes/sha3\";\nimport { concatBytes } from \"@noble/hashes/utils\";\n\nconst priv = p256.utils.randomPrivateKey();\nconst pubUncompressed = p256.getPublicKey(priv, false); // 0x04 || x || y\n\nconst digest = keccak_256(message);                      // 32-byte signing data\nconst sig = p256.sign(digest, priv, { lowS: true });     // enforce s \u003c= N/2\n\nconst encoded = concatBytes(\n  new Uint8Array([0x01]),                                // ALG_TYPE\n  sig.toCompactRawBytes(),                               // r || s (64 bytes)\n  pubUncompressed.slice(1),                              // x || y (64 bytes)\n);\nconsole.log(encoded.length); // 129\n```\n\n## 알아둘 점\n\n- **상태: Draft**이며, 마찬가지로 Draft인 [EIP-7932](/eip-7932/)에 의존합니다. 둘 다 채택되기 전까지는 여기 있는 어떤 것도 메인넷에서 쓸 수 없습니다.\n- 여기서 재사용하는 [EIP-7951](/eip-7951/) 프리컴파일은 별개로, 컨트랙트가 오늘 P256 서명을 검증할 수 있게 해 줍니다. EIP-8030은 프로토콜 수준에서의 서명 타입으로서의 P256에 관한 것입니다.\n- 명세는 주된 목적이 EIP-7932에 테스트 케이스용으로 안전성이 알려진 알고리즘을 제공하는 것이라고 밝힙니다.\n- 서명은 low-s 형태여야 합니다. 많은 P256 라이브러리는 기본적으로 `s`를 정규화하지 않습니다.\n- 보안 고려 사항은 아직 \"Needs discussion\"으로 표시되어 있습니다.\n"},"zh":{"lang":"zh","tldr":"在 EIP-7932 框架下将 P256（secp256r1）注册为签名算法类型 0x01，复用每个客户端因 EIP-7951 预编译而已经实现的 P256 验证逻辑。","tags":["signatures","p256","secp256r1","cryptography","core"],"related":[7932,7951,2],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/zh/eip-8030/","markdown":"## 它解决什么问题？\n\n以太坊账户使用 secp256k1 签名。[EIP-7932](/eip-7932/) 提出了一个**次级签名算法**框架，每种算法由一个字节的类型标识，这样交易和其他对象就可以用别的算法签名。一个框架需要第一个具体的算法来进行定义和测试。\n\nP256（也称 secp256r1）是一条被广泛使用的 NIST 曲线，通行密钥（passkey）和许多安全硬件芯片都使用它。由于 [EIP-7951](/eip-7951/) 中的 P256 验证预编译，每个执行客户端也已经实现了它。这使它成为一个低风险的首个算法。EIP-8030 精确定义了 P256 如何接入 EIP-7932。\n\n## 它如何运作\n\n该算法以如下参数注册：\n\n| 常量 | 值 |\n| --- | --- |\n| `ALG_TYPE` | `0x01` |\n| `SIZE` | `129` 字节 |\n\n签名格式为 `alg_type (1) || r (32) || s (32) || x (32) || y (32)`：类型字节、签名，然后是未压缩的公钥。\n\nEIP-7932 要求的函数：\n\n- **`verify(signature, signing_data)`**：如果 `signing_data` 不是恰好 32 字节，则先用 keccak256 对其哈希。去掉类型字节，`s` 必须不大于 `N/2`（low-s，用于防止可塑性，secp256k1 自 [EIP-2](/eip-2/) 起也是如此），并且 EIP-7951 的 `P256Verify` 逻辑必须通过。它返回 64 字节的公钥 `x || y`。\n- **`gas_cost(signing_data)`**：基础值为 3,900 gas，定义为 EIP-7951 预编译的成本减去 3,000（secp256k1 `ecrecover` 预编译的成本）。非 32 字节的数据会加上 keccak 的成本：`30 + 6 * words`。\n- **`validate`**：空操作。\n- **`merge_detached_signature`**：将 `r || s` 与 `x || y` 拼接起来。\n\n与 secp256k1 不同，P256 无法仅凭签名恢复公钥，这就是公钥要包含在这 129 字节中的原因。\n\n## 示例代码\n\n用 TypeScript 和 `@noble/curves` 构造 129 字节的签名：\n\n```ts\nimport { p256 } from \"@noble/curves/p256\";\nimport { keccak_256 } from \"@noble/hashes/sha3\";\nimport { concatBytes } from \"@noble/hashes/utils\";\n\nconst priv = p256.utils.randomPrivateKey();\nconst pubUncompressed = p256.getPublicKey(priv, false); // 0x04 || x || y\n\nconst digest = keccak_256(message);                      // 32-byte signing data\nconst sig = p256.sign(digest, priv, { lowS: true });     // enforce s \u003c= N/2\n\nconst encoded = concatBytes(\n  new Uint8Array([0x01]),                                // ALG_TYPE\n  sig.toCompactRawBytes(),                               // r || s (64 bytes)\n  pubUncompressed.slice(1),                              // x || y (64 bytes)\n);\nconsole.log(encoded.length); // 129\n```\n\n## 需要注意\n\n- **状态：Draft**，并且依赖同样处于 Draft 的 [EIP-7932](/eip-7932/)。在两者都被采纳之前，这里的任何内容都无法在主网上使用。\n- 这里复用的 [EIP-7951](/eip-7951/) 预编译是另一回事：它让合约今天就能验证 P256 签名。EIP-8030 讨论的是 P256 作为协议层面的签名类型。\n- 规范指出，其主要目的是为 EIP-7932 提供一个已知安全的算法用于测试用例。\n- 签名必须使用 low-s 形式；许多 P256 库默认不会规范化 `s`。\n- 安全考量仍标记为\"Needs discussion\"。\n"}}}
