1

is there any existing tools that can find & download all smart contracts deployed on Ethereum blockchain, regardless they have source code or not?

if there is no such a tool, what is the best way to implement one? i suppose we can look at all the transactions sent to 0x0, but this requires access to a big full node?

thanks.

2

is there any existing tools that can find & download all smart contracts deployed on Ethereum blockchain, regardless they have source code or not?

There is no such tool.

if there is no such a tool, what is the best way to implement one? i suppose we can look at all the transactions sent to 0x0, but this requires access to a big full node?

If you want to find all contracts and their code, your only option is to run a debug trace (offered by both Parity and Geth) using an archival node on each tx throughout Ethereum's history, and look for calls invoking the CREATE op code.

Moreover, this will only give you the bytecode for each contract, not the source code. Ethereum does not store the source code, and you will either need to use a disassembler, which rarely produces good quality source code, or scrape other services such as Github to find the code to common contracts, or run a service similar to etherscan which allows users to submit their contract source to you.

  • I wonder if rather than setting up your own archival node, you could use Google's new dataset on BigQuery. But ya, Raghav is totally right, results would just be byte code... – Shawn Tabrizi Sep 4 '18 at 7:46
  • I'm not sure if that datasets lists op codes. It would miss contracts created via internal calls if it doesn't – Raghav Sood Sep 4 '18 at 8:01
  • So here is what I understand, is that correct? (1) Browse all the blocks from genesis, then look for transactions with "to" address of 0, and get the transaction payload as contract bytecode (2) Somehow run this contract bytecode, and look for CREATE instruction, and extract the bytecode from input argument of CREATE as a new contract (3) Repeat step (2) with this new contract extracted from CREATE, because this contract can also create a new contract. – user311703 Sep 10 '18 at 5:26
  • By "contracts created via internal calls", do you mean the CREATE instruction? – user311703 Sep 10 '18 at 5:30
  • Correct. If you trace every transaction, you will cover both externally deployed contracts and contracts created by internal calls with just one iteration. – Raghav Sood Sep 10 '18 at 5:32

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.