1

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)?

1
  • all functions are executed within EVM, although external can be called by another contract which is a holy grail of composability of Ethereum, and it makes smart contracts interoperable within the chain May 16, 2022 at 18:58

1 Answer 1

3

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.

1
  • Looks like I was conflating "doesn't create an additional EVM call" with "doesn't execute within the EVM". Thank you!
    – RSW
    May 18, 2022 at 23:03

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.