validator

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2025 License: BSD-3-Clause Imports: 12 Imported by: 0

Documentation

Overview

Copyright (C) 2025, Lux Industries Inc. All rights reserved. See the file LICENSE for licensing terms.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SaveKeys

func SaveKeys(keys *ValidatorKeysWithTLS, outputDir string) error

SaveKeys saves validator keys and certificates to disk

func SaveValidatorConfigs

func SaveValidatorConfigs(validators []*ValidatorInfo, filepath string) error

SaveValidatorConfigs saves validator configurations to a JSON file

Types

type KeyGenerator

type KeyGenerator struct{}

KeyGenerator handles validator key generation

func NewKeyGenerator

func NewKeyGenerator() *KeyGenerator

NewKeyGenerator creates a new key generator

func (*KeyGenerator) GenerateBatch

func (kg *KeyGenerator) GenerateBatch(seedPhrase string, startAccount, count int) ([]*ValidatorKeys, error)

GenerateBatch generates keys for multiple validators from a single seed phrase

func (*KeyGenerator) GenerateCompatibleKeys

func (kg *KeyGenerator) GenerateCompatibleKeys() (*ValidatorKeysWithTLS, error)

GenerateCompatibleKeys generates validator keys compatible with luxd This uses the same TLS-based NodeID generation as luxd

func (*KeyGenerator) GenerateFromPrivateKey

func (kg *KeyGenerator) GenerateFromPrivateKey(privateKeyHex string) (*ValidatorKeysWithTLS, error)

GenerateFromPrivateKey generates validator keys from a BLS private key

func (*KeyGenerator) GenerateFromSeed

func (kg *KeyGenerator) GenerateFromSeed(seedPhrase string, accountNum int) (*ValidatorKeys, error)

GenerateFromSeed generates validator keys using BLS

func (*KeyGenerator) GenerateFromSeedWithTLS

func (kg *KeyGenerator) GenerateFromSeedWithTLS(seedPhrase string, accountNum int) (*ValidatorKeysWithTLS, error)

GenerateFromSeed generates validator keys using BLS with deterministic TLS cert

type ValidatorInfo

type ValidatorInfo struct {
	NodeID            string `json:"nodeID"`
	ETHAddress        string `json:"ethAddress"`
	PublicKey         string `json:"publicKey"`
	ProofOfPossession string `json:"proofOfPossession"`
	Weight            uint64 `json:"weight"`
	DelegationFee     uint32 `json:"delegationFee"`
}

ValidatorInfo contains the full validator configuration

func GenerateValidatorConfig

func GenerateValidatorConfig(keys *ValidatorKeys, ethAddress string, weight uint64, delegationFee uint32) *ValidatorInfo

GenerateValidatorConfig generates a complete validator configuration

type ValidatorKeys

type ValidatorKeys struct {
	NodeID            string `json:"nodeID"`
	PublicKey         string `json:"publicKey"`
	ProofOfPossession string `json:"proofOfPossession"`
	PrivateKey        string `json:"privateKey,omitempty"` // Only for secure storage, never in genesis
}

ValidatorKeys contains the generated validator key information

type ValidatorKeysWithTLS

type ValidatorKeysWithTLS struct {
	*ValidatorKeys
	TLSKeyBytes  []byte
	TLSCertBytes []byte
}

ValidatorKeysWithTLS contains validator keys and TLS certificate data

Jump to

Keyboard shortcuts

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