2

I understand what a function selector is and how it is computed:

The first four bytes of the call data for a function call specifies the function to be called. It is the first (left, high-order in big-endian) four bytes of the Keccak-256 (SHA-3) hash of the signature of the function.

However, I fail to see why knowing the selector is important as far as calling the function is concerned. For a loadable dynamic library (.so on Linux, .dll on Windows), a list of callable symbols are imported which serves as the entry points to external clients. Isn't there anything like that in EVM bytecode? If not, how does the EVM locate the method given the function selector? Don't the functions exist as separate entities in the compiled bytecode?

  • Welcome to the Ethereum Stack Exchange! Functions do not exist as separate entities in the compiled EVM bytecode. This may be a duplicate of some other ABI related questions, please check them out, and if not duplicate, feel free to reopen or edit. Thanks – eth Oct 14 '19 at 10:43