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

Function overloads and selectors

The same name can identify different input-type signatures.

LET’S PICTURE IT

Two service forms can share a heading while requiring different kinds of fields.

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.

Parameter types distinguish overloads

foo(uint256) and foo(address) have different canonical signatures. Their selectors are derived from those different strings, even though the function name is shared.

Outputs do not provide this distinction

A return-type-only change is not a standard selector-overload mechanism. Mutability and parameter names also do not belong in the selector signature.

Choose the exact declaration

A tool needs enough information to select the intended overload. Passing a value that resembles several types is not a reliable substitute for specifying the interface.

Short hashes can still collide

Different canonical signatures normally produce different selectors, but four bytes cannot guarantee uniqueness over every possible signature. Overload reasoning and collision awareness are separate concerns.

Follow the bytes

function foo(uint256 value)
arguments: ["7"]

selector: 0x2fbebd38
arguments begin at calldata byte 4

word 0 · argument offset 0 bytes
0x0000000000000000000000000000000000000000000000000000000000000007

Compare this selector with foo(address) in the hash tool.

TURN UNDERSTANDING INTO PRACTICEOpen the ABI encoder →
QUICK CHECK · NO PRESSURE

Which pair has different canonical signatures?

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.