2

How is possible for Etherscan to know the Solidity source code of contracts such as this one https://etherscan.io/address/0xab7c74abc0c4d48d1bdad5dcb26153fc8780f83e#code? They wouldn't be able to reconstruct it from the compiled code that's in the blockchain?

1
  • Great question. Excellent answer. Mar 6, 2017 at 4:19

1 Answer 1

4

The source code is uploaded to Etherscan by the contract developer or someone else who has access to it. They also provide Git hooks to do this automatically.

Since Ethercan can recompile the source code people send them and confirm that it matches the compiled code on the blockchain, they don't need to trust the people sending them source code.

2
  • 1
    Got it, thanks. A more general question. Is this mechanism of compiling and comparing compiled code the way trust is established for smart contracts (so that someone who interacts with contract knows what it actually exactly does)?
    – migu
    Mar 4, 2017 at 2:53
  • 2
    Yes, this is the normal process, whether you get the source code from Etherscan, directly from the developers or from somewhere else. Mar 4, 2017 at 2:57

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.