<p>It you join the <code>tx</code> (and the <code>ma_tx_out</code> table should reference <code>tx</code>) table with the <code>block</code> table then <code>block.block_no</code> increases by <code>1</code> each block. The you just need to filter by all <code>block.block_no</code> bigger than the one you want.</p>

CC BY-SA 4.0
2023-10-15T17:11:29.757Z
In this one for example:

https://cardanoscan.io/transaction/38e7ca5d1419bd8ce5e10b1723a223f6ab8fe3b4f4738d23988f26daa5d8c705?tab=utxo

How can we tell that the "Summary" of this tx is a simple transfer of ADA, and that even though there are other assets on the UTXO's involved, those assets themselves have nothing to do with the actual tx being performed, except indirectly?
The "Summary" on this one is "91 ADA moved from here to there" - but the assets on the UTXO's involved appear to be a part of the tx when I query from the perspective of ma_tx_out
RelevantData
CC BY-SA 4.0
2023-10-17T00:28:22.107Z
The ADA transfer and the other asset transfers are all part of the same transaction. I would not call that an "indirect" association. ADA tx_out values can be associated with multi asset tx out entries because they the `ma_tx_out` table will have a `tx_out_id` field that points back to the `tx_out` table.
Erik de Castro Lopo
CC BY-SA 4.0
2023-10-17T15:20:54.787Z
Agreed. However, look at this one, the summary shows it is a simple transfer of 91 ADA:

https://cardanoscan.io/transaction/38e7ca5d1419bd8ce5e10b1723a223f6ab8fe3b4f4738d23988f26daa5d8c705?tab=summary

"Summary" shows a transfer of 91 ADA. "UTXOs" has one which has several assets on it and 2 ADA.

When I query ma_tx_out for latest using the fingerprint of any of those assets, I get that tx, even though the tx is about a transfer of 91 ADA as opposed to having anything to do with the transfer of any of those assets on that utxo. In my case, I'd like to ignore that tx, but not sure how.
RelevantData
CC BY-SA 4.0
2023-10-17T15:22:38.597Z
Put another way, for this one:

https://cardanoscan.io/transaction/38e7ca5d1419bd8ce5e10b1723a223f6ab8fe3b4f4738d23988f26daa5d8c705?tab=summary

