3

Is it possible to have the following scenario?

  • Account A has 20 ether, account B has 20 ether
  • In transaction 1. Account A sends 25 ether to account B
  • In transaction 2. Account B sends 10 ether to account A
  • Both transactions are submitted almost at the same time so they will be a part of the same block

After the block is mined the net effect is account A sends 15 ether to account B. So there is enough ether in both accounts to satisfy the account balances.

But does Ethereum infrastructure allows for such operations?

3

These are both valid transactions, provided transaction 2 gets mined before transaction 1.

When a miner finds a block, they include the transactions in an order they choose. If they happen to choose transaction 2 to occur before transaction 1, then transaction 1 will be successful. If they do it in the opposite order, transaction 1 will not be successful.

Many clients that you may use will not allow transaction 1 to go through, because they are reading the state of the blockchain and see that you do not have proper balance, thus they will block the transaction from happening. You can avoid this by manually submitting a transaction to the network.

  • Miners cannot process transaction 1 before transaction 2 because A doesn't have enough balance to pay transaction fees. – Ismael Dec 30 '18 at 14:49

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.