1

Let's think of two transactions T1 and T2 implemented by different smart contracts, mined by different nodes, and executed in next order.

  1. T1 looks up a state of account A. The value is a1.
  2. T2 updates the state of A from a1 to a2.
  3. T1 updates a state of account B from b1 to b1 + a1. a1 is the value looked up in step 1.
  4. T2 is mined in block number n, then T1 is mined in block n+1.

Is this possible in Ethereum? Or does T1 check the value of A's state again mined in block n? I'm curious about the statement 'There's no concurrency in ethereum. It's single threaded.'

1 Answer 1

0

In my opinion T2 can be mined first by simple paying more gas fess than T1. Also , the values of a1 will be a2 because t1 has not executed yet onchain.

2
  • Thanks for the answer. If it is, T1 didn't use the latet status applied in block n. In other words, ethereum transactions can be interleaved. Then, how should I understand the meaning of single threaded? Is it only for transactions that write/update for a single account's status? T
    – You We Cho
    Aug 29, 2023 at 5:36
  • Operations are atomic, there isn't a way for a transaction to look up a value at one point in a block, for another transaction to partially execute, to then have the first resume. One transaction would be executed in its entirety before the next can act on any state changes.
    – Maka
    Aug 31, 2023 at 19:11

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.