How does Cardanoscan know to have the transfer of the 91 ADA in the "Summary" tab? How does it determine from the tx that a transfer of 91 ADA is all that tx effectively did?
RelevantData
CC BY-SA 4.0
2023-10-17T19:30:47.723Z
I don't *know* how cardanoscan does it, but if I was asked to replicate it, I would a build a query that for a transaction queries both the `tx_out` table and the `ma_tx_out` table. For a tx that only transfers ADA, the returned `ma_tx_out` output would be empty.
Erik de Castro Lopo
CC BY-SA 4.0
2023-10-14T03:00:22.997Z
2023-10-14T03:00:22.997Z
Erik de Castro Lopo
<p>I queried ma_tx_out and used the fingerprint of an asset to get its ident so I could get the tx_out_id to get the most recent tx_out for a given asset - but that asset is only in that tx_out because the UTXO has that asset in it, and was used as a part of a transaction that has nothing to do with that asset itself being transferred to another wallet, or contract etc.</p>
<p>How can I filter starting from ma_tx_out  so I am only looking at the latest tx that involves THAT asset directly rather than indirectly?</p>
<p>Scenario A: Asset X is sent from Wallet Z to another wallet
(this is one I want to retain as the tx involves Asset X directly)</p>
<p>Scenario B: Wallet Z transfers some ADA to another wallet, and Asset X is found in one of the UTXO's involved in the transaction.
(this one I don't want to retain, as Asset X is only involved in the tx indirectly)</p>

CC BY-SA 4.0
2023-11-22T15:27:13.513Z
Do you mean that in latest tx_out that you currently find for an asset, it didn't actually change hands but was transferred back to the same address as it came from?
Cigarette Smoking Man
CC BY-SA 4.0
2023-11-28T07:27:32.713Z
Correct. It is on the same address in the outputs as it is on the inputs. I have resolved my "issue" by examining both inputs & outputs.
RelevantData
<transaction><cardano-db-sync>
DBSync: Querying ma_tx_out
# DBSync: Querying ma_tx_out

(Asked by: username_0 on 2023-10-14)

I queried ma\_tx\_out and used the fingerprint of an asset to get its ident so I could get the tx\_out\_id to get the most recent tx\_out for a given asset - but that asset is only in that tx\_out because the UTXO has that asset in it, and was used as a part of a transaction that has nothing to do with that asset itself being transferred to another wallet, or contract etc.

How can I filter starting from ma\_tx\_out so I am only looking at the latest tx that involves THAT asset directly rather than indirectly?

Scenario A: Asset X is sent from Wallet Z to another wallet
(this is one I want to retain as the tx involves Asset X directly)

Scenario B: Wallet Z transfers some ADA to another wallet, and Asset X is found in one of the UTXO's involved in the transaction.
(this one I don't want to retain, as Asset X is only involved in the tx indirectly)

**Tags:** transaction, cardano-db-sync
> **Comments:**
> **username_1**: Do you mean that in latest tx_out that you currently find for an asset, it didn't actually change hands but was transferred back to the same address as it came from?  
> **username_0**: Correct. It is on the same address in the outputs as it is on the inputs. I have resolved my "issue" by examining both inputs & outputs.  

---

## 1 answers

### Answer by username_2 on 2023-10-14. Score: 0

It you join the `tx` (and the `ma_tx_out` table should reference `tx`) table with the `block` table then `block.block_no` increases by `1` each block. The you just need to filter by all `block.block_no` bigger than the one you want.

> **Comments:**
> **username_0**: In this one for example:  https://cardanoscan.io/transaction/38e7ca5d1419bd8ce5e10b1723a223f6ab8fe3b4f4738d23988f26daa5d8c705?tab=utxo  How can we tell that the "Summary" of this tx is a simple transfer of ADA, and that even though there are other assets on the UTXO's involved, those assets themselves have nothing to do with the actual tx being performed, except indirectly? The "Summary" on this one is "91 ADA moved from here to there" - but the assets on the UTXO's involved appear to be a part of the tx when I query from the perspective of ma_tx_out  
> **username_2**: The ADA transfer and the other asset transfers are all part of the same transaction. I would not call that an "indirect" association. ADA tx_out values can be associated with multi asset tx out entries because they the `ma_tx_out` table will have a `tx_out_id` field that points back to the `tx_out` table.  
> **username_0**: Agreed. However, look at this one, the summary shows it is a simple transfer of 91 ADA:  https://cardanoscan.io/transaction/38e7ca5d1419bd8ce5e10b1723a223f6ab8fe3b4f4738d23988f26daa5d8c705?tab=summary  "Summary" shows a transfer of 91 ADA. "UTXOs" has one which has several assets on it and 2 ADA.  When I query ma_tx_out for latest using the fingerprint of any of those assets, I get that tx, even though the tx is about a transfer of 91 ADA as opposed to having anything to do with the transfer of any of those assets on that utxo. In my case, I'd like to ignore that tx, but not sure how.  
> **username_0**: Put another way, for this one:  https://cardanoscan.io/transaction/38e7ca5d1419bd8ce5e10b1723a223f6ab8fe3b4f4738d23988f26daa5d8c705?tab=summary  How does Cardanoscan know to have the transfer of the 91 ADA in the "Summary" tab? How does it determine from the tx that a transfer of 91 ADA is all that tx effectively did?  
> **username_2**: I don't *know* how cardanoscan does it, but if I was asked to replicate it, I would a build a query that for a transaction queries both the `tx_out` table and the `ma_tx_out` table. For a tx that only transfers ADA, the returned `ma_tx_out` output would be empty.  

---

