The goal of this workshop is to run a single validator testnet on your local environment.
- Have go installed to the latest version
Although in this workshop we would be practicing with Osmosis repo, keep in mind that the same commands apply to all other cosmos-sdk chains.
git clone https://github.com/osmosis-labs/osmosis.git
cd osmosis
make install
make build
osmosisd init my-node --chain-id my-chain
osmosisd keys add my-account --keyring-backend=test
Daemon uses keychains to manage keys: the keyring-backend test flag enables us to use the keyrings in the test mode
One of the essential step in starting a chain is to have an account that the chain would start with. Why would we need to have a genesis account? - validators and blocks!
osmosisd add-genesis-account $(./osmosisd keys show my-account -a --keyring-backend=test) 1000000000000uatom,100000000000uosmo,100000000000uion,100000000000valtoken,100000000000stake,10000foo,10000bar --keyring-backend=test
./osmosisd gentx my-account 10000000000stake --chain-id my-chain --keyring-backend=test
Gen tx is a set of transactions where it is executed in block height 0 to create appropriate state at the start of the chain.
The amount specified is the amount we will have staked from our account.
Running this command generates a json file in our home directory(~/.osmosisd)
./osmosisd collect-gentxs
In practice, we would collect the gentx json file created from different “validators”. Then we run this command, in which then cosmos sdk would create initial state off of the genesis transactions.
osmosisd start
osmosisd query distribution validator-outstanding-rewards osmovaloper19f438whxuvxfkepsa7sk388p38qt9su2mx3y5h
osmosisd q bank balances osmo155248g4ck8ugjqjgapk4zn0arnjt6sepsn4zgq
osmosisd tx distribution withdraw-rewards osmovaloper155248g4ck8ugjqjgapk4zn0arnjt6sep2yapl8 --from osmo155248g4ck8ugjqjgapk4zn0arnjt6sepsn4zgq --chain-id my-chain --fees 875stake
osmosisd query bank balances osmo155248g4ck8ugjqjgapk4zn0arnjt6sepsn4zgq