<blockquote>
<p>As datums values are included in the witness set of the corresponding
transactions</p>
</blockquote>
<p>This is not true all of the time. When you create a new script UTxO by sending some amount of tokens to it, you don't necessarily need to provide the datum, since there is no validation being made yet. You can if you want, though, by using (in cardano-cli) the <code>tx-out-embeded-datum</code> argument.</p>
<p>When you consume it, however, you'll need the actual datum, since the script validation depends on it. In your case, I assume you are inspecting an UTxO that didn't have any datum attached to it.</p>

CC BY-SA 4.0
2022-03-08T11:01:33.853Z
2022-03-08T11:01:33.853Z
Mateus
<p>From time to time I encounter transactions which contain UTXOs associated to script addresses with datum hashes for which no corresponding entries are available in the <code>datum</code> table of a fully-synched cardano-db-sync postgres.</p>
<p>Here is a randomly selected example:</p>
<pre><code>select data_hash from tx_out where tx_id = (select id from tx where hash = '\xfc6536534b03f818494f21698994d387c879a121b263153a06975d056d9cf13e');
</code></pre>
<p>This will output <code>\x4a664c584e552af70dcc255921811b5f62637fd781a43e5c289d9e571a227117</code>. Then:</p>
<pre><code>select * from datum where hash = '\x4a664c584e552af70dcc255921811b5f62637fd781a43e5c289d9e571a227117';
</code></pre>
<p>finds 0 rows.</p>
<p>As <a href="https://cardano.stackexchange.com/questions/4902/how-do-i-read-the-datum-of-an-output">datums values are included in the witness set of the corresponding transactions</a> I would expect all hashes to have a matching entry in the <code>datum</code> table.</p>
<ul>
<li>Is this a bug on cardano-db-sync?</li>
<li>Is there any other way to retrieve those datum values directly, maybe by using cardano-cli to query the blockchain directly?</li>
</ul>

<cardano-cli><cardano-node><cardano-db-sync><datum>
Missing datums in db-sync
# Missing datums in db-sync

(Asked by: username_0 on 2022-03-06)

From time to time I encounter transactions which contain UTXOs associated to script addresses with datum hashes for which no corresponding entries are available in the datum table of a fully-synched cardano-db-sync postgres.
Here is a randomly selected example:
select data_hash from tx_out where tx_id = (select id from tx where hash = '\xfc6536534b03f818494f21698994d387c879a121b263153a06975d056d9cf13e');

This will output \x4a664c584e552af70dcc255921811b5f62637fd781a43e5c289d9e571a227117. Then:
select * from datum where hash = '\x4a664c584e552af70dcc255921811b5f62637fd781a43e5c289d9e571a227117';

finds 0 rows.
As datums values are included in the witness set of the corresponding transactions I would expect all hashes to have a matching entry in the datum table.

Is this a bug on cardano-db-sync?
Is there any other way to retrieve those datum values directly, maybe by using cardano-cli to query the blockchain directly?

**Tags:** cardano-cli, cardano-node, cardano-db-sync, datum

---

## 1 answers

### Answer by username_1 on 2022-03-08. Score: 1 | Accepted answer

> As datums values are included in the witness set of the corresponding
> transactions

This is not true all of the time. When you create a new script UTxO by sending some amount of tokens to it, you don't necessarily need to provide the datum, since there is no validation being made yet. You can if you want, though, by using (in cardano-cli) the `tx-out-embeded-datum` argument.

When you consume it, however, you'll need the actual datum, since the script validation depends on it. In your case, I assume you are inspecting an UTxO that didn't have any datum attached to it.


---

