# KES update/rollback tutorial for cntools install?

**URL:** <https://forum.cardano.org/t/kes-update-rollback-tutorial-for-cntools-install/108212>\
**Category:** Operate a Stake Pool\
**Created:** [27 September 2022 14:43 UTC](https://forum.cardano.org/t/kes-update-rollback-tutorial-for-cntools-install/108212 "2022-09-27T14:43:24Z")\
**Posts on this page:** 6\
**Page:** 2

<div class="post-metadata">

**Author:** ![Alexd1985](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.cardano.org/alexd1985/32/23759_2.png) [@Alexd1985](https://forum.cardano.org/u/Alexd1985)\
**Post date:** [15 January 2023 07:14 UTC](https://forum.cardano.org/t/kes-update-rollback-tutorial-for-cntools-install/108212/21 "2023-01-15T07:14:56Z")

</div>

first to rotate check on [adapools.org](http://adapools.org) which op number was used for the last block… if for example it was 10 now u should use 11

before/after rotate u can check the certificate with this command:

`cardano-cli query kes-period-info --op-cert-file op.cert --mainnet`

---

<div class="post-metadata">

**Author:** ![Alexd1985](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.cardano.org/alexd1985/32/23759_2.png) [@Alexd1985](https://forum.cardano.org/u/Alexd1985)\
**Post date:** [15 January 2023 07:23 UTC](https://forum.cardano.org/t/kes-update-rollback-tutorial-for-cntools-install/108212/23 "2023-01-15T07:23:49Z")

</div>

The idea is … if u did not create any blocks since last rotate u must use same counter

check with `cardano-cli query kes-period-info --op-cert-file op.cert --mainnet`

the output should be

```auto
   "qKesNodeStateOperationalCertificateNumber": X,
    "qKesOnDiskOperationalCertificateNumber": X+1,

```

---

<div class="post-metadata">

**Author:** ![cesar44](https://avatars.discourse-cdn.com/v4/letter/c/43a26b/32.png) [@cesar44](https://forum.cardano.org/u/cesar44)\
**Post date:** [15 January 2023 07:38 UTC](https://forum.cardano.org/t/kes-update-rollback-tutorial-for-cntools-install/108212/24 "2023-01-15T07:38:33Z")

</div>

then cntools does all the work correctly  
 ![image](https://us1.discourse-cdn.com/flex023/uploads/cardano/original/3X/a/c/acef0fd69523bd75480974eb5fb2d2cbc413c4d2.png)

![image](https://us1.discourse-cdn.com/flex023/uploads/cardano/original/3X/7/1/7198d5473e60da5f1c7918edd0bc3ee7abbdee64.png)

Thanks Alex

---

<div class="post-metadata">

**Author:** ![mcrio](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.cardano.org/mcrio/32/40017_2.png) [@mcrio](https://forum.cardano.org/u/mcrio)\
**Post date:** [15 January 2023 10:00 UTC](https://forum.cardano.org/t/kes-update-rollback-tutorial-for-cntools-install/108212/25 "2023-01-15T10:00:49Z")

</div>

> [@Alexd1985](#):
>
> The idea is … if u did not create any blocks since last rotate u must use same counter

Is that something `cntools` related? Asking as I thought the counter gets incremented by 1 each time a new operational certificate is registered with the blockchain?

Maybe I have it wrong, so I’ll appreciate some help here:

My pool has not minted a block yet. I always increased the counter by 1 when renewing the operational certificate.

Checking the `kes-period-info` on BP I’m getting `null` for the blockchain counter which seems to be expected due to non minted blocks, while the one on disk is the current iteration (6). Am I doing something wrong here?

```auto
✓ Operational certificate's KES period is within the correct KES period interval
✗ No blocks minted so far with the operational certificate at: node.cert
  On disk operational certificate counter: 6
{
    "qKesCurrentKesPeriod": 634,
    "qKesEndKesInterval": 681,
    "qKesKesKeyExpiry": null,
    "qKesMaxKESEvolutions": 62,
    "qKesNodeStateOperationalCertificateNumber": null,
    "qKesOnDiskOperationalCertificateNumber": 6,
    "qKesRemainingSlotsInKesPeriod": 6047604,
    "qKesSlotsPerKesPeriod": 129600,
    "qKesStartKesInterval": 619
}

```

**edit:**

> [@Alexd1985](#):
>
> the output should be
> 
> ```auto
> "qKesNodeStateOperationalCertificateNumber": X,
> "qKesOnDiskOperationalCertificateNumber": X+1,
> 
> ```

Shouldn’t `qKesNodeStateOperationalCertificateNumber` and `qKesOnDiskOperationalCertificateNumber` be equal after a successful rotation? Not sure how that plays together with the `null` value when no blocks minted.

Seems I understood it wrong here after the latest KES updates 🤨

---

<div class="post-metadata">

**Author:** ![Alexd1985](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.cardano.org/alexd1985/32/23759_2.png) [@Alexd1985](https://forum.cardano.org/u/Alexd1985)\
**Post date:** [15 January 2023 11:59 UTC](https://forum.cardano.org/t/kes-update-rollback-tutorial-for-cntools-install/108212/26 "2023-01-15T11:59:32Z")

</div>

> Is that something cntools related? Asking as I thought the counter gets incremented by 1 each time a new operational certificate is registered with the blockchain?

the rules changed after Vasil HF (u need to increase exactly by 1 in case u made blocks)  
Because u never made a block u need to use 0 as counter number each time when u rotate the KES

should be

```auto
qKesNodeStateOperationalCertificateNumber": null,
    "qKesOnDiskOperationalCertificateNumber": 0,

```

---

<div class="post-metadata">

**Author:** ![mcrio](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.cardano.org/mcrio/32/40017_2.png) [@mcrio](https://forum.cardano.org/u/mcrio)\
**Post date:** [15 January 2023 13:23 UTC](https://forum.cardano.org/t/kes-update-rollback-tutorial-for-cntools-install/108212/27 "2023-01-15T13:23:08Z")

</div>

Oh seems i totally misuderstood the updated rules. I thought it has to be exactly one number higher than the previoud and that it increases each time a new cert is issued. Thanks for the clarification.

[Previous page](https://forum.cardano.org/t/kes-update-rollback-tutorial-for-cntools-install/108212.md?page=1)
