1

I apologize in advance if my question is dumb.

I want to make a smart contract which will handle money from the outside. However, I haven't been able to find any information about multithreading on the Ethereum network.

Does it work as a multithreaded environment, or are all transactions in a block executed in a linear fashion? I'm asking since I don't know is there need for the introduction of custom-made atomic variables.

2 Answers 2

2

You are not concerned if EVM implementation itself is multithreaded or not (there are several implementations, you do not care.)

Does it work as a multithreaded environment, or are all transactions in a block executed in a linear fashion

Yes. All transactions are atomic by the definition. The whole block gets executed, or none of a block gets executed. You do not need to worry about atomicity as a developer. However, you still need to worry about re-entrancy.

If a transaction cannot get into a block, miners will try to fit into another block.

More information about the transaction lifecycle here.

1
  • 1
    Yes I have read up a lot about re-entrancy, but this specific question came to my mind because I didn't know whether I should worry about data consistency, locks, mutexes etc.
    – lizardev
    Jul 4, 2021 at 23:44
0

If you're looking for multithreading, look at Solana. EVM is single-threaded. https://fullstacks.org/materials/ethereumbook/14_evm.html

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.