Lux Docs
Lux Skills Reference

Lux Node - Core Validator Implementation

Documentation for Lux Node - Core Validator Implementation

Overview

Lux Node (luxd) is the core validator node for the Lux Network -- a multi-chain, multi-consensus blockchain with post-quantum hybrid finality (Quasar), 14 chain types, custom VM support, and W3C DID-based validator identity. Written in Go. The binary name is luxd, the module path is github.com/luxfi/node.

Tech Stack

  • Language: Go 1.26.1 (CGO enabled by default)
  • Consensus: Quasar hybrid finality (BLS + Ringtail post-quantum threshold)
  • Crypto: BLS aggregate signatures, ML-DSA-65 (post-quantum), ML-KEM, Ringtail threshold, Falcon, secp256k1
  • Database: LevelDB/PebbleDB (via github.com/luxfi/database)
  • Networking: Custom TCP P2P with TLS mutual auth, PROXY protocol support, Zstd compression
  • Serialization: Protocol Buffers (buf v1.31.0, protoc-gen-go v1.33.0)
  • Build: Make, shell scripts (scripts/build.sh), Docker multi-stage
  • Observability: OpenTelemetry (OTLP traces), Prometheus metrics, structured logging (zap)
  • FIPS: FIPS 140-3 always enabled (GOFIPS140=latest)

Key Dependencies

PackageVersionPurpose
github.com/luxfi/consensusv1.22.69Quasar consensus engine, DAG/linear engines
github.com/luxfi/cryptov1.17.42BLS, secp256k1, ML-DSA, ML-KEM, certificates
github.com/luxfi/databasev1.17.43Storage layer (LevelDB, PebbleDB, VersionDB)
github.com/luxfi/gethv1.16.76Go Ethereum fork (C-Chain EVM plugin base)
github.com/luxfi/sdkv1.16.45Go SDK for node interaction
github.com/luxfi/warpv1.18.5Cross-chain messaging (LP-118 Warp protocol)
github.com/luxfi/lattice/v7v7.0.0Post-quantum lattice cryptography
github.com/luxfi/genesisv1.6.2Genesis configuration and bootstrapping
github.com/luxfi/vmv1.0.39VM interface (ChainVM, DAG VM)
github.com/luxfi/aiv0.0.0-20251225AI integration for AIVM
github.com/luxfi/thresholdv1.5.5MPC threshold signing (CMP, LSS protocols)
github.com/luxfi/p2pv1.19.2-zapZAP (Zero-copy Agent Protocol) P2P transport
github.com/luxfi/constantsv1.4.4Network IDs, VM IDs, chain IDs, port constants
github.com/luxfi/idsv1.2.9ID types (NodeID, BlockID, TxID, ChainID)
github.com/luxfi/accelv1.0.6GPU-accelerated crypto (NTT, TFHE, BLS batch)
github.com/luxfi/compressv0.0.5Compression utilities
github.com/luxfi/validatorsv1.0.0Validator management and uptime tracking
github.com/luxfi/stakingv1.1.0Staking certificate management
github.com/luxfi/versionv1.0.1Version utilities
github.com/luxfi/concurrentv0.0.3Concurrency primitives
github.com/luxfi/codecv1.1.4Binary codec and serialization
github.com/luxfi/addressv1.0.1Address formatting (bech32)
github.com/luxfi/formattingv1.0.1Display formatting utilities
github.com/luxfi/utxov0.2.4UTXO model types
github.com/luxfi/unitsv1.0.0Unit conversions (LUX, nLUX)
github.com/luxfi/ringtailv0.2.0Post-quantum Ringtail threshold signatures
github.com/luxfi/samplerv1.0.0Weighted random sampling for validator selection
github.com/luxfi/zapdb/v4v4.9.3ZAP database integration
github.com/ProjectZKM/Zirenv0.0.0-20260215ZK runtime for zkVM
github.com/cloudflare/circlv1.6.3Cloudflare crypto (post-quantum, curves)
github.com/consensys/gnark-cryptov0.19.2ZK-SNARK crypto primitives
github.com/spf13/cobrav1.10.2CLI framework
github.com/spf13/viperv1.21.0Configuration management
go.uber.org/zapv1.27.1Structured logging
google.golang.org/grpcv1.79.1gRPC transport
google.golang.org/protobufv1.36.11Protocol buffer runtime
connectrpc.com/connectv1.19.1ConnectRPC (gRPC-Web compatible)

