In this track: Connect everything together
advanced · 6 MIN READ

Encode a token transfer by hand

Assemble one selector and two full argument words.

LET’S PICTURE IT

A labeled form contains a destination field and an exact unscaled amount.

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 simple public values

Use address one and raw amount one hundred. The exercise does not query a token, infer decimals or submit a transfer.

Encode the destination word

The twenty-byte address is left-padded with twelve zero bytes. Keep it distinct from fixed bytes20, whose standard ABI alignment differs.

Encode the integer word

Decimal one hundred is hex 64. Left-pad that value to a thirty-two-byte uint256 word and place it after the address word.

Verify the complete request

Prefix selector a9059cbb and count sixty-eight total bytes. Decode under the same declaration and recover the exact address and raw amount.

Your acceptance target

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

Use only local examples and public sample addresses. State the assumptions and limits alongside the result.

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

What is the total standard calldata size for this transfer?

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.