0

I'm doing a hobby project of blockchain exploration project. One thing I'd like to do is to see what contracts are deployed, maybe do some exploration analysis.

One thing I'd like to see is the source code of contracts.

There were quite a bit of questions on this matter, but I'd like take look at it from different angle: I'd like to be able to download source code somewhat automatically. Is there any standardish way to do it?

Things I have considered:

  • Download code from swarm, however it looks like that it is not widely used (is that true?);
  • Use service like: https://etherscan.io --- however API doesn't provide source code and their Terms And Conditions forbid scraping;
Joe
  • 1
  • 1
  • 1

4 Answers4

2

EtherScan.io offer the possibility to see the Solidity source code of a contract address.

  1. Enter the contract address in the search bar.
  2. Click on the contract tab.

To illustrate, this is the Solidity source code of the Tether token, as it has been deployed on the Ethereum blockchain.

CJ42
  • 136
  • 7
0

Possible duplicate How to get Source code of an already deployed contract? : How to get Source code of an already deployed contract?

Kishore
  • 362
  • 1
  • 11
  • I'm aware of that question. However there are some extra angle of trying to do this more or less automatically. – Joe Dec 02 '17 at 16:04
0

I basically see two options

  • download source-code from the various blockchain explorers if it was published (etherscan.io, ...) (here's my sample code to automate dumping of smart contract sources from etherchain.org)
  • decompile to a source-code equivalent from byte-code with porosity
tintin
  • 275
  • 3
  • 8
0

Cindercloud also offers an easy to use API to fetch the source and ABI. Underlying, it uses other APIs to fetch and cache the information.

Qkyrie
  • 562
  • 3
  • 7