2

Looking at the newer smart contract I rarely see "indexed" on events. Sometimes even event emiting is scarce, I would assume its to save gas on contract execution. So question is when would be good example (or a must) to add indexed attribute to event emission?

3

Indexes come from database theory

Indexed events are more expensive because nodes need to store more data to make indexes available. On the other hand, indexes allow the clients like web3.js to look up events from nodes more easily if you know the query parameters.

Alternatively many projects built ad run their own indexers or use centralised API services like The Hraph to build their indexes for displaying on the web pages, as the limit what kind of database services raw Ethereum nodes can provide is very limited.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.