Ethereum contract that emits 1 event log once every block

auxlinarch
0
0

Hello guys, I’m new to the sub but has been writing Web3 off-chain back-end code for a over a year now.

I’m looking for Ethereum contract + topics combination that is guaranteed to emit at least 1 event log (or very few, but preferably just 1) every block for testing my library code.

So do you guys know of any such contracts? Thank you!

If you want to know why I need event log, it’s because because the Go library I’m writing centers around it being event log polling building blocks with real-time chain reorganization detection and handling baked in. To detect chain reorg while only getting information from event logs, I use log’s block hash and will only fetch block headers (for block hashes) if there’s a reorg and a log disappeared from the block. So that’s why I need event log for block hash and not the block header.

It is now done and will soon be open sourced, so I’m writing examples for devs. One of the examples is a single-file chain reorg monitor service. So I need a contract and topics that would make the example seems reasonable and cheapest to run, hence the question. (I wouldn’t want to follow a topic with too many logs just to detect a chain reorg)

EDIT: Since many misunderstood my post - I’m not designing a smart contract that emits logs every block, and my code is not just for detecting chain reorg. The code is an event log crawler library.

But now I’m writing an EXAMPLE CODE for the devs, and the code would be using the lib just to see if a chain reorg. Hope this helps.