KES days til node.cert renew maths

Hi! I wrote myself a little cheatsheet to calculate everything that has to to with the key evolving signature. Can someone please review this and tell me if everything is correct?

KES

Current KES Period = Current Tip / slotsPerKESPeriod (=129600)

Current Tip: cardano-cli shelley query tip –mainnet = e.g. 6710594

slotsPerKESPeriod: cat mainnet-shelley-genesis.json | grep KESPeriod
(=129600sec = 2160min = 36h = one KES Period)
maxKESEvolutions: cat mainnet-shelley-genesis.json | grep maxKESEvolutions (= 62)
(means KES valid for 62 x 36h = 93 days)

Days left til node.cert renew:

  1. Current KES Period = Current Tip / slotsPerKESPeriod = e.g. 6710594 / 129600 = 51
  2. KES Periods left = 62 – Current KES Period = 62 – 51 = 11 KES Periods left till renew
  3. 11 KES Periods equals 11 x 36h = 396h = 16,5 days

When these 16,5 days are over, does the KES Period start from 0 again? If i renew my node.cert today, what does this mean?
BRGDS

1 Like

oh I think i wrote a lo of BS sorry for that - it always depends on when you made your first KES Keys right? So its different from operator to operator? i found my remaining KES periods with prometheus, found no other way to do it…

easiest way is to query ekg via:

curl localhost:12798/metrics | grep -i forge

2 Likes

i think you can get all the data from the prometheus (on BP Node with valid certs):

curl -s http://127.0.0.1:12798/metrics | grep KES

You will get:
Current KES Period: cardano_node_Forge_metrics_currentKESPeriod_int
Remaining KES: cardano_node_Forge_metrics_remainingKESPeriods_int
Remaining KES Days: cardano_node_Forge_metrics_remainingKESPeriods_int * 1.5

2 Likes

Works great thank you guys :pray::ok_hand:

This is exactly what I was looking for, and the solutions work great. Also I found the workings in the original question helpful. Thanks!

2 Likes

So my work wasnt entirely useless :joy::+1:

1 Like

Question, can you renew the kes too early? Any time? Or do you have to wait till day of expire. For instance. I know I will be away from a computer with access to bp node during the week before expire. Can I just renew it two weeks early,

Hi Mark,

You can renew KES at any time before expiration.

Your friend, FROG

1 Like

When I run the command

curl -s http://127.0.0.1:12798/metrics 1 | grep KES

I’m not getting any metrics returned. I have upgraded to the 1.21.1 and my bp-node is processing transactions.

Any idea on what it takes to get this metric to show up?

My BP-node is started using the certs and keys…

cardano-node run --topology {TOPOLOGY} --database-path {DB_PATH} --socket-path {SOCKET_PATH} --host-addr {HOSTADDR} --port {PORT} --config {CONFIG} --shelley-kes-key {KES} --shelley-vrf-key {VRF} --shelley-operational-certificate ${CERT}