In this track: ABI encoding foundations
advanced · 4 MIN READ

Selector collisions explained

Four bytes cannot uniquely label every possible function signature.

LET’S PICTURE IT

A short badge number can be reused when the space of possible names is much larger than the badge space.

SEE IT FOR YOURSELF
Build a transfer call from typed fieldsStep 1 / 4
Build a transfer call from typed fieldstransfer(address,uint256)Recipient: 0x0000…0001Raw amount: 100Diagram labels abbreviate addresses; the lab shows full bytes4-byte selectora9059cbbEach box is one byte; this prefix is not a 32-byte wordWord 0 · recipient address12 zero bytes20 address bytes000…0001Left padding preserves the lower-order address valueSelector4 bytesa9059cbbAddress32 bytesword 0Amount32 bytesword 1 → 0x644 + 32 + 32 = 68 bytesThe integer does not contain token decimals or market price

The standard transfer interface takes an address and a raw integer amount. This diagram uses address one and amount one hundred.

Animated local teaching model. No wallet, RPC or live blockchain data. Some labels and hashes are abbreviated for readability.

The selector space is finite

Four bytes provide 2³² possible bit patterns. The set of possible function signatures is far larger, so collisions exist even with a cryptographic hash.

A collision does not break the full hash

Keeping only four bytes deliberately discards most of the digest. A short-prefix collision is not the same as finding two inputs with the same complete Keccak-256 output.

Dispatch needs context

The target contract determines how selectors are handled. A signature database can suggest a candidate name but does not prove the intended function at every address.

Validation still matters

A correct ABI and deployed-code context help interpret a request. Never treat a decoded familiar name as sufficient evidence of a contract’s permissions or safety.

Follow the bytes

Full Keccak-256 digest: 32 bytes
Function selector prefix: 4 bytes
Selector possibilities: 2^32

Discarded digest bytes are not part of ordinary dispatch.

Short identifiers are useful without being globally unique.

TURN UNDERSTANDING INTO PRACTICEOpen the Keccak-256 →
QUICK CHECK · NO PRESSURE

Does a shared four-byte prefix prove a full Keccak-256 collision?

Your progress stays in this browser.
Keep exploring the original referenceSolidity documentation ↗

Original explanations by EtherTools. Examples are educational and source-linked; this site is independent of the Ethereum Foundation. Our approach.