<p>You cannot find the sender address using cardano-wallet. You will need to install cardano-db-sync for that and query it, or you will have to use an external API (like blockfrost.io) and make a call to the endpoint documented here: <a href="https://docs.blockfrost.io/#tag/Cardano-Transactions/paths/%7E1txs%7E1%7Bhash%7D%7E1utxos/get" rel="nofollow noreferrer">https://docs.blockfrost.io/#tag/Cardano-Transactions/paths/~1txs~1{hash}~1utxos/get</a></p>

CC BY-SA 4.0
2021-12-24T10:30:16.827Z
2021-12-24T10:30:16.827Z
George - APEX Stake Pool
<p>You can use db-sync. I wrote an article about how to do it on Medium</p>
<p><a href="https://medium.com/@carstenbreum/how-to-identify-who-sent-a-cardano-transaction-using-db-sync-b28918f21d93" rel="nofollow noreferrer">How to identify who sent a Cardano transaction using db-sync</a></p>

CC BY-SA 4.0
2023-04-01T15:01:59.927Z
Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer).
Community
CC BY-SA 4.0
2023-03-22T06:58:38.163Z
2023-03-22T06:58:38.163Z
CarstenB
<p>You can query the input transaction hash, in your case <code>80b4ab2773da9bccdb62d8bbf22f339bf041f0ff082f34acc6614f6a759e58e</code> using a block explorer like cardanoscan, or from your own running node using <a href="https://github.com/input-output-hk/cardano-db-sync/blob/master/doc/interesting-queries.md" rel="nofollow noreferrer">cardano-db-sync</a></p>
<p>For example, when I search the above Tx Hash in cardanoscan, I get:
<a href="https://testnet.cardanoscan.io/address/80b4ab2773da9bccdb62d8bbf22f339bf041f0ff082f34acc6614f6a759e58e" rel="nofollow noreferrer">https://testnet.cardanoscan.io/address/80b4ab2773da9bccdb62d8bbf22f339bf041f0ff082f34acc6614f6a759e58e</a></p>
<p>It seems like an unused address, but you mentioned the values were randomized. Try querying using the real TX hash that you are interested in. You should then be able to gather the info you need.</p>

