Lux SDKGoPackages

blockchain

Package blockchain provides blockchain configuration and genesis utilities.

import "github.com/luxfi/sdk/blockchain"

Package blockchain provides blockchain configuration and genesis utilities.

Types

Blockchain

Blockchain represents a Lux blockchain

BlockchainStatus

BlockchainStatus defines the status of a blockchain

BlockchainType

BlockchainType defines the type of blockchain

Builder

Builder handles blockchain creation and deployment

func NewBuilder(logger log.Logger) *Builder
func (b *Builder) CreateBlockchain(ctx context.Context, params *CreateParams) (*Blockchain, error)
func (b *Builder) Deploy(ctx context.Context, blockchain *Blockchain, network *network.Network) error
func (b *Builder) GenerateGenesis(params *GenesisParams) ([]byte, error)
func (b *Builder) GetBlockchain(blockchainID string) (*Blockchain, error)
func (b *Builder) ListBlockchains() []*Blockchain
func (b *Builder) ValidateConfig(config []byte) error

CreateParams

CreateParams defines parameters for creating a blockchain

GenesisAccount

GenesisAccount defines an account in genesis

GenesisParams

GenesisParams defines parameters for genesis generation

GenesisValidator

GenesisValidator defines a validator in the genesis Uses simplified fields for genesis configuration

L1Params

L1Params defines parameters for L1 creation

L2Config

L2Config defines L2-specific configuration

L2Params

L2Params defines parameters for L2 creation

L3Config

L3Config defines L3-specific configuration

L3Params

L3Params defines parameters for L3 creation

Metrics

Metrics tracks blockchain performance metrics

func NewMetrics() *Metrics
func (m *Metrics) GetSnapshot() map[string]interface{}
func (m *Metrics) RecordBlock(blockTime time.Time)
func (m *Metrics) RecordTransaction(success bool)
func (m *Metrics) UpdateNetwork(peers int, latency time.Duration)
func (m *Metrics) UpdateResources(cpu float64, memory, disk uint64)
func (m *Metrics) UpdateTPS(tps float64)

Net

Net represents a blockchain network with validator management capabilities As above, so below - unified across all network layers (primary, L1, L2, L3)

func (s *Net) InitializeProofOfAuthority(
	log interface{},
	network interface{},
	privateKey string,
	aggregatorLogger interface{},
	validatorManagerAddress string,
	v2_0_0 bool,
	signatureAggregatorEndpoint string,
) error
func (s *Net) InitializeProofOfStake(
	log interface{},
	network interface{},
	privateKey string,
	aggregatorLogger interface{},
	posParams interface{},
	managerAddress string,
	signatureAggregatorEndpoint string,
) error

VMType

VMType defines the virtual machine type

Validator

Validator is an alias for backward compatibility