Hanzo AI 8da1cca53b genesis/builder: ZAP-native genesis codec (Wave 2G-Genesis)
Migrates pvmGenesisCodec() and newXVMParserCodecs() off the legacy
linearcodec big-endian wire format onto the ZAP-native zapcodec
little-endian wire format. Aligned with LP-023 ZAP-native activation
(proto/zap_native: ZAPActivationUnix=0 — "ZAP mandatory from genesis"),
forward-only.

Wire-format verdict: BREAK.

ZAP-native bytes are NOT byte-equivalent to legacy linearcodec bytes —
endianness flips for every uint16/uint32/uint64/string-length prefix.
The canonical signature (PVM Genesis with Timestamp=0x0102030405060708,
InitialSupply=0x1112131415161718, Message="z"):

  legacy linearcodec (BE): ... 01 02 03 04 05 06 07 08  11 12 13 14 15 16 17 18 ...
  ZAP-native zapcodec (LE): ... 08 07 06 05 04 03 02 01  18 17 16 15 14 13 12 11 ...

No coordinated network upgrade needed: this is the first ZAP-native
genesis tag, and no production validator was running legacy linearcodec
in the post-LP-023 fleet. Mainnet/testnet/devnet/localnet all bootstrap
ZAP-only from genesis.

Code changes:

  - builder.go:
      Drop github.com/luxfi/codec + .../linearcodec direct imports.
      Drop math.MaxInt32 inline construction.
      pvmGenesisCodec()    calls newZapCodecPVMGenesis(CodecVersion)
                           + pchainblock.RegisterTypes(cm).
      newXVMParserCodecs() calls newZapCodecXVMParser(CodecVersion).
      Mirrors sdk/wallet/chain/p/pcodecs.NewPVMGenesisCodec and
      sdk/wallet/chain/x/constants.go::newXVMParserCodecs which already
      moved to proto/zap_codec in Wave 2G-Wallet.

  - zap_codec.go (new):
      Staging shim mirroring proto/zap_codec's public surface
      (NewPVMGenesis, NewXVMParser, Manager.{Marshal,Unmarshal,Size,
      RegisterType,SkipRegistrations}). When Wave 2G-Wallet lands and
      tags github.com/luxfi/proto/zap_codec, this file deletes and the
      two helpers in builder.go swap to that import — mechanical, no
      behavioural change because both shim and target wrap the same
      zapcodec.Codec backend.

  - wire_test.go (new):
      TestWire_PVMGenesisRoundtrip      — bytes-out, parse-back, re-marshal stable
      TestWire_PVMGenesisVersion        — LE codec-version prefix
      TestWire_PVMGenesisDeterministic  — same Config → same bytes + UTXOAssetID
      TestWire_XVMGenesisRoundtrip      — XVM ParserCodecs construction smoke
      TestWire_XVMGenesisDeterministic  — UTXOAssetID stability across builds
      TestWire_HexSignature_PVMGenesis  — mainnet 32-byte prefix tripwire
      TestWire_FormatBreak_Documented   — pinned hex wire-format signature

  - go.mod:
      luxfi/codec  v1.1.4 (indirect) → v1.1.5 (direct: zapcodec backend)
      luxfi/accel  v1.1.4 (indirect) → v1.1.8 (transitive)

Constraint-compliance:

  - NO github.com/luxfi/codec imports in builder.go (verified by grep).
  - NO snow/avalanche/subnet naming.
  - All builder tests pass (go test ./...).
  - All parent genesis + cmd modules build clean.
  - Race detector clean.

TODO (wave-2g-wallet): once luxfi/proto tags include the zap_codec
subpackage, swap zap_codec.go's shim for the canonical
github.com/luxfi/proto/zap_codec import in builder.go and delete the
shim file.
2026-06-06 04:58:12 -07:00
2026-06-02 23:11:39 -07:00

Lux Network Genesis Configurations

This repository contains the canonical genesis configurations for all Lux networks.

Directory Structure

