Function Selector
A 4-byte identifier that specifies which function in a smart contract to call.
Last Updated
2026-03-19
Related Concepts
What is Function Selector?
A function selector is the first four bytes of a transaction's "call data" that tells the Ethereum Virtual Machine (EVM) which specific function within a smart contract to execute. It acts as a unique ID for every function in a contract.
How does Function Selector work?
- A function is defined by its "signature" (e.g.,
transfer(address,uint256)). - The EVM takes the Keccak-256 hash of this signature.
- The first 4 bytes of this hash become the "selector."
- When you call a contract, your wallet automatically prepends this selector to your transaction data.
- The EVM reads these 4 bytes and "routes" the transaction to the matching code inside the contract.
Why does Function Selector matter?
Function selectors are the core of how different smart contracts and off-chain tools interact. They enable the "Application Binary Interface" (ABI) to work, allowing a wallet to talk to any contract as long as it knows the function names and types.
Key features of Function Selector
- Exactly 4 bytes long (8 hexadecimal characters)
- Derived from the function's name and parameter types
- First part of any "contract call" transaction data
- Enables function "routing" within the EVM
- Allows for "function overloading" (same name, different types)
Examples of Function Selector
The selector for the standard ERC-20 transfer(address,uint256) function is always 0xa9059cbb. Every time you send a token, your transaction starts with these 8 characters so the token contract knows you are trying to move funds.
