I need to generate a VRF Key Hash in this format: vrf_vk13hg4gg5fg67399nuz2ldk89kqw9h379cfgtkpvd83ra89f908kcqv2cw3j
When I generate it using cardano-cli
, I get this file:
{
"type": "VrfVerificationKey_PraosVRF",
"description": "VRF Verification Key",
"cborHex": "5820d3e6e69edf63e50ce0d12bc8fd891d6d00a09cb484a55f99caf0767bd9d75488"
}
What I'm trying to do is to convert this to VRFKeyHash
. I'm using this function (I'm reading the value directly from the file, that's why I'm parsing it):
const fromHex=(hex)=>Buffer.from(hex,"hex");
const vrfKeyHash = CardanoWasm.VRFKeyHash.from_bytes(fromHex(JSON.parse(vrfKeyFile).cborHex));
But when I do this, I get the following error:
Deserialization failed in VRFKeyHash because: Invalid cbor: expected tuple 'hash length' of length 32 but got length Len(34).
What is it that I'm doing wrong?