Lux Docs
Build

Subnets

Create and deploy custom subnets on Lux Network

Subnets

Subnets are sovereign networks within Lux that define their own rules for membership, consensus parameters, and virtual machine implementations. Every subnet is validated by a dynamic set of validators who also validate the Lux Primary Network.

What Are Subnets?

A subnet is an independent network with its own:

  • Validator set - Choose which validators participate
  • Consensus parameters - Tune finality speed and throughput
  • Virtual machine - Run EVM, Subnet-EVM, or a fully custom VM
  • Gas token - Use LUX or a custom native token
  • Access control - Public or permissioned networks

Subnets do not share state or execution with other subnets. They are isolated environments that leverage the Lux Primary Network for validator coordination and security.

Create a Subnet

Using the CLI

Install the Lux CLI

npm install -g @luxfi/cli

Create the Subnet Configuration

lux subnet create my-subnet

You will be prompted to select:

  • VM type: Subnet-EVM (recommended), Custom
  • Chain ID: A unique identifier for your subnet's chain
  • Gas configuration: Fee structure and limits
  • Airdrop: Optional initial token distribution

Deploy to Local Network

lux subnet deploy my-subnet --local

This starts a local multi-node network with your subnet for testing.

Deploy to Testnet

lux subnet deploy my-subnet --testnet

This creates the subnet on-chain and registers validators on the Lux testnet.

Deploy to Mainnet

lux subnet deploy my-subnet --mainnet

Subnet-EVM Configuration

Subnet-EVM is the most common VM for subnets. It is a configurable fork of the Lux C-Chain EVM.

Genesis Configuration

{
  "config": {
    "chainId": 12345,
    "feeConfig": {
      "gasLimit": 15000000,
      "targetBlockRate": 2,
      "minBaseFee": 25000000000,
      "targetGas": 15000000,
      "baseFeeChangeDenominator": 36,
      "minBlockGasCost": 0,
      "maxBlockGasCost": 1000000,
      "blockGasCostStep": 200000
    },
    "allowFeeRecipients": false
  },
  "alloc": {
    "0xYourAddress": {
      "balance": "0x52B7D2DCC80CD2E4000000"
    }
  },
  "nonce": "0x0",
  "timestamp": "0x0",
  "gasLimit": "0xE4E1C0"
}

Key Configuration Options

OptionDescriptionDefault
chainIdUnique chain identifierRequired
gasLimitMaximum gas per block15,000,000
targetBlockRateTarget seconds between blocks2
minBaseFeeMinimum gas price in Wei25 Gwei
allowFeeRecipientsAllow validators to collect feesfalse

Precompiles

Enable optional precompiles in your subnet genesis:

{
  "config": {
    "contractNativeMinterConfig": {
      "blockTimestamp": 0,
      "adminAddresses": ["0xAdminAddress"]
    },
    "contractDeployerAllowListConfig": {
      "blockTimestamp": 0,
      "adminAddresses": ["0xAdminAddress"]
    },
    "txAllowListConfig": {
      "blockTimestamp": 0,
      "adminAddresses": ["0xAdminAddress"]
    }
  }
}

Validator Management

Adding Validators

Each subnet validator must also be a Primary Network validator with at least 2,000 LUX staked.

lux subnet addValidator my-subnet \
  --node-id=NodeID-... \
  --stake-amount=2000 \
  --start-time="2025-01-01T00:00:00Z" \
  --end-time="2026-01-01T00:00:00Z"

Validator Requirements

RequirementValue
Primary Network stakeMinimum 2,000 LUX
Subnet stakeDefined by subnet creator
UptimeSubnet-specific (recommended 80%+)
DurationMust overlap with Primary Network validation period

Custom Virtual Machines

For use cases that require non-EVM execution, you can build a custom VM.

A Lux VM implements the block.ChainVM interface:

type ChainVM interface {
    Initialize(ctx *snow.Context, db database.Database, genesisBytes []byte, ...) error
    BuildBlock() (Block, error)
    ParseBlock([]byte) (Block, error)
    GetBlock(ids.ID) (Block, error)
    SetPreference(ids.ID) error
    LastAccepted() (ids.ID, error)
}

Custom VMs are powerful but require careful design. For most applications, Subnet-EVM with custom precompiles provides sufficient flexibility without the complexity of a fully custom VM.

Subnet Architecture

┌──────────────────────────────────────────────┐
│               Primary Network                │
│  ┌──────────┬──────────┬──────────┐         │
│  │ P-Chain  │ X-Chain  │ C-Chain  │         │
│  └──────────┴──────────┴──────────┘         │
│        Validators: {A, B, C, D, E}           │
└──────────────────────────────────────────────┘
           │                    │
    ┌──────┴──────┐     ┌──────┴──────┐
    │  Subnet-1   │     │  Subnet-2   │
    │  EVM-based  │     │  Custom VM  │
    │  Validators:│     │  Validators:│
    │  {A, B, C}  │     │  {B, D, E}  │
    └─────────────┘     └─────────────┘

Use Cases

DeFi Chains

High-throughput subnets optimized for decentralized finance with custom gas tokens and fee structures.

Gaming Networks

Low-latency subnets with fast block times and permissioned validator sets for predictable performance.

Enterprise Chains

Permissioned subnets with transaction allow-lists and KYC-compliant validator sets.

AI Compute

Specialized subnets for decentralized AI inference and training coordination.

Further Reading

On this page