3

I understand that I can add indexed to a param in my event and it should speed up the retrieval of events later on.

I also know that 'address' comes back from these .filter.get() requests and corresponds to the address of the contract that sent the event.

What I don't know is if geth or other blockchain client indexes the address in the same way that it does an indexed param.

The specific question: Is there any adavantage to doing:

Event MyEvent(indexed address sendingContract, indexed address sender, int value)

and calling it with

MyEvent(address(this), msg.sender, 10)

or do we get that first parameter of the contract address for 'free?'

4

The 'indexing' means a parameter becomes one of the three available topics (there are four topics, but the first is reserved for the event signature).

The event sender's address and each of the four topics are inserted into the receipt bloom. (There may be other things inserted as well, I don't remember.).

It's the bloom filter that makes things faster, so, if I understand your question correctly, no it doesn't help adding the sender's address because it's already in the bloom.

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.