constants

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 6, 2025 License: BSD-3-Clause Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MainnetID uint32 = 1
	TestnetID uint32 = 5
	LocalID   uint32 = 12345

	// Network names
	MainnetName = "mainnet"
	TestnetName = "testnet"
	LocalName   = "local"
)

Network IDs

View Source
const (
	MainnetHRP  = "lux"
	TestnetHRP  = "test"
	LocalHRP    = "local"
	FallbackHRP = "custom"
)

Network HRP (Human Readable Part) for addresses

View Source
const (
	PChainAlias = "P"
	XChainAlias = "X"
	CChainAlias = "C"
)

Chain aliases

View Source
const (
	Wei  uint64 = 1
	GWei uint64 = 1e9
	LUX  uint64 = 1e18

	// Legacy compatibility
	NanoLux  = Wei
	MicroLux = GWei
)

Denominations

View Source
const (
	// Minimum stake amounts
	MinValidatorStake = 2_000 * GWei // 2,000 LUX worth of GWei
	MinDelegatorStake = 25 * GWei    // 25 LUX worth of GWei

	// Maximum stake amounts
	MaxValidatorStake = 3_000_000 * GWei // 3M LUX worth of GWei
	MaxDelegatorStake = 3_000_000 * GWei // 3M LUX worth of GWei

	// Weight factors
	MaxValidatorWeightFactor = 5

	// Time parameters
	MinStakeDuration = 2 * 7 * 24 * time.Hour // 2 weeks
	MaxStakeDuration = 365 * 24 * time.Hour   // 1 year

	// Reward parameters
	MaxDelegationFee = 100 // 100% (in basis points / 100)
)

Staking parameters

View Source
const (
	// Total supply
	TotalSupply = 720_000_000 * GWei // 720M LUX worth of GWei

	// Initial supply distribution
	InitialSupply = 360_000_000 * GWei // 360M LUX worth of GWei

	// Reward config
	RewardPercentDenominator = 1_000_000
	InflationRate            = 0.05 // 5% annual
)

Supply and economics

View Source
const (
	// Base fees
	TxFee             = 1_000_000 * GWei  // 0.001 LUX
	CreateAssetTxFee  = 10_000_000 * GWei // 0.01 LUX
	CreateChainTxFee  = 1 * LUX
	CreateSubnetTxFee = 1 * LUX

	// Gas parameters
	GasPrice    = 25 * GWei
	MaxGasPrice = 1000 * GWei
	MinGasPrice = 1 * GWei
)

Transaction fees

View Source
const (
	// Block size limits
	MaxBlockSize    = 2 * 1024 * 1024 // 2 MiB
	MaxBlockGas     = 15_000_000
	TargetBlockRate = 2 * time.Second

	// Genesis block
	GenesisHeight    = 0
	GenesisTimestamp = 1640995200 // Jan 1, 2022 00:00:00 UTC
)

Block parameters

View Source
const (
	// VM types
	EVMID      = "evm"
	WasmVMID   = "wasm"
	CustomVMID = "custom"
	TokenVMID  = "tokenvm"

	// VM versions
	EVMVersion    = "v0.13.0"
	WasmVMVersion = "v0.1.0"
)

VM parameters

View Source
const (
	// Snow consensus
	SnowmanK                 = 20
	SnowmanAlphaPreference   = 15
	SnowmanAlphaConfidence   = 15
	SnowmanBeta              = 20
	SnowmanConcurrentRepolls = 4
	SnowmanOptimalProcessing = 10
	SnowmanMaxProcessing     = 1000
	SnowmanMaxTimeProcessing = 2 * time.Minute

	// For different network types
	TestnetSnowmanK               = 11
	TestnetSnowmanAlphaPreference = 7
	LocalSnowmanK                 = 5
	LocalSnowmanAlphaPreference   = 3
)

Consensus parameters

View Source
const (
	// Request timeouts
	RequestTimeout      = 30 * time.Second
	RequestRetryTimeout = 1 * time.Second

	// Gossip parameters
	GossipFrequency = 10 * time.Second
	GossipBatchSize = 30
	GossipPollSize  = 10

	// Health check
	HealthCheckFrequency   = 30 * time.Second
	MaxOutstandingRequests = 1024

	// Network limits
	MaxMessageSize     = 2 * 1024 * 1024 // 2 MiB
	MaxClockDifference = 10 * time.Second
)

