1

I'm trying to find an easy way to scan the blockchain for contracts that support a particular ABI. Take ERC20 as an example: What is the easiest way to find all the ERC20 supporting contracts on the public Ethereum blockchain?

I know I need to search for the function signatures from the ABI in the blockchain contract bytecode. Is there any way to do this without writing some custom code and if it requires custom code, are there any examples available?

I'm using Geth currently to run my node.

0

You can't, there is no way to get a smart search.

0

In order to find the contracts you need to scan the blockchain and compile a first list. The first event of a standard basic erc20 should be a Transfer from 0x0 to some address. Scan address 0x0 for that.

Given that, you should run a filter code which, in short, can call one or more standard functions from the contracts in the list in order to understand if that contract implements the basis of Erc20.

The most suitable test functions are balanceOf() and totalSupply(), where the first can return zero, both of them view functions, which means no gas to spend for them.

After this phase you should have a reduced list which can be further reduced applying some criteria depending on your application.

Nothing automatic, as you can see. At least as far as I can know.

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.