EventSignature
An EventSignature is a 32-byte identifier used as the first topic (topic[0]) in Ethereum event logs. It’s computed as the full Keccak-256 hash of the event signature.Type Definition
Creating Event Signatures
From Signature String
From Hex String
From Bytes
Operations
Convert to Hex
Compare Signatures
Common Event Signatures
ERC-20
ERC-721
Uniswap V2
Event Log Structure
Event signatures appear as the first topic in event logs:Signature Format
Event signatures must use canonical type names: ✅ Correct:Transfer(address,address,uint256)Swap(address,uint256,uint256,uint256,uint256,address)Deposit(address,(uint256,uint256))
Transfer(address, address, uint256)(has spaces)Transfer(address,address,uint)(should be uint256)transfer(address,address,uint256)(wrong capitalization)
How Event Signatures Work
- Event Signature: Start with the canonical event signature
- Hash: Compute
keccak256(signature) - Use Full Hash: Unlike function selectors, use all 32 bytes
Indexed vs Non-Indexed Parameters
Event parameters can be indexed or non-indexed:indexed keyword:
- Signature:
Transfer(address,address,uint256) - The
indexedkeyword only affects where data appears in the log
Anonymous Events
Anonymous events don’t include the event signature as topic[0]:- No topic[0] (no event signature)
- Indexed params use topic[0], topic[1], topic[2]…
- Saves gas but harder to identify the event
Filtering Events
Use event signatures to filter logs:API Reference
Constructors
from(value: EventSignatureLike): EventSignatureType- Create from various inputsfromHex(hex: string): EventSignatureType- Create from hex stringfromSignature(signature: string): EventSignatureType- Compute from event signature
Operations
toHex(sig: EventSignatureType): string- Convert to hex stringequals(a: EventSignatureType, b: EventSignatureType): boolean- Compare signatures
See Also
- Selector - 4-byte function selector
- FunctionSignature - Extended function selector
- ErrorSignature - 4-byte error selector
- EventLog - Event log structure

