<p>Here is how you do it using <code>cardano-graphql</code>:</p>
<pre><code>  {
    transactions(where: { hash: { _eq: &quot;4c827fe1c193de7924b19696965d21a34df04fed99a35428b22d475dbc999cc3&quot;} })   {
      block {
        epoch {
          number
        }
        epochNo
        fees
        forgedAt

        hash
      }
      blockIndex
      deposit
      fee
      hash
      inputs {
        address
          txHash
      }
      invalidBefore
      invalidHereafter
      scriptSize
      size
      totalOutput
      includedAt
      validContract
    }
  }
</code></pre>
<p>You can use <a href="https://graphql-api.testnet.dandelion.link/" rel="nofollow noreferrer">Dandelion</a> and paste this code in there to retrieve the information requested. You can even play with the different data types (check the &quot;DOCS&quot; tab for reference) and add/remove the ones you want.</p>
<p>If you want a real implementation of this, you can refer to the following TypeScript code:</p>
<pre><code>import axios from &quot;axios&quot;;

export async function getTransaction(txHash: string) {
  
  const url = `https://graphql-api.testnet.dandelion.link`;

  const headers = {
    &quot;content-type&quot;: &quot;application/json&quot;
  };

  const query = `
  {
    transactions(where: { hash: { _eq: &quot;${txHash}&quot;} })  {
      block {
        epoch {
          number
        }
        epochNo
        fees
        forgedAt

        hash
      }
      blockIndex
      deposit
      fee
      hash
      inputs {
        address
          txHash
      }
      invalidBefore
      invalidHereafter
      scriptSize
      size
      totalOutput
      includedAt
      validContract
    }
  }
`;

  const graphqlQuery = {
      &quot;query&quot;: query
  };

  const response = await axios({
    url,
    method: 'post',
    headers: headers,
    data: graphqlQuery
  });

  return response.data;

}
</code></pre>
<p>I'm using <code>axios</code> library to handle the request to Dandelion.</p>

CC BY-SA 4.0
2022-06-03T05:33:16.970Z
2022-06-03T05:33:16.970Z
Falcon Stakepool
<p>GraphQL is probably the easiest in my option and offers the most room for growth.</p>
<p>The public GraphQL API hosted by Dandelion (<a href="https://graphql-api.testnet.dandelion.link" rel="nofollow noreferrer">https://graphql-api.testnet.dandelion.link</a>) is a great place to learn and get started with GraphQL.   I suggest hosting your own GraphQL Servers so you can query larger and more advanced data sets.</p>
<p><a href="https://blockfrost.io" rel="nofollow noreferrer">Blockfrost.io</a> and <a href="https://www.tangocrypto.com/api-reference/#/" rel="nofollow noreferrer">Tangcrypto</a> are honorable mentions, which will allow you get data from the Cardano Blockchain but have daily free limits. It is possible to get mostly all the data you need from one of the Blockfrost or Tangcrypto, but you will mosy likely need to execute multiple queries to get all the info you want.</p>
<p>There is another open-source API that is free and in the process of being created. I found it a few months ago but forgot the link, it was like the blockfront API but a little more in-depth and advanced, and it was all free with unlimited queries. If I find it ill again ill add it.</p>
<p>Short answer GraphQL is the best, and blockfrost is the most convenient.</p>
<p>@RdLrT also suggested <a href="https://api.koios.rest/" rel="nofollow noreferrer">https://api.koios.rest/</a></p>

CC BY-SA 4.0
2022-06-05T21:39:44.557Z
I assume you meant [koios](https://api.koios.rest/#post-/tx_info)? It's already part of OP's list
RdLrT
CC BY-SA 4.0
2022-06-05T16:44:10.490Z
2022-06-07T04:22:31.630Z
2022-06-07T04:22:31.630Z
yungtechboy1
<p>The Cardano ecosystem has a mountain of various tools for querying the chain. Here are a few I'm aware of</p>
<ul>
<li>Ogmios</li>
<li>Cardano-Wallet</li>
<li>dbsync</li>
<li>Cardano-graphql</li>
<li>koios</li>
</ul>
<p>We would like to retrieve all information related to a transaction (sender, receiver, amounts, insertion slot, etc). What is the best tool for doing that as of today?</p>

<transaction>
Best approach to retrieving transaction by id
# Best approach to retrieving transaction by id

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

The Cardano ecosystem has a mountain of various tools for querying the chain. Here are a few I'm aware of

* Ogmios
* Cardano-Wallet
* dbsync
* Cardano-graphql
* koios

We would like to retrieve all information related to a transaction (sender, receiver, amounts, insertion slot, etc). What is the best tool for doing that as of today?

**Tags:** transaction

---

## 2 answers

### Answer by username_1 on 2022-06-03. Score: 1

Here is how you do it using cardano-graphql:
  {
    transactions(where: { hash: { _eq: "4c827fe1c193de7924b19696965d21a34df04fed99a35428b22d475dbc999cc3"} })   {
      block {
        epoch {
          number
        }
        epochNo
        fees
        forgedAt

        hash
      }
      blockIndex
      deposit
      fee
      hash
      inputs {
        address
          txHash
      }
      invalidBefore
      invalidHereafter
      scriptSize
      size
      totalOutput
      includedAt
      validContract
    }
  }

You can use Dandelion and paste this code in there to retrieve the information requested. You can even play with the different data types (check the "DOCS" tab for reference) and add/remove the ones you want.
If you want a real implementation of this, you can refer to the following TypeScript code:
import axios from "axios";

export async function getTransaction(txHash: string) {
  
  const url = `https://graphql-api.testnet.dandelion.link`;

  const headers = {
    "content-type": "application/json"
  };

  const query = `
  {
    transactions(where: { hash: { _eq: "${txHash}"} })  {
      block {
        epoch {
          number
        }
        epochNo
        fees
        forgedAt

        hash
      }
      blockIndex
      deposit
      fee
      hash
      inputs {
        address
          txHash
      }
      invalidBefore
      invalidHereafter
      scriptSize
      size
      totalOutput
      includedAt
      validContract
    }
  }
`;

  const graphqlQuery = {
      "query": query
  };

  const response = await axios({
    url,
    method: 'post',
    headers: headers,
    data: graphqlQuery
  });

  return response.data;

}

I'm using axios library to handle the request to Dandelion.


---

### Answer by username_2 on 2022-06-05. Score: 1

GraphQL is probably the easiest in my option and offers the most room for growth.

The public GraphQL API hosted by Dandelion (<https://graphql-api.testnet.dandelion.link>) is a great place to learn and get started with GraphQL. I suggest hosting your own GraphQL Servers so you can query larger and more advanced data sets.

[Blockfrost.io](https://blockfrost.io) and [Tangcrypto](https://www.tangocrypto.com/api-reference/#/) are honorable mentions, which will allow you get data from the Cardano Blockchain but have daily free limits. It is possible to get mostly all the data you need from one of the Blockfrost or Tangcrypto, but you will mosy likely need to execute multiple queries to get all the info you want.

There is another open-source API that is free and in the process of being created. I found it a few months ago but forgot the link, it was like the blockfront API but a little more in-depth and advanced, and it was all free with unlimited queries. If I find it ill again ill add it.

Short answer GraphQL is the best, and blockfrost is the most convenient.

@RdLrT also suggested <https://api.koios.rest/>

> **Comments:**
> **username_3**: I assume you meant [koios](https://api.koios.rest/#post-/tx_info)? It's already part of OP's list  

---

