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
| Package | Version | Purpose |
|---|---|---|
github.com/luxfi/consensus | v1.22.69 | Quasar consensus engine, DAG/linear engines |
github.com/luxfi/crypto | v1.17.42 | BLS, secp256k1, ML-DSA, ML-KEM, certificates |
github.com/luxfi/database | v1.17.43 | Storage layer (LevelDB, PebbleDB, VersionDB) |
github.com/luxfi/geth | v1.16.76 | Go Ethereum fork (C-Chain EVM plugin base) |
github.com/luxfi/sdk | v1.16.45 | Go SDK for node interaction |
github.com/luxfi/warp | v1.18.5 | Cross-chain messaging (LP-118 Warp protocol) |
github.com/luxfi/lattice/v7 | v7.0.0 | Post-quantum lattice cryptography |
github.com/luxfi/genesis | v1.6.2 | Genesis configuration and bootstrapping |
github.com/luxfi/vm | v1.0.39 | VM interface (ChainVM, DAG VM) |
github.com/luxfi/ai | v0.0.0-20251225 | AI integration for AIVM |
github.com/luxfi/threshold | v1.5.5 | MPC threshold signing (CMP, LSS protocols) |
github.com/luxfi/p2p | v1.19.2-zap | ZAP (Zero-copy Agent Protocol) P2P transport |
github.com/luxfi/constants | v1.4.4 | Network IDs, VM IDs, chain IDs, port constants |
github.com/luxfi/ids | v1.2.9 | ID types (NodeID, BlockID, TxID, ChainID) |
github.com/luxfi/accel | v1.0.6 | GPU-accelerated crypto (NTT, TFHE, BLS batch) |
github.com/luxfi/compress | v0.0.5 | Compression utilities |
github.com/luxfi/validators | v1.0.0 | Validator management and uptime tracking |
github.com/luxfi/staking | v1.1.0 | Staking certificate management |
github.com/luxfi/version | v1.0.1 | Version utilities |
github.com/luxfi/concurrent | v0.0.3 | Concurrency primitives |
github.com/luxfi/codec | v1.1.4 | Binary codec and serialization |
github.com/luxfi/address | v1.0.1 | Address formatting (bech32) |
github.com/luxfi/formatting | v1.0.1 | Display formatting utilities |
github.com/luxfi/utxo | v0.2.4 | UTXO model types |
github.com/luxfi/units | v1.0.0 | Unit conversions (LUX, nLUX) |
github.com/luxfi/ringtail | v0.2.0 | Post-quantum Ringtail threshold signatures |
github.com/luxfi/sampler | v1.0.0 | Weighted random sampling for validator selection |
github.com/luxfi/zapdb/v4 | v4.9.3 | ZAP database integration |
github.com/ProjectZKM/Ziren | v0.0.0-20260215 | ZK runtime for zkVM |
github.com/cloudflare/circl | v1.6.3 | Cloudflare crypto (post-quantum, curves) |
github.com/consensys/gnark-crypto | v0.19.2 | ZK-SNARK crypto primitives |
github.com/spf13/cobra | v1.10.2 | CLI framework |
github.com/spf13/viper | v1.21.0 | Configuration management |
go.uber.org/zap | v1.27.1 | Structured logging |
google.golang.org/grpc | v1.79.1 | gRPC transport |
google.golang.org/protobuf | v1.36.11 | Protocol buffer runtime |
connectrpc.com/connect | v1.19.1 | ConnectRPC (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
- ALWAYS use
github.com/luxfi/*packages -- NEVERgo-ethereumorluxfi - NEVER use EWOQ keys -- generate fresh keys for every deployment
- NEVER
pkill luxd-- uselux clior send SIGINT/SIGTERM for graceful shutdown - NEVER bump Go packages above v1.x.x (except
luxfi/lattice/v7andluxfi/zapdb/v4which are already >v1) - Go version must be 1.26.1 or higher
- CGO must be enabled for production builds (BLS, GPU crypto acceleration)
- FIPS 140-3 is always enabled -- do not disable it
Quick reference table
| Item | Value |
|---|---|
| Module | github.com/luxfi/node |
| Go version | 1.26.1 |
| Node version | 1.23.25 (default), from version.txt: 1.22.78 |
| Binary | luxd |
| HTTP API port | 9630 (mainnet), 9640 (testnet), 9650 (devnet), 9660 (custom) |
| Staking/P2P port | HTTP port + 1 (e.g., 9631 for mainnet) |
| RPC VM protocol | 42 |
| Min compatible version | luxd/1.13.0 |
| Database version | 1.4.5 |
| Docker image | ghcr.io/luxfi/node:<tag> |
| Hardware minimum | 8 vCPU, 16 GiB RAM, 1 TiB storage |
| OS | Ubuntu 22.04/24.04, macOS >= 12 |
| Tier 1 platform | linux/amd64 |
| Tier 2 platforms | linux/arm64, darwin/amd64 |
| Mainnet Network ID | 1 (P-Chain), C-Chain EVM ChainID: 96369 |
| Testnet Network ID | 2 (P-Chain), C-Chain EVM ChainID: 96368 |
| Devnet Network ID | 3 (P-Chain), C-Chain EVM ChainID: 96370 |
| Custom Network ID | 1337 (both P-Chain and EVM) |
| Address HRP | lux (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/luxdRun 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 96368API 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=/dataCore 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 featuresChain Types
The Lux Network supports 14 built-in chain types across 3 tiers.
Primary Network Chains (always running)
| Chain | Letter | VM | Consensus | Purpose |
|---|---|---|---|---|
| P-Chain | P | platformvm | Linear (Snowman) | Validator management, staking, subnet/L1 creation |
| X-Chain | X | exchangevm | DAG (Lux) | UTXO-based asset creation and transfers |
| C-Chain | C | EVM plugin | Linear (Snowman) | EVM-compatible smart contracts (ChainID 96369) |
Extended Chains (allvms build tag)
| Chain | Letter | VM | Purpose |
|---|---|---|---|
| Q-Chain | Q | quantumvm | Post-quantum cryptography, Ringtail keys, quantum stamps |
| A-Chain | A | aivm | AI/ML compute attestation, TEE verification (SGX/SEV-SNP/TDX/nvtrust) |
| B-Chain | B | bridgevm | Cross-chain bridge with MPC threshold signing |
| T-Chain | T | thresholdvm | MPC-as-a-service (CMP/LSS protocols) |
| Z-Chain | Z | zkvm | Zero-knowledge proofs, FHE processing, nullifier tracking |
| G-Chain | G | graphvm | GraphQL/DGraph unified data layer |
| D-Chain | D | dexvm | On-chain DEX (orderbook, AMM, perpetuals, lending, MEV protection) |
| K-Chain | K | keyvm | Distributed key management (ML-KEM post-quantum, AES-GCM, HKDF) |
| O-Chain | O | oraclevm | Decentralized oracle feeds, ZK aggregation proofs |
| R-Chain | R | relayvm | Cross-chain relay and message passing |
| I-Chain | I | identityvm | W3C 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
-
Linear (Snowman): For linear chains (P-Chain, C-Chain, Q-Chain, etc.). Blocks form a single chain. Uses
ChainVMinterface. Wrapped by ProposerVM (Linear++) for congestion control via soft leader election. -
DAG (Lux/Lux): For directed acyclic graph chains (X-Chain). Vertices can have multiple parents. Uses
DAGVertexinterface. Enables higher throughput via parallel transaction processing. -
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
-
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 fallbackVote 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
| Network | Network ID | C-Chain EVM ChainID | HRP | API Port | Q-Chain ID |
|---|---|---|---|---|---|
| Mainnet | 1 | 96369 | lux | 9630 | 36963 |
| Testnet | 2 | 96368 | test | 9640 | 36962 |
| Devnet | 3 | 96370 | dev | 9650 | - |
| Custom | 1337 | 1337 | custom | 9660 | - |
| Dev | 1337 | 1337 | custom | 8545 | - |
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, usesgithub.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/accelC++ 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 sizeMakefile 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 dependenciesTroubleshooting
| Issue | Cause | Solution |
|---|---|---|
| Node won't start | Port conflict | Check 9630/9631 (or network-specific ports) availability with lsof -i :PORT |
| Slow sync | Insufficient hardware | Meet minimum 8 vCPU / 16 GiB / 1 TiB requirements; increase DB IOPS |
| Peer connection fails | Firewall blocking staking port | Open staking port (API port + 1) for inbound TCP |
| Bootstrap timeout | Bad bootstrap nodes | Use official bootstrap endpoints; check info.isBootstrapped |
| Import errors | Using go-ethereum | Switch ALL imports to github.com/luxfi/* packages |
| Build fails CGO | Missing C compiler | Install gcc and g++ (or set CGO_ENABLED=0 for non-production) |
| FIPS errors | Go version too old | Upgrade to Go 1.26.1+ which supports GOFIPS140=latest |
| Plugin VM crash | RPC protocol mismatch | Ensure EVM plugin matches node's RPC VM protocol version (42) |
| Cross-compile fails | Wrong cross-compiler | Use gcc-aarch64-linux-gnu for arm64, gcc-x86-64-linux-gnu for amd64 |
| Quasar finality fails | Ringtail not initialized | Ensure all validators have both BLS and Ringtail keypairs; check ErrRingtailNotConnected |
| allvms VMs missing | Wrong build tag | Build with -tags=allvms for Q/A/B/T/Z/G/D/K/O/R/I chains |
| Large binary size | Debug symbols included | Use make build-release or -p tiny profile for smaller binary |
Related Skills
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)