1

I am wanting to listen for new contracts deployed and monitor specific events within these contracts.

The method I am currently using to retrieve newly deployed contracts is very long-winded and not cost-effective. I am using the Infura RPC and ether.js to scan the blocks and loop through the transactions to see if the data begins with 0x60806040.

Are there more efficient ways to achieve this and how?

Any guidance is appreciated, thanks.

1 Answer 1

1

There are a few different ways you could try to more efficiently watch for new ERC20 contracts deployed on the Ethereum blockchain:

  1. Use an Ethereum event logs API: Many Ethereum event logs APIs, such as The Graph or Etherscan, allow you to subscribe to events for a specific contract address or for all contract addresses. This would allow you to monitor specific events within ERC20 contracts without having to scan blocks or transactions yourself.
  2. Use a blockchain indexer: A blockchain indexer is a tool that can be used to index the blockchain and make it easier to query for specific data. There are several open-source blockchain indexers available, such as EthIndexer, that you could use to more efficiently retrieve data from the blockchain.
  3. Use a blockchain event notification service: There are several services available that will send you notifications when specific events occur on the blockchain. For example, you could use a service like Blocknative to receive notifications when new ERC20 contracts are deployed.

Overall, using an event logs API, blockchain indexer, or event notification service can be more efficient than scanning blocks and transactions yourself, as they are specifically designed to make it easier to retrieve data from the blockchain.

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.