LPsLux Proposals
Threshold Cryptography
LP-4200

Post-Quantum Cryptography Suite for Lux Network

Review

Comprehensive specification for NIST-standardized post-quantum cryptographic algorithms

Category
Core
Created
2025-01-24

Abstract

This proposal establishes the complete post-quantum cryptography suite for the Lux Network, integrating NIST FIPS 203-205 standardized algorithms (ML-KEM, ML-DSA, SLH-DSA) alongside Lux-native schemes (Ringtail threshold signatures, Lamport OTS) to provide quantum-resistant security for all blockchain operations. The suite enables confidential AI compute and private finance applications through lattice-based and hash-based cryptographic primitives that resist attacks from both classical and quantum computers. Ringtail provides post-quantum threshold signatures for T-Chain MPC custody, while Lamport OTS enables quantum resistance on any remote EVM chain.

Motivation

With quantum computers approaching the threshold to break current elliptic curve and RSA cryptography (estimated 10,000 logical qubits by 2030), blockchain networks must transition to post-quantum algorithms. This is particularly critical for:

  • AI Confidential Compute: Protecting model parameters and inference data
  • Private Finance: Securing long-term financial contracts and custody
  • Validator Security: Preventing quantum attacks on consensus
  • State Proofs: Ensuring merkle proofs remain unforgeable

Specification

1. ML-KEM (Module-Lattice Key Encapsulation Mechanism) - FIPS 203

Algorithm Parameters

Parameter SetSecurity LevelPublic KeyPrivate KeyCiphertextShared Secret
ML-KEM-512NIST Level 1 (128-bit)800 B1,632 B768 B32 B
ML-KEM-768NIST Level 3 (192-bit)1,184 B2,400 B1,088 B32 B
ML-KEM-1024NIST Level 5 (256-bit)1,568 B3,168 B1,568 B32 B

Implementation

package mlkem

import (
    "crypto/rand"
    "github.com/cloudflare/circl/kem/mlkem768" // Reference implementation
)

type KEMScheme interface {
    GenerateKeyPair(rand io.Reader) (PublicKey, PrivateKey, error)
    Encapsulate(rand io.Reader, pk PublicKey) (ct []byte, ss []byte, error)
    Decapsulate(sk PrivateKey, ct []byte) (ss []byte, error)
}

// Security proof: Based on Module-LWE problem
// Reduction: If Module-LWE is hard, ML-KEM is IND-CCA2 secure
// Reference: Bos et al., "CRYSTALS-Kyber: A CCA-Secure Module-Lattice-Based KEM"

EVM Precompiled Contracts

// ML-KEM precompiles for EVM integration
address constant ML_KEM_512_ENCAP = 0x0000000000000000000000000000000000000120;
address constant ML_KEM_768_ENCAP = 0x0000000000000000000000000000000000000121;
address constant ML_KEM_1024_ENCAP = 0x0000000000000000000000000000000000000122;
address constant ML_KEM_DECAP = 0x0000000000000000000000000000000000000123;

// Gas costs based on computational complexity
uint256 constant GAS_ML_KEM_ENCAP = 500_000;
uint256 constant GAS_ML_KEM_DECAP = 600_000;

2. ML-DSA (Module-Lattice Digital Signature Algorithm) - FIPS 204

Algorithm Parameters

Parameter SetSecurity LevelPublic KeyPrivate KeySignatureSigning Ops/secVerification Ops/sec
ML-DSA-44NIST Level 2 (128-bit)1,312 B2,560 B2,420 B40,00045,000
ML-DSA-65NIST Level 3 (192-bit)1,952 B4,032 B3,309 B35,00040,000
ML-DSA-87NIST Level 5 (256-bit)2,592 B4,896 B4,627 B30,00035,000

EVM Optimization (ETH-ML-DSA)

Based on ZKNOX ETHDILITHIUM research:

