---
eip: 8051
label: EIP-8051
title: Precompile for ML-DSA signature verification
status: Draft
type: Standards Track
category: Core
created: 2025-10-15
requires: 7932
official: https://eips.ethereum.org/EIPS/eip-8051
source: https://github.com/ethereum/EIPs/blob/master/EIPS/eip-8051.md
canonical: https://eips.huatuo.xyz/eip-8051/
lang: en
tldr: "Proposes two precompiles that verify ML-DSA (Dilithium, FIPS-204) post-quantum signatures for 4500 gas each: one strictly NIST-compliant and one EVM-optimized variant that uses Keccak instead of SHAKE256."
tags: [precompile, post-quantum, signatures, ml-dsa, cryptography]
---

# EIP-8051: Precompile for ML-DSA signature verification

> Precompiled contracts for FIPS-204 ML-DSA signature verification and an EVM-optimized variant

**TL;DR:** Proposes two precompiles that verify ML-DSA (Dilithium, FIPS-204) post-quantum signatures for 4500 gas each: one strictly NIST-compliant and one EVM-optimized variant that uses Keccak instead of SHAKE256.

## What problem does it solve?

Ethereum's signatures (secp256k1 ECDSA) would be breakable by a sufficiently large quantum computer. Moving applications to new signature schemes takes years, so the infrastructure needs to exist well before any such machine does.

ML-DSA (formerly CRYSTALS-Dilithium) is the main lattice-based signature standardized by NIST as FIPS-204. Verifying it in Solidity costs millions of gas. EIP-8051 adds native verification so smart accounts, and potentially transactions, can use post-quantum keys at a practical cost.

## How it works

Two precompiles, both for NIST security level II (ML-DSA-44: `n = 256`, `q = 8380417`, `k = l = 4`):

| Precompile | Proposed address | Hashing | Gas |
| --- | --- | --- | --- |
| `VERIFY_MLDSA` | `0x12` | SHAKE256, FIPS-204 compliant | 4500 |
| `VERIFY_MLDSA_ETH` | `0x13` | Keccak256-based counter-mode PRNG | 4500 |

- **Input:** 32-byte message, 2420-byte signature, then a 20,512-byte *expanded* public key (the full matrix `A_hat`, `tr`, and `t1` already in the NTT domain). Storing the key expanded means the verifier skips the expensive derivation and one NTT.
- **Output:** 32-byte `1` on success, `0` on failure. Malformed input lengths, out-of-range coefficients, bad hints or norm-bound violations all fail.
- **The ETH variant** deviates from FIPS-204 only in its hash/XOF and encodings, so it can be checked cheaply by EVM code too; signatures from standard ML-DSA libraries will not verify under it.
- **Transaction signatures:** the spec also defines how ML-DSA plugs into [EIP-7932](/eip-7932/) algorithmic transactions (`ALG_TYPE` `0xD1` for standard, `0xD2` for the ETH variant), with the account address derived as the last 20 bytes of `keccak256(pubkey)`.

## Sample code

Calling the proposed precompile from Solidity (address not final):

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

library MLDSA {
    address internal constant VERIFY_MLDSA = address(0x12); // proposed

    /// @param pubkey 20,512-byte expanded public key (A_hat || tr || t1_ntt)
    /// @param sig    2,420-byte FIPS-204 signature
    function verify(bytes32 message, bytes memory sig, bytes memory pubkey)
        internal view returns (bool)
    {
        require(sig.length == 2420 && pubkey.length == 20512, "bad length");
        (bool ok, bytes memory out) =
            VERIFY_MLDSA.staticcall(abi.encodePacked(message, sig, pubkey));
        return ok && out.length == 32 && abi.decode(out, (uint256)) == 1;
    }
}
```

## Things to know

- Status is **Draft**. Addresses, gas cost and the `GAS_PENALTY` for EIP-7932 (suggested around 3000) are subject to benchmarking, and the security considerations section is still mostly TBD.
- The proposed addresses `0x12`/`0x13` overlap with those used in the prototype for the generic NTT precompile, [EIP-7885](/eip-7885/); final numbering is not settled.
- Keys are large: about 20 KB in the expanded form used here (1312 bytes in compact form), and signatures are 2.4 KB. Storing and passing them on-chain has a real calldata and storage cost.
- [EIP-7885](/eip-7885/) takes a more generic route (NTT building blocks for any lattice scheme); [EIP-7951](/eip-7951/) is the analogous, already-final precompile for classical P-256 signatures.


---

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