testnetify

package
v6.2.0-bdjuno Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

README

Testnetify.py

This script takes a state export JSON file (under the name testnet_genesis.json) and edits multiple values to give the operator address 1M spendable OSMO, makes your validator file possess over 1M OSMO, and makes the epoch duration 3600s.

Instructions

Start at home directory

cd $HOME

Create state export from a running node (ensure to name it testnet_genesis.json for script to work)

osmosisd export 2> testnet_genesis.json

Make a copy of the genesis file, just in case you mess up

cp $HOME/testnet_genesis.json $HOME/testnet_genesis_bk.json

NOTE: There are three values in the python script you can change.

  1. The operator address (op_address) and its corresponding public key (op_pubkey). I provided the mnemonic for the provided address (osmo12smx2wdlyttvyzvzg54y2vnqwq2qjateuf7thj), but you may change the address and corresponding pubkey if desired
  2. The chain-id (new_chain_id)
  3. The config.toml file location (at the very end of the script, change the path if its somewhere other than $HOME/.osmosisd/config)

Mnemonic for provided address: bottom loan skill merry east cradle onion journey palm apology verb edit desert impose absurd oil bubble sweet glove shallow size build burst effort

From the same directory as the testnet_genesis.json, run testnetify.py

python3 testnetify.py

After it is complete, overwrite the current genesis file with new testnet genesis

cp testnet_genesis.json .osmosisd/config/genesis.json

Unsafe reset all

osmosisd unsafe-reset-all

Start osmosis daemon (with extra flag first time around)

osmosisd start --x-crisis-skip-assert-invariants

After initializing, you will get a "couldn't connect to any seeds" error. Leave the node as it is.

Set up a second node with the same genesis.json file that was created using the first node.

On the first node, retrieve its public IP and also run this command to get your node ID

osmosisd tendermint show-node-id

On the second node, open the config.toml

nano $HOME/.osmosisd/config/config.toml

Under persistent_peers and seeds, add the first nodes information like so: node-id@IP:26656

Example: 665ebb897edc41d691c70b15916086a9c7761dc4@199.43.113.117:26656

On the second node, start the osmosis daemon

osmosisd start --x-crisis-skip-assert-invariants

Once the second peer initializes, the chain will no longer be halted (this is necessary due to a tendermint bug). The second peer can then be shut off if desired. If the first peer ever shuts down, the second peer must be started in order to kickstart the chain again.

As a last note, sometimes getting testnet nodes spun up for the first time can be finicky. If you are stuck getting the second node to connect to the first node, sometimes doing a unsafe-reset-all on both nodes fixes the issue. Also, try adding the second node as a persistent peer to the first node. These two methods have fixed nodes that do not want to cooperate. Lastly, if your node keeps killing the daemon, please ensure you have a swap file set up.

Enjoy your state exported testnet!

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func StateExportToTestnetGenesis

func StateExportToTestnetGenesis() *cobra.Command

get cmd to convert any bech32 address to an osmo prefix

Types

type TestnetParams

type TestnetParams struct {
	ValidatorConsensusPubkeys []string
	ValidatorOperatorPubkeys  []string
	OutputExportFilepath      string
}

TODO: Add params for min num validators for consensus

func (TestnetParams) NewValidatorDetails

func (params TestnetParams) NewValidatorDetails() []ValidatorDetails

type ValidatorDetails

type ValidatorDetails struct {
	// e.g. 16A169951A878247DBE258FDDC71638F6606D156
	// Only appears once
	ConsAddressHex string
	// e.g. b77zCh/VsRgVvfGXuW4dB+Dhg4PrMWWBC5G2K/qFgiU=
	ConsPubkeyRaw string
	// e.g. osmovaloper1cyw4vw20el8e7ez8080md0r8psg25n0cq98a9n
	OperatorAddress string
}

Jump to

Keyboard shortcuts

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