title: How to get a contract by a transaction uising web3j?
body: <p>I need to check if a transaction is a ERC721/ERC1155 transaction and fetch information like receiving address, token address, value, etc. If I understand correctly, I have to load a contract for the transaction and check if it inherits ERC165 in order to confirm that it is a ERC721/ERC1155 transaction.</p>
  <p><strong>Problem:</strong> I don't understand how I can get a contract having a transaction object. I also haven't found a way to get token address.</p>
  <p>I have an Ethereum node on Infura, I read blocks from there and iterate over transactions. I get a transaction and its receipt. My code looks like this:</p>
  <pre><code>var tr = web3j.ethGetTransactionByBlockNumberAndIndex(blockIdParam, transactionIndex).sendAsync().get();
  var hash = tr.getTransaction().get().getHash();
  var receipt = web3.ethGetTransactionReceipt(hash).send().getTransactionReceipt();
  </code></pre>
  <p>Right now I am working in the direction of reading transaction logs, checking their topics and verifying if they include <code>Transfer</code> events. But transfer events are also emitted by ERC20 transactions, so I am a bit confused here.</p>