ABI encoding foundations
Begin with “ABI: the contract’s interface” and work toward “Static ABI decoding challenge set”. Each available lesson includes a visual explanation and a quick knowledge check.
Read in order or choose a topic below. Completion marks stay in this browser. All 20 lessons in this track are available.
- 01
ABI: the contract’s interface
Turn a function name and typed arguments into bytes.
8 MIN READ - 02
Trace calldata byte by byte
Find the selector, split the words, and follow dynamic offsets.
9 MIN READ - 03
Canonical function signatures
Normalize the name and parameter types before hashing a selector.
4 MIN READ - 04
Calculate a function selector
Keep the first four bytes of the canonical signature’s Keccak-256 digest.
4 MIN READ - 05
Encode uint256 step by step
An unsigned integer occupies one left-padded 32-byte word.
4 MIN READ - 06
Encode signed integers
Negative values use two’s-complement and sign extension.
4 MIN READ - 07
Encode an address word
Twenty address bytes occupy the lower-order part of a word.
4 MIN READ - 08
Encode a boolean word
The boolean schema uses canonical zero or one values.
4 MIN READ - 09
Encode bytes4 versus bytes32
Fixed bytes are right-padded, unlike unsigned integers.
4 MIN READ - 10
Static tuples explained
A tuple of static members concatenates their encodings without an offset to a tail.
4 MIN READ - 11
Fixed-size arrays in the ABI
A fixed count does not automatically make the entire value static.
4 MIN READ - 12
ABI return values without selectors
Ordinary result data begins with the output tuple encoding.
4 MIN READ - 13
Decode multiple return values
Read the output tuple in its declared order.
4 MIN READ - 14
Function overloads and selectors
The same name can identify different input-type signatures.
4 MIN READ - 15
The JSON ABI format
Structured interface entries describe functions, events and errors.
4 MIN READ - 16
Why ABI data is not self-describing
A valid word can support several different interpretations.
4 MIN READ - 17
Selector collisions explained
Four bytes cannot uniquely label every possible function signature.
4 MIN READ - 18
ABI encoding versus packed encoding
Compact concatenation has different boundaries and ambiguity properties.
4 MIN READ - 19
A complete ERC-20 calldata walkthrough
Separate action selector, recipient and raw token amount.
4 MIN READ - 20
Static ABI decoding challenge set
Use the schema, padding and complete static width together.
4 MIN READ