user3953: How do I get the datum of an output from cardano-graphql (or another service)? I have attached it using the --tx-out-datum-embed-file flag already when building the tx using cardano-cli.
Thanks!

user1052: If you are running a DbSync node you can retrieve the datum and redeemer:
redeemer
A table containing redeemers. A redeemer is provided for all items that are validated by a script.

Primary Id: id





Column name
Type
Description




id
integer (64)



tx_id
integer (64)
The Tx table index that contains this redeemer.


unit_mem
word63type
The budget in Memory to run a script.


unit_steps
word63type
The budget in Cpu steps to run a script.


fee
lovelace
The budget in fees to run a script. The fees depend on the ExUnits and the current prices.


purpose
scriptpurposetype
What kind pf validation this redeemer is used for. It can be one of 'spend', 'mint', 'cert', 'reward'.


index
uinteger
The index of the redeemer pointer in the transaction.


script_hash
hash28type
The script hash this redeemer is used for.


datum_id
integer (64)




datum
A table containing Plutus Data available in the blockchain, found in redeemers or witnesses

Primary Id: id





Column name
Type
Description




id
integer (64)



hash
hash32type
The Hash of the Plutus Data


tx_id
integer (64)
The Tx table index for the transaction where this script first became available.


value
jsonb
The actual data in json format




Taken from dbSync:
https://github.com/input-output-hk/cardano-db-sync
It is also possible by just inspecting the blockchain. Even tho only the Datum hash is attached to the eUTXO, the datum value should be in the witness set of the transaction that created such eUTXO, so we should be able to:
a) Get the datum hash from the eUTXO and then.
b) Get the transaction that created such eUTXO and use the hash to retrieve the actual datum data.
Otherwise, if the Datum were not present at all on the chain it would be impossible to re-validate the blockchain from scratch.

3953: <p>How do I get the datum of an output from cardano-graphql (or another service)? I have attached it using the <code>--tx-out-datum-embed-file</code> flag already when building the tx using <code>cardano-cli</code>.</p>
<p>Thanks!</p>
 1052: <p>If you are running a DbSync node you can retrieve the datum and redeemer:</p>
<h3><code>redeemer</code></h3>
<p>A table containing redeemers. A redeemer is provided for all items that are validated by a script.</p>
<ul>
<li>Primary Id: <code>id</code></li>
</ul>
<div class="s-table-container">
<table class="s-table">
<thead>
<tr>
<th>Column name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>id</code></td>
<td>integer (64)</td>
<td></td>
</tr>
<tr>
<td><code>tx_id</code></td>
<td>integer (64)</td>
<td>The Tx table index that contains this redeemer.</td>
</tr>
<tr>
<td><code>unit_mem</code></td>
<td>word63type</td>
<td>The budget in Memory to run a script.</td>
</tr>
<tr>
<td><code>unit_steps</code></td>
<td>word63type</td>
<td>The budget in Cpu steps to run a script.</td>
</tr>
<tr>
<td><code>fee</code></td>
<td>lovelace</td>
<td>The budget in fees to run a script. The fees depend on the ExUnits and the current prices.</td>
</tr>
<tr>
<td><code>purpose</code></td>
<td>scriptpurposetype</td>
<td>What kind pf validation this redeemer is used for. It can be one of 'spend', 'mint', 'cert', 'reward'.</td>
</tr>
<tr>
<td><code>index</code></td>
<td>uinteger</td>
<td>The index of the redeemer pointer in the transaction.</td>
</tr>
<tr>
<td><code>script_hash</code></td>
<td>hash28type</td>
<td>The script hash this redeemer is used for.</td>
</tr>
<tr>
<td><code>datum_id</code></td>
<td>integer (64)</td>
<td></td>
</tr>
</tbody>
</table>
</div><h3><code>datum</code></h3>
<p>A table containing Plutus Data available in the blockchain, found in redeemers or witnesses</p>
<ul>
<li>Primary Id: <code>id</code></li>
</ul>
<div class="s-table-container">
<table class="s-table">
<thead>
<tr>
<th>Column name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>id</code></td>
<td>integer (64)</td>
<td></td>
</tr>
<tr>
<td><code>hash</code></td>
<td>hash32type</td>
<td>The Hash of the Plutus Data</td>
</tr>
<tr>
<td><code>tx_id</code></td>
<td>integer (64)</td>
<td>The Tx table index for the transaction where this script first became available.</td>
</tr>
<tr>
<td><code>value</code></td>
<td>jsonb</td>
<td>The actual data in json format</td>
</tr>
</tbody>
</table>
</div>
<p>Taken from dbSync:</p>
<p><a href="https://github.com/input-output-hk/cardano-db-sync" rel="noreferrer">https://github.com/input-output-hk/cardano-db-sync</a></p>
<p>It is also possible by just inspecting the blockchain. Even tho only the Datum hash is attached to the eUTXO, the datum value should be in the witness set of the transaction that created such eUTXO, so we should be able to:</p>
<p>a) Get the datum hash from the eUTXO and then.</p>
<p>b) Get the transaction that created such eUTXO and use the hash to retrieve the actual datum data.</p>
<p>Otherwise, if the Datum were not present at all on the chain it would be impossible to re-validate the blockchain from scratch.</p>
