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!
Cardano Stack Exchange is a question and answer site for users and developers of the Cardano cryptocurrency ecosystem. It only takes a minute to sign up.
Sign up to join this communityIf 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.
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
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.
034cd38f3f8387e6963c78175e459a2ffab0e36becb36510aaa81534f6ea6e54
I can't find the datum for this tx in cardano db sync.