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

Trace calldata byte by byte

Find the selector, split the words, and follow dynamic offsets.

LET’S PICTURE IT

A parcel has an action label and a carefully arranged set of compartments. Calldata uses a similarly agreed layout.

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.

First identify the layout

Standard function calldata begins with a 4-byte selector. Bytes after it encode the arguments. Split that argument region into 32-byte words. Our decoder numbers the words starting at zero and shows offsets relative to the start of the arguments.

A static example

transfer(address,uint256) encodes two words. The first is a zero-padded 20-byte address; the second is the unsigned amount. The amount is a raw integer. Token decimals are separate information, so a decoder should not automatically label it as ETH.

Follow a string offset

For setMessage(string), the first argument word is 0x20, meaning 32 bytes from the argument region’s start. At that location, a word gives the UTF-8 byte length. The bytes of the string follow and are padded to a multiple of 32 bytes. A byte count can differ from the number of visible characters.

Know what you can conclude

Decoding with a supplied ABI tells you how those bytes fit that ABI. It does not prove the recipient’s deployed code uses that interface or that a selector has only one possible signature. Contract behavior, state and network context require further checks.

TURN UNDERSTANDING INTO PRACTICEOpen the Calldata decoder →
QUICK CHECK · NO PRESSURE

A dynamic ABI offset is measured from where in a simple function call?

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.