# Cheat Sheet

## Key management

#### Add new key

```
junctiond keys add $AIRCHAIN_WALLET
```

#### Recover existing key

```
junctiond keys add $AIRCHAIN_WALLET --recover
```

#### List all keys

```
junctiond keys list
```

#### Delete key

```
junctiond keys delete $AIRCHAIN_WALLET
```

#### Export key to the file

```
junctiond keys export $AIRCHAIN_WALLET
```

#### Import key from the file

```
junctiond keys import $AIRCHAIN_WALLETwallet.backup
```

#### Query wallet balance

```
junctiond q bank balances $(junctiond keys show $AIRCHAIN_WALLET -a)
```

***

## Validator management

{% hint style="info" %}
Please make sure you have adjusted **moniker**, **identity and** **details** to match your values.
{% endhint %}

#### Create new validator

```
cd $HOME
# Create validator.json file
echo "{\"pubkey\":{\"@type\":\"/cosmos.crypto.ed25519.PubKey\",\"key\":\"$(junctiond comet show-validator | grep -Po '\"key\":\s*\"\K[^"]*')\"},
    \"amount\": \"1000000amf\",
    \"moniker\": \"test\",
    \"identity\": \"\",
    \"website\": \"\",
    \"security\": \"\",
    \"details\": \"\",
    \"commission-rate\": \"0.1\",
    \"commission-max-rate\": \"0.2\",
    \"commission-max-change-rate\": \"0.01\",
    \"min-self-delegation\": \"1\"
}" > validator.json

# Create a validator using the JSON configuration
junctiond tx staking create-validator validator.json \
    --from $AIRCHAIN_WALLET \
    --chain-id junction \
	--fees 200amf \
	
```

#### Edit existing validator

```
junctiond tx staking edit-validator \
--commission-rate 0.1 \
--new-moniker "" \
--identity "" \
--details "" \
--from $AIRCHAIN_WALLET \
--chain-id junction \
--fees 200amf \
-y 
```

#### Unjail validator

```
junctiond tx slashing unjail --from $AIRCHAIN_WALLET --chain-id junction --fees 200amf -y 
```

#### List all active validators

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

#### View validator details

```
junctiond q staking validator $(junctiond keys show $AIRCHAIN_WALLET --bech val -a)
```

***

## Token management

#### Withdraw rewards from all validators

```
junctiond tx distribution withdraw-all-rewards --from $WALLET --chain-id junction --fees 200amf 
```

#### Withdraw commission and rewards from your validator

```
junctiond tx distribution withdraw-rewards $VALOPER_ADDRESS --from $WALLET --commission --chain-id junction --fees 200amf -y 
```

#### Delegate tokens to yourself

```
junctiond tx staking delegate $(junctiond keys show $WALLET --bech val -a) 1000000amf --from $WALLET --chain-id junction --fees 200amf -y 
```

#### Delegate tokens to validator

```
junctiond tx staking delegate <TO_VALOPER_ADDRESS> 1000000amf --from $WALLET --chain-id junction --fees 200amf -y 	
```

#### Redelegate tokens to another validator

```
junctiond tx staking redelegate $VALOPER_ADDRESS <TO_VALOPER_ADDRESS> 1000000amf --from $WALLET --chain-id junction --fees 200amf -y 
```

#### Unbond tokens from your validator

```
junctiond tx staking unbond $(junctiond keys show $WALLET --bech val -a) 1000000amf --from $WALLET --chain-id junction --fees 200amf -y 
```

#### Send tokens to the wallet

```
junctiond tx bank send $WALLET_ADDRESS <TO_WALLET_ADDRESS> 1000000amf --fees 200amf -y 
```

***

## Governance

#### List all proposals

```
junctiond query gov proposals
```

#### View proposal by id

```
junctiond query gov proposal 1
```

#### Vote 'Yes'

```
junctiond tx gov vote 1 yes --from $WALLET --chain-id junction  --fees 200amf -y 
```

#### Vote 'No'

```
junctiond tx gov vote 1 no --from $WALLET --chain-id junction  --fees 200amf -y 
```

#### Vote 'Abstain'

