1

Let's assume that we only have access to the address and bytecode of a smart contract (pure decentralization, no 3rd party tools such as etherscan etc). How can we understand or deduce what the behavior of this smart contract is, or how to interact with the smart contract?

I imagine the founders of ethereum (Vitalik etc) must have considered this. What is the solution?

1 Answer 1

1

Check out this answer.

Long story short you are looking for a decompiler. The difficulty is that decompilation is not always reliable. That being said, options (discussed in the post linked above) do exist but should be used with discretion.

Another option is to analyze the opcode directly, but this would take a lot more effort and expertise.

3
  • Makes sense. If this is the case, how can anyone trust the behavior of smart contracts in a purely decentralized world? It seems the only way to trust a smart contract would be to obtain the source code and verify an exact bytecode match oneself.
    – bioround
    Apr 22, 2022 at 0:32
  • 1
    I believe the ethereum protocol doesn’t not comment on this topic. That is not to say that the core contributors weren’t aware of it, as they definitely were. It simply wasn’t a design constraint of the protocol to provide a way for humans to understand the functionality of each smart contract. Although it doesn’t seem difficult to build a solution to this problem directly into the protocol, it wouldn’t be practical or necessary...
    – stam_a
    Apr 22, 2022 at 14:13
  • 1
    ...As I understand it, the idea is that if you want other accounts to interact with your smart contract, you are strongly incentivized to share the source code in a standardized (i.e. human-friendly) form on the internet. It doesn’t matter if its through centralized or decentralized means since everyone can always check that it compiles to exactly what’s on the chain. This process is still completely trustless even though it's not directly written into the protocol.
    – stam_a
    Apr 22, 2022 at 14:17

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.