// Optimizations for EVM execution
contract ETHMDLSA {
    // Replace SHAKE with Keccak256 (native opcode)
    function expandSeedOptimized(bytes32 seed) internal pure returns (bytes memory) {
        bytes memory output = new bytes(EXPANSION_SIZE);
        for (uint i = 0; i < BLOCKS; i++) {
            bytes32 block = keccak256(abi.encode(seed, i));
            // 8x gas reduction: 4M → 500K gas
        }
        return output;
    }
    
    // Store NTT precomputed public keys
    mapping(address => bytes) public nttPublicKeys;
    
    // Verification with precomputed NTT: 13M → 4M gas
    function verifyOptimized(
        bytes32 message,
        bytes memory signature,
        bytes memory pubkeyNTT
    ) public view returns (bool) {
        (bool success,) = ML_DSA_OPTIMIZED.staticcall(
            abi.encode(message, signature, pubkeyNTT)
        );
        return success;
    }
}

Security Analysis

Security Reduction: ML-DSA → Module-SIS + Module-LWE
Quantum Security: 128/192/256-bit against Grover's algorithm
Classical Security: 256/384/512-bit against lattice reduction

Reference: Ducas et al., "CRYSTALS-Dilithium: Digital Signatures from Module Lattices"
NIST PQC Round 3 Winner - Selected July 2022

3. SLH-DSA (Stateless Hash-Based Digital Signature Algorithm) - FIPS 205

Algorithm Parameters

Parameter SetSecurityPublic KeyPrivate KeySignatureUse Case
SLH-DSA-SHA2-128sLevel 132 B64 B7,856 BSmall signatures
SLH-DSA-SHA2-128fLevel 132 B64 B17,088 BFast signing
SLH-DSA-SHA2-192sLevel 348 B96 B16,224 BBalanced
SLH-DSA-SHA2-256sLevel 564 B128 B29,792 BMaximum security

Implementation Strategy

package slhdsa

// Stateless design - no state management required
type SLHDSAKey struct {
    mode     Mode
    publicKey []byte  // 32-64 bytes only!
    secretKey []byte
}

// Perfect for long-term security (50+ years)
func (k *SLHDSAKey) Sign(message []byte) []byte {
    // Deterministic, no RNG failures possible
    // Based solely on hash function security
    return sphincsSign(k.secretKey, message)
}

// Security: Only assumes collision resistance of SHA-256/SHA3
// No algebraic structure that quantum computers can exploit

4. Hybrid Cryptography Mode

Transition Strategy

type HybridSigner struct {
    classical ECDSAKey    // For compatibility
    quantum   MLDSAKey    // For security
    mode      HybridMode  // AND or OR validation
}

func (h *HybridSigner) Sign(msg []byte) *HybridSignature {
    return &HybridSignature{
        Classical: h.classical.Sign(msg),
        Quantum:   h.quantum.Sign(msg),
        Mode:      h.mode,
    }
}

func VerifyHybrid(msg []byte, sig *HybridSignature, pubkeys *HybridPublicKey) bool {
    classicalValid := ecdsa.Verify(msg, sig.Classical, pubkeys.Classical)
    quantumValid := mldsa.Verify(msg, sig.Quantum, pubkeys.Quantum)
    
    switch sig.Mode {
    case HybridAND:
        return classicalValid && quantumValid  // Both must pass
    case HybridOR:
        return classicalValid || quantumValid  // Either passes
    }
}

5. AI Confidential Compute Applications

Secure Multi-Party Computation

type ConfidentialAICompute struct {
    // Lattice-based homomorphic properties
    encryptionScheme *MLKEMScheme
    
    // Threshold signatures for distributed inference
    signatureScheme  *MLDSAThreshold
    
    // Secure model parameter sharing
    secretSharing    *LatticeShamir
}