genesis/
├── mainnet/           # LUX Mainnet (Chain ID: 96369)
│   ├── cchain.json    # C-Chain genesis (EVM compatible)
│   ├── pchain.json    # P-Chain genesis (ProtocolVM)
│   ├── xchain.json    # X-Chain genesis (Exchange chain)
│   ├── network.json   # Network configuration
│   └── genesis.json   # Full network genesis
├── testnet/           # LUX Testnet (Chain ID: 96368)
│   ├── cchain.json    # C-Chain genesis (EVM compatible)
│   └── genesis.json   # Full testnet genesis
├── devnet/            # LUX Devnet (Chain ID: 96370) - Fast iteration network
│   └── cchain.json    # C-Chain genesis (EVM compatible)
├── local/             # Local development network (Chain ID: 1337)
│   ├── cchain.json    # C-Chain genesis (EVM compatible)
│   └── genesis.json   # Local network genesis
├── bootstrappers.json # Network bootstrapper nodes
└── checkpoints.json   # Network checkpoints

Mainnet C-Chain Genesis

The mainnet C-Chain was initialized with a single genesis allocation:

Address Balance
0x9011e888251ab053b7bd1cdb598db4f9ded94714 2,000,000,000,000,000,000,000,000,000,000 wei (2T LUX)

Key Parameters

  • Chain ID: 96369
  • Gas Limit: 30,000,000 (0x1C9C380)
  • Min Base Fee: 25 gwei
  • Block Rate: 2 seconds

Network IDs

Network Chain ID Network ID Purpose
LUX Mainnet 96369 96369 Production network
LUX Testnet 96368 96368 Public test network
LUX Devnet 96370 96370 Fast iteration dev network
Local 1337 1337 Local development

Network Configurations

Mainnet (96369)

  • Block Rate: 2 seconds
  • Gas Limit: 30M
  • Min Base Fee: 25 gwei
  • Genesis Account: 0x9011... with 2T LUX

Testnet (96368)

  • Block Rate: 2 seconds
  • Gas Limit: 12M
  • Min Base Fee: 25 gwei
  • Genesis Account: 0x9011... with 2T LUX (same as mainnet)

Devnet (96370)

  • Block Rate: 1 second (faster)
  • Gas Limit: 20M
  • Min Base Fee: 1 gwei (cheaper)
  • Genesis Account: 0x9011... with 2T LUX
  • All upgrades enabled at genesis (Shanghai, Cancun, etc.)

Local (1337)

  • Block Rate: 1 second
  • Gas Limit: 15M
  • Min Base Fee: 1 gwei
  • Genesis Account: 0x9011... with 2T LUX
  • All upgrades enabled at genesis

Usage

These genesis files are used by:

  • luxd node for network initialization
  • coreth for C-Chain configuration
  • Block explorers for genesis block verification
  • Migration tools for state reconstruction

RPC Endpoints

  • Mainnet: http://localhost:9630/ext/bc/C/rpc
  • Testnet: http://localhost:9630/ext/bc/C/rpc (testnet node)
  • Devnet: http://localhost:9630/ext/bc/C/rpc (devnet node)

Genesis Account

All networks use the same production genesis account:

Account Balance Networks
0x9011e888251ab053b7bd1cdb598db4f9ded94714 2T LUX All networks

State Data & RLP Exports

Blockchain state exports and RLP-encoded blocks are maintained in a separate repository:

Repository: github.com/luxfi/state

Available Data

Network Chain ID Blocks RLP Location
Lux Mainnet 96369 1,082,780 rlp/lux-mainnet/lux-mainnet-96369.rlp
Lux Testnet 96368 219 rlp/lux-testnet/lux-testnet-96368.rlp
Zoo Mainnet 200200 799 rlp/zoo-mainnet/zoo-mainnet-200200.rlp
Zoo Testnet 200201 85 rlp/zoo-testnet/zoo-testnet-200201.rlp

Import Workflow

# Clone repos
git clone https://github.com/luxfi/genesis
git clone https://github.com/luxfi/state

# Initialize with genesis
geth init --datadir /path/to/db genesis/mainnet/cchain.json

# Import blocks from state repo
geth import --datadir /path/to/db state/rlp/lux-mainnet/lux-mainnet-96369.rlp

Source Data

The state repo also contains:

  • pebbledb/ - Original SubnetEVM PebbleDB databases
  • docs/ - State verification and recovery documentation
  • pkg/ - Go tools for archaeology, bridge, and scanning
S
Description
Lux Network genesis for Mainnet, Testnet, Devnet, Local/Custom.
Readme BSD-3-Clause
20 MiB
Languages
Go 96.6%
Python 3%
Makefile 0.4%