A post-quantum signature check

0x1002

The precompile address, after staking (0x1000) and reserve balance (0x1001).

7,856 bytes

One signature. The public key is 32 bytes.

36,000 gas

The base cost, 6 times ECRECOVER on Monad.

MIP-24 is a Draft and is not active on any network. It adds a precompile that verifies SLH-DSA-SHA2-128s signatures as FIPS 205 specifies them. It is meant for recovery and key rotation keys.

The information on this page should not be quoted. Please refer to MIP-24 for the authoritative spec.

What a verification costs

Gas depends only on the input length: 36,000 plus 12 per 32-byte word of message.

Input length

7,920 bytes

32 + 7,856 + 32

Gas

36,012

Charged in full before any verification work.

Base

36,000

An input shorter than 7,888 bytes costs exactly this and returns 0.

CasePrecompileContract codeRatio
Average, excluding calldata36,000443,05512.3×
Worst case, excluding calldata36,000796,68422.1×
Average, including calldata336,520590,2631.75×
Worst case, including calldata336,520943,8922.80×

The comparison is from the spec. Contract code makes about 2,123 hash calls on average and up to 3,823, each costing at least 208 gas through the SHA-256 precompile.

Input and output

One byte string, with no header and no length fields.

  • pubkey · 32 bytes

    PK.seed followed by PK.root.

  • signature · 7,856 bytes

    R, then SIG_FORS, then SIG_HT, in the FIPS 205 encoding.

  • message · the rest

    Any length, including zero. There is no pre-hash and the context string is always empty.

  • output · 32 bytes

    1 for a valid signature, 0 otherwise. The precompile never reverts.

  • Missing precompile

    Before activation the address returns empty data. A result that isn't 32 bytes long means the precompile isn't there.

It can be called with CALL, STATICCALL, DELEGATECALL or CALLCODE, and its address is warm at the start of every transaction.

Why this scheme

FIPS 205 defines twelve parameter sets. MIP-24 adopts one.

  • Hash-based

    Its security rests on SHA-256, with no number-theoretic or lattice assumption.

  • The small variant

    7,856-byte signatures, against 17,088 for the fast variant. Signing is slow, which doesn't matter for a key that signs rarely.

  • SHA2, not SHAKE

    Every surveyed validator CPU accelerates SHA-256. A SHAKE variant would be priced at 132,000 gas against 36,000.

  • FIPS 205 unmodified

    Hardware security modules and key management services sign only as the standard specifies. Variants that swap in KECCAK256 change the standardized scheme.

The gas price comes from measurements on one Zen 4 machine and an estimate for Zen 5.

Who this affects

Wallet and account teams

A recovery key on a different assumption

An account that signs routine transactions with a lattice key can register an SLH-DSA key for recovery and rotation, so a break of the lattice assumption doesn't cost it the account.

Contract developers

Put replay protection in the message

The precompile checks the bytes it is given under the empty context. Chain, contract and nonce have to be part of the message. Signature bytes should not be used as a unique identifier.

Everyone else

It doesn't make accounts quantum-resistant

An account stays controlled by its secp256k1 key until the protocol or the account's own code removes that key's authority. MIP-24 doesn't address that.

The gas constants rest on one Zen 4 measurement and a Zen 5 estimate. Also open: whether to add smaller parameter sets once they are standardized, whether a lattice verifier should activate in the same upgrade, and how a future transaction type would use this verifier.

Continue the discussion on Monad Forum

Questions, feedback, or a better idea? Weigh in on the forum thread.

Open forum thread