I searched for SE and google, but did not find answer to this simple doubt.

If I include two transactions (state changing ones which cost gas) in same block for execution.

Then my question is: will the value of msg.sender.balance (user's ETH balance) change in both transaction calls, or it will remain the same?

Thanks in advance.

2 Answers 2


If you are talking about the mainnet you can't choose in which block the transactions are included. In private blockchains you have more control over the issue.

Strictly speaking there is no consurrency in the Ethereum network. All transactions are ran after each other. Therefore you don't need to worry about which transactions get executed first. If two transactions try to perform conflicting actions (for example sending all the Ether out from an account) only one of them gets through - the one which gets executed earlier. The other one is executed later and it sees that the balance is already zero and the transction fails.

You can read more about this kind of problems for example here: Race conditions when calling remote contracts and here: Concurrent calls to a contract - state changes

  • Thank you @Lauri. It helps.. Actually, I was looking to generate some sort of unique numbers in multiple transactions in same block by same user. so msg.sender.balance should be always different due to tx cost. In most cases thought.. haha Commented Jun 19, 2019 at 11:51

Separate transactions may or may not be mined in the same block.

If separate transactions are from different addresses, they may be mined in any order. If they are from the same address, then they will assuredly be mined in nonce order which is, usually, the order they were sent. The exception is the sender is manually playing with the nonce value of each transaction - usually not the case since wallets handle it automatically.

Whatever order the transactions are mined in, the second transaction will execute in the context of everything that came before including account balance, contract states, etc.

Hope it helps.

  • Thank you for your comments. yes it helps too to clarify things further :) Commented Jun 20, 2019 at 6:13

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.