Lux Precompiles

Lux Precompiles

High-performance native EVM precompiles for the Lux blockchain

Lux Precompiles

Native EVM precompiles providing high-performance cryptography, DEX operations, and blockchain primitives for the Lux Network.

Overview

Precompiles are native code executed by the EVM at reserved addresses, offering 10-100x performance improvements over equivalent Solidity implementations.

CategoryPrecompilesDescription
CryptographyML-DSA, ML-KEM, SLH-DSA, FROST, Ringtail, CGGMP21Post-quantum and threshold signatures
DEXPoolManager, Hooks, Lending, PerpetualsUniswap v4-style DEX operations
FHEEncrypted operationsFully Homomorphic Encryption
OraclePrice feeds, GraphQLNative oracle and query interface
AIGPU attestation, miningAI compute verification

Installation

# In your Solidity project
forge install luxfi/precompile
# foundry.toml remapping
@luxfi/precompile/=lib/precompile/

Usage

import {IMLDSA} from "@luxfi/precompile/mldsa/IMLDSA.sol";
import {IDEX} from "@luxfi/precompile/solidity/dex/IDEX.sol";
import {IFHE} from "@luxfi/precompile/fhe/IFHE.sol";

contract MyContract {
    // Use precompiles for high-performance operations
    function verifySignature(bytes calldata sig, bytes32 msg) external view {
        IMLDSA(0x0200000000000000000000000000000000000006).verify(sig, msg);
    }
}

Address Map

Cryptography (0x0200...0005 - 0x0200...000D)

AddressPrecompileGasDescription
0x...0005PQCryptoVariableMulti-algorithm PQ operations
0x...0006ML-DSA100,000FIPS 204 post-quantum signatures
0x...0007SLH-DSA150,000Stateless hash-based signatures
0x...0008Warp120,000Cross-chain BLS messaging
0x...0009ML-KEM50,000FIPS 203 key encapsulation
0x...000AQuasarVariableQuantum consensus operations
0x...000BRingtail150,000Post-quantum threshold signatures
0x...000CFROST50,000Schnorr threshold signatures
0x...000DCGGMP2175,000ECDSA threshold signatures

DEX (0x0400 - 0x0403)

AddressPrecompileGasDescription
0x0400PoolManager2.26μsSingleton pool management
0x0401SwapRouterVariableOptimized swap routing
0x0402HooksRegistryVariableHook contract registry
0x0403FlashLoanVariableFlash loan facility

FHE (0x0200...0080 - 0x0200...0083)

AddressPrecompileDescription
0x...0080FHE OpsEncrypted arithmetic
0x...0081FHE ConfigConfiguration
0x...0082FHE GatewayDecryption gateway
0x...0083Task ManagerAsync task management

Oracle (0x0500)

AddressPrecompileDescription
0x0500GraphQLNative G-Chain queries

AI (0x0300)

AddressPrecompileDescription
0x0300AttestationGPU TEE verification

Performance Benchmarks (Apple M1 Max)

OperationPrecompilePure SoliditySpeedup
DEX Swap2.26μs~200μs88x
ML-DSA Verify50μsN/A-
FROST Verify45μsN/A-
FHE Add10μsN/A-

On this page