2

I'm trying to query the token transactions using the schemas of Cardano-db-sync. When querying ADA transactions, I can easily see the input and output addresses with the values sent by joining the tx, tx_in, and tx_out tables, as shown in the examples here.

However, it is not as easy when I try to query token transactions. I used the multi_asset and ma_tx_out tables to identify which token was sent and in which transaction. I can see the address that received the token, but I cannot identify the address that sent the token when there are multiple input addresses.

For example, how can I know that (addr1q8h ... 8k5s6cnspc) sent the token and not the other input address in this transaction? Is it actually possible to do that by only joining the tables?

1 Answer 1

1

For example, how can I know that (addr1q8h ... 8k5s6cnspc) sent the token and not the other input address in this transaction? Is it actually possible to do that by only joining the tables?

The multiple inputs of a transaction are not mapped individually to an output. All you can do is query the input UTxO to know assets associated with individual input (which is same for base currency, ADA) - you probably already have the latter part sorted, but just in case - sample example code used by koios for complete transaction information can be found here

In the example you mention, it is easy to deduce since all the assets were present on single address. However, if you try to look at slightly more matured wallet transaction, this will likely complicate further as you'd be associating multiple inputs containing same asset - which is true also for base asset (ADA). The logic would be the same, consider inputs used to consume in desired output, and have the remainder spent to change address.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.