4

What are the practical use cases of anonymous events in Solidity? In which situations they might be helpful?

2
  • What do you mean by anonymous events? Events in solidity have a name.
    – Ismael
    Commented May 12, 2022 at 3:06
  • 2
    Anonymous events don't have a signature topic hash, the events cannot be filtered by the event signature: docs.ethers.io/v5/concepts/events/#events-solidity
    – Deniz
    Commented May 12, 2022 at 12:16

2 Answers 2

2

At the low level all events are quite similar: an optional topics array with a maximum of 4 entries and a data array of arbitrary length. Topics are 32 bytes in length and they are indexed in the block bloom filter.

Solidity events use one of the topics for the event identifier. So the only advantage of anonymous events is that they may have 4 topics.

2

Anonymous events are cheaper to deploy and call (and can have up to 4 indexed topics as mentioned, as opposed to 3 for non-anonymous events). The blockchain nodes hosting the log files will need less storage as events emitted to the log files do not require a 256-bit topic hash to be stored.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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