VRF Check

Use these checks to ensure that you are using the correct VRF File

Issue: Wrong VRF key file is used

Symptoms

As with all advanced checks, there is no obvious symptoms until you have missed a block.

When that happens, gLiveView will show Leader has increased by 1 but Adopted and Invalid will have no increase.

For this particular error, you may notice that vrf.skey is newer than your kes.skey though this does not necessarily mean that you have this issue.

If you already noticed that you failed to create a block, you can confirm if this is the cause using the following method:

Extract data from the console

sudo journalctl -u cardano-node.service > blockfail.log

Open blockfail.log and search for your pool id. You will find details of the block you missed along with error messages relating to the cause of the failed block e.g. Wrong VRF Key

If you did miss a block, it is important to download your logs using the above command BEFORE restarting your nodes so that you will be able to confirm the cause of the issue.

Check

To check if you are using the correct VRF key, use the steps below.

Download the ledger state from blockchain:

cardano-cli query ledger-state --mainnet > ledger-state.out

Open ledger-state.out and search for your pool’s ID.

For example, for me, the WISH Pool's ID is: 4dbdfb68de96a563719f7df2b3cf7c98fb547a3e7edca2a547d35852

So I search for the above string in ledger-state.out:

nano ledger-state.out 

After locating your pool ID, you should see the vrf entry similar to this one:

  • “vrf”: “836fa998ca67a09089f08afac90a5de8ef987a9520579f7afecb997954498901a”,

  • The above VRF value in ledger-state.out is the key-hash of your vrf.vkey. It is NOT the same as the contents of your vrf.vkey.

  • Take note of the above key hash as you will use it in locating the correct vrf.vkey.

  • Compute the key-hash of your existing vrf.vkey from your cold machine:

cardano-cli node key-hash-VRF --verification-key-file vrf.vkey --out-file vkeyhash.out

If the vrf keyhash from ledger-state.out is the same as vkeyhash.out, then you do not have this issue.

If the keyhashes are different, repeat the above steps on other copies of your vrf.vkey until you find the one that matches the vrf keyhash from ledger-state.out.

Proceed to the remediation steps section depending on your situation:

  • Use Remediation Option 1 if you were able to find the correct vrf.vkey

  • Use Remediation Option 2 if you are unable to find the correct vrf.vkey

Root Cause and Avoidance

The following are two possible causes of this issue. Both relate to wrong vrf keys:

  1. A vrf.skey is in the BP which does not correspond to the vrf.vkey that was signed at the cold machine when the pool was registered.

  2. New vrf keys were made and the new vrf.skey was put in the BP but the 3 epochs required for the change to take effect has not yet passed. Therefore, the pool is still registered to the old vrf keys.

To avoid this issue, I suggest to never update your VRF files after you have registered your pool.

If you have already created new VRF files, always keep copies of your old VRF files as they are still required to be used for the next 3 epochs.

Remediation Option 1: Correct VRF files are available

You are in luck because this is the easiest option. Do the following

  1. Copy the correct vrf.skey onto the $NODE_HOME in the BP

  2. Copy the correct vrf.vkey onto the $NODE_HOME in your cold machine

  3. Restart the cardano-node.service

NOTE: If the node does not start up, you may need to delete the existing socket file first using the following steps:

  1. Stop the cardano-node.service

  2. Delete the socket file usually located at: $NODE_HOME/db/socket

  3. Start the cardano-node.service

Please refer to typical commands below on how to do the above steps:

sudo systemctl stop cardano-node.service
cd $NODE_HOME/db
rm socket
sudo systemctl start cardano-node.service

Remediation Option 2: Correct VRF files are NOT available

Create a new vrf.vkey from the existing vrf.skey:

# WARNING:  This will overwrite vrf.vkey in $NODE_HOME
# Run with caution!
cd $NODE_HOME
cardano-cli key verification-key --signing-key-file vrf.skey --verification-key-file vrf.vkey

Create the keyhash of this vrf.vkey

cardano-cli node key-hash-VRF --verification-key-file vrf.vkey --out-file vkeyhash.out

Compare the contents of vkeyhash.out with the keyhash from ledger-state.out

  • If the keyhash matches, do the steps under Remediation Option 1 above

  • If the keyhash does not match, look for other vrf.skey and repeat the above steps until you find the correct vrf.skey. If you find the correct VRF files, go to Remediation Option 1 above

  • If you are still unable to find the correct vrf.vkey after the above steps, you may need to redo your pool registration using a new set of VRF keys. Just take note that the new keys will not take effect until after 3 epochs.

Last updated