I need all Ethereum smart contracts

0 votes

The problem

I would like to get all ERC20 token smart contract bytecodes in Ethereum network.

The question

Is there a way to scan the blockchain for ERC20 smart contracts and/or scan an address for a [ERC20] smart contract?

Jun 16, 2018 in Blockchain by aryya
• 7,460 points
515 views

1 answer to this question.

0 votes

Have a look at EIP165. It allows you some form of introspection wether an address offers a certain interface. Obviously this only works for contracts that at least implement ERC20 and EIP165.

How to detect if a contract implements ERC-165:

  1. The source contact makes a STATICCALL to the destination address with input data: 0x01ffc9a701ffc9a700000000000000000000000000000000000000000000000000000000 and gas 30,000. This corresponds to contract.supportsInterface(0x01ffc9a7).
  2. If the call fails or return false, the destination contract does not implement ERC-165.
  3. If the call returns true, a second call is made with input data 0x01ffc9a7ffffffff00000000000000000000000000000000000000000000000000000000.

  4. If the second call fails or returns true, the destination contract does not implement ERC-165. Otherwise it implements ERC-165.

How to detect if a contract implements any given interface:

  1. If you are not sure if the contract implements ERC-165, use the above procedure to confirm.
  2. If it does not implement ERC-165, then you will have to see what methods it uses the old-fashioned way.
  3. If it implements ERC-165 then just call supportsInterface(interfaceID) to determine if it implements an interface you can use.

answered Jun 16, 2018 by charlie_brown
• 7,720 points

Related Questions In Blockchain

+1 vote
1 answer

How to deploy ethereum smart contracts on a website?

There are many ways to do this: 1 ...READ MORE

answered Mar 27, 2018 in Blockchain by Johnathon
• 9,090 points
1,861 views
0 votes
0 answers
+15 votes
2 answers

What are the various blockchain smart contracts platforms?

While Ethereum is the most popular platform ...READ MORE

answered Mar 27, 2018 in Blockchain by Johnathon
• 9,090 points
1,156 views
0 votes
1 answer

Truffle tests not running after truffle init

This was a bug. They've fixed it. ...READ MORE

answered Sep 11, 2018 in Blockchain by Christine
• 15,790 points
1,878 views
0 votes
1 answer

Hyperledger Sawtooth vs Quorum in concurrency and speed Ask

Summary: Both should provide similar reliability of ...READ MORE

answered Sep 26, 2018 in IoT (Internet of Things) by Upasana
• 8,620 points
1,395 views
+1 vote
3 answers

Is it possible to store data about arbitrary objects on the blockchain using smart contracts?

Basically you implement requested logic on by ...READ MORE

answered Aug 30, 2018 in Blockchain by Artem
1,446 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP