Skip to content
All services

Mainnet

Osmosis

Chain ID
Version
Go

Run these after the install guide, which sets $WALLET, $MONIKER and the chain variables.

Keys and wallet

  1. Add a new key

    osmosisd keys add $WALLET
  2. Recover a key

    osmosisd keys add $WALLET --recover
  3. List keys

    osmosisd keys list
  4. Wallet balance

    osmosisd q bank balances $(osmosisd keys show $WALLET -a)

Validator

  1. Create a validator

    cat > $HOME/validator.json << EOF
    {
      "pubkey": $(osmosisd comet show-validator),
      "amount": "1000000uosmo",
      "moniker": "$MONIKER",
      "identity": "",
      "website": "",
      "security": "",
      "details": "",
      "commission-rate": "0.05",
      "commission-max-rate": "0.20",
      "commission-max-change-rate": "0.05",
      "min-self-delegation": "1"
    }
    EOF
    osmosisd tx staking create-validator $HOME/validator.json --from $WALLET --chain-id $OSMO_CHAIN_ID --gas auto --gas-adjustment 1.5 --gas-prices 0.03uosmo -y
  2. Edit the validator

    osmosisd tx staking edit-validator --new-moniker "$MONIKER" --identity "" --website "" --details "" --from $WALLET --chain-id $OSMO_CHAIN_ID --gas auto --gas-adjustment 1.5 --gas-prices 0.03uosmo -y
  3. Unjail

    osmosisd tx slashing unjail --from $WALLET --chain-id $OSMO_CHAIN_ID --gas auto --gas-adjustment 1.5 --gas-prices 0.03uosmo -y
  4. Validator details

    osmosisd q staking validator $(osmosisd keys show $WALLET --bech val -a)

Tokens

  1. Withdraw all rewards

    osmosisd tx distribution withdraw-all-rewards --from $WALLET --chain-id $OSMO_CHAIN_ID --gas auto --gas-adjustment 1.5 --gas-prices 0.03uosmo -y
  2. Withdraw commission and rewards

    osmosisd tx distribution withdraw-rewards $(osmosisd keys show $WALLET --bech val -a) --commission --from $WALLET --chain-id $OSMO_CHAIN_ID --gas auto --gas-adjustment 1.5 --gas-prices 0.03uosmo -y
  3. Delegate to yourself

    osmosisd tx staking delegate $(osmosisd keys show $WALLET --bech val -a) 1000000uosmo --from $WALLET --chain-id $OSMO_CHAIN_ID --gas auto --gas-adjustment 1.5 --gas-prices 0.03uosmo -y
  4. Redelegate

    osmosisd tx staking redelegate $(osmosisd keys show $WALLET --bech val -a) <TO_VALOPER> 1000000uosmo --from $WALLET --chain-id $OSMO_CHAIN_ID --gas auto --gas-adjustment 1.5 --gas-prices 0.03uosmo -y
  5. Unbond

    osmosisd tx staking unbond $(osmosisd keys show $WALLET --bech val -a) 1000000uosmo --from $WALLET --chain-id $OSMO_CHAIN_ID --gas auto --gas-adjustment 1.5 --gas-prices 0.03uosmo -y
  6. Send tokens

    osmosisd tx bank send $WALLET <TO_ADDRESS> 1000000uosmo --chain-id $OSMO_CHAIN_ID --gas auto --gas-adjustment 1.5 --gas-prices 0.03uosmo -y

Governance

  1. List proposals

    osmosisd q gov proposals
  2. View a proposal

    osmosisd q gov proposal <ID>
  3. Vote

    osmosisd tx gov vote <ID> yes --from $WALLET --chain-id $OSMO_CHAIN_ID --gas auto --gas-adjustment 1.5 --gas-prices 0.03uosmo -y
    # yes | no | abstain | no_with_veto

Maintenance

  1. Node status

    osmosisd status 2>&1 | jq
  2. Node peer address

    echo $(osmosisd comet show-node-id)@$(wget -qO- eth0.me):$OSMO_PORT656
  3. Live peers

    curl -s localhost:$OSMO_PORT657/net_info | jq -r '.result.peers[] | "\(.node_info.id)@\(.remote_ip):\(.node_info.listen_addr | split(":") | last)"' | paste -sd,
  4. Check the validator key

    [[ $(osmosisd q staking validator $(osmosisd keys show $WALLET --bech val -a) -o json | jq -r .validator.consensus_pubkey.value) = $(osmosisd comet show-validator | jq -r .key) ]] && echo "match" || echo "MISMATCH"
  5. Reset chain data

    osmosisd comet unsafe-reset-all --keep-addr-book --home $HOME/.osmosisd
  6. Remove the node

    sudo systemctl stop osmosisd
    sudo systemctl disable osmosisd
    sudo rm /etc/systemd/system/osmosisd.service
    sudo systemctl daemon-reload
    rm -rf $HOME/.osmosisd $(which osmosisd)

Service

  1. Service status

    sudo systemctl status osmosisd
  2. Follow logs

    sudo journalctl -fu osmosisd -o cat
  3. Restart

    sudo systemctl restart osmosisd
  4. Stop

    sudo systemctl stop osmosisd