<blockquote>
<p>I wonder if it is true that at anytime we can always get Datum from
its corresponding DatumHash?</p>
</blockquote>
<p>No, the transaction info <a href="https://staging.plutus.iohkdev.io/doc/haddock/plutus-ledger-api/html/Plutus-V1-Ledger-Contexts.html#t:TxInfo" rel="nofollow noreferrer"><code>TxInfo</code></a> has an argument called <code>txInfoData</code>, defined as <code>txInfoData :: [(DatumHash, Datum)]</code>. Not necessarily your <code>DatumHash</code> will be inside this list, but what <code>findDatum</code> does, is to try to lookup the given datum hash, and if it's there, return the corresponding <code>Datum</code>.</p>
<blockquote>
<p>For example, in the Lobster challenge, are we able to reveal ourselves
the Datum from the given DatumHash?</p>
</blockquote>
<p>Yes, because the Lobster Chalange's <code>txInfoData</code> contains inside it's list the pair <code>(DatumHash, Datum)</code> corresponding to it's current data.</p>

CC BY-SA 4.0
2021-10-02T19:09:11.257Z
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.
Giang Nguyen
CC BY-SA 4.0
2021-09-30T13:04:41.830Z
2021-09-30T13:04:41.830Z
Mateus
<p>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.</p>

<plutus><smart-contract><plutus-pioneer-program>
Question about Datum and DatumHash
# Question about Datum and DatumHash

(Asked by: username_0 on 2021-09-29)

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.

**Tags:** plutus, smart-contract, plutus-pioneer-program

---

## 1 answers

### Answer by username_1 on 2021-09-30. Score: 1

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

No, the transaction info [`TxInfo`](https://staging.plutus.iohkdev.io/doc/haddock/plutus-ledger-api/html/Plutus-V1-Ledger-Contexts.html#t: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.

> **Comments:**
> **username_0**: 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.  

---

