0

I've this query on Preprod:

SELECT
    ENCODE(TX.HASH, 'hex') as tx_hash,
    TX_OUT.INDEX,
    TX_OUT.ADDRESS_HAS_SCRIPT,
    ENCODE(TX_OUT.DATA_HASH,'hex') AS DATUM_HASH,
    SCRIPT.ID as script_id,
    TX_OUT.REFERENCE_SCRIPT_ID,
ENCODE(INLINE_DATUM.HASH,'hex') AS INLINE_DATUM_HASH
FROM TX_OUT
INNER JOIN TX ON TX.ID = TX_OUT.TX_ID
LEFT JOIN "script" ON "script"."hash" = "tx_out"."payment_cred"
LEFT JOIN "datum" AS "inline_datum" ON "inline_datum"."id" = 
"tx_out"."inline_datum_id"
WHERE TX.HASH = 
DECODE('8502fe3617b70d12fc65c8c17dab8483f5a7f847e0fba0376fe7abacf4773262','hex')
AND TX_OUT.INDEX = 3;

Where I'm getting some info about a specific UTxO. The result is this:

 tx_hash                                                          | index | address_has_script |                            datum_hash                            | script_id | reference_script_id |                        inline_datum_hash                         
------------------------------------------------------------------+-------+--------------------+------------------------------------------------------------------+-----------+---------------------+------------------------------------------------------------------
 8502fe3617b70d12fc65c8c17dab8483f5a7f847e0fba0376fe7abacf4773262 |     3 | f                  | 93892d0c469bd1228f0e94621d3101e755523e97ea0a837c9b509b1aeb9d8c42 |           |                     | 93892d0c469bd1228f0e94621d3101e755523e97ea0a837c9b509b1aeb9d8c42

You can see the UTxO doesn't have script address_has_script = f and left join to script table is null (LEFT JOIN "script" ON "script"."hash" = "tx_out"."payment_cred") resulting on empty column script_id. The same goes to column reference_script_id .

So we can we can assume no script is involved in this UTxO but we can see it has data_hash and according to db-sync schema doc:

enter image description here

You can also notice the UTxO has inline datum (column inline_datum_hash in the query) which value is the same as data_hash. I know strictly speaking having data_hash doesn't mean it must have a script but I just cannot understand this UTxO.

Why data_hash is the same as inline_datum_hash, and what does it means?

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.