1

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?

2 Answers 2

3

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

2
  • 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 ? Jan 24, 2017 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 Jan 24, 2017 at 22:34
0

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:

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

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.