func (c *ConfidentialAICompute) SecureInference(
    encryptedInput []byte,
    modelShards []ModelShard,
) ([]byte, error) {
    // Each compute node processes encrypted data
    results := make([][]byte, len(modelShards))
    
    for i, shard := range modelShards {
        // Homomorphic computation on encrypted data
        results[i] = shard.ComputeOnEncrypted(encryptedInput)
    }
    
    // Aggregate results while preserving privacy
    return c.secretSharing.Reconstruct(results)
}

Private Finance Integration

contract QuantumSafeDeFi {
    // Long-term value locks with quantum resistance
    struct TimeLock {
        uint256 amount;
        uint256 unlockTime; // Can be 50+ years
        bytes32 slhdsaPublicKey; // Only 32 bytes!
        bytes quantumProof;
    }
    
    // Zero-knowledge proofs with lattice cryptography
    function proveBalanceGTE(
        uint256 threshold,
        bytes memory latticeProof
    ) public view returns (bool) {
        // Verify using lattice-based ZK-SNARK
        return verifyLatticeProof(latticeProof, threshold);
    }
}

Rationale

Why NIST Algorithms?

  1. Standardization: FIPS 203-205 provide formal security definitions
  2. Analysis: 7+ years of cryptanalysis by global researchers
  3. Implementation: Reference implementations available
  4. Hardware: Expected support in secure elements

Why Lattice-Based?

  1. Efficiency: Better performance than code/multivariate alternatives
  2. Versatility: Supports encryption, signatures, and advanced protocols
  3. Security: Based on worst-case to average-case reductions
  4. Future-Proof: Resistant to known quantum algorithms

Performance Considerations

Benchmarks (AMD EPYC 7763, single-threaded):

ML-KEM-768:
  KeyGen: 20 μs
  Encaps: 25 μs
  Decaps: 30 μs

ML-DSA-65:
  KeyGen: 30 μs
  Sign: 100 μs
  Verify: 35 μs

SLH-DSA-192s:
  KeyGen: 10 μs
  Sign: 25 ms
  Verify: 2 ms

Hardware Acceleration (with AVX2/SHA extensions):
  2-3x speedup for lattice operations
  5x speedup for hash operations

Backwards Compatibility

The hybrid mode ensures complete backwards compatibility:

  1. Phase 1 (Months 1-3): Deploy alongside classical crypto
  2. Phase 2 (Months 4-6): Require both signatures
  3. Phase 3 (Months 7-9): Quantum primary, classical fallback
  4. Phase 4 (Month 10+): Quantum-only for new accounts

Test Cases

func TestQuantumSuite(t *testing.T) {
    // Test ML-KEM key exchange
    kemPub, kemPriv, _ := mlkem.GenerateKeyPair(rand.Reader)
    ct, ss1, _ := mlkem.Encapsulate(rand.Reader, kemPub)
    ss2, _ := mlkem.Decapsulate(kemPriv, ct)
    assert.Equal(t, ss1, ss2)
    
    // Test ML-DSA signatures
    dsaPub, dsaPriv, _ := mldsa.GenerateKeyPair(rand.Reader)
    msg := []byte("quantum resistant message")
    sig, _ := mldsa.Sign(dsaPriv, msg)
    assert.True(t, mldsa.Verify(dsaPub, msg, sig))
    
    // Test hybrid validation
    hybridSig := signHybrid(msg, classicalKey, quantumKey)
    assert.True(t, verifyHybrid(msg, hybridSig, hybridPubKey))
}

Reference Implementation

Complete implementation available at: https://github.com/luxfi/crypto

Security Considerations

  1. Side-Channel Resistance: All implementations use constant-time operations
  2. RNG Quality: Require NIST SP 800-90A compliant random number generators
  3. Key Storage: Larger keys require secure hardware/software key management
  4. Migration Risks: Hybrid mode prevents single point of failure during transition
  5. Quantum Timeline: Monitor NIST and NSA guidance on quantum threat evolution

6. Lux-Native Post-Quantum Schemes

Ringtail: Post-Quantum Threshold Signatures (LP-7324)

