Beginner

Events & Logs — Hands-on

Understand how contracts emit data to the chain.

Developer Beginner
5/7 — Events & Logs — Hands-on

See it liveEvents click once you watch them appear in receipts and filters. Work on a testnet so you can emit freely and compare explorer UI fields to the ABI.

Steps
  1. Open a verified ERC-20:On a testnet explorer; inspect its Transfer logs. Note topics vs data fields.
  2. In Remix, emit a:Custom event with two indexed addresses and one value; send a tx and view the receipt logs.
  3. Use an explorer log:Filter to find events by a specific indexed address; confirm non-indexed data isn’t searchable.
  4. Simulate a reorg risk:Send a low-confirmation tx, observe logs, then wait for more confirmations to consider them stable.
  5. Optional:Write a quick script (ethers.js/viem) that listens for your event filter and prints decoded arguments.
← Previous section
Next section →