Is it possible to distinguish a functions bytecode out of an entire contracts bytecode? For example, when I pull the bytecode from a contract address, I get something like:


Is it a fact that a functions bytecode representation is in this output? For example, would a function be within this bytecode (shown in grey):


  • 2
    Yes, but you need to know the function's name and the types of its input arguments in order to find it in the bytecode. Dec 18, 2019 at 5:09

1 Answer 1


Compiler does not have to put function body into contract bytecode as a consequent range. Actually, optimizing compiler could decide to inline small functions used only in few places, i.e. copy their bytecode into every place the function is actually used.

However, I believe, current versions of Solidity does not do this. The body of the unction usually starts with JUMPDEST opcode (0x5b) and ends with JUMP opcode (0x56).

You may try to compile your smart contract with --asm option and review produced assembly file to find out exactly what bytecode your function was translated into.

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.