cmd

package
v17.0.0 Latest Latest
Warning

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

Go to latest
Published: May 17, 2024 License: Apache-2.0 Imports: 57 Imported by: 1

README

Testnet command extensions

gaiad extends testnet commands with unsafe-start-local-validator command that should be used only for testing.

The command makes changes to the local mainnet node to make it suitable for local testing. The changes include modification of consensus and application states by removing old validator data and injecting the new one, and funding the addresses to be used in testing without affecting existing addresses.

The command is added as a sub-command of the gaiad testnet command.

Building a local testnet binary

The gaia binary will cointain the testnet extensions only if the unsafe_start_local_validator build tags is used.

make build BUILD_TAGS="-tag unsafe_start_local_validator

CLI usage

Example of running the command:

./gaiad testnet unsafe-start-local-validator  
--validator-operator="cosmosvaloper17fjdcqy7g80pn0seexcch5pg0dtvs45p57t97r"  
--validator-pubkey="SLpHEfzQHuuNO9J1BB/hXyiH6c1NmpoIVQ2pMWmyctE=" 
--validator-privkey="AiayvI2px5CZVl/uOGmacfFjcIBoyk3Oa2JPBO6zEcdIukcR/NAe64070nUEH+FfKIfpzU2amghVDakxabJy0Q=="  
--accounts-to-fund="cosmos1ju6tlfclulxumtt2kglvnxduj5d93a64r5czge,cosmos1r5v5srda7xfth3hn2s26txvrcrntldjumt8mhl"  
[other gaiad start flags]

Local setup

gaiad init localnet-export
gaiad keys add test-key --keyring-backend test --keyring-dir ~/.gaia
# get --validator-operator
export VAL_ACC_ADDR=$(gaiad keys show test-key --home ~/.gaia --keyring-backend test --output json | jq .address -r)
gaiad keys parse $(gaiad keys parse $VAL_ACC_ADDR --output=json | jq .bytes -r) --output json | jq .
{
  "formats": [
    "cosmos1738fdeqcepf9mrpdwyrl9zvhlmf2jk4t2x3jwd",
    "cosmospub1738fdeqcepf9mrpdwyrl9zvhlmf2jk4t4qaphg",
    "cosmosvaloper1738fdeqcepf9mrpdwyrl9zvhlmf2jk4t0j98z7", # --> take this one
    "cosmosvaloperpub1738fdeqcepf9mrpdwyrl9zvhlmf2jk4ta3uyqm",
    "cosmosvalcons1738fdeqcepf9mrpdwyrl9zvhlmf2jk4tmpkmwl",
    "cosmosvalconspub1738fdeqcepf9mrpdwyrl9zvhlmf2jk4tv48v22"
  ]
}

# --validator-pubkey and --validator-privkey are in`$HOME/.gaia/config/priv_validator.json
cat $HOME/.gaia/config/priv_validator.json
{
  "address": "067CC9545EC0CD744C44D611E3E8857D69E9CAD4",
  "pub_key": {
    "type": "tendermint/PubKeyEd25519",
    "value": "0zorKvPxmVUSBRl49julqrBu69mu6U6+V4GxC8fvxcM="  # --validator-pubkey
  },
  "priv_key": {
    "type": "tendermint/PrivKeyEd25519",
    "value": "rfZBWExZtNzrLx+cy8lMPXQFowXO7AZc5FXBeOyvSdDTOisq8/GZVRIFGXj2O6WqsG7r2a7pTr5XgbELx+/Fww==" # --validator-privkey
  }
}

Example usecase

  1. download a mainnet node snapshot
  2. replace all validator key files (keyring data, priv_validator_key.json, values in priv_validator_state.json are reset to 0...)
  3. run gaiad testnet unsafe-start-local-validator -> switches the validator set and starts the node

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddBech32ConvertCommand

func AddBech32ConvertCommand() *cobra.Command

AddBech32ConvertCommand returns bech32-convert cobra Command.

func AddGenesisAccountCmd

func AddGenesisAccountCmd(defaultNodeHome string) *cobra.Command

AddGenesisAccountCmd returns add-genesis-account cobra Command.

func NewRootCmd

func NewRootCmd() (*cobra.Command, params.EncodingConfig)

NewRootCmd creates a new root command for simd. It is called once in the main function.

func NewTestnetCmd

func NewTestnetCmd(mbm module.BasicManager, genBalIterator banktypes.GenesisBalancesIterator, appCreator appCreator) *cobra.Command

NewTestnetCmd creates a root testnet command with subcommands to: 1. run an in-process testnet or 2. initialize validator configuration files for running a multi-validator testnet in a separate process or 3. update application and consensus state with the local validator info

Types

type UnsafeStartValidatorCmdCreator

type UnsafeStartValidatorCmdCreator func(ac appCreator) *cobra.Command

Jump to

Keyboard shortcuts

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