Suppose you don't have the source of a contract, but have its bytecode. Can you theoretically interact with it somehow, or see what it does, by only looking at its bytecode?

Can functionality be obscured, or can you deduce everything that a contract does by its bytecode alone?


Decompiling bytecode is much the same as revere engineering any other form of binary program. It can be a bit tricky, but given the right incentive someone could definitely learn enough from the bytecode to interact with the contract.

Obfuscation is not very practical right now, so for the present, just assume that if you publish something to the blockchain, it will be public.

It is not necessary to have the ABI for the contract, since it is trivial to figure out the function signature hashes from the bytecode, which is all you need

  • As reverting to source code is impossible ( see ethereum.stackexchange.com/a/238/405 ) could you provide an example of extraction of necessary information to interact with contracts from opcode ? – Nicolas Massart Jan 24 '17 at 9:24
  • Sure, names are removed but it's a pretty common practice to attempt to reverse-engineer compiled code. I never said it was straightforward, though. It will require significant testing and experience with the solidity compiler – Tjaden Hess Jan 24 '17 at 22:34

I might be wrong, but ihmo, I don't think it is possible to interact with it, since the bytecode is the result of the compiler, compiling your ABI code and making your code understable by the EVM which runs low level low-level assembly.

If you want have the sources that build up this response:

  • The ABI is the result of compilation, and make interacting with the contract easier, but is in no way required. – Tjaden Hess Jan 23 '17 at 15:48
  • So, from which input the bytecode is generated from? – FrenchieiSverige Jan 23 '17 at 15:54
  • 2
    The ABI and bytecode are both the result of compiling the solidity source code – Tjaden Hess Jan 23 '17 at 15:55

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.