Skip to main content
Loading…
AS Albert Schaper
  • 01Home
    • Profile & Career
    • Expertise
    • Overview
    • Results
    • Technical Depth
  • 04Projects
  • 05Contact
  • 06Insights
  • 07Tools
AS

Albert Schaper

01Home
Profile & CareerExpertise
OverviewResultsTechnical Depth
04Projects05Contact06Insights07Tools

AI · Finance · Entrepreneur

Home / Insights / What the 4-Byte Selector Means: How Contracts Find a Function
Insights

What the 4-Byte Selector Means: How Contracts Find a Function

A call to transfer(address,uint256) starts with 0xa9059cbb. Those four bytes are Keccak-256 of the canonical signature, and the hash does not give the name back.

By Albert Schaper AI Expert & Entrepreneur
10 November 2026 CryptoWeb3
Auf Deutsch lesen LinkedIn X
Contents
  • The hash covers one canonical string
  • Four bytes cannot be reversed
  • How to check a selector without sending anything

Call transfer(address,uint256) and the calldata opens with 0xa9059cbb. Those are the first four bytes of Keccak-256 over that exact string. The ABI specification in the Solidity docs says which string gets hashed. The examples below were recomputed against it on 10 November 2026.

The four bytes name the signature. They do not prove the contract contains the function. The words after them can mean something other than you expect, and you check the target address on its own.

The hash covers one canonical string

What gets hashed is the function name plus the parameter types in parentheses. A comma separates the types, with no space. Parameter names, the word function, and data locations such as memory or calldata stay out of the string. For the selector, uint and int are written uint256 and int256. address and bool stay address and bool.

transfer(address,uint256) yields 0xa9059cbb. The same Keccak run matches the specification's examples: baz(uint32,bool) starts with 0xcdcd77c0, and sam(bytes,bool,uint256[]) starts with 0xa5643bf2.

What you typeWhat is hashedSelector
transfer(address,uint256)that same string0xa9059cbb
function transfer(address to, uint amount)transfer(address,uint256)0xa9059cbb
transfer(address,uint) in the selector tooltransfer(address,uint256) (rewritten by the tool)0xa9059cbb
Raw string transfer(address,uint)that text, with no rewriting0x6cb927d8

Rows two and three are what the Function Selector prints: parsed, uint rewritten to uint256, then hashed. Row four is the same text without that rewrite. Solidity lets you write uint. The selector hashes uint256.

The same string transfer(address,uint256) starts with 0xa9059cbb under Keccak-256 and with 0x4b40e901 under SHA-3-256. NIST standardized SHA-3 later. Use the wrong function and you look up a different selector.

Four bytes cannot be reversed

Four bytes have 2^32 possible values. The signature does not follow from the selector alone. Two different canonical signatures can share the same first four bytes. A table only shows signatures somebody entered ahead of time.

Type a signature and the Function Selector on this site hashes it from scratch. Paste a selector and it only searches a local list of common functions, including ERC-20, ERC-721, and ERC-1155. If the selector is missing from that list, the display stays a hash. The input can still be valid. The function can be ordinary and simply absent from the list.

When no function on the contract matches the signature, a fallback may run. The Solidity documentation allows at most one fallback and runs it when nothing else matches the signature. Whether this contract is built that way is not in the selector.

How to check a selector without sending anything

Open the Function Selector and paste transfer(address,uint256). You get 0xa9059cbb and the canonical signature. Paste 0xa9059cbb next. The local table names transfer(address,uint256), because that signature is on the list. A selector that is not on the list stays unnamed.

You can open that signature in the ABI Decoder. The selector says which function is supposed to be called. The 32-byte words that follow are covered in How calldata is laid out.


Sources:

Specification and recomputation

  • Solidity: Contract ABI Specification (selector, canonical signature, baz and sam examples). Retrieved 10 November 2026.
  • Solidity: Fallback Function. Retrieved 10 November 2026.
  • Selectors 0xa9059cbb, 0x6cb927d8, and 0x4b40e901: recomputed with Keccak-256 (ethers) and SHA-3-256 (Node.js) on 10 November 2026. The specification examples 0xcdcd77c0 and 0xa5643bf2 were the check that the same Keccak function was in use.

Continue reading

  • How calldata is laid out
  • What is a nonce?
  • Geld 2.0
More Insights
  • Crypto

    How Calldata Is Laid Out: Selector, Arguments, and Offsets

    After the selector's four bytes, arguments follow in 32-byte words. Static values sit in place, dynamic values point onward with an offset measured without the selector.

  • Crypto

    What a Message Signature Proves — and What It Does Not

    A valid signature shows that the key for this address signed exactly these bytes under a specific prefix. It does not show that the text is true or that you should pay.

  • Crypto

    Learning Bitcoin and Web3: Books, papers, and where to start

    Which books and papers are worth your time depends on the question. Three reading paths, a timeline and annotated tables on founding texts, technology, money, Ethereum, DeFi, privacy, regulation and the critics — with level, access and the tools on this site.

Albert Schaper
About the author

AI expert and entrepreneur with a finance background and a focus on execution. I support companies as a partner and partly with own capital, mainly on strategy, financing and sales, and advise teams on putting AI to work. LinkedIn

← All Insights
AS

AI · Finance · Entrepreneur

Navigation

HomeAboutExpertiseProjectsContactInsightsTools

Projects

Best-AI.orgBitAutorGeld 2.0Pharmaceutical company

Tools

ETH Unit ConverterAddress ValidatorQR Code GeneratorSeed Phrase ValidatorWallet Generator

© Albert Schaper. All rights reserved.

Privacy / Imprint