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

A complete ERC-20 calldata walkthrough

Separate action selector, recipient and raw token amount.

LET’S PICTURE IT

Read a delivery form’s action label before interpreting its address and quantity 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.

Choose the standard function

transfer(address,uint256) gives the familiar 0xa9059cbb selector. The calldata destination in a real transaction would be the token contract; the final token recipient is an argument.

Read word zero

The first thirty-two-byte argument word contains the left-padded address. Remove only the address padding according to its type rather than trimming arbitrary significant bytes.

Read word one

The next word is the unsigned raw amount. Decimal 100 is hex 64. Nothing in that word supplies the token’s decimals, market value or transfer-fee behavior.

State what you know

The trace identifies a standard-shaped request under the chosen ABI. It does not prove a real token contract executes it honestly or that the recipient’s net balance will match every token implementation.

Follow the bytes

function transfer(address to, uint256 amount)
arguments: ["0x0000000000000000000000000000000000000001","100"]

selector: 0xa9059cbb
arguments begin at calldata byte 4

word 0 · argument offset 0 bytes
0x0000000000000000000000000000000000000000000000000000000000000001

word 1 · argument offset 32 bytes
0x0000000000000000000000000000000000000000000000000000000000000064

The argument region is sixty-four bytes after the four-byte selector.

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

Does the amount word alone tell you token decimals?

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.