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?
Asked
Active
Viewed 437 times
2
-
Great question. Excellent answer. – Thomas Jay Rush Mar 06 '17 at 04:19
1 Answers
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.
Edmund Edgar
- 16,897
- 1
- 29
- 58
-
1Got 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 04 '17 at 02:53
-
2Yes, this is the normal process, whether you get the source code from Etherscan, directly from the developers or from somewhere else. – Edmund Edgar Mar 04 '17 at 02:57