Layer 2 Blockchains – How to Read Events in Polygon, Arbitrum, and zkSync

arbitrumeventsl2polygonzksync

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!

Best Answer

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.

Related Topic