tx builder: change always the last index of outputs? #93
-
Is it safe to assume, when using the tx builder, that change is always added as the very last output, hence will appear as the last index of the list of outputs? Thank you so much! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
Hi @robinboening , you are right, the change is currently the last output in any transaction, except when |
Beta Was this translation helpful? Give feedback.
-
The reason I am asking is that blockfrost easily presents outdated information about the actual utxo of an address, especially if you send multiple transactions in a short time. This leads to randomly failing transactions. So I decided to keep track of all the utxo myself, without consulting blockfrost. This requires me to store information around new utxos and "change" is one of them. Only after posting the question I noticed it was not really important to ask since I can simply look out for any outputs with my input address. But thanks for clarifying this is not a promise or part of a public API and could change anytime, so I'll definitely go for checking the addresses instead of relying on it being the last output. Thanks for the ⚡ response and the great library! |
Beta Was this translation helpful? Give feedback.
Hi @robinboening , you are right, the change is currently the last output in any transaction, except when
merge_change
is set toTrue
. However, this behavior is not exposed or promised as part of any interface, so it might change in the future. If you don't mind, could you tell me why you need this assumption?