2

When a contract calls a function in another contract, is the called function executed in the same EVM as the caller function, in another EVM on the same node or in another random node?

2

There is only one EVM (Ethereum Virtual Machine) and it's not physically located in any single place. It's distributed to each node. The EVM is a rather abstract construct.

If a function in contract A calls a function in contract B all the execution happens within the same transaction. A transaction either succeeds fully or fails fully (in which case all its operations are reverted). Each node executes all transactions in the blockchain (as long as it finds out about them in time).

So if you issue a transaction it will be executed on every node running on the network. Mining nodes will then compete to solve the mining puzzle to get mining rewards and whoever wins that race gets to decide which transactions are included in the next block and in which order.

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.