r/ethdev • u/Resident_Anteater_35 • 1d ago
Tutorial A small Ethereum log-filtering exercise, plus the free articles behind it
Hey everyone.
I shared an EVM reading path here before. This time I wanted to bring one small exercise from the same area, something you can check against actual logs.
Say you want to track an ERC-20 wallet’s incoming and outgoing transfers. In the topics filter, putting the wallet in both address positions looks reasonable:
[TransferSignature, wallet, wallet]But that matches transfers from the wallet to itself.
Topic positions are combined with AND. To find activity in either direction, use two filters:
Outgoing: [TransferSignature, wallet]
Incoming: [TransferSignature, null, wallet]Here, TransferSignature means the event signature hash, and wallet is the address padded to 32 bytes. These are schematic filters, not literal JSON requests.
Use the same token contract and block range for both queries. Combine the results and remove duplicates, since a self-transfer matches both. For that fixed set of logs, (blockHash, logIndex) identifies each entry.
Another useful variation:
[TransferSignature, [walletA, walletB]]That matches transfers from either wallet. The inner array gives you OR within one position.
Try predicting the results before running the queries. It is a small exercise, but it makes the filtering rules much easier to remember.
I collect my free Ethereum articles and accompanying code examples on 0xByteBeetle. They cover EVM execution, transactions, events, deployments and proxies, with examples you can run and inspect alongside the explanations.
If you try one, I’d be interested to hear where the explanation or setup needs more detail.

