commands

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2024 License: LGPL-3.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultHomeEnv is the default environment variable for the base path
	DefaultHomeEnv = "GSSMRHOME"
)

Default values

Variables

View Source
var AccountCmd = &cobra.Command{
	Use:   "account",
	Short: "Create and manage node keystore accounts",
	Long: `The account command is used to manage the gossamer keystore.
Examples:

To generate a new ed25519 account:
	gossamer account generate --keystore-path=path/to/location --scheme=ed25519
To generate a new secp256k1 account:
	gossamer account generate --keystore-path=path/to/location --scheme secp256k1
To import a keystore file:
	gossamer account import --keystore-path=path/to/location --keystore-file=keystore.json
To import a raw key:
	gossamer account import-raw --keystore-path=path/to/location --keystore-file=keystore.json
To list keys: gossamer account list --keystore-path=path/to/location`,
	RunE: func(cmd *cobra.Command, args []string) error {
		if len(args) == 0 {
			logger.Errorf("account command cannot be empty")
			return cmd.Help()
		}

		switch args[0] {
		case "generate":
			if err := generateKeyPair(cmd); err != nil {
				return err
			}
		case "import":
			if err := importKey(cmd); err != nil {
				return err
			}
		case "import-raw":
			if err := importRawKey(cmd); err != nil {
				return err
			}
		case "list":
			if err := listKeys(cmd); err != nil {
				return err
			}
		default:
			logger.Errorf("invalid account command: %s", args[0])
			return fmt.Errorf("invalid account command: %s", args[0])
		}

		return nil
	},
}

AccountCmd is the command to manage the gossamer keystore

View Source
var BuildSpecCmd = &cobra.Command{
	Use:   "build-spec",
	Short: "Generates chain-spec JSON data, and can convert to raw chain-spec data",
	Long: `The build-spec command outputs current chain-spec JSON data.
Usage: gossamer build-spec
To generate raw chain-spec file from default:
	gossamer build-spec --raw --output chain-spec.json
To generate raw chain-spec file from specific chain-spec file:
	gossamer build-spec --raw --chain chain-spec.json --output-path chain-spec-raw.json`,
	RunE: func(cmd *cobra.Command, args []string) error {
		return execBuildSpec(cmd)
	},
}

BuildSpecCmd is the command to generate genesis JSON

View Source
var ImportRuntimeCmd = &cobra.Command{
	Use:   "import-runtime",
	Short: "Appends the given .wasm runtime binary to a chain-spec",
	Long: `The import-runtime command appends the given .wasm runtime binary to a chain-spec.
Example: 
	gossamer import-runtime --wasm-file runtime.wasm --chain chain-spec.json > chain-spec-new.json`,
	RunE: func(cmd *cobra.Command, args []string) error {
		return execImportRuntime(cmd)
	},
}

ImportRuntimeCmd is the command to import a runtime binary into a genesis file

View Source
var ImportStateCmd = &cobra.Command{
	Use:   "import-state",
	Short: "Import state from a JSON file and set it as the chain head state",
	Long: `The import-state command allows a JSON file containing a given state
in the form of key-value pairs to be imported.
Input can be generated by using the RPC function state_getPairs.
Example: 
	gossamer import-state --state-file state.json --state-version 1 --header-file header.json 
	--first-slot <first slot of network>`,
	RunE: func(cmd *cobra.Command, args []string) error {
		return execImportState(cmd)
	},
}

ImportStateCmd is the command to import a state from a JSON file

View Source
var InitCmd = &cobra.Command{
	Use:   "init",
	Short: "Initialise node databases, load chain-spec and create default configuration",
	Long: `The init command initialises the node databases, loads the chain-spec and creates default configuration.
Examples: 
	gossamer init --chain chain-spec.json
	gossamer init --chain westend`,
	RunE: func(cmd *cobra.Command, args []string) error {
		return execInit(cmd)
	},
}

InitCmd is the command to initialise the node

View Source
var PruneStateCmd = &cobra.Command{
	Use:   "prune-state",
	Short: "Prune state will prune the state trie",
	Long: `prune-state <retain-blocks> will prune historical state data.
All trie nodes that do not belong to the specified version state will be deleted from the database.
The default pruning target is the HEAD-256 state`,
	RunE: func(cmd *cobra.Command, args []string) error {
		return execPruneState(cmd)
	},
}

PruneStateCmd is the command to prune the state trie

View Source
var VersionCmd = &cobra.Command{
	Use:   "version",
	Short: "gossamer version",
	Long:  `gossamer version`,
	RunE: func(cmd *cobra.Command, args []string) error {
		fmt.Printf("%s version %s\n", config.System.SystemName, config.System.SystemVersion)
		return nil
	},
}

VersionCmd returns the Gossamer version

Functions

func NewRootCommand

func NewRootCommand() (*cobra.Command, error)

NewRootCommand creates the root command

func ParseConfig

func ParseConfig() error

ParseConfig parses the config from the command line flags

Types

type KeypairInserter

type KeypairInserter interface {
	Insert(kp keystore.KeyPair) error
}

KeypairInserter inserts a keypair.

Jump to

Keyboard shortcuts

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