2

I'm planning to query a tx using a tx hash on Ethereum and get the events/logs to find out the recipient and sender of the ETH. Is it possible to do so for L2 blockchains like Optimism, ZkSync, Polygon, and Arbitrum?

Thank you!

2 Answers 2

2

Is it possible to do so for L2 blockchains like Optimism, ZkSync, Polygon, and Arbitrum?

All EVM-compatible blockchains implement Ethereum's original JSON-RPC API.

This includes

  • Layer 1 chains that are EVM compatible: Polygon, BNB Smart Chain, Avalanche C-chain, etc.

  • Layer 2: Arbitrum, Optimism, zkSync, etc.

You interact with this JSON-RPC API using libraries like Web3.py or Ethers.js.

You will need to have a JSON-RPC full node to read the events. Normal nodes do not store event history, especially if you are using crappy public RPC endpoints.

0

Yes, L2 EVM-compatible chains support the same JSON RPC methods supported by Ethereum.

You essentially do it the same way; you just need to have access to an endpoint for the L2 chain you are interested in.

Here is a list of a few methods that allow you to retrieve transactions information and logs:

These URLs link to the Polygon API reference, but those methods will work the same way on the other networks you mentioned; just use the corresponding endpoint.

3
  • To avoid being flagged as spammer you need to disclose your affiliation ethereum.stackexchange.com/help/promotion.
    – Ismael
    Apr 17, 2023 at 21:08
  • 1
    The disclosure is in my name :) A mod suggested this a while ago. Plus this is hardly a promotion. Yes, I work for the company but the resources I shared are relevant to the question and useful. Apr 18, 2023 at 0:07
  • 1
    Thank you David. It's a valuable resource.
    – att
    Apr 18, 2023 at 16:09

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.