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:
eth_newBlockFilter()and get a filter id.
- Using this filter id, periodically check
eth_getFilterChanges(filterId)to obtain new block hashes.
- For each block hash do
- Check if any transactions from the previous call are made from the given account. For the matching transactions do
contractAddressis not null, it contains a contract address I’m looking for.
- When I don’t need to watch for new contracts anymore, I call
The question is: could I do it in an easier way, with less RPC requests and computations, or not? Any suggestions?