3

I want to watch the blockchain for new contracts created from some given account. I’ve got an Ethereum node with RPC enabled.

I think, it should be something like this:

  1. Call eth_newBlockFilter() and get a filter id.
  2. Using this filter id, periodically check eth_getFilterChanges(filterId) to obtain new block hashes.
  3. For each block hash do eth_getBlockByHash(blockHash, true).
  4. Check if any transactions from the previous call are made from the given account. For the matching transactions do eth_getTransactionReceipt(txHash).
  5. If contractAddress is not null, it contains a contract address I’m looking for.
  6. When I don’t need to watch for new contracts anymore, I call eth_uninstallFilter(filterId).

The question is: could I do it in an easier way, with less RPC requests and computations, or not? Any suggestions?

1

I've tried to get to that better solution you're seeking because INFURA doesn't support eth_newBlockFilter() no more.

In the end I had to settle with the public Augur node to deploy my contracts.

TL;DR I couldn't find a different solution to validate contract deployment.

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.