Implements the AI mining precompile for compute-to-earn verification on the Lux EVM. Miners submit work proofs attesting to GPU compute time, verified via TEE attestation and ML-DSA signatures. The precompile calculates rewards based on compute minutes, privacy level, and hardware trust score. Includes double-spend prevention via a spent-set and BLAKE3 work ID computation.
0x0300 -- AI range.
0x01 VerifyMLDSA: paramSet(1) + pubkey + signature + message -> bool(32)
0x02 CalculateReward: work_proof -> reward(32)
0x03 VerifyTEE: tee_quote + nonce -> { verified(bool), trust_score(uint8) }
0x04 IsSpent: work_id(32) -> bool(32)
0x05 ComputeWorkId: work_proof -> work_id(32) (BLAKE3 hash)
0x06 MarkSpent: work_id(32) -> () (state write)
Work proof layout:
bytes 0-31: device_id (32 bytes)
bytes 32-63: nonce (32 bytes)
bytes 64-71: timestamp (uint64, big-endian)
bytes 72-73: privacy_level (uint16)
bytes 74-77: compute_minutes (uint32)
bytes 78+: tee_quote (optional, variable)
GPU acceleration is used for batch ML-DSA verification (NTT-based) and batch attestation verification when available.
1. Work proofs are bound to a specific device_id and timestamp. Replay protection via the spent-set.
2. TEE attestation is platform-agnostic (NVIDIA NVTrust, Intel TDX, ARM CCA). Verification is local.
3. ML-DSA signatures (FIPS 204) provide post-quantum authentication of work proofs.
4. Privacy level multipliers incentivize higher security tiers. The Sovereign tier requires both hardware CC and local-only attestation (no cloud dependencies).
5. The MarkSpent operation is a state write -- only callable by authorized mining contracts.
github.com/luxfi/precompile/ai/Copyright (C) 2024-2026, Lux Partners Limited. All rights reserved.
Licensed under the MIT License.