I'm using cardanocli-js to create both VRF files for running a stake pool: vrf.vkey and vrf.skey:

const vrfKeyAccount = cardanocliJs.nodeKeyGenVRF("Totem");

Then I want to read the vrf.vkey file and convert the cborHex value to VRFKeyHash format, from the Cardano Serialization Lib. For that, I do:


But I'm getting the following error:

    throw takeObject(arg0);
JsValue("Deserialization failed in VRFKeyHash because: Invalid cbor: expected tuple 'hash length' of length 32 but got length Len(34).")
(Use `node --trace-uncaught ...` to show where the exception was thrown)

2 Answers 2


Maybe this could help,

as cborHex is in hex, and you can pass a Uint8Array (bytes) to initialize a VRFKeyHash like in many cardano-serialization-lib objects, in theory you can use Buffer.from(hexValue,"hex"), like this:


not tested!


I have checked that every cborHex on vrf.vkey files starts with the prefix "5820" and every cborHex on vrf.skey files starts with the prefix "5840". If I remove those prefixes from the conversion, then it works:


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.