4

I am confused with the tx_in and tx_out schema on Cardano dbsync and the transaction process as a whole. For example:

Alice has 10000 ADA distributed as 3000, 5000 and 2000 ADA in three different EUTXOs. If she wants to send 6000 ADA to Bob then she can sends two EUTXOs to Bob, e.g. 5000 and 2000 ADA (total 7000 ADA) and receives a new EUTXOs of 1000 ADA back, right?.

For Alice, are those 7000 ADA stored in the tx_out table and the 1000 ADA in the tx_in table? Will she get the 1000 ADA back into the same address or a different one? If she receives the 1000 ADA back to a different address, will the same transaction block contain both transaction, i.e. address used to send ADA to Bob and the other address used to receive ADA back? Will they have the same transaction id?

4

Thanks for your question.

send about 6000ada to bob then he sends the two UTXOs to bob i.e. 5000ada and 2000ada (total 7000 ada) and he receives a new UTXOs of 1000ada back, right?

Correct. For regular transactions, the sum of the transaction inputs values must match the sum of the outputs (This isn't strictly true, as there are fees and the possibility to create native assets in a transaction too)

for alice, is not 7000ada stored in tx_out table and 1000ada in tx_in table?

Correct. A total of 7,000 ₳ would appear in Alice's tx_out and 1000 ₳ in Alice's tx_in, while Bob would see just the outputs of 6,000 ₳ - balancing the transaction inputs and outputs.

Will the receiver(alice) get the 1000ada back to same address or different?

Alice will receive the change to the same address which created the transaction.

Will they have the same transaction id?

Yes, any given transaction can have multiple inputs and multiple outputs.

If you want a patiently presented video that describes the model in an adequate amount of details, I'd recommend The first lecture in the Plutus Pioneers program.

1
  • 1
    One more thing to add maybe, Alice doesn't "send" the transactions to Bob, they're marked as "spent" and 2 completely new EUTXOs are crated: one with 6000 ADA and the other with 1000 ADA Aug 31 at 21:19

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.