1

I have a question about findDatum which is used in some of example contracts in Plutus Pioneer Program. According to those lectures, this method is used to get Datum from its DatumHash. I wonder if it is true that at anytime we can always get Datum from its corresponding DatumHash? For example, in the Lobster challenge, are we able to reveal ourselves the Datum from the given DatumHash? Please help me clarify this.

1 Answer 1

1

I wonder if it is true that at anytime we can always get Datum from its corresponding DatumHash?

No, the transaction info TxInfo has an argument called txInfoData, defined as txInfoData :: [(DatumHash, Datum)]. Not necessarily your DatumHash will be inside this list, but what findDatum does, is to try to lookup the given datum hash, and if it's there, return the corresponding Datum.

For example, in the Lobster challenge, are we able to reveal ourselves the Datum from the given DatumHash?

Yes, because the Lobster Chalange's txInfoData contains inside it's list the pair (DatumHash, Datum) corresponding to it's current data.

1
  • 2
    Thanks @Mateus for your reply. I understand in case there is no Datum provided then we can't look it up from the DatumHash because in that case it is always TxOutDatumHashNone. So as you said, we can get Datum from a corresponding DatumHash if it is present. Can you please tell me how can we get Datum of the Lobster Challenge Contract from its DatumHash which is "45b0cfc220ceec5b7c1c62c4d4193d38e4eba48e8815729ce75f9c0ab0e4c1c0" Thanks again for your answer. Commented Oct 2, 2021 at 19:09

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.