1

I would like to process N number of transactions in batches.

When N people make a call to a transfer function, I would like to process all N transfers (and not before that last call is made).

Then, after all N transactions are processed, I would like to wait until another N number of calls is made (and so on).

I understand that I can make a map of addresses and their amounts to track the transfers, however, I do not want the gas price to be much higher because I am doing it in batches.

Can I do this (as explained above) without having a significant increase in the gas prices ?

Solidity version is 5.0 and above.

  • 1
    Have a look at the MultiSigWallet contract by Gnosis, it does exactly that. – goodvibration Aug 28 '19 at 20:34
  • @goodvibration Quick question, does the gas come from all parties that agreed for a transaction or not ? If yes, does ETH need to be deposited to cover the gas costs? – Damir Olejar Aug 28 '19 at 23:11
1

I assume you are talking about a smart contract you are building and not something on the node side.

You can't delay or defer the actual transactions. A transaction is processed when it is processed and it either succeeds or fails immediately.

Nothing prevents you from storing data internally in the contract and then processing that data in batches. I'd say it largely depends on what kind of transactions you are expecting - you can't for example reset msg.sender or store the transactions' gases. Whoever initiates the last transaction in the batch which starts the batch processing pays for the extra gas - be it you or some random user.

So the amount of gas increase depends on the type of transactions. But surely there is some increase compared to a regular transaction.

| improve this answer | |

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.