Input Format for Precompiled Function Calls

1. Input Format Specification

When invoking precompiled contracts for Dilithium5 or MLDSA-87 verification, the input must follow this structured byte format:

Copy

[...PUBLIC_KEY...MESSAGE...SIGNATURE]

Field Definitions

Field
Description

PUBLIC_KEY

The public key (Dilithium5: 1,312 bytes / MLDSA-87: ~3 KB)

MESSAGE

Original message (arbitrary length) that was signed

SIGNATURE

Cryptographic signature (Dilithium5: 2.8 KB / MLDSA-87: 2.5 KB)


2. Precompiled Contract Addresses

// Precompiled Contract Addresses
address constant DILITHIUM_VERIFIER = 0x0000000000000000000000000000000000000012;
address constant MLDSA_VERIFIER = 0x0000000000000000000000000000000000000013;

3. Verification Logic

The precompiled contracts:

  1. Validate that SIGNATURE matches MESSAGE when signed by PUBLIC_KEY.

  2. Return 1 (success) or 0 (failure) as a 32-byte word.


4. Use Cases

4.1 Post-Quantum Secure Authentication

  • Verify off-chain signatures before executing sensitive transactions.

4.2 Decentralized Identity

  • Validate quantum-proof credentials in DID (Decentralized Identifiers) systems.

4.3 Gas Optimization

  • 30-50% cheaper than equivalent EVM-based signature verification.

Last updated