CC BY-SA 4.0
2021-12-24T05:24:25.693Z
This is a good approach, but requires db-sync. I was trying to figure out a way using `cardano-wallet`.
melchoir55
CC BY-SA 4.0
2021-12-23T23:29:31.613Z
2021-12-23T23:29:31.613Z
zhekson
<p>You all are way over complicating this.. It's as easy as:</p>
<pre><code>def get_return_address_from_utxo(utxo):
try:
    r = requests.get(f&quot;https://cardanoscan.io/transaction/{utxo}&quot;)

    content = r.content.decode(&quot;utf-8&quot;).split(
        'FROM ADDRESSES (INPUTS)&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=mt-4&gt;&lt;div class=&quot;d-flex flex-row '
        'justify-content-between px-3&quot;&gt;&lt;div&gt;&lt;strong&gt;Address&lt;/strong&gt;&lt;/div&gt;&lt;div&gt;&lt;strong&gt;Amount&lt;/strong&gt;&lt;/div&gt;&lt;/div&gt;&lt;hr class=darkHR&gt;&lt;div data-simplebar&gt;&lt;div class=&quot;d-flex flex-row justify-content-between px-2&quot;&gt;&lt;div class=addressField&gt;&lt;div class=&quot;row align-items-center&quot;&gt;&lt;div class=col-auto&gt;')
    sub = content[1].split(&quot;span&quot;)
    address = sub[0]
    address = address.replace(&quot;&lt;a href=/address/&quot;, &quot;&quot;).replace(&quot;&gt;&lt;&quot;, &quot;&quot;)
    return address
except requests.exceptions.RequestException as e:
    return ''
except IndexError as e:
    return ''
</code></pre>

CC BY-SA 4.0
2021-12-27T17:24:43.217Z
This is a pretty cool solution. Unfortunately, it relies on third party data (cardanoscan) which introduces a vector for attack. If it were a fun website providing data this would be fine but as a payment processor this isn't an acceptable security tradeoff.
melchoir55
CC BY-SA 4.0
2021-12-27T18:55:19.397Z
Something similar could just as easily be built using https://explorer.cardano.org/ which is IOHK and not third party..
Tygar Pool
CC BY-SA 4.0
2021-12-27T20:14:32.430Z
iohk is a third party. But, maybe trustworthy depending on what you're building for.
melchoir55
CC BY-SA 4.0
2023-03-22T20:18:20.197Z
Also, parsing HTML content that can change at any time is pretty fragile.
Marek Mahut - StakeNuts
CC BY-SA 4.0
2021-12-27T01:01:26.997Z
2021-12-27T01:01:26.997Z
Tygar Pool
<p>A transaction consumes UTXOs not addresses, therefore you can see the <code>80b4ab2773da9bccdb62d8bbf22f339bf041f0ff082f34acc6614f6a759e58e#0</code> which is the UTXO being consumed.</p>
<p>To find out the originating address, you might need to list the transaction that created this UTXO.</p>
<p>I do not think <code>cardano-wallet</code> supports finding the wallet of a given address, so you would need to look through all the wallets to find your address.</p>

CC BY-SA 4.0
2021-11-23T19:36:33.157Z
Does this mean I would have to iterate through every wallet *in existence* looking for that utxo id in the wallet's transaction history? I don't think even that would work as the `cardano-wallet` api does not provide this kind of information in the `wallet` endpoint. There must be a way to figure out the sender, no? Wallets like daedalus show the sender. Is `cardano-wallet` just a red herring project which is unused?
melchoir55
CC BY-SA 4.0
2021-11-23T18:48:41.717Z
2021-11-23T18:48:41.717Z
Marek Mahut - StakeNuts
<p>We are trying to figure out how to identify the sender (source address) of a given transaction retrieved using <code>cardano-wallet</code>.</p>
<p>Here is an example datastructure from the api. Be aware the field values are randomized (not real):</p>
<pre><code>{
  inserted_at: {
    height: { quantity: 4263, unit: &quot;block&quot; },
    time: &quot;2021-11-21T18:00:39Z&quot;,
    epoch_number: 190,
    absolute_slot_number: 4323,
    slot_number: 132423,
  },
  status: &quot;in_ledger&quot;,
  withdrawals: [],
  amount: { quantity: 2000000, unit: &quot;lovelace&quot; },
  inputs: [
    {
      id: &quot;80b4ab2773da9bccdb62d8bbf22f339bf041f0ff082f34acc6614f6a759e58e&quot;,
      index: 0,
    },
  ],
  direction: &quot;incoming&quot;,
  fee: { quantity: 0, unit: &quot;lovelace&quot; },
  outputs: [
    {
      amount: { quantity: 2000000, unit: &quot;lovelace&quot; },
      address:
        &quot;addr_test1qzwtzc4vrase42ytaj8nqam6z4322x5dx08gj2gxtjqy05wl5feqsw9lgy9askcyzjemw4d8x94n25nq204j6kqfpmhsn64us7&quot;,
      assets: [],
    },
    {
      amount: { quantity: 56, unit: &quot;lovelace&quot; },
      address: &quot;addr_test1vqd00tpc537seq9hy64pupcu7s88x5w9jdln4lqyfees3swgmk&quot;,
      assets: [],
    },
  ],
  metadata: None,
  depth: { quantity: 370, unit: &quot;block&quot; },
  id: &quot;d6c29eb3a8865b1e79d5cf2beb4d04b6685145a2c73d910d70e8f80080384&quot;,
  deposit: { quantity: 0, unit: &quot;lovelace&quot; },
  collateral: [],
  mint: [],
};
</code></pre>
<p>Now, the source address is listed in one of the outputs, since the transaction must send the remainder of the balance to it. However, this isn't a great way to identify the source address because it might not be there if there is no remainder, or there may be 3 or more outputs.</p>
<p>I expected the <code>inputs</code> to contain the address, but it just has an id.</p>
<p>I see no other mentions of the source address. How does one figure out who sent a transaction?</p>

CC BY-SA 4.0
2021-11-23T11:32:34.747Z
Not sure what you mean by the source of a TX, tx's in cardano consume a bunch of utxo's and create a bunch of utxo's, anyone with a wallet can create a TX and will need to sign it, so if the creator is what you mean by source, then the source is your wallet (or the wallet that created the tx)
Calin
CC BY-SA 4.0
2021-11-23T18:15:12.223Z
All of that is accurate. So, based on the above data struct, can you tell me what wallet created the transaction?
melchoir55
CC BY-SA 4.0
2021-11-24T08:44:24.740Z
Not really, a wallet can verify that it signed a transaction, so in a way you can have a wallet claim the tx.
Calin
<wallet><transaction>
How to identify who sent a transaction
# How to identify who sent a transaction

(Asked by: username_0 on 2021-11-22)

We are trying to figure out how to identify the sender (source address) of a given transaction retrieved using cardano-wallet.
Here is an example datastructure from the api. Be aware the field values are randomized (not real):
{
  inserted_at: {
    height: { quantity: 4263, unit: "block" },
    time: "2021-11-21T18:00:39Z",
    epoch_number: 190,
    absolute_slot_number: 4323,
    slot_number: 132423,
  },
  status: "in_ledger",
  withdrawals: [],
  amount: { quantity: 2000000, unit: "lovelace" },
  inputs: [
    {
      id: "80b4ab2773da9bccdb62d8bbf22f339bf041f0ff082f34acc6614f6a759e58e",
      index: 0,
    },
  ],
  direction: "incoming",
  fee: { quantity: 0, unit: "lovelace" },
  outputs: [
    {
      amount: { quantity: 2000000, unit: "lovelace" },
      address:
        "addr_test1qzwtzc4vrase42ytaj8nqam6z4322x5dx08gj2gxtjqy05wl5feqsw9lgy9askcyzjemw4d8x94n25nq204j6kqfpmhsn64us7",
      assets: [],
    },
    {
      amount: { quantity: 56, unit: "lovelace" },
      address: "addr_test1vqd00tpc537seq9hy64pupcu7s88x5w9jdln4lqyfees3swgmk",
      assets: [],
    },
  ],
  metadata: None,
  depth: { quantity: 370, unit: "block" },
  id: "d6c29eb3a8865b1e79d5cf2beb4d04b6685145a2c73d910d70e8f80080384",
  deposit: { quantity: 0, unit: "lovelace" },
  collateral: [],
  mint: [],
};

Now, the source address is listed in one of the outputs, since the transaction must send the remainder of the balance to it. However, this isn't a great way to identify the source address because it might not be there if there is no remainder, or there may be 3 or more outputs.
I expected the inputs to contain the address, but it just has an id.
I see no other mentions of the source address. How does one figure out who sent a transaction?

**Tags:** wallet, transaction
> **Comments:**
> **username_1**: Not sure what you mean by the source of a TX, tx's in cardano consume a bunch of utxo's and create a bunch of utxo's, anyone with a wallet can create a TX and will need to sign it, so if the creator is what you mean by source, then the source is your wallet (or the wallet that created the tx)  
> **username_0**: All of that is accurate. So, based on the above data struct, can you tell me what wallet created the transaction?  
> **username_1**: Not really, a wallet can verify that it signed a transaction, so in a way you can have a wallet claim the tx.  

---

## 5 answers

### Answer by username_2 on 2021-12-24. Score: 1

You cannot find the sender address using cardano-wallet. You will need to install cardano-db-sync for that and query it, or you will have to use an external API (like blockfrost.io) and make a call to the endpoint documented here: [https://docs.blockfrost.io/#tag/Cardano-Transactions/paths/~1txs~1{hash}~1utxos/get](https://docs.blockfrost.io/#tag/Cardano-Transactions/paths/%7E1txs%7E1%7Bhash%7D%7E1utxos/get)


---

### Answer by username_3 on 2023-03-22. Score: 0

You can use db-sync. I wrote an article about how to do it on Medium

[How to identify who sent a Cardano transaction using db-sync](https://medium.com/@carstenbreum/how-to-identify-who-sent-a-cardano-transaction-using-db-sync-b28918f21d93)

> **Comments:**
> **username_4**: Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer).  

---

### Answer by username_5 on 2021-12-23. Score: 0

You can query the input transaction hash, in your case `80b4ab2773da9bccdb62d8bbf22f339bf041f0ff082f34acc6614f6a759e58e` using a block explorer like cardanoscan, or from your own running node using [cardano-db-sync](https://github.com/input-output-hk/cardano-db-sync/blob/master/doc/interesting-queries.md)

For example, when I search the above Tx Hash in cardanoscan, I get:
<https://testnet.cardanoscan.io/address/80b4ab2773da9bccdb62d8bbf22f339bf041f0ff082f34acc6614f6a759e58e>

It seems like an unused address, but you mentioned the values were randomized. Try querying using the real TX hash that you are interested in. You should then be able to gather the info you need.

> **Comments:**
> **username_0**: This is a good approach, but requires db-sync. I was trying to figure out a way using `cardano-wallet`.  

---

### Answer by username_6 on 2021-12-27. Score: 0

You all are way over complicating this.. It's as easy as:
def get_return_address_from_utxo(utxo):
try:
    r = requests.get(f"https://cardanoscan.io/transaction/{utxo}")

    content = r.content.decode("utf-8").split(
        'FROM ADDRESSES (INPUTS)AddressAmount')
    sub = content[1].split("span")
    address = sub[0]
    address = address.replace("<", "")
    return address
except requests.exceptions.RequestException as e:
    return ''
except IndexError as e:
    return ''

> **Comments:**
> **username_0**: This is a pretty cool solution. Unfortunately, it relies on third party data (cardanoscan) which introduces a vector for attack. If it were a fun website providing data this would be fine but as a payment processor this isn't an acceptable security tradeoff.  
> **username_6**: Something similar could just as easily be built using https://explorer.cardano.org/ which is IOHK and not third party..  
> **username_0**: iohk is a third party. But, maybe trustworthy depending on what you're building for.  
> **username_7**: Also, parsing HTML content that can change at any time is pretty fragile.  

---

### Answer by username_7 on 2021-11-23. Score: 0

A transaction consumes UTXOs not addresses, therefore you can see the `80b4ab2773da9bccdb62d8bbf22f339bf041f0ff082f34acc6614f6a759e58e#0` which is the UTXO being consumed.

To find out the originating address, you might need to list the transaction that created this UTXO.

I do not think `cardano-wallet` supports finding the wallet of a given address, so you would need to look through all the wallets to find your address.

> **Comments:**
> **username_0**: Does this mean I would have to iterate through every wallet *in existence* looking for that utxo id in the wallet's transaction history? I don't think even that would work as the `cardano-wallet` api does not provide this kind of information in the `wallet` endpoint. There must be a way to figure out the sender, no? Wallets like daedalus show the sender. Is `cardano-wallet` just a red herring project which is unused?  

---

