0

I thought smart contract code can be accessed using etherscan.io; however, I have been coming across many smart contracts that once I click the "Contract" tab, I can't see the original code.

Here is one example:

https://etherscan.io/address/0x36cb72433fbe10f03988b9d61d6c479a97a2a0b0

Yet some contract codes are actually available. Is there any other way to get the contract code? (I know the decompilation of the bytecode that etherscan provide)

1 Answer 1

1

The bytecode is an on-chain artifact. The nodes use it to know what's going on and process transactions.

The source.code is not on-chain.

Etherscan is a centralized database about the blockchain. Thier service includes many features that are beyond the raw transactions and blocks they observe.

One such feature is source code verification. A deployer optionally uploads codes for a deployed contract. If that code compiles to an exact match for the bytecode that exists on the chain, then they accept that the code is a legitimate pre-compile version of the contract and they add it to their database.

Hope it helps

1
  • Thank you for the response. What do you mean by source.code? Do you mean the source code of the smart contract? If so, it is on-chain right?
    – Emrah
    Mar 19, 2021 at 4:31

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.