---
eip: 665
label: EIP-665
title: Add precompiled contract for Ed25519 signature verification
status: Stagnant
type: Standards Track
category: Core
created: 2018-03-25
official: https://eips.ethereum.org/EIPS/eip-665
source: https://github.com/ethereum/EIPs/blob/master/EIPS/eip-665.md
canonical: https://eips.huatuo.xyz/eip-665/
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]
---

# EIP-665: Add precompiled contract for Ed25519 signature verification

> 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.

**TL;DR:** 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.

## What problem does it solve?

Ethereum 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.

A precompile would let contracts:

- prove that one person controls both an Ethereum account and an off-chain Ed25519 key (a server, a domain, an SSH identity),
- accept Ed25519-signed data relayed by any sender,
- verify headers or messages from Ed25519-based chains.

## How it works

The proposal adds a precompile `ED25519VFY`:

| Item | Value |
| --- | --- |
| Address | `0x09` |
| Input | 128 bytes: 32-byte message, 32-byte public key, 64-byte signature |
| Output | 4 bytes: `0x00000000` if valid, any non-zero value if invalid |
| Gas | 2000 (cheaper than `ecrecover`'s 3000, since Ed25519 is faster) |

Unlike `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.

To 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.

## Sample code

How a contract **would** have called it. This is hypothetical. On mainnet, address `0x09` is a different precompile, so this code does not work.

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

library Ed25519Proposed {
    address constant ED25519VFY = address(0x09); // as proposed in EIP-665 only

    function verify(bytes32 message, bytes32 pubKey, bytes memory sig)
        internal view returns (bool)
    {
        require(sig.length == 64, "bad sig length");
        (bool ok, bytes memory out) =
            ED25519VFY.staticcall(abi.encodePacked(message, pubKey, sig));
        return ok && out.length == 4 && bytes4(out) == bytes4(0);
    }
}
```

## Things to know

- This proposal is **Stagnant** and was never adopted. Ethereum mainnet has no Ed25519 precompile.
- The address it asked for, `0x09`, was later assigned to the BLAKE2 compression function ([EIP-152](/eip-152/)).
- The message input is a fixed 32 bytes, so callers would typically sign a hash rather than arbitrary-length data.
- 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.


---

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