<p>You would have to use <a href="https://github.com/input-output-hk/cardano-db-sync#cardano-db-sync" rel="nofollow noreferrer">cardano-db-sync</a> - it is a service that stores ledger (chain) data into a more easy-to-work-with SQL structure. Otherwise, one would have to parse raw chain data (incredibly inefficient), which is why a framework like db-sync is so useful.</p>
<p>All the API's like Blockfrost or Cardanoscan use db-sync at backend to provide their services.</p>

CC BY-SA 4.0
2022-01-31T15:59:48.840Z
I am familiar with db-sync and APIs that provide services to provide users with more details than can be found in the ledger. But how does db-sync know this in the first place? since only the utxo hashes are available at the input of a transaction. I am currently using blockfrost, but with congestion it is my weak point and there are times it does not respond, which miss up my wor
Fourzin
CC BY-SA 4.0
2022-01-31T14:26:22.507Z
2022-01-31T14:26:22.507Z
zhekson
<p>like the other colleagues mentioned it is not possible from cli.
what i would recommend is to</p>
<ol>
<li>create account in <a href="https://blockfrost.io/" rel="nofollow noreferrer">https://blockfrost.io/</a></li>
<li>take a Project ID</li>
</ol>
<p>and then &quot;curl&quot; info from the DB using the command below</p>
<p>curl -H 'project_id: Insert_here_youProject_ID' <br />
<a href="https://cardano-mainnet.blockfrost.io/api/v0/txs/$%7Btx_hash%7D/utxos" rel="nofollow noreferrer">https://cardano-mainnet.blockfrost.io/api/v0/txs/${tx_hash}/utxos</a> <br />
| jq '.inputs' | jq '.[0]' | jq '.address' | sed 's/^.//;s/.$//'</p>
<p>TX_Hash, you can receive it from</p>
<p>cardano-cli query utxo --address $myAddr --mainnet</p>

CC BY-SA 4.0
2022-01-31T15:53:24.640Z
I am familiar with db-sync and APIs that provide services to provide users with more details than can be found in the ledger. But how does db-sync know this in the first place? since only the utxo hashes are available at the input of a transaction. I am currently using blockfrost, but with congestion it is my weak point and there are times it does not respond, which miss up my work
Fourzin
CC BY-SA 4.0
2022-01-31T17:38:07.033Z
i dont know if that here is clear for you. github.com/input-output-hk/cardano-db-sync - The purpose of Cardano DB Sync is to follow the Cardano chain and take information from the chain and an internally maintained copy of ledger state. Data is then extracted from the chain and inserted into a PostgreSQL database. SQL queries can then be written directly against the database schema or as queries embedded in any language with libraries for interacting with an SQL database. - i am learning also, and i read so many related infos here –
TTS17
CC BY-SA 4.0
2022-01-31T17:50:12.170Z
Yeah I understand, I have been developing on Cardano for awhile now. I like most of the concepts but the fact that you cant get info of input and output addresses is frustrating. It would be much more robust for the ledger to include these info. I know main reason is size and all, but still. Anyways thank you a lot
Fourzin
CC BY-SA 4.0
2022-01-31T15:23:37.400Z
2022-01-31T15:23:37.400Z
TTS17
<p>With <code>Cardano-cli</code> you can only query your UtxOs to get the corresponding tx hash. Unfortunately, there is nothing to go deeper and get additional information.</p>
<p>I dont' understand what you mean by <em>&quot;are not directly retrievable from the ledger&quot;</em>, but yes, <code>db-sync</code> has access to this information.</p>
<blockquote>
<p>The purpose of Cardano DB Sync is to follow the Cardano chain and take
information from the chain and an internally maintained copy of ledger
state. Data is then extracted from the chain and inserted into a
PostgreSQL database. SQL queries can then be written directly against
the database schema or as queries embedded in any language with
libraries for interacting with an SQL database.</p>
</blockquote>
<p>However, you need some non negligible resource to run <code>db-sync</code>. What <code>Blockfrost</code> does is <em>&quot;just&quot;</em> to wrap a web API around the DB in order for everyone to get an easy access to it. <code>Blockfrost</code> is the easiest way to retrieve your sender address.</p>

CC BY-SA 4.0
2022-01-31T15:51:51.447Z
I am familiar with db-sync and APIs that provide services to provide users with more details than can be found in the ledger. But how does db-sync know this in the first place? since only the utxo hashes are available at the input of a transaction. I am currently using blockfrost, but with congestion it is my weak point and there are times it does not respond, which miss up my work
Fourzin
CC BY-SA 4.0
2022-02-01T21:16:08.080Z
I don't know exactly how, but a transaction references the Utxo it consumes. This reference is made up of a Tx Hash and UtxO index (from a previous transaction). But, the referenced UtxO belongs to some address, so, somehow, you can get the sender.
Jean-Sébastien Gonsette
CC BY-SA 4.0
2022-01-31T14:26:40.833Z
2022-01-31T14:26:40.833Z
Jean-Sébastien Gonsette
<p>Is there away to retrieve the senders addresses of a transaction in cli commands, given the transaction hash? How do APIs (like blockfrost) get this data?</p>
<p>I know db-sync stores the data, but how does db-sync know in the first place about these details that are not directly retrievable from the ledger?</p>

