Documentation
¶
Index ¶
- Constants
- func GenerateNodeID() (ids.NodeID, error)
- func GetDefaultNetworkID() uint32
- func NewTestGenesisWithFunds(networkID uint32, nodes []*Node, fundedKeys []*secp256k1.PrivateKey) ([]byte, error)
- func ValidateGenesis(genesisBytes []byte) error
- type Allocation
- type Chain
- type Flags
- type GenesisConfig
- type Network
- func (n *Network) EnsureDefaultConfig(log log.Logger) error
- func (n *Network) EnsureNodeConfig(node *Node) error
- func (n *Network) GetBootstrapIPsAndIDs() ([]string, []string)
- func (n *Network) Start(ctx context.Context, log log.Logger) error
- func (n *Network) Stop(ctx context.Context) error
- func (n *Network) Write() error
- type Node
- func (n *Node) EnsureBLSSigningKey() error
- func (n *Node) EnsureKeys() error
- func (n *Node) GetURI() string
- func (n *Node) InitiateStop() error
- func (n *Node) IsRunning() bool
- func (n *Node) Start(ctx context.Context, log log.Logger) error
- func (n *Node) Stop(ctx context.Context) error
- func (n *Node) WaitForStopped(ctx context.Context) error
- func (n *Node) Write() error
- type NodeConfig
- type NodeRuntimeConfig
- type ProcessRuntimeConfig
- type Staker
- type Subnet
- type UnlockPeriod
Constants ¶
const (
DefaultNetworkTimeout = 2 * time.Minute
)
Variables ¶
This section is empty.
Functions ¶
func GenerateNodeID ¶ added in v1.16.56
GenerateNodeID generates a random NodeID for testing purposes
func GetDefaultNetworkID ¶ added in v1.16.56
func GetDefaultNetworkID() uint32
GetDefaultNetworkID returns the default network ID for testing
func NewTestGenesisWithFunds ¶ added in v1.1.11
func NewTestGenesisWithFunds( networkID uint32, nodes []*Node, fundedKeys []*secp256k1.PrivateKey, ) ([]byte, error)
NewTestGenesisWithFunds creates a test genesis configuration with funded accounts
func ValidateGenesis ¶ added in v1.16.56
ValidateGenesis validates a genesis configuration
Types ¶
type Allocation ¶ added in v1.16.56
type Allocation struct {
ETHAddr string `json:"ethAddr"`
LUXAddr string `json:"luxAddr"`
InitialAmount uint64 `json:"initialAmount"`
UnlockSchedule []UnlockPeriod `json:"unlockSchedule,omitempty"`
}
Allocation represents an initial fund allocation
type Flags ¶ added in v1.16.56
type Flags map[string]interface{}
Flags is a map of node flags with helper methods
func (Flags) GetStringVal ¶ added in v1.16.56
GetStringVal returns the string value for a flag, or empty string if not found or not a string
type GenesisConfig ¶ added in v1.16.56
type GenesisConfig struct {
NetworkID uint32 `json:"networkID"`
Allocations []Allocation `json:"allocations"`
StartTime uint64 `json:"startTime"`
InitialStakeDuration uint64 `json:"initialStakeDuration"`
InitialStakeDurationOffset uint64 `json:"initialStakeDurationOffset"`
InitialStakedFunds []string `json:"initialStakedFunds"`
InitialStakers []Staker `json:"initialStakers"`
CChainGenesis string `json:"cChainGenesis"`
Message string `json:"message"`
}
GenesisConfig represents genesis configuration
type Network ¶
type Network struct {
UUID string
NetworkID uint32
Owner string
Dir string
Nodes []*Node
DefaultRuntimeConfig NodeRuntimeConfig
Genesis interface{} // Can be []byte or *genesis.UnparsedConfig
DefaultFlags Flags
// Track subnets/chains
Subnets []*Subnet
}
Network represents a local test network
func ReadNetwork ¶
ReadNetwork reads a network from its directory
func (*Network) EnsureDefaultConfig ¶
EnsureDefaultConfig ensures the network has default configuration
func (*Network) EnsureNodeConfig ¶
EnsureNodeConfig ensures a node has proper configuration for this network
func (*Network) GetBootstrapIPsAndIDs ¶
GetBootstrapIPsAndIDs returns the bootstrap IPs and IDs for the network
type Node ¶
type Node struct {
NodeID ids.NodeID
URI string
StakingPort uint64
HTTPPort uint64
StakingAddress netip.AddrPort
DataDir string
RuntimeConfig *NodeRuntimeConfig
Flags Flags
// BLS signing key
SigningKey *bls.SecretKey
// Staking credentials
StakingKey []byte
StakingCert []byte
// contains filtered or unexported fields
}
Node represents a node in a local test network
func (*Node) EnsureBLSSigningKey ¶
EnsureBLSSigningKey ensures the node has a BLS signing key
func (*Node) EnsureKeys ¶
EnsureKeys ensures the node has staking credentials and derives NodeID from them
func (*Node) InitiateStop ¶
InitiateStop sends SIGTERM to the node process without waiting
func (*Node) WaitForStopped ¶
WaitForStopped waits for the node process to exit
type NodeConfig ¶ added in v1.1.11
type NodeConfig struct {
NodeID string `json:"nodeID"`
URI string `json:"uri"`
StakingPort uint64 `json:"stakingPort"`
HTTPPort uint64 `json:"httpPort"`
DataDir string `json:"dataDir"`
Flags map[string]interface{} `json:"flags"`
}
NodeConfig is the serialized node configuration
type NodeRuntimeConfig ¶
type NodeRuntimeConfig struct {
Process *ProcessRuntimeConfig
}
NodeRuntimeConfig configures how nodes are run
type ProcessRuntimeConfig ¶
type ProcessRuntimeConfig struct {
LuxdPath string
LuxNodePath string // Alias for LuxdPath for CLI compatibility
PluginDir string
}
ProcessRuntimeConfig configures process execution
type Staker ¶ added in v1.16.56
type Staker struct {
NodeID string `json:"nodeID"`
RewardAddress string `json:"rewardAddress"`
DelegationFee uint32 `json:"delegationFee"`
}
Staker represents an initial staker
type UnlockPeriod ¶ added in v1.16.56
UnlockPeriod represents a vesting unlock period