{"eip":665,"title":"Add precompiled contract for Ed25519 signature verification","description":"Support performant and cheap verification of Ed25519 cryptographic signatures in smart contracts in general by adding a precompiled contract for Ed25519 signature verification to the EVM.","authors":["Tobias Oberstein \u003ctobias.oberstein@crossbario.com\u003e"],"status":"Stagnant","type":"Standards Track","category":"Core","created":"2018-03-25","repo":"EIPs","label":"EIP-665","officialUrl":"https://eips.ethereum.org/EIPS/eip-665","sourceUrl":"https://github.com/ethereum/EIPs/blob/master/EIPS/eip-665.md","url":"https://eips.huatuo.xyz/eip-665/","tldr":{"en":"Proposed a cheap precompiled contract for verifying Ed25519 signatures in the EVM, so contracts could check signatures from SSH, DNSSEC, TLS and Ed25519-based blockchains.","ja":"EVM で Ed25519 署名を検証する安価なプリコンパイル済みコントラクトの提案。SSH、DNSSEC、TLS、Ed25519 ベースのブロックチェーンの署名をコントラクトから確認できるようにするもの。","ko":"EVM에서 Ed25519 서명을 검증하는 저렴한 프리컴파일 컨트랙트 제안. SSH, DNSSEC, TLS, Ed25519 기반 블록체인의 서명을 컨트랙트가 확인할 수 있게 하려는 것이었다.","zh":"提议增加一个廉价的预编译合约，用于在 EVM 中验证 Ed25519 签名，使合约能够检查来自 SSH、DNSSEC、TLS 以及基于 Ed25519 的区块链的签名。"},"tags":["precompile","cryptography","ed25519","signatures","core"],"explainers":{"en":{"lang":"en","tldr":"Proposed a cheap precompiled contract for verifying Ed25519 signatures in the EVM, so contracts could check signatures from SSH, DNSSEC, TLS and Ed25519-based blockchains.","tags":["precompile","cryptography","ed25519","signatures","core"],"related":[152,7951,2537],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/eip-665/","markdown":"## What problem does it solve?\n\nEthereum natively verifies only secp256k1 signatures (via `ecrecover`). Much of the wider world signs with **Ed25519**, including OpenSSH keys, DNSSEC, TLS certificates, OpenPGP, software-signing tools and several proof-of-stake blockchains. You can verify Ed25519 in plain EVM bytecode, but its wide-word arithmetic is a poor fit for the EVM, so gas costs are very high.\n\nA precompile would let contracts:\n\n- prove that one person controls both an Ethereum account and an off-chain Ed25519 key (a server, a domain, an SSH identity),\n- accept Ed25519-signed data relayed by any sender,\n- verify headers or messages from Ed25519-based chains.\n\n## How it works\n\nThe proposal adds a precompile `ED25519VFY`:\n\n| Item | Value |\n| --- | --- |\n| Address | `0x09` |\n| Input | 128 bytes: 32-byte message, 32-byte public key, 64-byte signature |\n| Output | 4 bytes: `0x00000000` if valid, any non-zero value if invalid |\n| Gas | 2000 (cheaper than `ecrecover`'s 3000, since Ed25519 is faster) |\n\nUnlike `ecrecover`, the public key must be passed in, because Ed25519 does not let you recover a key from a signature. A zero return means success, so different non-zero codes can signal different failure reasons.\n\nTo avoid consensus bugs between clients, the author recommended every client use **libsodium** (or its bindings), and pointed to the IETF and NaCl test vectors. Implementation PRs were opened for Geth, Parity, pyethereum and cpp-ethereum.\n\n## Sample code\n\nHow a contract **would** have called it. This is hypothetical. On mainnet, address `0x09` is a different precompile, so this code does not work.\n\n```solidity\n// SPDX-License-Identifier: MIT\npragma solidity ^0.8.20;\n\nlibrary Ed25519Proposed {\n    address constant ED25519VFY = address(0x09); // as proposed in EIP-665 only\n\n    function verify(bytes32 message, bytes32 pubKey, bytes memory sig)\n        internal view returns (bool)\n    {\n        require(sig.length == 64, \"bad sig length\");\n        (bool ok, bytes memory out) =\n            ED25519VFY.staticcall(abi.encodePacked(message, pubKey, sig));\n        return ok \u0026\u0026 out.length == 4 \u0026\u0026 bytes4(out) == bytes4(0);\n    }\n}\n```\n\n## Things to know\n\n- This proposal is **Stagnant** and was never adopted. Ethereum mainnet has no Ed25519 precompile.\n- The address it asked for, `0x09`, was later assigned to the BLAKE2 compression function ([EIP-152](/eip-152/)).\n- The message input is a fixed 32 bytes, so callers would typically sign a hash rather than arbitrary-length data.\n- Other curve precompiles did ship later: [EIP-2537](/eip-2537/) for BLS12-381 and [EIP-7951](/eip-7951/) for secp256r1 (P-256, used by passkeys). Without a precompile, Ed25519 verification in Solidity is possible but costly.\n"},"ja":{"lang":"ja","tldr":"EVM で Ed25519 署名を検証する安価なプリコンパイル済みコントラクトの提案。SSH、DNSSEC、TLS、Ed25519 ベースのブロックチェーンの署名をコントラクトから確認できるようにするもの。","tags":["precompile","cryptography","ed25519","signatures","core"],"related":[152,7951,2537],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ja/eip-665/","markdown":"## 何を解決するのか\n\nEthereum がネイティブに検証できるのは secp256k1 署名（`ecrecover` 経由）だけです。一方、外の世界の多くは **Ed25519** で署名しており、OpenSSH の鍵、DNSSEC、TLS 証明書、OpenPGP、ソフトウェア署名ツール、いくつかのプルーフ・オブ・ステークのブロックチェーンなどが含まれます。Ed25519 は通常の EVM バイトコードでも検証できますが、幅の広いワードの演算は EVM に向いておらず、ガスコストが非常に高くなります。\n\nプリコンパイルがあれば、コントラクトは次のことができます。\n\n- ある人が Ethereum アカウントとオフチェーンの Ed25519 鍵（サーバー、ドメイン、SSH アイデンティティ）の両方を管理していることを証明する\n- 任意の送信者が中継した Ed25519 署名付きデータを受け入れる\n- Ed25519 ベースのチェーンのヘッダーやメッセージを検証する\n\n## 仕組み\n\nこの提案は `ED25519VFY` というプリコンパイルを追加します。\n\n| 項目 | 値 |\n| --- | --- |\n| アドレス | `0x09` |\n| 入力 | 128 バイト: 32 バイトのメッセージ、32 バイトの公開鍵、64 バイトの署名 |\n| 出力 | 4 バイト: 有効なら `0x00000000`、無効ならゼロ以外の任意の値 |\n| ガス | 2000（Ed25519 のほうが高速なため、`ecrecover` の 3000 より安い） |\n\n`ecrecover` と違い、Ed25519 では署名から鍵を復元できないため、公開鍵を渡す必要があります。戻り値がゼロなら成功を意味するので、ゼロ以外の異なるコードで異なる失敗理由を示せます。\n\nクライアント間のコンセンサスバグを避けるため、作者はすべてのクライアントが **libsodium**（またはそのバインディング）を使うことを推奨し、IETF と NaCl のテストベクターを示しました。Geth、Parity、pyethereum、cpp-ethereum には実装の PR が出されました。\n\n## サンプルコード\n\nコントラクトがこれをどのように呼び出す**はずだったか**を示します。これは仮定の話です。メインネットではアドレス `0x09` は別のプリコンパイルなので、このコードは動作しません。\n\n```solidity\n// SPDX-License-Identifier: MIT\npragma solidity ^0.8.20;\n\nlibrary Ed25519Proposed {\n    address constant ED25519VFY = address(0x09); // EIP-665 の提案内容のみ\n\n    function verify(bytes32 message, bytes32 pubKey, bytes memory sig)\n        internal view returns (bool)\n    {\n        require(sig.length == 64, \"bad sig length\");\n        (bool ok, bytes memory out) =\n            ED25519VFY.staticcall(abi.encodePacked(message, pubKey, sig));\n        return ok \u0026\u0026 out.length == 4 \u0026\u0026 bytes4(out) == bytes4(0);\n    }\n}\n```\n\n## 知っておくべきこと\n\n- この提案は **Stagnant** で、採用されることはありませんでした。Ethereum メインネットに Ed25519 のプリコンパイルはありません。\n- この提案が求めたアドレス `0x09` は、後に BLAKE2 圧縮関数（[EIP-152](/eip-152/)）に割り当てられました。\n- メッセージ入力は固定の 32 バイトなので、呼び出し側は任意長のデータではなく、通常はハッシュに署名することになります。\n- 他の曲線のプリコンパイルは後にリリースされました。BLS12-381 向けの [EIP-2537](/eip-2537/) と、secp256r1（P-256、パスキーで使用）向けの [EIP-7951](/eip-7951/) です。プリコンパイルがなくても Solidity で Ed25519 検証を行うことは可能ですが、コストが高くなります。\n"},"ko":{"lang":"ko","tldr":"EVM에서 Ed25519 서명을 검증하는 저렴한 프리컴파일 컨트랙트 제안. SSH, DNSSEC, TLS, Ed25519 기반 블록체인의 서명을 컨트랙트가 확인할 수 있게 하려는 것이었다.","tags":["precompile","cryptography","ed25519","signatures","core"],"related":[152,7951,2537],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ko/eip-665/","markdown":"## 어떤 문제를 해결하나요?\n\n이더리움이 기본적으로 검증하는 것은 secp256k1 서명(`ecrecover`를 통해)뿐입니다. 하지만 바깥 세상의 많은 곳은 **Ed25519**로 서명하며, OpenSSH 키, DNSSEC, TLS 인증서, OpenPGP, 소프트웨어 서명 도구, 여러 지분 증명(proof-of-stake) 블록체인이 여기에 해당합니다. 일반 EVM 바이트코드로도 Ed25519를 검증할 수 있지만, 넓은 워드 연산은 EVM에 잘 맞지 않아 가스 비용이 매우 높습니다.\n\n프리컴파일이 있다면 컨트랙트는 다음을 할 수 있습니다.\n\n- 한 사람이 이더리움 계정과 오프체인 Ed25519 키(서버, 도메인, SSH 신원)를 모두 제어한다는 것을 증명\n- 어떤 발신자가 중계했든 Ed25519로 서명된 데이터를 수락\n- Ed25519 기반 체인의 헤더나 메시지를 검증\n\n## 어떻게 동작하나요?\n\n이 제안은 프리컴파일 `ED25519VFY`를 추가합니다.\n\n| 항목 | 값 |\n| --- | --- |\n| 주소 | `0x09` |\n| 입력 | 128바이트: 32바이트 메시지, 32바이트 공개 키, 64바이트 서명 |\n| 출력 | 4바이트: 유효하면 `0x00000000`, 유효하지 않으면 0이 아닌 아무 값 |\n| 가스 | 2000(Ed25519가 더 빠르기 때문에 `ecrecover`의 3000보다 저렴) |\n\n`ecrecover`와 달리 Ed25519는 서명에서 키를 복구할 수 없기 때문에 공개 키를 직접 전달해야 합니다. 반환값이 0이면 성공을 뜻하므로, 0이 아닌 서로 다른 코드로 서로 다른 실패 사유를 나타낼 수 있습니다.\n\n클라이언트 간 합의 버그를 피하기 위해 작성자는 모든 클라이언트가 **libsodium**(또는 그 바인딩)을 사용하도록 권장했고, IETF와 NaCl의 테스트 벡터를 가리켰습니다. Geth, Parity, pyethereum, cpp-ethereum에 구현 PR이 올라왔습니다.\n\n## 샘플 코드\n\n컨트랙트가 이것을 어떻게 호출**했을 것인지** 보여 줍니다. 이는 가정입니다. 메인넷에서 주소 `0x09`는 다른 프리컴파일이므로 이 코드는 동작하지 않습니다.\n\n```solidity\n// SPDX-License-Identifier: MIT\npragma solidity ^0.8.20;\n\nlibrary Ed25519Proposed {\n    address constant ED25519VFY = address(0x09); // EIP-665에서 제안된 내용일 뿐\n\n    function verify(bytes32 message, bytes32 pubKey, bytes memory sig)\n        internal view returns (bool)\n    {\n        require(sig.length == 64, \"bad sig length\");\n        (bool ok, bytes memory out) =\n            ED25519VFY.staticcall(abi.encodePacked(message, pubKey, sig));\n        return ok \u0026\u0026 out.length == 4 \u0026\u0026 bytes4(out) == bytes4(0);\n    }\n}\n```\n\n## 알아둘 점\n\n- 이 제안은 **Stagnant** 상태이며 채택된 적이 없습니다. 이더리움 메인넷에는 Ed25519 프리컴파일이 없습니다.\n- 이 제안이 요청한 주소 `0x09`는 이후 BLAKE2 압축 함수([EIP-152](/eip-152/))에 할당되었습니다.\n- 메시지 입력은 32바이트로 고정이므로, 호출자는 보통 임의 길이의 데이터가 아니라 해시에 서명하게 됩니다.\n- 다른 곡선의 프리컴파일은 이후 실제로 출시되었습니다. BLS12-381용 [EIP-2537](/eip-2537/)과 secp256r1(P-256, 패스키에서 사용)용 [EIP-7951](/eip-7951/)입니다. 프리컴파일 없이 Solidity에서 Ed25519를 검증하는 것은 가능하지만 비용이 큽니다.\n"},"zh":{"lang":"zh","tldr":"提议增加一个廉价的预编译合约，用于在 EVM 中验证 Ed25519 签名，使合约能够检查来自 SSH、DNSSEC、TLS 以及基于 Ed25519 的区块链的签名。","tags":["precompile","cryptography","ed25519","signatures","core"],"related":[152,7951,2537],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/zh/eip-665/","markdown":"## 它解决什么问题？\n\n以太坊原生只能验证 secp256k1 签名（通过 `ecrecover`）。而外部世界的很多系统使用 **Ed25519** 签名，包括 OpenSSH 密钥、DNSSEC、TLS 证书、OpenPGP、软件签名工具以及若干权益证明区块链。用普通 EVM 字节码也能验证 Ed25519，但它的宽字长运算与 EVM 不太匹配，因此 gas 成本非常高。\n\n预编译可以让合约：\n\n- 证明同一个人既控制某个以太坊账户，又控制某个链下的 Ed25519 密钥（服务器、域名、SSH 身份），\n- 接受由任意发送者转发的、经 Ed25519 签名的数据，\n- 验证来自基于 Ed25519 的链的区块头或消息。\n\n## 它如何运作\n\n该提案增加了一个预编译 `ED25519VFY`：\n\n| 项目 | 值 |\n| --- | --- |\n| 地址 | `0x09` |\n| 输入 | 128 字节：32 字节消息、32 字节公钥、64 字节签名 |\n| 输出 | 4 字节：有效时为 `0x00000000`，无效时为任意非零值 |\n| Gas | 2000（比 `ecrecover` 的 3000 便宜，因为 Ed25519 更快） |\n\n与 `ecrecover` 不同，公钥必须作为输入传入，因为 Ed25519 无法从签名中恢复出公钥。返回零表示成功，因此不同的非零代码可以表示不同的失败原因。\n\n为避免客户端之间出现共识错误，作者建议所有客户端使用 **libsodium**（或其绑定），并指出了 IETF 和 NaCl 的测试向量。Geth、Parity、pyethereum 和 cpp-ethereum 都已提交了实现的 PR。\n\n## 示例代码\n\n合约**本来会**如何调用它。这只是假设。在主网上，地址 `0x09` 是另一个预编译，因此这段代码无法工作。\n\n```solidity\n// SPDX-License-Identifier: MIT\npragma solidity ^0.8.20;\n\nlibrary Ed25519Proposed {\n    address constant ED25519VFY = address(0x09); // 仅为 EIP-665 的提案内容\n\n    function verify(bytes32 message, bytes32 pubKey, bytes memory sig)\n        internal view returns (bool)\n    {\n        require(sig.length == 64, \"bad sig length\");\n        (bool ok, bytes memory out) =\n            ED25519VFY.staticcall(abi.encodePacked(message, pubKey, sig));\n        return ok \u0026\u0026 out.length == 4 \u0026\u0026 bytes4(out) == bytes4(0);\n    }\n}\n```\n\n## 需要注意\n\n- 该提案处于 **Stagnant** 状态，从未被采纳。以太坊主网没有 Ed25519 预编译。\n- 它所申请的地址 `0x09` 后来被分配给了 BLAKE2 压缩函数（[EIP-152](/eip-152/)）。\n- 消息输入固定为 32 字节，因此调用方通常会对哈希签名，而不是对任意长度的数据签名。\n- 其他曲线的预编译后来确实上线了：BLS12-381 的 [EIP-2537](/eip-2537/)，以及 secp256r1（P-256，passkey 使用）的 [EIP-7951](/eip-7951/)。没有预编译时，在 Solidity 中验证 Ed25519 是可行的，但成本很高。\n"}}}
