Documentation
¶
Overview ¶
Package chainkit provides the chain.yaml schema, parser, validator, and CRD generator for the `lux chain launch` command.
A single chain.yaml file drives the entire ecosystem deployment: nodes, indexer, explorer, gateway, exchange, wallet, faucet. The generator produces Kubernetes CRDs that the lux-operator reconciles.
Index ¶
- func WriteManifests(results []*GenerateResult, outDir string) ([]string, error)
- type BrandSpec
- type ChainConfig
- type ChainSpec
- type DeploySpec
- type DomainSpec
- type ExchangeServiceSpec
- type ExplorerServiceSpec
- type FaucetServiceSpec
- type GatewayServiceSpec
- type GenerateResult
- type GenesisSpec
- type IndexerServiceSpec
- type MPCSpec
- type NetworkSpec
- type NodeServiceSpec
- type PrecompileSpec
- type ServicesSpec
- type SocialSpec
- type StakingKMSSpec
- type TokenSpec
- type VMPluginSpec
- type WalletServiceSpec
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WriteManifests ¶
func WriteManifests(results []*GenerateResult, outDir string) ([]string, error)
WriteManifests writes all generated manifests to an output directory.
Types ¶
type BrandSpec ¶
type BrandSpec struct {
DisplayName string `yaml:"displayName" json:"displayName"`
LegalEntity string `yaml:"legalEntity,omitempty" json:"legalEntity,omitempty"`
PrimaryColor string `yaml:"primaryColor,omitempty" json:"primaryColor,omitempty"`
Logo string `yaml:"logo,omitempty" json:"logo,omitempty"`
Favicon string `yaml:"favicon,omitempty" json:"favicon,omitempty"`
Domains DomainSpec `yaml:"domains" json:"domains"`
Social SocialSpec `yaml:"social,omitempty" json:"social,omitempty"`
}
BrandSpec defines UI branding across all services.
type ChainConfig ¶
type ChainConfig struct {
// Version of the chain.yaml schema (currently "1")
Version string `yaml:"version" json:"version"`
// Chain identity and consensus
Chain ChainSpec `yaml:"chain" json:"chain"`
// Per-network configuration (mainnet, testnet, devnet)
Networks map[string]NetworkSpec `yaml:"networks" json:"networks"`
// Native token configuration
Token TokenSpec `yaml:"token" json:"token"`
// Genesis configuration
Genesis GenesisSpec `yaml:"genesis" json:"genesis"`
// Branding for explorer, exchange, wallet UIs
Brand BrandSpec `yaml:"brand" json:"brand"`
// Services to deploy (each maps to a CRD or K8s Deployment)
Services ServicesSpec `yaml:"services" json:"services"`
// Deployment target configuration
Deploy DeploySpec `yaml:"deploy" json:"deploy"`
// Precompile activation configuration
Precompiles []PrecompileSpec `yaml:"precompiles,omitempty" json:"precompiles,omitempty"`
}
ChainConfig is the top-level schema for chain.yaml. One file per chain project (e.g. ~/work/pars/chain.yaml).
func Load ¶
func Load(path string) (*ChainConfig, error)
Load reads and parses a chain.yaml file, resolving relative paths.
func (*ChainConfig) LoadGenesisJSON ¶
func (c *ChainConfig) LoadGenesisJSON() (json.RawMessage, error)
LoadGenesisJSON reads the genesis file (or inline) as raw JSON bytes.
func (*ChainConfig) NamespaceFor ¶
func (c *ChainConfig) NamespaceFor(network string) string
NamespaceFor returns the K8s namespace for a given network name.
func (*ChainConfig) Validate ¶
func (c *ChainConfig) Validate() error
Validate checks that the chain.yaml is well-formed and self-consistent.
type ChainSpec ¶
type ChainSpec struct {
// Human-readable name (e.g. "Pars Network")
Name string `yaml:"name" json:"name"`
// Lowercase slug used in K8s namespaces, domains, labels (e.g. "pars")
Slug string `yaml:"slug" json:"slug"`
// Chain layer: l1, l2, l3
Type string `yaml:"type" json:"type"`
// Sequencer type: lux, ethereum, op, external
Sequencer string `yaml:"sequencer" json:"sequencer"`
// VM type: evm, pars, custom
VM string `yaml:"vm" json:"vm"`
// Additional VM plugins (e.g. sessionvm for Pars)
VMPlugins []VMPluginSpec `yaml:"vmPlugins,omitempty" json:"vmPlugins,omitempty"`
// Database type: zapdb, pebbledb, memdb
DBType string `yaml:"dbType,omitempty" json:"dbType,omitempty"`
// Network compression: zstd, none
Compression string `yaml:"compression,omitempty" json:"compression,omitempty"`
}
ChainSpec defines the chain's identity and consensus parameters.
type DeploySpec ¶
type DeploySpec struct {
// Platform: hanzo, k8s, docker
Platform string `yaml:"platform" json:"platform"`
// K8s namespace template (e.g. "pars-{network}")
Namespace string `yaml:"namespace" json:"namespace"`
// Container registry (e.g. "ghcr.io/luxfi")
Registry string `yaml:"registry" json:"registry"`
// Secrets provider: kms.hanzo.ai
SecretsProvider string `yaml:"secretsProvider" json:"secretsProvider"`
// Ingress class: hanzo (NEVER nginx/caddy)
IngressClass string `yaml:"ingressClass" json:"ingressClass"`
}
DeploySpec defines the deployment target.
type DomainSpec ¶
type DomainSpec struct {
Explorer string `yaml:"explorer,omitempty" json:"explorer,omitempty"`
Exchange string `yaml:"exchange,omitempty" json:"exchange,omitempty"`
Wallet string `yaml:"wallet,omitempty" json:"wallet,omitempty"`
Faucet string `yaml:"faucet,omitempty" json:"faucet,omitempty"`
RPC string `yaml:"rpc,omitempty" json:"rpc,omitempty"`
Docs string `yaml:"docs,omitempty" json:"docs,omitempty"`
}
DomainSpec defines per-service domain names.
type ExchangeServiceSpec ¶
type ExchangeServiceSpec struct {
Enabled bool `yaml:"enabled" json:"enabled"`
Image string `yaml:"image,omitempty" json:"image,omitempty"`
BrandPackage string `yaml:"brandPackage,omitempty" json:"brandPackage,omitempty"` // e.g. "@parsdao/brand"
}
ExchangeServiceSpec configures the DEX frontend.
type ExplorerServiceSpec ¶
type ExplorerServiceSpec struct {
Enabled bool `yaml:"enabled" json:"enabled"`
Image string `yaml:"image,omitempty" json:"image,omitempty"` // default: ghcr.io/luxfi/explore
Replicas int32 `yaml:"replicas,omitempty" json:"replicas,omitempty"`
IngressClass string `yaml:"ingressClass,omitempty" json:"ingressClass,omitempty"` // default: hanzo
}
ExplorerServiceSpec configures the Blockscout frontend.
type FaucetServiceSpec ¶
type FaucetServiceSpec struct {
Enabled bool `yaml:"enabled" json:"enabled"`
DripAmount string `yaml:"dripAmount,omitempty" json:"dripAmount,omitempty"` // in wei
RateLimit string `yaml:"rateLimit,omitempty" json:"rateLimit,omitempty"` // e.g. "1/hour"
}
FaucetServiceSpec configures the testnet/devnet faucet.
type GatewayServiceSpec ¶
type GatewayServiceSpec struct {
Enabled bool `yaml:"enabled" json:"enabled"`
Replicas int32 `yaml:"replicas,omitempty" json:"replicas,omitempty"`
RateLimitRPS int `yaml:"rateLimitRps,omitempty" json:"rateLimitRps,omitempty"`
RateLimitBurst int `yaml:"rateLimitBurst,omitempty" json:"rateLimitBurst,omitempty"`
CORSAllowOrigins string `yaml:"corsAllowOrigins,omitempty" json:"corsAllowOrigins,omitempty"` // comma-separated
}
GatewayServiceSpec configures the API gateway.
type GenerateResult ¶
type GenerateResult struct {
Network string // e.g. "mainnet", "testnet", "devnet"
Namespace string // K8s namespace
// CRD manifests (consumed by lux-operator)
LuxNetwork string // LuxNetwork CR YAML
LuxIndexer string // LuxIndexer CR YAML
LuxExplorer string // LuxExplorer CR YAML
LuxGateway string // LuxGateway CR YAML
// Standard K8s manifests (for services without CRDs)
Namespace_ string // Namespace YAML
Exchange string // Exchange Deployment YAML (if enabled)
Faucet string // Faucet Deployment YAML (if enabled)
}
GenerateResult holds all generated manifests for a network.
func Generate ¶
func Generate(cfg *ChainConfig, network string) (*GenerateResult, error)
Generate produces all K8s manifests for a single network from chain.yaml.
func GenerateAll ¶
func GenerateAll(cfg *ChainConfig) ([]*GenerateResult, error)
GenerateAll produces manifests for all networks defined in chain.yaml.
type GenesisSpec ¶
type GenesisSpec struct {
// Path to genesis JSON file (relative to chain.yaml)
File string `yaml:"file,omitempty" json:"file,omitempty"`
// Inline genesis JSON (alternative to file)
Inline map[string]interface{} `yaml:"inline,omitempty" json:"inline,omitempty"`
// Airdrop configuration
AirdropAddress string `yaml:"airdropAddress,omitempty" json:"airdropAddress,omitempty"`
AirdropAmount string `yaml:"airdropAmount,omitempty" json:"airdropAmount,omitempty"`
// Gas configuration
GasLimit uint64 `yaml:"gasLimit,omitempty" json:"gasLimit,omitempty"`
MinBaseFee uint64 `yaml:"minBaseFee,omitempty" json:"minBaseFee,omitempty"`
BlockRate uint64 `yaml:"blockRate,omitempty" json:"blockRate,omitempty"` // seconds
}
GenesisSpec defines genesis configuration.
type IndexerServiceSpec ¶
type IndexerServiceSpec struct {
Enabled bool `yaml:"enabled" json:"enabled"`
Image string `yaml:"image,omitempty" json:"image,omitempty"`
ImageTag string `yaml:"imageTag,omitempty" json:"imageTag,omitempty"`
Replicas int32 `yaml:"replicas,omitempty" json:"replicas,omitempty"`
DBStorageSize string `yaml:"dbStorageSize,omitempty" json:"dbStorageSize,omitempty"` // default: 20Gi
TraceEnabled bool `yaml:"traceEnabled,omitempty" json:"traceEnabled,omitempty"`
ContractVerification bool `yaml:"contractVerification,omitempty" json:"contractVerification,omitempty"`
PollInterval int `yaml:"pollInterval,omitempty" json:"pollInterval,omitempty"` // seconds
}
IndexerServiceSpec configures the Blockscout indexer.
type MPCSpec ¶
type MPCSpec struct {
Enabled bool `yaml:"enabled" json:"enabled"`
Endpoint string `yaml:"endpoint" json:"endpoint"`
}
MPCSpec configures MPC key management.
type NetworkSpec ¶
type NetworkSpec struct {
// Lux network ID (1=mainnet, 2=testnet, 3=devnet, or custom)
NetworkID uint32 `yaml:"networkId" json:"networkId"`
// EVM chain ID
ChainID uint64 `yaml:"chainId" json:"chainId"`
// P-chain blockchain ID (assigned after deployment, or preconfigured)
BlockchainID string `yaml:"blockchainId,omitempty" json:"blockchainId,omitempty"`
// RPC endpoint
RPCUrl string `yaml:"rpcUrl,omitempty" json:"rpcUrl,omitempty"`
// WebSocket endpoint
WSUrl string `yaml:"wsUrl,omitempty" json:"wsUrl,omitempty"`
// Number of validator nodes
Validators uint32 `yaml:"validators" json:"validators"`
// Node image tag override
ImageTag string `yaml:"imageTag,omitempty" json:"imageTag,omitempty"`
// Bootstrap nodes (host:port)
BootstrapNodes []string `yaml:"bootstrapNodes,omitempty" json:"bootstrapNodes,omitempty"`
// Seed restore URL (S3 snapshot tarball)
SeedRestoreURL string `yaml:"seedRestoreUrl,omitempty" json:"seedRestoreUrl,omitempty"`
// Snapshot schedule interval (seconds, 0=disabled)
SnapshotInterval uint64 `yaml:"snapshotInterval,omitempty" json:"snapshotInterval,omitempty"`
// Sybil protection (disable for devnet)
SybilProtection *bool `yaml:"sybilProtection,omitempty" json:"sybilProtection,omitempty"`
}
NetworkSpec defines per-network (mainnet/testnet/devnet) configuration.
type NodeServiceSpec ¶
type NodeServiceSpec struct {
Enabled bool `yaml:"enabled" json:"enabled"`
Image string `yaml:"image,omitempty" json:"image,omitempty"` // default: ghcr.io/luxfi/node
ImageTag string `yaml:"imageTag,omitempty" json:"imageTag,omitempty"`
// Storage
StorageSize string `yaml:"storageSize,omitempty" json:"storageSize,omitempty"` // default: 100Gi
StorageClass string `yaml:"storageClass,omitempty" json:"storageClass,omitempty"` // default: do-block-storage
// Resources
CPURequest string `yaml:"cpuRequest,omitempty" json:"cpuRequest,omitempty"`
CPULimit string `yaml:"cpuLimit,omitempty" json:"cpuLimit,omitempty"`
MemoryRequest string `yaml:"memoryRequest,omitempty" json:"memoryRequest,omitempty"`
MemoryLimit string `yaml:"memoryLimit,omitempty" json:"memoryLimit,omitempty"`
// Staking key source (KMS reference)
StakingKMS *StakingKMSSpec `yaml:"stakingKms,omitempty" json:"stakingKms,omitempty"`
// MPC configuration
MPC *MPCSpec `yaml:"mpc,omitempty" json:"mpc,omitempty"`
}
NodeServiceSpec configures the validator node fleet.
type PrecompileSpec ¶
type PrecompileSpec struct {
Name string `yaml:"name" json:"name"`
BlockTimestamp int64 `yaml:"blockTimestamp" json:"blockTimestamp"` // 0 = genesis
}
PrecompileSpec defines a precompile activation.
type ServicesSpec ¶
type ServicesSpec struct {
Node NodeServiceSpec `yaml:"node" json:"node"`
Indexer IndexerServiceSpec `yaml:"indexer" json:"indexer"`
Explorer ExplorerServiceSpec `yaml:"explorer" json:"explorer"`
Gateway GatewayServiceSpec `yaml:"gateway" json:"gateway"`
Exchange ExchangeServiceSpec `yaml:"exchange" json:"exchange"`
Wallet WalletServiceSpec `yaml:"wallet" json:"wallet"`
Faucet FaucetServiceSpec `yaml:"faucet" json:"faucet"`
}
ServicesSpec controls which services to deploy.
type SocialSpec ¶
type SocialSpec struct {
Twitter string `yaml:"twitter,omitempty" json:"twitter,omitempty"`
Discord string `yaml:"discord,omitempty" json:"discord,omitempty"`
GitHub string `yaml:"github,omitempty" json:"github,omitempty"`
}
SocialSpec defines social media links.
type StakingKMSSpec ¶
type StakingKMSSpec struct {
HostAPI string `yaml:"hostApi" json:"hostApi"`
ProjectSlug string `yaml:"projectSlug" json:"projectSlug"`
EnvSlug string `yaml:"envSlug" json:"envSlug"`
SecretsPath string `yaml:"secretsPath" json:"secretsPath"`
}
StakingKMSSpec configures staking key retrieval from Hanzo KMS.
type TokenSpec ¶
type TokenSpec struct {
Name string `yaml:"name" json:"name"`
Symbol string `yaml:"symbol" json:"symbol"`
Decimals uint8 `yaml:"decimals" json:"decimals"`
Supply string `yaml:"supply,omitempty" json:"supply,omitempty"`
}
TokenSpec defines the native token.
type VMPluginSpec ¶
type VMPluginSpec struct {
Name string `yaml:"name" json:"name"` // Plugin name (e.g. "sessionvm")
VMID string `yaml:"vmId" json:"vmId"` // VM ID on the P-chain
Image string `yaml:"image" json:"image"` // Container image with the plugin binary
}
VMPluginSpec defines an additional VM plugin to deploy alongside the main VM.
type WalletServiceSpec ¶
type WalletServiceSpec struct {
Enabled bool `yaml:"enabled" json:"enabled"`
Image string `yaml:"image,omitempty" json:"image,omitempty"`
Platforms []string `yaml:"platforms,omitempty" json:"platforms,omitempty"` // web, extension, ios, android
}
WalletServiceSpec configures the wallet deployment.