# KES node state counter decreased after rotation

**URL:** <https://forum.cardano.org/t/kes-node-state-counter-decreased-after-rotation/119917>\
**Category:** Operate a Stake Pool\
**Created:** [18 July 2023 15:39 UTC](https://forum.cardano.org/t/kes-node-state-counter-decreased-after-rotation/119917 "2023-07-18T15:39:31Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![0xRabbit](https://avatars.discourse-cdn.com/v4/letter/0/a9adbd/32.png) [@0xRabbit](https://forum.cardano.org/u/0xRabbit)\
**Post date:** [18 July 2023 15:39 UTC](https://forum.cardano.org/t/kes-node-state-counter-decreased-after-rotation/119917/1 "2023-07-18T15:39:31Z")

</div>

I just rotated my KES keys and encountered some strange behavior.

Before doing anything I checked the counter values with `cardano-cli query kes-period-info` and got the following results:

```auto
{
    ...
    "qKesNodeStateOperationalCertificateNumber": 3,
    "qKesOnDiskOperationalCertificateNumber": 3,
    ...
}

```

Then I used the same counter file as last time to generate a new operational certificate. The counter file showed `Next certificate issue number: 4` before and `Next certificate issue number: 5` after the generation. That seems correct to me.

After copying the certificate to the block-producer I checked the counter values again and now got the following results:

```auto
✓ Operational certificate's KES period is within the correct KES period interval
✗ The operational certificate counter too far ahead of the node protocol state counter in the operational certificate at: node.cert
  On disk operational certificate counter: 4
  Protocol state counter: 2
{
    ...
    "qKesNodeStateOperationalCertificateNumber": 2,
    "qKesOnDiskOperationalCertificateNumber": 4,
    ...
}

```

I don’t understand why `qKesNodeStateOperationalCertificateNumber` decreased to 2 now. Should I generate a new certificate with a lower counter now or is this some kind of bug?

---

<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:** [18 July 2023 16:05 UTC](https://forum.cardano.org/t/kes-node-state-counter-decreased-after-rotation/119917/2 "2023-07-18T16:05:04Z")

</div>

Check on [adapools.org](http://adapools.org) → blocks which number was used to produce last block… then use the next one to generate a new certificate

Thx,

---

<div class="post-metadata">

**Author:** ![0xRabbit](https://avatars.discourse-cdn.com/v4/letter/0/a9adbd/32.png) [@0xRabbit](https://forum.cardano.org/u/0xRabbit)\
**Post date:** [18 July 2023 16:07 UTC](https://forum.cardano.org/t/kes-node-state-counter-decreased-after-rotation/119917/3 "2023-07-18T16:07:03Z")

</div>

Thanks! Last block was indeed produced with counter 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:** [18 July 2023 16:17 UTC](https://forum.cardano.org/t/kes-node-state-counter-decreased-after-rotation/119917/4 "2023-07-18T16:17:37Z")

</div>

Then create a new certificate with counter 3

Cheers,
