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
| Precompile | Address | Purpose |
|---|---|---|
| SR25519 Verify | 0x0a00000000000000000000000000000000000001 | Substrate Schnorrkel signature verification |
| Ed25519 Verify | 0x0200000000000000000000000000000000000005 | EdDSA signature verification |
| secp256r1 Verify | 0x0200000000000000000000000000000000000004 | NIST P-256 curve verification (WebAuthn/Passkeys) |
| FROST Verify | 0x0800000000000000000000000000000000000002 | Threshold Schnorr signatures (FROST protocol) |
| CGGMP21 Verify | 0x0800000000000000000000000000000000000003 | Threshold ECDSA (secp256k1, CGGMP21 protocol) |
| ML-DSA Verify | 0x0200000000000000000000000000000000000006 | FIPS 204 post-quantum digital signatures |
| SLH-DSA Verify | 0x0600000000000000000000000000000000000001 | FIPS 205 hash-based PQ signatures |
| ML-KEM Config | 0x0200000000000000000000000000000000000007 | FIPS 203 post-quantum key encapsulation |
| Ringtail Threshold | 0x020000000000000000000000000000000000000B | Post-quantum threshold signatures (Ring-LWE) |
| Blake3 Hash | 0x0500000000000000000000000000000000000004 | Fast cryptographic hashing |
| DEX | 0x0000000000000000000000000000000000009010 | Native on-chain DEX trading |
| Router | 0x0000000000000000000000000000000000009012 | DEX routing |
Categories
The precompiles are organized into four categories:
- Signature Verification -- Classical and post-quantum signature schemes (SR25519, Ed25519, secp256r1, ML-DSA, SLH-DSA)
- Threshold Signatures -- Multi-party computation protocols (FROST, CGGMP21, Ringtail)
- Key Encapsulation -- Post-quantum key exchange (ML-KEM)
- Utilities -- Hashing and on-chain DEX (Blake3, DEX, Router)
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?