<cardano-cli><transaction><cardano-address>
Is there away to retrieve the senders addresses of a transaction from its hash, using cli?
# Is there away to retrieve the senders addresses of a transaction from its hash, using cli?

(Asked by: username_0 on 2022-01-31)

Is there away to retrieve the senders addresses of a transaction in cli commands, given the transaction hash? How do APIs (like blockfrost) get this data?

I know db-sync stores the data, but how does db-sync know in the first place about these details that are not directly retrievable from the ledger?

**Tags:** cardano-cli, transaction, cardano-address

---

## 3 answers

### Answer by username_1 on 2022-01-31. Score: 0

You would have to use [cardano-db-sync](https://github.com/input-output-hk/cardano-db-sync#cardano-db-sync) - it is a service that stores ledger (chain) data into a more easy-to-work-with SQL structure. Otherwise, one would have to parse raw chain data (incredibly inefficient), which is why a framework like db-sync is so useful.

All the API's like Blockfrost or Cardanoscan use db-sync at backend to provide their services.

> **Comments:**
> **username_0**: I am familiar with db-sync and APIs that provide services to provide users with more details than can be found in the ledger. But how does db-sync know this in the first place? since only the utxo hashes are available at the input of a transaction. I am currently using blockfrost, but with congestion it is my weak point and there are times it does not respond, which miss up my wor  

---

### Answer by username_2 on 2022-01-31. Score: 0

like the other colleagues mentioned it is not possible from cli.
what i would recommend is to

1. create account in <https://blockfrost.io/>
2. take a Project ID

and then "curl" info from the DB using the command below

curl -H 'project\_id: Insert\_here\_youProject\_ID'   
[https://cardano-mainnet.blockfrost.io/api/v0/txs/${tx\_hash}/utxos](https://cardano-mainnet.blockfrost.io/api/v0/txs/$%7Btx_hash%7D/utxos)   
| jq '.inputs' | jq '.[0]' | jq '.address' | sed 's/^.//;s/.$//'

TX\_Hash, you can receive it from

cardano-cli query utxo --address $myAddr --mainnet

> **Comments:**
> **username_0**: I am familiar with db-sync and APIs that provide services to provide users with more details than can be found in the ledger. But how does db-sync know this in the first place? since only the utxo hashes are available at the input of a transaction. I am currently using blockfrost, but with congestion it is my weak point and there are times it does not respond, which miss up my work  
> **username_2**: i dont know if that here is clear for you. github.com/input-output-hk/cardano-db-sync - The purpose of Cardano DB Sync is to follow the Cardano chain and take information from the chain and an internally maintained copy of ledger state. Data is then extracted from the chain and inserted into a PostgreSQL database. SQL queries can then be written directly against the database schema or as queries embedded in any language with libraries for interacting with an SQL database. - i am learning also, and i read so many related infos here –  
> **username_0**: Yeah I understand, I have been developing on Cardano for awhile now. I like most of the concepts but the fact that you cant get info of input and output addresses is frustrating. It would be much more robust for the ledger to include these info. I know main reason is size and all, but still. Anyways thank you a lot  

---

### Answer by username_3 on 2022-01-31. Score: 0

With `Cardano-cli` you can only query your UtxOs to get the corresponding tx hash. Unfortunately, there is nothing to go deeper and get additional information.

I dont' understand what you mean by *"are not directly retrievable from the ledger"*, but yes, `db-sync` has access to this information.

> The purpose of Cardano DB Sync is to follow the Cardano chain and take
> information from the chain and an internally maintained copy of ledger
> state. Data is then extracted from the chain and inserted into a
> PostgreSQL database. SQL queries can then be written directly against
> the database schema or as queries embedded in any language with
> libraries for interacting with an SQL database.

However, you need some non negligible resource to run `db-sync`. What `Blockfrost` does is *"just"* to wrap a web API around the DB in order for everyone to get an easy access to it. `Blockfrost` is the easiest way to retrieve your sender address.

> **Comments:**
> **username_0**: I am familiar with db-sync and APIs that provide services to provide users with more details than can be found in the ledger. But how does db-sync know this in the first place? since only the utxo hashes are available at the input of a transaction. I am currently using blockfrost, but with congestion it is my weak point and there are times it does not respond, which miss up my work  
> **username_3**: I don't know exactly how, but a transaction references the Utxo it consumes. This reference is made up of a Tx Hash and UtxO index (from a previous transaction). But, the referenced UtxO belongs to some address, so, somehow, you can get the sender.  

---

