Solidity Function Selector

Generate Solidity function selectors from signatures. Convert function names to 4-byte selectors and event signatures to Topic0. Lookup common selectors instantly.

Enter function signature without spaces (e.g., transfer(address,uint256))

About Solidity Function Selector

The Solidity Function Selector tool helps developers work with Ethereum smart contract function selectors and event signatures. Function selectors are the first 4 bytes of the Keccak256 hash of a function signature and are used to identify which function to call in a smart contract. Event signatures (Topic0) are the full 32-byte Keccak256 hash of the event signature. This tool generates selectors from signatures and looks up common selectors in a built-in database.

What is a function selector?

A function selector is a 4-byte identifier used in Ethereum to specify which function to call in a smart contract. It's calculated as the first 4 bytes of the Keccak256 hash of the function signature. For example, the function signature 'transfer(address,uint256)' generates the selector '0xa9059cbb'.

How are function selectors calculated?

Function selectors are calculated by:
1. Creating the function signature (e.g., 'transfer(address,uint256)')
2. Computing the Keccak256 hash of the signature
3. Taking the first 4 bytes (8 hex characters) of the hash
4. Prepending '0x' to create the selector

What is an event signature (Topic0)?

An event signature, also known as Topic0, is the full 32-byte Keccak256 hash of an event signature. Unlike function selectors which use only 4 bytes, event signatures use the complete hash. This is used to identify events in transaction logs. For example, 'Transfer(address,address,uint256)' generates a unique 32-byte Topic0.

Why lookup function selectors?

When analyzing smart contracts or transactions, you often encounter raw function selectors (like 0xa9059cbb) without knowing what function they represent. Looking up selectors helps you understand what functions are being called. This is especially useful for debugging, auditing, or understanding unfamiliar contracts.

What is the difference between function and event selectors?

Function selectors are 4 bytes (8 hex chars) and identify function calls, while event signatures are 32 bytes (64 hex chars) and identify events in logs. Function selectors are used in transaction input data, while event signatures appear as Topic0 in transaction logs.

Key Features

  • Generate function selectors (4 bytes) from signatures
  • Generate event signatures (Topic0, 32 bytes)
  • Display full Keccak256 hash
  • Lookup common function selectors in built-in database
  • Validate signature and selector formats
  • Load random examples for testing
  • Links to external signature databases (4byte.directory, Openchain)
  • Includes 30+ common ERC20, DeFi, and governance selectors
  • Client-side computation for privacy