For instance, I'd like to make the following query:

Return all the addresses that have approved spender x on a particular token

It seems that I can only query for a specific (address, spender) pair on Etherscan.

1 Answer 1


I assume, that you want to query this for particular token, not for all tokens.

  1. Via Web3 API query Ethereum node for all Approval events with _spender equal to x logged by particular token contract.
  2. Extract _owner values from all such events and deduplicate these values. This will give you all addresses that have ever approved anything to x.
  3. Query current allowance these addresses currently have for x to remove addresses that do not have allowance for x anymore.
  • Interesting. How long til I get all events? Can I use infura? Commented Aug 4, 2019 at 21:51
  • Yes, sure, infura supports such queries. This will be indexed query, so performance should be good unless you have too many Approval events with _spander equal to x. Commented Aug 4, 2019 at 22:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.