Lux Docs
Lux Skills Reference

Lux SDK

Official Go SDK

Overview

Lux SDK is the official Go SDK for building and managing Lux networks. It provides a unified interface for network lifecycle management, blockchain creation and deployment (L1/L2/L3), multi-chain wallet operations, validator management, smart contract interaction, and cross-chain messaging via Warp. The SDK wraps CLI, netrunner, and direct node APIs into a single coherent library.

Quick Reference

ItemValue
Modulegithub.com/luxfi/sdk
Go1.26.1
Entry pointsdk.go (LuxSDK struct)
Main APIsdk.New(cfg) returns *LuxSDK

Core luxfi Dependencies

DependencyVersionPurpose
github.com/luxfi/consensusv1.22.63Snow consensus engine
github.com/luxfi/evmv0.8.35C-Chain EVM
github.com/luxfi/nodev1.23.4Lux node implementation
github.com/luxfi/netrunnerv1.15.11Network testing orchestrator
github.com/luxfi/genesisv1.6.1Genesis configuration
github.com/luxfi/warpv1.18.5Cross-chain Warp messaging
github.com/luxfi/ledgerv1.1.6Hardware wallet support
github.com/luxfi/lpmv1.9.4Lux Plugin Manager
github.com/luxfi/cryptov1.17.40Cryptographic primitives
github.com/luxfi/gethv1.16.75Go-Ethereum fork (EVM)
github.com/luxfi/idsv1.2.9ID types (ID, ShortID, NodeID)
github.com/luxfi/protocolv0.0.3P-Chain protocol types
github.com/luxfi/rpcv1.0.0JSON-RPC client
github.com/luxfi/utxov0.2.4UTXO management
github.com/luxfi/vmv1.0.33Virtual machine interfaces
github.com/luxfi/validatorsv1.0.0Validator types
github.com/luxfi/constantsv1.4.4Network constants
github.com/luxfi/databasev1.17.40Storage layer
github.com/luxfi/codecv1.1.4Serialization codec
github.com/luxfi/formattingv1.0.1Encoding utilities
github.com/luxfi/keychainv1.0.2Key management
github.com/luxfi/addressv1.0.1Bech32 address formatting
github.com/luxfi/apiv1.0.1API types
github.com/luxfi/bftv0.1.5BFT consensus
github.com/luxfi/go-bip32v1.0.2BIP-32 HD keys
github.com/luxfi/go-bip39v1.1.2BIP-39 mnemonics
github.com/luxfi/runtimev1.0.1VM runtime
github.com/luxfi/upgradev1.0.0Upgrade management
github.com/luxfi/tlsv1.0.3TLS certificate utilities
github.com/luxfi/netv0.0.2Network utilities
github.com/luxfi/mathv1.2.3Math utilities
github.com/luxfi/utilsv1.1.4General utilities
github.com/luxfi/p2pv1.19.2-zapP2P networking

Package Map

Top-Level SDK

PackageImportPurpose
sdkgithub.com/luxfi/sdkLuxSDK struct -- entry point with New(cfg), Networks(), Blockchains(), LaunchNetwork(), CreateAndDeployBlockchain()
config.../sdk/configConfig struct with Default() factory
constants.../sdk/constantsSDK-level constants

Network Management

PackageImportPurpose
network.../sdk/networkNetworkManager -- create/start/stop networks. Types: NetworkType (mainnet/testnet/local/custom), NetworkStatus, NodeType (validator/api/full/light), NetworkParams
network (legacy).../sdk/networkLegacyNetwork with predefined MainnetNetwork (api.lux.network), TestnetNetwork (api-test.lux.network), LocalNetwork (127.0.0.1:9630)
netrunner.../sdk/netrunnerWraps github.com/luxfi/netrunner for test network orchestration
connect.../sdk/connectNode connection utilities

Blockchain Creation

PackageImportPurpose
blockchain.../sdk/blockchainBuilder -- CreateBlockchain(), Deploy(). Types: BlockchainType (L1/L2/L3), VMType (evm/wasm/custom/tokenvm/morpheusvm), Blockchain, Net, GenesisAccount, GenesisValidator
chainconfig.../sdk/chainconfigChain config and genesis generation/parsing
configspec.../sdk/configspecConfiguration specification utilities
fees.../sdk/feesFee configuration

Chain Clients

PackageImportPurpose
platformvm.../sdk/platformvmP-Chain client: GetHeight(), GetBalance(), GetUTXOs(), GetCurrentValidators(), GetNet(), GetNets(), GetStakingAssetID(), GetL1Validator()
exchangevm.../sdk/exchangevmX-Chain client: Client, WalletClient, StaticClient -- UTXO transfers, asset creation
evm.../sdk/evmC-Chain EVM utilities
health.../sdk/healthNode health client with Health(ctx)
admin.../sdk/adminAdmin API client
info.../sdk/infoNode info client
indexer.../sdk/indexerTransaction indexer client

Wallet & Key Management

