setup

package
v0.10.2 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2025 License: Apache-2.0 Imports: 33 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateNodeDir

func GenerateNodeDir(rootDir string, genesis *config.GenesisConfig, node *config.Config, privateKey *crypto.Secp256k1PrivateKey, snapshot string) error

GenerateNodeDir generates a node configuration directory. It is a minimal function that takes a full configuration. Most users should use GenerateNodeRoot instead.

func GenerateNodeRoot

func GenerateNodeRoot(ncfg *NodeGenConfig) error

func GenerateTestnetConfigs

func GenerateTestnetConfigs(cfg *TestnetConfig, opts *ConfigOpts, gencfg *config.GenesisConfig) error

func GenerateTestnetDir

func GenerateTestnetDir(testnetDir string, genesis *config.GenesisConfig, nodes []*TestnetNodeConfig, snapshot string) error

GenerateTestnetDir generates a testnet configuration for multiple nodes. It is a minimal function that takes full configurations. Most users should use GenerateTestnetConfigs instead. copies the snapshot file to each node directory if it is not empty.

func GenesisCmd

func GenesisCmd() *cobra.Command

func GenesisHashCmd

func GenesisHashCmd() *cobra.Command

func InitCmd

func InitCmd() *cobra.Command

func ResetCmd

func ResetCmd() *cobra.Command

func SetupCmd

func SetupCmd() *cobra.Command

func TestnetCmd

func TestnetCmd() *cobra.Command

Types

type ConfigOpts

type ConfigOpts struct {
	// UniquePorts is a flag to generate unique listening addresses
	// (JSON-RPC, HTTP, Admin, P2P, node RPC) for each node.
	// This is useful for testing multiple nodes on the same machine.
	// If it is used for generating a single config, it has no effect.
	UniquePorts bool

	// DnsHost is a flag to use DNS hostname as host in the config
	// instead of ip. It will be used together with DnsNamePrefix to generate
	// hostnames.
	// This is useful for testing nodes inside docker containers.
	DnsHost bool
}

type NodeGenConfig

type NodeGenConfig struct {
	RootDir    string
	PortOffset int
	DBPort     uint16 // leave zero for default plus any offset
	IP         string
	NoPEX      bool
	NodeKey    *crypto.Secp256k1PrivateKey
	Genesis    *config.GenesisConfig

	BootNodes       []string
	ExternalAddress string
}

type TestnetConfig

type TestnetConfig struct {
	RootDir       string
	ChainID       string
	NumVals       int
	NumNVals      int
	NoPex         bool
	StartingPort  uint64
	StartingIP    string
	DnsNamePrefix string // optional and only used if DnsHost is true (default: node)
	Hostnames     []string
	Allocs        []string
}

type TestnetNodeConfig

type TestnetNodeConfig struct {
	// Config is the node configuration.
	Config *config.Config
	// DirName is the directory name of the node.
	// If the testnetDir is "testnet" and the DirName is "node0",
	// the full path of the node is "testnet/node0".
	DirName string
	// PrivateKey is the private key of the node.
	PrivateKey *crypto.Secp256k1PrivateKey
}

Jump to

Keyboard shortcuts

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