I am trying to implement following scenario.

  • Get a notification every time a new block is mined.
  • Loop through/filter all the transactions in the newly created block.
  • Check if the any transaction contains a newly deployed erc20 or erc721 token.

I am using infura`s websocket, but I am not sure how to identify if the transaction was new contract deployment.

1 Answer 1

  • You can identify contract deployed by an External Owned Account by looking at the recipient which should be empty.

    There's no reliable way to identify a contract as ERC20. You can query the created address for known ERC20 functions like name(), symbol(), totalSupply(), balanceOf(), etc.

    Fortunately for ERC721 compliant tokens it should be easier since they must support EIP165.

  • A contract can deploy a token through an internal transaction. Unfortunately there's no easy access to internal transactions, you need a client to implement that functionality.

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.