EVM Functions – If Not in the EVM, Where Do Internal Functions Execute?

evmfunctioninternal-transactions

The Ethereum documentation says that internal functions are not executed in the EVM, while external ones are:

enter image description here

If not in the EVM, where are internal functions executed? Does this simply mean that internal functions are executed wholly within the one node the call is made within, while external functions end up being broadcast to the entire network (all nodes)?

Best Answer

internal functions are called through a JUMP / JUMPI instruction, simply jumping to another point of the current code. This makes sense because internal functions do not change context (i.e., they stay inside the same contract). To make things clearer, you can only call an internal function if you are running a contract's code, which imply that a call was made to that contract to begin with, it's just that calling an internal function doesn't require (nor allow) an EVM call to reach it directly, only jumps.

external functions on the other hand can only be called through an internal EVM call.

You can read more about it in the solidity documentation.

I hope that answers your question.

Related Topic