<p>To check exact query as explorer for GraphQL - in your browser, when viewing page from explorer - you can check Developer Tools &gt; Network (tab). In the list, look for <code>graphql</code> POST requests where variable is your transaction ID - you would see the graphql query in Request Payload.</p>
<p>Thus, for the mentioned link in example , you'd see the request is:</p>
<pre><code>{&quot;query&quot;:&quot;query searchById($id: Hash32Hex!) {\n  blocks(where: {hash: {_eq: $id}}) {\n    ...BlockDetails\n  }\n  transactions(where: {hash: {_eq: $id}}) {\n    ...TransactionDetails\n  }\n}\n\nfragment BlockDetails on Block {\n  ...BlockOverview\n  nextBlock {\n    hash\n    number\n  }\n  previousBlock {\n    hash\n    number\n  }\n  transactions(limit: 10, order_by: {fee: desc}) {\n    ...TransactionDetails\n  }\n}\n\nfragment BlockOverview on Block {\n  forgedAt\n  slotLeader {\n    description\n  }\n  epochNo\n  hash\n  number\n  size\n  slotNo\n  transactions_aggregate {\n    aggregate {\n      count\n      sum {\n        totalOutput\n      }\n    }\n  }\n}\n\nfragment TransactionDetails on Transaction {\n  block {\n    epochNo\n    hash\n    number\n    slotNo\n  }\n  deposit\n  fee\n  hash\n  includedAt\n  mint {\n    asset {\n      assetName\n      decimals\n      description\n      fingerprint\n      name\n      policyId\n      ticker\n    }\n    quantity\n  }\n  inputs {\n    address\n    sourceTxHash\n    sourceTxIndex\n    value\n    tokens {\n      asset {\n        assetName\n        decimals\n        description\n        fingerprint\n        name\n        policyId\n        ticker\n      }\n      quantity\n    }\n  }\n  metadata {\n    key\n    value\n  }\n  outputs {\n    address\n    index\n    value\n    tokens {\n      asset {\n        assetName\n        decimals\n        description\n        fingerprint\n        name\n        policyId\n        ticker\n      }\n      quantity\n    }\n  }\n  totalOutput\n  withdrawals {\n    address\n    amount\n  }\n}\n&quot;,&quot;variables&quot;:{&quot;id&quot;:&quot;f58152cafbd25e618433eae52f72bb419e00efe91b5cf7c74a93f8c29cbb2e7b&quot;}}
</code></pre>
<p>Note that this is ofcourse a request payload sent to graphql endpoint, you can substitute <code>\n</code> and use/replace variable(s) as desired</p>

CC BY-SA 4.0
2021-08-05T00:34:46.307Z
2021-08-05T00:34:46.307Z
RdLrT
<p>I am looking for a GraphQL query that will return transaction details as seen on the Cardano Blockchain Explorer when searched with <code>txId</code>.</p>
<p>For example,</p>
<p><a href="https://explorer.cardano.org/en/transaction?id=f58152cafbd25e618433eae52f72bb419e00efe91b5cf7c74a93f8c29cbb2e7b" rel="nofollow noreferrer">https://explorer.cardano.org/en/transaction?id=f58152cafbd25e618433eae52f72bb419e00efe91b5cf7c74a93f8c29cbb2e7b</a></p>
<p>Can anyone provide a sample query which can also be tested on the Dandelion <a href="https://graphql-api.mainnet.dandelion.link/" rel="nofollow noreferrer">GraphQL playground</a>?</p>

CC BY-SA 4.0
2021-07-29T10:44:16.403Z
Just came across this example on GitHub that aggregates inputs and outputs of a transaction.   https://github.com/input-output-hk/cardano-graphql/blob/master/packages/api-cardano-db-hasura/src/example_queries/transactions/aggregateDataWithinTransaction.graphql Could there be a more comprehensive query?
lambda
CC BY-SA 4.0
2021-07-31T14:22:30.750Z
This is not related to GraphQL query, but if this could help you get the txn info https://github.com/input-output-hk/cardano-db-sync/blob/master/doc/interesting-queries.md#get-the-reward-history-for-a-specified-stake-address
Kuldeep Srivastava
<transaction><cardano-graphql><blockchain-explorer>
How to query cardano-graphql API to get the details of a transaction with the transaction id?
# How to query cardano-graphql API to get the details of a transaction with the transaction id?

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

