# Commands

## 📚Useful commands📚

## ⚙️Service

**Info**

```python
osmosisd status 2>&1 | jq .NodeInfo
osmosisd status 2>&1 | jq .SyncInfo
osmosisd status 2>&1 | jq .ValidatorInfo
```

**Check node logs**

```python
sudo journalctl -fu osmosisd -o cat
```

**Check service status**

```python
sudo systemctl status osmosisd 
```

**Restart service**

```python
sudo systemctl restart osmosisd 
```

**Stop service**

```python
sudo systemctl stop osmosisd 
```

**Start service**

```python
sudo systemctl start osmosisd 
```

**reload/disable/enable**

```python
sudo systemctl daemon-reload
sudo systemctl disable osmosisd 
sudo systemctl enable osmosisd 
```

**Your Peer**

```python
echo $(osmosisd tendermint show-node-id)'@'$(wget -qO- eth0.me)':'$(cat $HOME/.osmosisd/config/config.toml | sed -n '/Address to listen for incoming connection/{n;p;}' | sed 's/.*://; s/".*//')
```

## 🥅Working with keys

**New Key or Recover Key**

```python
osmosisd keys add Wallet_Name
      OR
osmosisd keys add Wallet_Name --recover
```

**Check all keys**

```python
osmosisd keys list
```

**Check Balance**

```python
osmosisd query bank balances addressjkl1yjgn7z09ua9vms259j
```

**Delete Key**

```python
osmosisd  keys delete Wallet_Name
```

**Export Key**

```python
osmosisd keys export wallet
```

**Import Key**

```python
osmosisd keys import wallet wallet.backup
```

## 🚀Validator Management

**Edit Validator**

```python
osmosisd tx staking edit-validator \
--new-moniker "Your_Moniker" \
--identity "Keybase_ID" \
--details "Your_Description" \
--website "Your_Website" \
--security-contact "Your_Email" \
--chain-id osmosis-1 \
--commission-rate 0.05 \
--from Wallet_Name \
--gas 350000 -y
```

**Your Valoper-Address**

```python
osmosisd  keys show Wallet_Name --bech val
```

**Your Valcons-Address**

```python
osmosisd tendermint show-address
```

**Your Validator-Info**

```python
osmosisd query staking validator valoperaddress......
```

**Jail Info**

```python
osmosisd query slashing signing-info $(osmosisd tendermint show-validator)
```

**Unjail**

```python
osmosisd tx slashing unjail --from Wallet_name --chain-id osmosis-1 --gas 350000 -y
```

**Active Validators List**

```python
osmosisd q staking validators -oj --limit=3000 | jq '.validators[] | select(.status=="BOND_STATUS_BONDED")' | jq -r '(.tokens|tonumber/pow(10; 6)|floor|tostring) + " \t " + .description.moniker' | sort -gr | nl
```

**Inactive Validators List**

```python
osmosisd  q staking validators -oj --limit=3000 | jq '.validators[] | select(.status=="BOND_STATUS_UNBONDED")' | jq -r '(.tokens|tonumber/pow(10; 6)|floor|tostring) + " \t " + .description.moniker' | sort -gr | nl
```

**Check that your key matches the validator (Win -&#x20;**<mark style="color:green;">**Good**</mark>**. Lose -** [<mark style="color:red;">**Bad**</mark>](#user-content-fn-1)[^1]**)**

```python
VALOPER=Enter_Your_valoper_Here
[[ $(osmosisd q staking validator $VALOPER -oj | jq -r .consensus_pubkey.key) = $(osmosisd status | jq -r .ValidatorInfo.PubKey.value) ]] && echo -e "\nYou win\n" || echo -e "\nYou lose\n"
```

**Withdraw all rewards from all validators**

```python
osmosisd tx distribution withdraw-all-rewards --from Wallet_Name --chain-id osmosis-1 --gas 350000 -y
```

**Withdraw and commission from your Validator**

```python
osmosisd tx distribution withdraw-rewards valoper1amx.......g85v07t9ka2tfuhamhldgf8e --from Wallet_Name --gas 350000 --chain-id=osmosis-1 --commission -y
```

**Delegate tokens to your validator**

```python
osmosisd  tx staking delegate Your_valpoer........ "100000000"uosmo --from Wallet_Name --gas 350000 --chain-id=osmosis-1 -y
```

**Delegate tokens to different validator**

```python
osmosisd tx staking delegate valpoer........ "100000000"uosmo --from Wallet_Name --gas 350000 --chain-id=osmosis-1 -y
```

**Redelegate tokens to another validator**

```python
osmosisd tx staking redelegate Your_valpoer........ valpoer........ "100000000"uosmo --from Wallet_Name --gas 350000  --chain-id=osmosis-1 -y
```

**Unbond tokens from your validator or different validator**

```python
osmosisd tx staking unbond Your_valpoer........ "100000000"uosmo --from Wallet_Name --gas 350000 --chain-id=osmosis-1 -y
osmosisd  tx staking unbond valpoer........ "100000000"uosmo --from Wallet_Name --gas 350000 --chain-id=osmosis-1 -y
```

**Transfer tokens from wallet to wallet**

```python
osmosisd  tx bank send Your_address............ address........... "1000000000000000000"uosmo --gas 350000 --chain-id=osmosis-1 -y
```

## 📝Governance

**View all proposals**

```python
osmosisd query gov proposals
```

**View specific proposal**

```python
osmosisd query gov proposal 1
```

**Vote yes**

```python
osmosisd tx gov vote 1 yes --from Wallet_Name --gas 350000  --chain-id=osmosis-1 -y
```

**Vote no**

```python
osmosisd tx gov vote 1 no --from Wallet_Name --gas 350000  --chain-id=osmosis-1 -y
```

**Vote abstain**

```python
osmosisd tx gov vote 1 abstain --from Wallet_Name --gas 350000  --chain-id=osmosis-1 -y
```

**Vote no\_with\_veto**

```python
osmosisd tx gov vote 1 no_with_veto --from Wallet_Name --gas 350000  --chain-id=osmosis-1 -y
```

## 📡IBC transfer

* for exapmle - Osmosis -> Osmosis

```python
osmosisd tx ibc-transfer transfer transfer channel-2 Your_OSMOaddress............ "100000"uosmo --from Osmosis_Wallet_Name ---gas 350000 --chain-id=osmosis-1 -y
```

[^1]:
