Nesting transaction groups - General - Algorand

Nesting transaction groups

post by andreask on Sep 5, 2021

I’ve been thinking about the possibility of nesting groups of transaction. The use case I’m after is combining transactions between unrelated dApps. Let’s say for instance I want to buy something from one dApp but pay with a token not supported by the seller. Then I could combine a set of transactions to an exchange dApp, with the required transactions to the seller. If this could all be one atomic transaction I would be confident I only make the purchase if the exchange succeeds and vice-versa.

Maybe there is already other established solutions to this problem?

post by andreask on Sep 5, 2021

This could be solved with one flat group of all required transactions. That would however require that the involved dApps don’t verify the group-size or any absolute positions in groups. I guess they could instead verify companion transactions at offsets from their own index. But all examples and docs I’ve seen, seem to advocate verifying expected group-size and even absolut indices, are there valid reasons for this?

post by fabrice on Sep 6, 2021

Welcome @andreask !

This is indeed a very insightful comment.

Currently, the documentation advocates for checking group of transactions as it is simpler from a developer perspective.

However, there is now work to allow for composition of applications.

See https://github.com/algorandfoundation/ARCs/pull/7

Note that this is very much at a draft level.

As you mentioned, this ARC will recommend to not check the size of the groups to allow for composition.

In addition: it will most likely be recommended that

post by andreask on Sep 6, 2021

Ah, nice, there’s an RFC repository! Glad to hear this is being worked on. Composition is a powerful feature that will drive network effect.

Thanks!