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

Decode multiple return values

Read the output tuple in its declared order.

LET’S PICTURE IT

A reply can contain a destination and a count, with each field interpreted under its own type.

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.

Outputs form a tuple

Returning address and uint256 produces the encodings in declared order. Both are static, so the example needs two words without a dynamic offset prefix.

Names help documentation

A named return can explain what a value means, but the name is not embedded in standard result bytes. The schema and trusted call context supply that meaning.

Order errors can look plausible

Swapping two compatible-looking integer fields can produce a technically decoded but semantically wrong result. Validate the exact ABI and implementation context.

Nested and dynamic results extend the same model

A tuple containing arrays or strings needs the relevant head/tail rules. Do not infer every output is one word merely because a simple example was.

Follow the bytes

types: address,uint256
values: ["0x0000000000000000000000000000000000000001","42"]
no function selector prefix

word 0 · argument offset 0 bytes
0x0000000000000000000000000000000000000000000000000000000000000001

word 1 · argument offset 32 bytes
0x000000000000000000000000000000000000000000000000000000000000002a

The first word is the address; the second is the integer.

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

Are output parameter names embedded as text in ordinary result bytes?

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.