PackageImportPurpose
wallet.../sdk/walletWallet struct -- multi-chain wallet with ImportKey(), BLS key support for validator ops, UTXO tracking
wallet/primary.../sdk/wallet/primaryPrimary network wallet operations
wallet/chain.../sdk/wallet/chainPer-chain wallet backends
wallet/crypto.../sdk/wallet/cryptoWallet cryptographic operations
wallet/keychain.../sdk/wallet/keychainWallet keychain management
key.../sdk/keyKey struct (ed25519/bls/secp256k1), Keychain with Add(), Sign(), Get(), Addresses()
keychain.../sdk/keychainExtended keychain utilities
ledger.../sdk/ledgerLedger hardware wallet integration
crypto.../sdk/cryptoEd25519 key operations
multisig.../sdk/multisigMulti-signature transaction support

Validator Management

PackageImportPurpose
validator.../sdk/validatorValidator configuration and context
validatormanager.../sdk/validatormanagerL1 validator lifecycle: PoA and PoS manager contracts, registration, removal, weight updates, uptime tracking. Embeds deployed contract bytecodes (ValidatorMessages, PoAValidatorManager, PoSValidatorManager, TransparentUpgradeableProxy)
validatormanager/txs.../sdk/validatormanager/txsValidator manager transaction types
validatormanager/warp.../sdk/validatormanager/warpWarp message handling for validator ops

Smart Contracts

PackageImportPurpose
contract.../sdk/contractSmart contract interaction: Deploy(), Chain(), ABI parsing, receipt status handling, allocation management. Uses github.com/luxfi/evm/accounts/abi/bind
contract/contracts.../sdk/contract/contractsPrecompiled contract interfaces
contracts/bin.../sdk/contracts/binCompiled contract binaries

Cross-Chain

PackageImportPurpose
warp.../sdk/warpWarp cross-chain messaging utilities

Infrastructure

PackageImportPurpose
lpm.../sdk/lpmLux Plugin Manager -- VM plugin installation
models.../sdk/modelsData models: Network, Sidecar, L2, Host, ClustersConfig, BootstrapValidator, NodeConfig, VM, Cloud, Docker
publicarchive.../sdk/publicarchivePublic archive downloader for chain data
profiles.../sdk/profilesNode configuration profiles
trace.../sdk/traceOpenTelemetry tracing
utils.../sdk/utilsGeneral utilities
utils/fs.../sdk/utils/fsFilesystem utilities
ux.../sdk/uxUser experience helpers (output formatting)
prompts.../sdk/promptsInteractive prompt utilities
flags.../sdk/flagsCLI flag mutex support
assets.../sdk/assetsEmbedded asset files
chain.../sdk/chainChain type definitions

Chain Support

ChainTypeSDK PackageOperations
P-ChainPlatformplatformvmStaking, validators, L1/net creation, UTXOs, balance
X-ChainExchangeexchangevmUTXO transfers, asset creation/minting
C-ChainContractevmEVM transactions, contract deployment
Q-ChainQuantum(via node API)PQ-specific operations
M-ChainMPC(via node API)Multi-party custody

Network Endpoints

NetworkIDEndpoint
Mainnetconstants.MainnetIDhttps://api.lux.network
Testnetconstants.TestnetIDhttps://api-test.lux.network
Localconstants.LocalIDhttp://127.0.0.1:9630
Devnetcustomcustom

API Examples

Initialize SDK


cfg := config.Default()
s, err := sdk.New(cfg)
// s.Networks()    -> *network.NetworkManager
// s.Blockchains() -> *blockchain.Builder

Launch Network

net, err := s.LaunchNetwork(ctx, "local", 5)

Create & Deploy Blockchain

bc, err := s.CreateAndDeployBlockchain(ctx, &sdk.BlockchainParams{
    Name:    "my-chain",
    Type:    blockchain.TypeL1,
    VMType:  blockchain.VMTypeEVM,
    ChainID: big.NewInt(43114),
    Network: net,
})

P-Chain Client


client := platformvm.NewClientWithNetworkID("http://localhost:9630", 1)
height, err := client.GetHeight(ctx)
validators, err := client.GetCurrentValidators(ctx, chainID, nil)
balance, err := client.GetBalance(ctx, addrs)

Wallet Operations


w := wallet.New(networkID, chainID)
addr, err := w.ImportKey(privateKey)

Key Management


kc := key.NewKeychain()
err := kc.Add(privateKey)
sig, err := kc.Sign(message, address)

Smart Contract Deployment


// Contract interaction uses luxfi/evm/accounts/abi/bind
// and luxfi/geth types for EVM compatibility

Validator Manager (L1)


// Deploys embedded PoA/PoS validator manager contracts
// Handles registration, removal, weight updates via Warp

VM Types

VMConstantDescription
EVMVMTypeEVMEthereum Virtual Machine (via luxfi/evm)
WASMVMTypeWASMWebAssembly VM
CustomVMTypeCustomUser-provided VM
TokenVMVMTypeTokenVMHyperSDK token VM
MorpheusVMVMTypeMorpheusVMHyperSDK general VM
  • lux/lux-node.md -- Node that SDK connects to
  • lux/lux-cli.md -- CLI tool (SDK wraps CLI)
  • lux/lux-netrunner.md -- Network testing (SDK wraps netrunner)
  • lux/lux-crypto.md -- Cryptographic primitives used by SDK
  • lux/lux-evm.md -- EVM implementation

On this page