I am looking for a GraphQL query that will return transaction details as seen on the Cardano Blockchain Explorer when searched with `txId`.

For example,

<https://explorer.cardano.org/en/transaction?id=f58152cafbd25e618433eae52f72bb419e00efe91b5cf7c74a93f8c29cbb2e7b>

Can anyone provide a sample query which can also be tested on the Dandelion [GraphQL playground](https://graphql-api.mainnet.dandelion.link/)?

**Tags:** transaction, cardano-graphql, blockchain-explorer
> **Comments:**
> **username_0**: Just came across this example on GitHub that aggregates inputs and outputs of a transaction.   https://github.com/input-output-hk/cardano-graphql/blob/master/packages/api-cardano-db-hasura/src/example_queries/transactions/aggregateDataWithinTransaction.graphql Could there be a more comprehensive query?  
> **username_1**: This is not related to GraphQL query, but if this could help you get the txn info https://github.com/input-output-hk/cardano-db-sync/blob/master/doc/interesting-queries.md#get-the-reward-history-for-a-specified-stake-address  

---

## 1 answers

### Answer by username_2 on 2021-08-05. Score: 1 | Accepted answer

To check exact query as explorer for GraphQL - in your browser, when viewing page from explorer - you can check Developer Tools > Network (tab). In the list, look for graphql POST requests where variable is your transaction ID - you would see the graphql query in Request Payload.
Thus, for the mentioned link in example , you'd see the request is:
{"query":"query searchById($id: Hash32Hex!) {\n  blocks(where: {hash: {_eq: $id}}) {\n    ...BlockDetails\n  }\n  transactions(where: {hash: {_eq: $id}}) {\n    ...TransactionDetails\n  }\n}\n\nfragment BlockDetails on Block {\n  ...BlockOverview\n  nextBlock {\n    hash\n    number\n  }\n  previousBlock {\n    hash\n    number\n  }\n  transactions(limit: 10, order_by: {fee: desc}) {\n    ...TransactionDetails\n  }\n}\n\nfragment BlockOverview on Block {\n  forgedAt\n  slotLeader {\n    description\n  }\n  epochNo\n  hash\n  number\n  size\n  slotNo\n  transactions_aggregate {\n    aggregate {\n      count\n      sum {\n        totalOutput\n      }\n    }\n  }\n}\n\nfragment TransactionDetails on Transaction {\n  block {\n    epochNo\n    hash\n    number\n    slotNo\n  }\n  deposit\n  fee\n  hash\n  includedAt\n  mint {\n    asset {\n      assetName\n      decimals\n      description\n      fingerprint\n      name\n      policyId\n      ticker\n    }\n    quantity\n  }\n  inputs {\n    address\n    sourceTxHash\n    sourceTxIndex\n    value\n    tokens {\n      asset {\n        assetName\n        decimals\n        description\n        fingerprint\n        name\n        policyId\n        ticker\n      }\n      quantity\n    }\n  }\n  metadata {\n    key\n    value\n  }\n  outputs {\n    address\n    index\n    value\n    tokens {\n      asset {\n        assetName\n        decimals\n        description\n        fingerprint\n        name\n        policyId\n        ticker\n      }\n      quantity\n    }\n  }\n  totalOutput\n  withdrawals {\n    address\n    amount\n  }\n}\n","variables":{"id":"f58152cafbd25e618433eae52f72bb419e00efe91b5cf7c74a93f8c29cbb2e7b"}}

Note that this is ofcourse a request payload sent to graphql endpoint, you can substitute \n and use/replace variable(s) as desired


---

