PQ Precompiles

Post-Quantum Cryptography Precompiles

Native precompile contracts for post-quantum and threshold cryptographic operations on the Lux EVM.

Overview

The Lux EVM includes native precompile contracts for post-quantum and threshold cryptographic operations. These precompiles are available on any Lux L1/L2 chain, including the Lux Mainnet, Testnet, and white-label chains.

Unlike the AllowList-based precompiles which manage access control for chain configuration, PQ precompiles provide cryptographic primitives that any contract or EOA can call. They do not require activation in the genesis file -- they are built into the Lux EVM itself.

Precompile Addresses

PrecompileAddressPurpose
SR25519 Verify0x0a00000000000000000000000000000000000001Substrate Schnorrkel signature verification
Ed25519 Verify0x0200000000000000000000000000000000000005EdDSA signature verification
secp256r1 Verify0x0200000000000000000000000000000000000004NIST P-256 curve verification (WebAuthn/Passkeys)
FROST Verify0x0800000000000000000000000000000000000002Threshold Schnorr signatures (FROST protocol)
CGGMP21 Verify0x0800000000000000000000000000000000000003Threshold ECDSA (secp256k1, CGGMP21 protocol)
ML-DSA Verify0x0200000000000000000000000000000000000006FIPS 204 post-quantum digital signatures
SLH-DSA Verify0x0600000000000000000000000000000000000001FIPS 205 hash-based PQ signatures
ML-KEM Config0x0200000000000000000000000000000000000007FIPS 203 post-quantum key encapsulation
Ringtail Threshold0x020000000000000000000000000000000000000BPost-quantum threshold signatures (Ring-LWE)
Blake3 Hash0x0500000000000000000000000000000000000004Fast cryptographic hashing
DEX0x0000000000000000000000000000000000009010Native on-chain DEX trading
Router0x0000000000000000000000000000000000009012DEX routing

Categories

The precompiles are organized into four categories:

Supported Chains

All PQ precompiles are available on:

  • Lux Mainnet (Chain ID: 96369)
  • Lux Testnet (Chain ID: 96368)
  • Any Lux L1/L2 -- including white-label chains (e.g., Liquidity Chain ID: 8675309)

Quick Start

Verify an ML-DSA (FIPS 204) post-quantum signature using viem:

import { createPublicClient, http, encodePacked } from 'viem'
import { lux } from 'viem/chains'

const client = createPublicClient({
  chain: lux,
  transport: http(),
})

// ML-DSA Verify precompile
const ML_DSA_ADDRESS = '0x0200000000000000000000000000000000000006'

const result = await client.call({
  to: ML_DSA_ADDRESS,
  data: encodePacked(
    ['bytes', 'bytes', 'bytes'],
    [message, publicKey, signature]
  ),
})

const isValid = result.data === '0x01'

Or with ethers.js:

import { ethers } from 'ethers'

const provider = new ethers.JsonRpcProvider('https://api.lux.network/ext/bc/C/rpc')

const ML_DSA_ADDRESS = '0x0200000000000000000000000000000000000006'

const result = await provider.call({
  to: ML_DSA_ADDRESS,
  data: ethers.solidityPacked(
    ['bytes', 'bytes', 'bytes'],
    [message, publicKey, signature]
  ),
})

const isValid = result === '0x01'

All verification precompiles return 0x01 for a valid signature and 0x00 for an invalid one. A revert indicates malformed input (wrong key size, truncated signature, etc.).

Why On-Chain PQ Cryptography?

Post-quantum cryptography protects against attacks from quantum computers. NIST finalized three post-quantum standards in 2024:

  • FIPS 203 (ML-KEM) -- Key encapsulation based on Module-LWE
  • FIPS 204 (ML-DSA) -- Digital signatures based on Module-LWE (formerly Dilithium)
  • FIPS 205 (SLH-DSA) -- Hash-based digital signatures (formerly SPHINCS+)

By providing these as EVM precompiles, Lux enables smart contracts to verify post-quantum signatures natively, without the prohibitive gas costs of implementing lattice-based or hash-based cryptography in Solidity. This is critical for:

  • Bridge security -- Verifying PQ-signed messages from external chains
  • Account abstraction -- Supporting PQ key pairs as wallet signers
  • Threshold custody -- Multi-party signing with quantum-resistant keys (Ringtail)
  • WebAuthn/Passkeys -- Native secp256r1 verification for browser-based wallets

Is this guide helpful?