I am having trouble using cardano-serialization-lib. I am trying to calculate the datum hash from bytes using this library:

var myBytes = Buffer.from(
  const dtHash = hash_plutus_data(PlutusData.new_bytes(myBytes));

which gives me a4c44696aa4ed831f3a1c0b86e407a8c092cf680e61ed23f0e47a15b73d59c79 but when I tried to do it through cli with cardano-cli transaction hash-script-data --script-data-file $datumFile where datumFile is

    "bytes": "b1566319045054327346e0043eed1af00eec2a63d9536f65087ca1"

I got edc92947d6f09957c3fe31c10478e6eeee7fdaec1e2cc7439633325cd9bcf13f instead

  • Did you manage to solve this?
    – martin
    Commented Oct 26, 2021 at 0:17

1 Answer 1


I'm pretty sure this is a known bug which the devs are aiming to fix in the next hard fork. You can see the discussion here: https://github.com/Emurgo/cardano-serialization-lib/issues/227

Does your transaction work when you submit it? If it doesn't, you should get a relevant error related to the datum which you can use to fix your transaction body.

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.