1

There is same question on stackexchange but the answer to that question does not include the new api on etherscan which, given an address as input, allows you to download source code of that verified smart contract.

But I want to download source code of a random verified contracts without knowing its address.

My ultimate goal is to make folders based on versions of contracts and download 50-100 for each version if available enough. I also want to know how many verified smart contracts are there on etherscan so that i can estimate time of download as only last 500 verified contracts are visible on etherscan.

edit: If I know addresses of verified smart contract then the api will work since i can loop over all addresses. Is there any way to get a list of addresses of all verified smart contracts?

3 Answers 3

0

I think your best chance is to build a scraper to harvest the Ethereum address of random smart contracts and if they are verified, then feed the address into the API to grab the source code.

0

Given your last edit I think this would help you

Is there any way to get a list of addresses of all verified smart contracts? Blockquote

This will give you the list of contracts in a csv:

https://etherscan.io/exportData?type=open-source-contract-codes

0

It's Official Etherscan API:

https://docs.etherscan.io/api-endpoints/contracts#get-contract-source-code-for-verified-contract-source-codes

Just make ID, and use API.

Free limit:-

  • 5 calls/second limit
  • Up to 100,000 API calls a day

Cost of Etherscan API: https://etherscan.io/apis

If you want to create your own api for this purpose use puppeteer or selenium or something similar.

There maybe many third party APIs also. You may search on internet.

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.