Ringtail is Lux's own post-quantum threshold signature scheme, providing distributed signing with quantum resistance:

// Ringtail: Ring-LWE based threshold signatures
type RingtailScheme struct {
    threshold   uint16      // Minimum signers required (t of n)
    totalNodes  uint16      // Total participants
    modulusQ    *big.Int    // Lattice modulus
    dimension   uint16      // Ring dimension (n=1024)
}

// Two-round threshold protocol
func (r *RingtailScheme) ThresholdSign(
    message []byte,
    partialSigs []PartialSignature,
) (*RingtailSignature, error) {
    // Round 1: Commitment phase (each signer commits)
    // Round 2: Response phase (aggregate into final signature)
    return aggregateRingtailSignatures(partialSigs, message)
}

Precompile Address: 0x020000000000000000000000000000000000000B

Integration with Quasar Consensus:

  • Dual-certificate finality: BLS (classical) + Ringtail (quantum-safe)
  • T-Chain threshold MPC custody uses Ringtail for quantum resistance
  • Sub-second finality with post-quantum security guarantees

Lamport OTS: Hash-Based One-Time Signatures (LP-4105)

Lamport One-Time Signatures provide quantum resistance for remote chains secured by T-Chain MPC:

// Lamport OTS for any EVM chain - no lattice math required
contract LamportBase {
    // 256-bit security using only hash functions
    function verify_u256(
        uint256 bits,
        bytes[256] calldata sig,
        bytes32[2][256] calldata pub
    ) public pure returns (bool) {
        for (uint256 i; i < 256; i++) {
            if (pub[i][((bits & (1 << (255 - i))) > 0) ? 1 : 0] !=
                keccak256(sig[i])) return false;
        }
        return true;
    }
}

Use Cases:

  • Remote chain custody (any EVM chain without PQC precompiles)
  • T-Chain MPC wallet integration (threshold custody + PQC)
  • Lux Safe multisig with quantum-resistant recovery
  • Bridge security with post-quantum attestations

Migration Path:

  1. ECDSA_ONLY: Classical signatures (current state)
  2. DUAL_SIGNATURES: ECDSA + Lamport OTS (hybrid security)
  3. LAMPORT_PREFERRED: Lamport primary, ECDSA fallback
  4. LAMPORT_ONLY: Full quantum resistance

7. Complete PQC Ecosystem

The Lux PQC ecosystem provides defense-in-depth with multiple complementary schemes:

SchemeTypeUse CaseChain
ML-KEMKey ExchangeConfidential compute, encrypted channelsQ-Chain
ML-DSASignaturesValidator attestations, consensusQ-Chain
SLH-DSASignaturesLong-term archives (50+ years)Q-Chain
RingtailThreshold SigsDistributed signing, T-Chain custodyT-Chain
Lamport OTSOne-Time SigsRemote chains, Safe walletsAny EVM

T-Chain Integration:

  • T-Chain (Threshold Chain) provides MPC custody secured by Ringtail
  • Remote chains use Lamport OTS with T-Chain as the trusted signer set
  • Quasar consensus achieves finality with BLS + Ringtail dual certificates

References

NIST-Standardized Algorithms

Lux-Native Schemes

Hybrid & Transition

Integration

NIST Standards

  1. FIPS 203: Module-Lattice-Based Key-Encapsulation Mechanism
  2. FIPS 204: Module-Lattice-Based Digital Signature Algorithm
  3. FIPS 205: Stateless Hash-Based Digital Signature Algorithm
  4. Regev, O. "On lattices, learning with errors, random linear codes, and cryptography"
  5. Peikert, C. "A Decade of Lattice Cryptography"
  6. NIST Post-Quantum Cryptography Standardization

Implementation References

  1. ZKNOX ETHDILITHIUM - EVM Optimizations
  2. Cloudflare CIRCL - Pure Go Implementation

Copyright and related rights waived via CC0.