4

I have the following question:

What is the best way to get all unique addresses who interacted with a specific smart contract?

For example, I want to extract all unique addresses which have interacted with the Uniswap smart contract. (optional: as a next step, also include a date/block height filter, eg all addresses who have interacted with Uniswap within the last 6 months)

I've checked the Etherscan and Moralis API but could not find a function that does exactly that (input: smart contract address, output: all addresses who interacted with it).

Any ideas on what the best way is to do this?

Thanks a lot in advance for your help - highly appreciated!

1 Answer 1

3

There is no direct way of doing it, but you could try this approach:

  1. Use the txlistinternal method of the Ethersan API, using the contract address as account. The cons here is there is a limit of records you can get.
  2. And filter all transactions from value, those will be all the addresses that interacted with your contract.

You could use a Autotask service that checks this periodically and saves it on a database, so you could return the last six months at will without getting limited by the amount of transactions Etherscan is able to return.

4
  • That's super helpful, thank you! As you're saying, the only restriction is the return limit of 10k records. Let's say I wanted to get all addresses that have interacted with a contract at once and it would be more than 10k records. What would be the best way to do this then, in your opinion? Simply run the API call several times with an adjusted block range (startblock, endblock) every time?
    – user93027
    Jan 31, 2022 at 17:39
  • Seems rustic but is your only option, note that the api is free up to a certain number of calls, so if you are planning to perform this on an old contract you will have to pay. Good luck
    – Julissa DC
    Jan 31, 2022 at 19:21
  • Definitely rustic... Seems weird that even with a paid account there's this limit and it's not possible to achieve this in a simple way.
    – user93027
    Jan 31, 2022 at 19:40
  • When people seem to know everyone who has staked a certain token--as DeBank does--is this what they have to do?
    – kuzzooroo
    Apr 25, 2022 at 2:23

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.