```
junctiond tx gov vote 1 abstain --from $WALLET --chain-id junction  --fees 200amf -y 
```

#### Vote 'NoWithVeto'

```
junctiond tx gov vote 1 no_with_veto --from $WALLET --chain-id junction  --fees 200amf -y 
```

***

## Utility

#### Update ports

```
CUSTOM_PORT=110
sed -i -e "s%^proxy_app = \"tcp://127.0.0.1:26658\"%proxy_app = \"tcp://127.0.0.1:${CUSTOM_PORT}58\"%; s%^laddr = \"tcp://127.0.0.1:26657\"%laddr = \"tcp://127.0.0.1:${CUSTOM_PORT}57\"%; s%^pprof_laddr = \"localhost:6060\"%pprof_laddr = \"localhost:${CUSTOM_PORT}60\"%; s%^laddr = \"tcp://0.0.0.0:26656\"%laddr = \"tcp://0.0.0.0:${CUSTOM_PORT}56\"%; s%^prometheus_listen_addr = \":26660\"%prometheus_listen_addr = \":${CUSTOM_PORT}66\"%" $HOME/.junction/config/config.toml
sed -i -e "s%^address = \"tcp://0.0.0.0:1317\"%address = \"tcp://0.0.0.0:${CUSTOM_PORT}17\"%; s%^address = \":8080\"%address = \":${CUSTOM_PORT}80\"%; s%^address = \"0.0.0.0:9090\"%address = \"0.0.0.0:${CUSTOM_PORT}90\"%; s%^address = \"0.0.0.0:9091\"%address = \"0.0.0.0:${CUSTOM_PORT}91\"%" $HOME/.junction/config/app.toml
```

***

## 🚨 Maintenance

#### Get validator info

```
junctiond status 2>&1 | jq .ValidatorInfo
```

#### Get sync info

```
junctiond status 2>&1 | jq .SyncInfo
```

#### Get node peer

```
echo $(junctiond tendermint show-node-id)'@'$(curl -s ifconfig.me)':'$(cat $HOME/.0gchain/config/config.toml | sed -n '/Address to listen for incoming connection/{n;p;}' | sed 's/.*://; s/".*//')
```

#### Check if validator key is correct

```
[[ $(junctiond q staking validator $(0gchaind keys show wallet --bech val -a) -oj | jq -r .consensus_pubkey.key) = $(stchaind status | jq -r .ValidatorInfo.PubKey.value) ]] && echo -e "\n\e[1m\e[32mTrue\e[0m\n" || echo -e "\n\e[1m\e[31mFalse\e[0m\n"
```

#### Get live peers

```
curl -sS http://localhost:26657/net_info | jq -r '.result.peers[] | "\(.node_info.id)@\(.remote_ip):\(.node_info.listen_addr)"' | awk -F ':' '{print $1":"$(NF)}'
```

#### Reset chain data

```
junctiond tendermint unsafe-reset-all --keep-addr-book --home $HOME/.junctiond --keep-addr-book
```

#### Remove node

{% hint style="danger" %}
Please, before proceeding with the next step! All chain data will be lost! Make sure you have backed up your **priv\_validator\_key.json** !
{% endhint %}

```
sudo systemctl stop junctiond 
sudo systemctl disable 0junctiond 
sudo rm -rf /etc/systemd/system/junctiond.service
sudo rm $(which junctiond)
sudo rm -rf $HOME/.junctiond 
sed -i "/AIRCHAIN_/d" $HOME/.bash_profile
```

***

## Service Management

#### Reload service configuration

```
sudo systemctl daemon-reload
```

#### Enable service

```
sudo systemctl enable junctiond 
```

#### Disable service

```
sudo systemctl disable junctiond 
```

#### Start service

```
sudo systemctl start junctiond 
```

#### Stop service

```
sudo systemctl stop junctiond 
```

#### Restart service

```
sudo systemctl restart junctiond 
```

#### Check service status

```
sudo systemctl status junctiond 
```

#### Check service logs

```
sudo journalctl -u junctiond -f --no-hostname -o cat
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.logosnodos.online/testnet-node/airchains/cheat-sheet.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
