# Rotating KES

When manually rotating KES keys, you need to make sure your node.counter value is correct.  \
First check your current Operational Certificate values by running this command:

```
cardano-cli conway query kes-period-info --mainnet  \
  --op-cert-file $NODE_HOME/node.cert
```

Take note of the qKesNodeStateOperationalCertificateNumber.  The number in your node.counter should be:

* 0 if you have never made a block in the history of your pool
* 1 greater than the value of qKesNodeStateOperationalCertificateNumber otherwise

If you find your node.counter has a different value, back it up then create a new node.counter file Using the command below.   Remember to change the number 8 to the current value of qKesNodeStateOperationalCertificateNumber:

```
cd $HOME/cold-keys/
cardano-cli conway node new-counter \
--cold-verification-key-file node.vkey \
--counter-value $((8 + 1)) \
--operational-certificate-issue-counter-file node.counter

## Continue with your KES Rotation
```
