2

I'm doing some analysis on Db-sync and I came across a situation where it appeared the full EUTXO at an address was not being spent so wanted to see what I was misunderstanding.

Here is the first transaction: https://cardanoscan.io/transaction/23141e4c6fed6114dc77f5e7d1bd6e115d983e5704dd2206b0af3a41fe924c2b

Notice there are 2 amounts going to the address ending in 3d for 6.4 Ada and 118k Ada.

Now look at what I believe to be the only transaction that consumes the EUTXO at this address. https://cardanoscan.io/transaction/10beefe48f417f3fdb9d164da95adf78e9efaf22f24c0a24893b68fe8e322f68

I can see the 6.4 Ada being spent but not the 118k. They do have different 'index' fields in db-Sync so is that why? i.e. it's not all the Ada at one address that gets sent, but only enough indexes as needed?

-- Edit --

Just to add clarity:

a) The first transaction has two amounts going back to the same user. This I presume means it's getting back two separate EUTXOs - one containing additional tokens, and the other just Ada.

b) When I look for these transaction outputs in DbSync (tx_out table) the only way I can identify them as separate EUTXOs is if I treat Address + Transaction ID + Index as the unique ID

c) Therefore is it fair to say that when making a transaction the wallet treats everything with a unique Address + Transaction ID + Index as a separate EUTXO, and this is why the wallet did not need to consume the 118k EUTXO from the first transaction?

2 Answers 2

2

I think there might be a misunderstanding in the fact that a transaction has several "outputs" - and those outputs are called "UTXO"'s (as long as they are unspent; hence "unspent transaction outputs") - and those can be spent separately.

So one of the UTXOs created by your first transaction holds only Ada (~118k). That output is not used in the second transaction your linking to, though.

Regarding the edit, you can identify any tx output or utxo by "transaction id" + "output index".

The ~118k Ada UTXO for example is still sitting at output index 2 of the transaction 23141e4c6fed6114dc77f5e7d1bd6e115d983e5704dd2206b0af3a41fe924c2b - ready to be spent.

1
  1. In the first transaction (starting with 23141), there is a single input UTXO with three outputs - the first output (4.5 ADA) going to a non-staking address, the second and third outputs are going back to the sender's address, likely as change.

  2. The second transaction (starting with 10beef) has three inputs and three outputs. The first two inputs are from the sender, and the third input is from a different address, likely a script address. The first output is to the same non-staking address as the first output in the first (above) TX, and the last two outputs are again going back to the sender.

UTXOs are always consumed in whole when used as inputs. The confusion may have been in the fact that the majority of the contents in both transactions go back to the same address, but they do so in the form of new UTXOs. In this case, a lot of ADA and other tokens were all sitting in a single UTXO, so when the user ordered the swap, the entire UTXO was consumed and most of its contents were returned back as change in a new UTXO. Whatever assets were required for the swap were output as separate UTXOs.

2
  • Thanks for this. See Edit I've made to my question and see if you agree.
    – Reddspark
    Apr 17 at 5:31
  • Put more simply, the 118k UTXO was not consumed because none of its contents were needed for the transaction.
    – zhekson
    Apr 17 at 13:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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