# Cheat Sheet

## Key management

#### Add new key

```
crossfid keys add wallet
```

#### Recover existing key

```
crossfid keys add wallet --recover
```

#### List all keys

```
crossfid keys list
```

#### Delete key

```
crossfid keys delete wallet
```

#### Export key to the file

```
crossfid keys export wallet
```

#### Import key from the file

```
crossfid keys import wallet wallet.backup
```

#### Query wallet balance

```
crossfid q bank balances $(crossfid keys show wallet -a)
```

***

## Validator management

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

#### Create new validator

```
crossfid tx staking create-validator \
  --amount 1000000mpx \
  --commission-max-change-rate "0.1" \
  --commission-max-rate "0.2" \
  --commission-rate "0.1" \
  --min-self-delegation "1" \
  --pubkey  $(swisstronikd tendermint show-validator) \
  --moniker "<your moniker>" \
  --website "<your website>" \
  --identity "<your identity> \
  --details "<your descriptions> \
  --chain-id $CROSSFI_CHAIN_ID \
  --gas-prices 10000000000000mpx \
  --from wallet \
  -y
```

#### Edit existing validator

```
crossfid tx staking edit-validator \
  --moniker=<your moniker> \
  --identity=<your_keybase_id> \
  --website=<your_website> \
  --details=<your_validator_description> \
  --chain-id=$CROSSFI_CHAIN_ID \
  --from=wallet \
  -y
```

#### Unjail validator

```
crossfid tx slashing unjail \
  --broadcast-mode=block \
  --chain-id=$CROSSFI_CHAIN_ID \
  --gas=auto \
  --from=wallet \
  -y
```

#### View validator details

```
crossfid q staking validator $(crossfid keys show wallet --bech val -a)
```

***

## Token management

#### Withdraw rewards from all validators

```
crossfid tx distribution withdraw-all-rewards --from wallet --chain-id crossfi-evm-testnet-1 --gas-prices 10000000000000mpx  --gas-adjustment 1.5 --gas "auto" -y 
```

#### Withdraw commission and rewards from your validator

```
crossfid tx distribution withdraw-rewards $(crossfid keys show wallet --bech val -a) --commission --from wallet --chain-id crossfi-evm-testnet-1 --gas-prices 10000000000000mpx  --gas-adjustment 1.5 --gas "auto" -y 
```

#### Delegate tokens to yourself

```
crossfid tx staking delegate $(crossfid keys show wallet --bech val -a) 1000000mpx --from wallet --chain-id crossfi-evm-testnet-1 --gas-prices 10000000000000mpx  --gas-adjustment 1.5 --gas "auto" -y 
```

#### Redelegate tokens to another validator

```
crossfid tx staking redelegate $(crossfid keys show wallet --bech val -a) <TO_VALOPER_ADDRESS> 1000000mpx --from wallet --chain-id crossfi-evm-testnet-1 --gas-prices 10000000000000mpx  --gas-adjustment 1.5 --gas "auto" -y 
```

#### Unbond tokens from your validator

```
crossfid tx staking unbond $(crossfid keys show wallet --bech val -a) 1000000mpx --from wallet --chain-id crossfi-evm-testnet-1 --gas-prices 10000000000000mpx  --gas-adjustment 1.5 --gas "auto" -y 
```

#### Send tokens to the wallet

```
crossfid tx bank send wallet <TO_WALLET_ADDRESS> 1000000mpx --from wallet --chain-id crossfi-evm-testnet-1 --gas-prices 10000000000000mpx  --gas-adjustment 1.5 --gas "auto" -y 
```

***

## Governance

#### List all proposals

```
crossfid query gov proposals
```

#### View proposal by id

```
crossfid query gov proposal 1
```

#### Vote 'Yes'

```
crossfid tx gov vote 1 yes --from wallet --chain-id $CROSSFI_CHAIN_ID --gas-adjustment 1.4 --gas auto --gas-prices 10000000000000mpx -y
```

#### Vote 'No'

```
crossfid tx gov vote 1 no --from wallet --chain-id $CROSSFI_CHAIN_ID --gas-adjustment 1.4 --gas auto --gas-prices 10000000000000mpx -y
```

#### Vote 'Abstain'

```
crossfid tx gov vote 1 abstain --from wallet --chain-id $CROSSFI_CHAIN_ID --gas-adjustment 1.4 --gas auto --gas-prices 10000000000000mpx -y
```

#### Vote 'NoWithVeto'

```
crossfid tx gov NoWithVote 1 yes --from wallet --chain-id $CROSSFI_CHAIN_ID --gas-adjustment 1.4 --gas auto --gas-prices 10000000000000mpx -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/.mineplex-chain/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/.mineplex-chain/config/app.toml
```

#### Get sync info

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

#### 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)}'
```

#### Enable prometheus

```
sed -i -e "s/prometheus = false/prometheus = true/" $HOME/.mineplex-chain/config/config.toml
```

#### Reset chain data

```
crossfid tendermint unsafe-reset-all --keep-addr-book --home $HOME/.mineplex-chain --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 %}

```
cd $HOME 
sudo systemctl stop crossfid 
sudo systemctl disable crossfid 
sudo rm /etc/systemd/system/crossfid.service 
sudo systemctl daemon-reload 
sudo rm -rf $(which crossfid)
sudo rm -rf $HOME/.mineplex-chain 
sudo rm -rf $(which crossfid) 
```