Network timeouts

View Source
const (
	// RPC endpoints
	PublicAPIEndpoint   = "/ext/bc"
	AdminAPIEndpoint    = "/ext/admin"
	HealthAPIEndpoint   = "/ext/health"
	InfoAPIEndpoint     = "/ext/info"
	KeystoreAPIEndpoint = "/ext/keystore"
	MetricsAPIEndpoint  = "/ext/metrics"

	// Chain endpoints
	PChainEndpoint = "/ext/P"
	XChainEndpoint = "/ext/X"
	CChainEndpoint = "/ext/C"
)

API endpoints

View Source
const (
	// Default data directory
	DefaultDataDir = "~/.luxd"

	// Database names
	ChainDataDir = "chainData"
	StateDir     = "state"
	LogDir       = "logs"
	KeystoreDir  = "keystore"

	// Database prefixes
	ChainDBPrefix = "chain"
	StateDBPrefix = "state"
)

Database paths

View Source
const (
	// Bootstrap retry parameters
	BootstrapRetryAttempts = 50
	BootstrapRetryDelay    = 1 * time.Second

	// Bootstrap timeouts
	BootstrapTimeout  = 1 * time.Hour
	MinBootstrapPeers = 1
)

Bootstrapping

View Source
const (
	// Validator limits
	MaxValidators        = 10_000
	MaxPendingValidators = 4_096

	// Subnet limits
	MaxSubnetValidators     = 100
	MinSubnetValidatorStake = 1 * GWei // 1 LUX worth of GWei
)

Validator set parameters

View Source
const (
	// Warp message size limits
	MaxWarpMessageSize    = 256 * 1024 // 256 KiB
	MaxWarpMessagePayload = 200 * 1024 // 200 KiB

	// Warp signature parameters
	WarpQuorumNumerator   = 67
	WarpQuorumDenominator = 100
)

Cross-chain (Warp) messaging

View Source
const (
	// Transaction limits
	MaxTxSize   = 64 * 1024 // 64 KiB
	MaxMemoSize = 256

	// UTXO limits
	MaxUTXOsToFetch = 1024

	// Import/Export limits
	MaxImportSize = 1024
)

Platform limits

Variables

View Source
var (
	PlatformChainID = ids.ID{'p', 'l', 'a', 't', 'f', 'o', 'r', 'm'}
	XChainID        = ids.ID{'x', 'c', 'h', 'a', 'i', 'n'}
	CChainID        = ids.ID{'c', 'c', 'h', 'a', 'i', 'n'}
)

Chain IDs

View Source
var (
	// Network errors
	ErrInvalidNetworkID = errors.New("invalid network ID")

	// Chain errors
	ErrUnknownChain   = errors.New("unknown chain")
	ErrInvalidChainID = errors.New("invalid chain ID")

	// Configuration errors
	ErrInvalidConfiguration = errors.New("invalid configuration")
	ErrMissingConfiguration = errors.New("missing configuration")
)
View Source
var (
	ErrUnknownNetwork = errors.New("unknown network")
)

Errors

View Source
var (
	LuxAssetID = ids.ID{
		0x21, 0xe6, 0x73, 0x17, 0xcb, 0xc4, 0xbe, 0x2a,
		0xeb, 0x00, 0x67, 0x7a, 0xd6, 0x46, 0x27, 0x78,
		0xa8, 0xf5, 0x22, 0x74, 0xb9, 0xd6, 0x05, 0xdf,
		0x25, 0x91, 0xb2, 0x30, 0x27, 0xa8, 0x7d, 0xff,
	}
)

Asset IDs

Functions

func GetHRP

func GetHRP(networkID uint32) string

GetHRP returns the HRP for a network ID

func GetNetworkID

func GetNetworkID(name string) (uint32, error)

GetNetworkID returns the network ID from name

func GetNetworkName

func GetNetworkName(networkID uint32) string

GetNetworkName returns the network name from ID

func IsLocal

func IsLocal(networkID uint32) bool

IsLocal returns true if the network ID is local

func IsMainnet

func IsMainnet(networkID uint32) bool

IsMainnet returns true if the network ID is mainnet

func IsTestnet

func IsTestnet(networkID uint32) bool

IsTestnet returns true if the network ID is testnet

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL