Get the sending address of a transaction from UTXO

Hey everyone, I’ve searched the Internet and this forum, tried asking in various Discord servers but haven’t found the answer.

What I’m trying to do: Given a UTXO, get the sender address.

I have tried the cardano cli, up to 1.26.1. I’m hoping for a solution that doesn’t involve spinning my own graphql for just this one applicaiton but I found this GitHub - input-output-hk/cardano-graphql: GraphQL API for Cardano.

I found this as an external option https://graphql-api.mainnet.dandelion.link/. But is there anything that can be done locally? I have a relay node running. I can build and send transactions. Basically I want the data that’s in every explorer such as https://cardanoscan.io/.

Thank you for the help I appreciate it.

You can query your transaction details via cardano-db-sync (graphql/rest/etc query layers rely on this common backend)

Hey thanks for your reply! Does this mean you have to get this running locally? GitHub - input-output-hk/cardano-graphql: GraphQL API for Cardano

Or is there a simpler way since it’s the infrastructure is fairly complex. I’m not quite sure what you mean by via cardano-db-sync? Do you have any docs or more concrete steps?

Thanks!

It is simply a postgres DB with a node and a daemon, I’d say it’s pretty basic for blockchain architecture. You can find doco for each component at https://docs.cardano.org.
But if you’re simply looking to leverage off someone else’s node, then you can checkout https://blockfrost.io or https://dandelion.link

This is really helpful, I’d seen dandelion but looking at blockfrost now too. Thank you so much!

1 Like

Newbie here – I have a node and wallet running and have also set up cardano-dy-sync-exented on my machine, and am curious on how exactly to query the transaction details of my wallet? I can locally query my wallet’s UTxOs and find respective txHash, but am stumped on how to find the sender’s address associated to the various txHashes. I have tried various queries such as

select tx_out.* from tx_out inner join tx on tx_out.tx_id = tx.id where tx.hash = '<my transaction hash>' ;

and

select tx_out.* from tx_out inner join tx_in on tx_out.tx_id = tx_in.tx_out_id inner join tx on tx.id = tx_in.tx_in_id and tx_in.tx_out_index = tx_out.index where tx.hash = '<my transaction hash>' ;

but always end up with an empty output.
Any insight would be appreciated :slight_smile:

Hi, Did you find out the anwer?

I guess you took that SQL from the reference given in the official doc. I tried the same query but could not determine which one is the sender and which ones are the receivers.

I went with blackfrost.io route. This is the transaction details for an UTXO hash. Anyone know how to identify which one is the sender’s address?
{
“hash”:
“52b38f6d08138406ac6346f753b2a9254f3bba2afe5d0971253304b633bd6a4b”,
“inputs”: [a
{
“address”:
“addr1qye0s7efe98gyd9jfrjqm0kmq96t6c9qlr8mjnfuk33ulne8jyyvzx6mjrlcv80q8a22rn3decgx47km3vj4ycdyhc2q8sh6dm”,
“amount”: [
{
“unit”: “lovelace”,
“quantity”: “1600000”
},
{
“unit”: “086c2ccb567991202a3e3bdc8c9f70567e54ad9cf2faff511cf99516526f79616c204772616e6420233030303033”,
“quantity”: “1”
}
],
“tx_hash”:
“24b908309ec54bfff9cbcc7283702b2c49b8ae41bc11aba028dbbda269cab77f”,
“output_index”: 0,
“collateral”: false,
“data_hash”: null
},
{
“address”: “addr1qyp2llre84lxf4t7drnfm47ya2ws8lvmz4fnnf0lpxzanf38jyyvzx6mjrlcv80q8a22rn3decgx47km3vj4ycdyhc2q2c0rav”,
“amount”: [
{
“unit”: “lovelace”,
“quantity”: “3038915”
}
],
“tx_hash”: “b974db46c369d78291b06b2add8c2fa61016b0532730778b0f02dbf60184fd6d”,
“output_index”: 1,
“collateral”: false,
“data_hash”: null
}
],
“outputs”: [
{
“address”: “addr1v8cwarljkvlwmwdegq5s0nkaut5jtvrs8u0ugph3243pr9ge9ksyt”,
“amount”: [
{
“unit”: “lovelace”,
“quantity”: “2000000”
}
],
“output_index”: 0,
“data_hash”: null
},
{
“address”: “addr1q9t7cyqgmkxqe8aag0ds8ag49d4jpf94ukr4kajtg0ffm038jyyvzx6mjrlcv80q8a22rn3decgx47km3vj4ycdyhc2qspfgvv”,
“amount”: [
{
“unit”: “lovelace”,
“quantity”: “2463514”
},
{
“unit”: “086c2ccb567991202a3e3bdc8c9f70567e54ad9cf2faff511cf99516526f79616c204772616e6420233030303033”,
“quantity”: “1”
}
],
“output_index”: 1,
“data_hash”: null
}
]
}

Easiest way to consume that information would be to use our new and free public API.
We first brought it online today, and the node still has to synchronize a bit more - but it’s still usable to some extend and will be fully available in the next days (including live data).

Here the direct API call with the free public api key:
https://mainnet.cutymals.com/odata/TransactionsOut?txHashInHex=253e233a6b262aed75fce1819903f8d56cd31b23d56e204717424451cc287055&includeTxSender=true&includeTxReceiver=false&X-API-KEY=ILoveCutyMals&%24top=1&%24select=Address

We put together an explanation how you can consume the API for you’re use case, see here:

We also have a swagger API, so that you can check whats possible.
https://mainnet.cutymals.com/swagger/index.html

We will improve that documentation over the next days.
Bear in mind that the API still needs to synchronize and is some days behind.
We started testing our API today, if you find some issues - feel free to report via github.