I am working on a smart contract and trying to come up with ways through which I can make sure that each transaction sent to my Ethereum smart contract is only processed as part of separate block, that does not contain any other transaction related to my smart contract. Based on my own understanding and research on the subject, I believe that won't be technically possible as depending on network traffic, it is completely possible that multiple transactions for my smart contract are processed as part of the same block. Do you think there's any way around it - or not possible at all.

1 Answer 1


Your contract doesn't process transactions, the miners on the network do that.

Nevertheless, you could:

  1. Add at the beginning of your contract uint256 public blockNumber;
  2. Add at the beginning of every non-constant function in your contract:
    • require(blockNumber < block.number);
    • blockNumber = block.number;

It's not too subtle IMO, but I guess it could do what you (for some reason) want to achieve.

  • I thought of this one, but that means if someone tries to send two transcations in the same block, the later transaction will simply get rejected. Is there some way to delay the transaction so that it gets processed as part of the next block, in case the "require" condition is met. Apr 12, 2020 at 3:53
  • @shrillbrave: No, there isn't. A transaction gets executed when it is picked by miners. Either it completes successfully, or it reverts. You're asking if it could start execute, then hold, and then resume on the next block. That cannot be achieved in a single transaction (because - again - either it completes successfully, or it reverts). Apr 12, 2020 at 4:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.