When to use

  • Running a Lux mainnet/testnet/devnet validator
  • Building custom Virtual Machines (VMs) for the Lux ecosystem
  • Developing subnet/L1/L2/L3 chains on the Lux network
  • Cross-chain messaging via LP-118 Warp protocol
  • Post-quantum secure blockchain operations
  • AI compute attestation and decentralized inference
  • Decentralized exchange, oracle, identity, key management, or ZK proof chains

Hard requirements

  1. ALWAYS use github.com/luxfi/* packages -- NEVER go-ethereum or luxfi
  2. NEVER use EWOQ keys -- generate fresh keys for every deployment
  3. NEVER pkill luxd -- use lux cli or send SIGINT/SIGTERM for graceful shutdown
  4. NEVER bump Go packages above v1.x.x (except luxfi/lattice/v7 and luxfi/zapdb/v4 which are already >v1)
  5. Go version must be 1.26.1 or higher
  6. CGO must be enabled for production builds (BLS, GPU crypto acceleration)
  7. FIPS 140-3 is always enabled -- do not disable it

Quick reference table

ItemValue
Modulegithub.com/luxfi/node
Go version1.26.1
Node version1.23.25 (default), from version.txt: 1.22.78
Binaryluxd
HTTP API port9630 (mainnet), 9640 (testnet), 9650 (devnet), 9660 (custom)
Staking/P2P portHTTP port + 1 (e.g., 9631 for mainnet)
RPC VM protocol42
Min compatible versionluxd/1.13.0
Database version1.4.5
Docker imageghcr.io/luxfi/node:<tag>
Hardware minimum8 vCPU, 16 GiB RAM, 1 TiB storage
OSUbuntu 22.04/24.04, macOS >= 12
Tier 1 platformlinux/amd64
Tier 2 platformslinux/arm64, darwin/amd64
Mainnet Network ID1 (P-Chain), C-Chain EVM ChainID: 96369
Testnet Network ID2 (P-Chain), C-Chain EVM ChainID: 96368
Devnet Network ID3 (P-Chain), C-Chain EVM ChainID: 96370
Custom Network ID1337 (both P-Chain and EVM)
Address HRPlux (mainnet), test (testnet), dev (devnet), custom (custom)

One-file quickstart

Build from source

git clone https://github.com/luxfi/node.git
cd node

# Minimal build (default: ZAP transport, all VMs, stripped ~30MB)
make build

# Or use build profiles:
./scripts/build.sh              # minimal stripped build
./scripts/build.sh -p full      # full build with gRPC+ZAP, all features (~36MB)
./scripts/build.sh -p dev       # development with debug symbols (~40MB)
./scripts/build.sh -p tiny      # UPX compressed (~20MB)
./scripts/build.sh -p core      # P/X/C only, plugin-ready (~25MB)

# Binary is at ./build/luxd

Run a validator

# Mainnet (default)
./build/luxd

# Testnet
./build/luxd --network-id=testnet

# Custom local network
./build/luxd --network-id=custom \
  --staking-enabled=false \
  --http-host=0.0.0.0 \
  --http-port=9660

# Or use Makefile targets
make run-mainnet    # Network ID 96369
make run-testnet    # Network ID 96368

API examples

# Node info
curl -X POST http://localhost:9630/ext/info \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","id":1,"method":"info.getNodeID"}'

# Health check
curl -X POST http://localhost:9630/ext/health \
  -d '{"jsonrpc":"2.0","id":1,"method":"health.health"}'

# Bootstrap status
curl -X POST http://localhost:9630/ext/info \
  -d '{"jsonrpc":"2.0","id":1,"method":"info.isBootstrapped","params":{}}'

# P-Chain: current validators
curl -X POST http://localhost:9630/ext/bc/P \
  -d '{"jsonrpc":"2.0","id":1,"method":"platform.getCurrentValidators","params":{}}'

# C-Chain: EVM JSON-RPC
curl -X POST http://localhost:9630/ext/bc/C/rpc \
  -d '{"jsonrpc":"2.0","id":1,"method":"eth_blockNumber","params":[]}'

# X-Chain: asset balance
curl -X POST http://localhost:9630/ext/bc/X \
  -d '{"jsonrpc":"2.0","id":1,"method":"avm.getBalance","params":{"address":"X-lux1...","assetID":"LUX"}}'

Go SDK client


c := client.New("http://localhost:9630")

nodeID, _ := c.Info().GetNodeID(ctx)
peers, _ := c.Info().Peers(ctx)
fmt.Printf("Node: %s, Peers: %d\n", nodeID, len(peers))

Docker

# Build image
./scripts/run-task.sh build-image

# Run
docker run -ti -p 9630:9630 -p 9631:9631 \
  -v luxd-data:/data \
  ghcr.io/luxfi/node:latest \
  --network-id=mainnet --db-dir=/data

Core Concepts

Architecture

luxd (main/main.go)
├── app/              — Application lifecycle (Start/Stop/ExitCode)
├── node/             — Node initialization, VM registration, resource management
├── chains/           — Chain manager (creates/manages all chain instances)
│   └── rpc/          — Inter-chain RPC communication
├── consensus/        — Consensus infrastructure
│   ├── engine/chain/ — Linear chain consensus engine (vote messages)
│   ├── quasar/       — Hybrid quantum-safe finality (BLS + Ringtail)
│   └── zap/          — ZAP bridge (W3C DID identity, agentic consensus)
├── network/          — P2P networking, peer management, IP tracking
│   ├── peer/         — Peer connections, handshake
│   ├── throttling/   — Inbound/outbound bandwidth throttling
│   ├── dialer/       — Connection dialing
│   └── tracker/      — Connection tracking
├── vms/              — Virtual Machine implementations
│   ├── platformvm/   — P-Chain (staking, validators, subnet creation)
│   ├── exchangevm/   — X-Chain (UTXO-based asset transfers, DAG consensus)
│   ├── evm/          — C-Chain support (LP-176/LP-226 precompiles; EVM runs as plugin)
│   ├── quantumvm/    — Q-Chain (post-quantum crypto, Ringtail keys)
│   ├── aivm/         — A-Chain (AI compute attestation, TEE/nvtrust)
│   ├── bridgevm/     — B-Chain (cross-chain bridge, MPC signing)
│   ├── thresholdvm/  — T-Chain (MPC-as-a-service, threshold signing)
│   ├── zkvm/         — Z-Chain (zero-knowledge proofs, FHE, nullifiers)
│   ├── graphvm/      — G-Chain (GraphQL/DGraph data layer)
│   ├── dexvm/        — D-Chain (decentralized exchange, orderbook, AMM)
│   ├── keyvm/        — K-Chain (distributed KMS, ML-KEM post-quantum)
│   ├── oraclevm/     — O-Chain (oracle data feeds, ZK aggregation)
│   ├── relayvm/      — R-Chain (cross-chain relay/message passing)
│   ├── identityvm/   — I-Chain (W3C DID, decentralized identity)
│   ├── servicenodevm/— Service node registration/discovery
│   ├── proposervm/   — Block proposal wrapper (Linear++, soft leader election)
│   ├── rpcchainvm/   — gRPC plugin VM interface
│   ├── chainadapter/ — Chain adapter utilities
│   ├── falconfx/     — Falcon post-quantum signature FX for X-Chain
│   ├── da/           — Data availability (blob store)
│   ├── components/   — Shared VM components (chain caching, state)
│   └── registry/     — VM discovery and registration
├── config/           — Node configuration (flags, viper, YAML)
├── genesis/          — Genesis block building
├── message/          — P2P message definitions (protobuf)
├── staking/          — TLS certificates, ML-DSA post-quantum key pairs
├── warp/             — LP-118 Warp cross-chain messaging (IPC sockets)
├── service/          — HTTP API services
│   ├── admin/        — Admin API
│   ├── health/       — Health check API
│   ├── info/         — Node info API
│   ├── keystore/     — Keystore API
│   ├── metrics/      — Prometheus metrics
│   ├── auth/         — API authentication
│   ├── backup/       — State backup
│   └── warp/         — Warp message API
├── server/           — HTTP server
├── indexer/          — Transaction/block indexer
├── upgrade/          — Network upgrade definitions
├── version/          — Version constants (semantic versioning, compatibility)
├── trace/            — OpenTelemetry tracing
├── benchlist/        — Validator benchmarking/blacklisting
├── benchmarks/       — Performance benchmarks
├── cache/            — Caching utilities (LRU)
├── gas/              — Gas pricing
├── nat/              — NAT traversal (UPnP, NAT-PMP)
├── pubsub/           — Pub/sub event system
├── router/           — Message routing
├── utils/            — General utilities
├── wallet/           — Wallet implementation
├── tests/            — E2E, load, upgrade tests
├── proto/            — Protobuf definitions
├── scripts/          — Build, test, lint scripts
├── docker/           — Docker-related files
├── k8s/              — Kubernetes manifests
└── x/                — Extended/experimental features

Chain Types

The Lux Network supports 14 built-in chain types across 3 tiers.

Primary Network Chains (always running)

ChainLetterVMConsensusPurpose
P-ChainPplatformvmLinear (Snowman)Validator management, staking, subnet/L1 creation
X-ChainXexchangevmDAG (Lux)UTXO-based asset creation and transfers
C-ChainCEVM pluginLinear (Snowman)EVM-compatible smart contracts (ChainID 96369)

Extended Chains (allvms build tag)

ChainLetterVMPurpose
Q-ChainQquantumvmPost-quantum cryptography, Ringtail keys, quantum stamps
A-ChainAaivmAI/ML compute attestation, TEE verification (SGX/SEV-SNP/TDX/nvtrust)
B-ChainBbridgevmCross-chain bridge with MPC threshold signing
T-ChainTthresholdvmMPC-as-a-service (CMP/LSS protocols)
Z-ChainZzkvmZero-knowledge proofs, FHE processing, nullifier tracking
G-ChainGgraphvmGraphQL/DGraph unified data layer
D-ChainDdexvmOn-chain DEX (orderbook, AMM, perpetuals, lending, MEV protection)
K-ChainKkeyvmDistributed key management (ML-KEM post-quantum, AES-GCM, HKDF)
O-ChainOoraclevmDecentralized oracle feeds, ZK aggregation proofs
R-ChainRrelayvmCross-chain relay and message passing
I-ChainIidentityvmW3C DID-based decentralized identity

Build Tags

  • Default build (no tag): P-Chain, X-Chain, C-Chain plugin, ProposerVM only
  • -tags=allvms: All 14 chain types (adds Q, A, B, T, Z, G, D, K, O, R, I)

Consensus Architecture

Lux Node implements a multi-consensus architecture:

Consensus Engines

  1. Linear (Snowman): For linear chains (P-Chain, C-Chain, Q-Chain, etc.). Blocks form a single chain. Uses ChainVM interface. Wrapped by ProposerVM (Linear++) for congestion control via soft leader election.

  2. DAG (Lux/Lux): For directed acyclic graph chains (X-Chain). Vertices can have multiple parents. Uses DAGVertex interface. Enables higher throughput via parallel transaction processing.

  3. Quasar: The hybrid quantum-safe finality engine. Runs on top of linear consensus. Produces hybrid finality proofs requiring both:

    • BLS Path: Aggregate BLS signatures from 2/3+ validator weight (96-byte proof, fast)
    • Ringtail Path: Post-quantum threshold signatures (t-of-n, 2-round protocol)
    • Both paths execute in parallel; blocks achieve quantum finality only when both complete
  4. ZAP (Zero-copy Agent Protocol): Bridges agentic consensus with Quasar. Uses W3C DID-based validator identity (did:lux, did:key, did:web methods). Supports ML-DSA-65 post-quantum public keys.

Signature Types

SignatureTypeBLS      = 0  // Classical BLS aggregate
SignatureTypeRingtail = 1  // Post-quantum threshold
SignatureTypeQuasar   = 2  // Hybrid BLS + Ringtail
SignatureTypeMLDSA    = 3  // ML-DSA fallback

Vote Flow

Validators cast votes (wire format: Chits/Vote messages) for proposed blocks. The consensus engine collects votes, runs polls, and pushes results into the consensus code to Accept/Reject containers (blocks or vertices).

Network Architecture

NetworkNetwork IDC-Chain EVM ChainIDHRPAPI PortQ-Chain ID
Mainnet196369lux963036963
Testnet296368test964036962
Devnet396370dev9650-
Custom13371337custom9660-
Dev13371337custom8545-

Staking port is always API port + 1 (e.g., 9631 for mainnet).

Staking and Identity

  • TLS Certificates: Self-signed ECDSA certs for P2P mutual auth (staking/tls.go)
  • BLS Keys: For aggregate signature consensus
  • ML-DSA Keys: Post-quantum key pairs for hybrid staking (staking/pq.go, uses github.com/luxfi/crypto/mldsa)
  • Ringtail Keys: Post-quantum threshold signature shares
  • W3C DIDs: Validator identity via did:lux method (ZAP bridge)

Cross-Chain Messaging (LP-118 Warp)

The Warp protocol enables cross-chain communication via IPC sockets. ChainIPCs manage event sockets for consensus and decision events per chain. Validators sign warp messages with BLS; cross-chain verification uses aggregate signature verification with signer bitsets.

Plugin Architecture

The C-Chain EVM runs as an external plugin via gRPC (RPC Chain VM protocol v42). The plugin binary is downloaded separately from github.com/luxfi/evm releases and placed in build/plugins/<vmID>. The default EVM plugin VM ID is mgj786NP7uDwBCcq6YwThhaN8FLyybkCa4zBWTQbNgmK6k9A6.

Custom VMs can also run as plugins via the same gRPC interface. The Lux Plugin Manager (lpm) handles plugin discovery and installation.

GPU Acceleration

Production builds link against libluxaccel for GPU-accelerated cryptographic operations:

  • NTT (Number Theoretic Transform) for lattice crypto
  • TFHE (Fully Homomorphic Encryption) operations
  • BLS batch verification
  • Built from luxcpp/accel C++ library

Configuration

# Key CLI flags
--network-id=mainnet|testnet|devnet|custom|<number>
--http-port=9630              # HTTP API port
--staking-port=9631           # P2P staking port
--http-host=127.0.0.1         # API listen address
--db-dir=/path/to/db          # Database directory
--data-dir=/path/to/data      # Data directory
--log-dir=/path/to/logs       # Log directory
--log-level=info|debug|trace  # Log verbosity
--bootstrap-ips=...           # Bootstrap node IPs
--bootstrap-ids=...           # Bootstrap node IDs
--staking-enabled=true        # Enable staking/TLS
--staking-tls-cert-file=...   # Staking TLS cert
--staking-tls-key-file=...    # Staking TLS key
--index-enabled=true          # Enable transaction indexer
--api-admin-enabled=false     # Enable admin API
--http-allowed-origins="*"    # CORS origins
--consensus-sample-size=20    # Consensus sample size
--consensus-quorum-size=14    # Consensus quorum size

Makefile Targets

make build              # Build luxd binary (minimal profile)
make test               # Run all tests with race detector
make test-short         # Short tests only
make test-unit          # Unit tests
make test-integration   # Integration tests
make test-e2e           # End-to-end tests
make test-package PKG=./vms/platformvm  # Test specific package
make fmt                # Format with gofumpt
make lint               # Run golangci-lint
make clean              # Remove build artifacts
make install            # Install to $GOPATH/bin
make install-system     # Install to /usr/local/bin (sudo)
make install-local      # Install to ~/.local/bin
make install-dev        # Symlink for development
make run-mainnet        # Start mainnet node
make run-testnet        # Start testnet node
make node-status        # Check bootstrap status
make stop-node          # Stop running node
make verify-fips        # Show FIPS environment
make build-release      # Optimized release binary (~46MB)
make build-release-upx  # Release + UPX compression (~20MB)
make build-mlx          # Build with MLX GPU acceleration
make mockgen            # Generate mock files
make dev-setup          # Download dependencies

Troubleshooting

IssueCauseSolution
Node won't startPort conflictCheck 9630/9631 (or network-specific ports) availability with lsof -i :PORT
Slow syncInsufficient hardwareMeet minimum 8 vCPU / 16 GiB / 1 TiB requirements; increase DB IOPS
Peer connection failsFirewall blocking staking portOpen staking port (API port + 1) for inbound TCP
Bootstrap timeoutBad bootstrap nodesUse official bootstrap endpoints; check info.isBootstrapped
Import errorsUsing go-ethereumSwitch ALL imports to github.com/luxfi/* packages
Build fails CGOMissing C compilerInstall gcc and g++ (or set CGO_ENABLED=0 for non-production)
FIPS errorsGo version too oldUpgrade to Go 1.26.1+ which supports GOFIPS140=latest
Plugin VM crashRPC protocol mismatchEnsure EVM plugin matches node's RPC VM protocol version (42)
Cross-compile failsWrong cross-compilerUse gcc-aarch64-linux-gnu for arm64, gcc-x86-64-linux-gnu for amd64
Quasar finality failsRingtail not initializedEnsure all validators have both BLS and Ringtail keypairs; check ErrRingtailNotConnected
allvms VMs missingWrong build tagBuild with -tags=allvms for Q/A/B/T/Z/G/D/K/O/R/I chains
Large binary sizeDebug symbols includedUse make build-release or -p tiny profile for smaller binary
  • lux/lux-consensus.md -- Quasar consensus engine (separate repo: github.com/luxfi/consensus)
  • lux/lux-evm.md -- C-Chain EVM execution (separate repo: github.com/luxfi/evm)
  • lux/lux-sdk.md -- Go SDK for node interaction (github.com/luxfi/sdk)
  • lux/lux-cli.md -- CLI for node management (github.com/luxfi/lux-cli)

On this page