How Function Selectors Work
The function selector is the first 4 bytes of the keccak256 hash of the canonical function signature:Usage Examples
Basic Usage
Matching Selectors
Detecting Function from Calldata
Building Function Registry
Error Handling
Selector Collisions
While rare, 4-byte selectors can theoretically collide. The EVM uses only the selector to route calls, so two functions with different names but identical selectors would conflict:See Also
- getSignature - Get canonical function signature string
- encodeParams - Encode function calldata
- decodeParams - Decode function parameters

