IntersectMBO / IntersectMBO/cardano-ledger
Consider adding "batch" transactions
- Dominant language
- Haskell
- Stars
- 295
- Forks
- 179
- Avg merge
- 4d 7h
- Merged PRs (30d)
- 29
Description
Suppose you have a chain of transactions, A -> B -> C, where each one spends outputs from the previous one. (This is only really a thing you want if you have scripts or multi-currency, since for "normal" transactions you can usually just merge them.)
At the moment, such a sequence will take `|sequence|` slots to fully validate, if we wait for each transaction to be successfully validated before submitting the next one, which is rubbish.
It would be nice to be able to "batch" such transactions.
Concretely, I propose an new alternative `TxBody`:
```
data TxBody = .... | Sequence [TxBody]
```
What does this mean?
- The semantics are simple: it's exactly the same as applying each `TxBody` in sequence. It validates iff the whole sequence does. If part of it fails to validate then the whole thing is rejected.
- It's a new kind of `TxBody`, which allows us to have witnesses over the whole sequence.
- This would enable other use cases where multiple parties could coordinate to create transaction batches that interact with resources owned by different parties, and only proceed if the whole batch is signed. This allows e.g. atomic swaps.
- The alternative would be `data Tx = ... | Sequence [Tx]`, which would also work fine for batching.
I think this would be relatively straightforward to add. The wallet backend would need to know about them, but I don't expect the frontend would, since users probably don't want to make these very often. Rather, the clients are likely to be "smart contracts"/wallet backend applications.
Contributor guide
Assessment
This issue has not been assessed yet.