Try it Live
Run ABI examples in the interactive playground
Overview
ABI encoding serializes typed data into byte sequences for EVM consumption. Solidity ABI specification defines encoding rules for all Ethereum types.Encoding Rules
Static types (fixed size):uint<N>,int<N>,address,bool,bytes<N>(N ≤ 32)- Encoded in-place as 32-byte words
bytes,string, arrays (T[],T[k])- Encoded with offset pointer + length + data
Function Encoding
Function calls encode as:selector (4 bytes) + params (ABI-encoded)
Event Encoding
Events encode indexed parameters as topics, non-indexed as data.Error Encoding
Errors encode like functions:selector (4 bytes) + params
Constructor Encoding
Constructor parameters append to contract bytecode during deployment.Tuple Encoding
Tuples (structs) encode components sequentially.Array Encoding
Fixed-size arrays: Encode elements sequentially Dynamic arrays: Encode length + elementsPacked Encoding
Standard ABI uses 32-byte words. Packed encoding removes padding (used inabi.encodePacked for signatures/hashing).
Tevm uses standard ABI encoding. For packed encoding, use manual byte manipulation.
Decoding
Decoding reverses encoding process, extracting typed values from byte sequences.Specification
Full encoding rules: Solidity ABI SpecificationSee Also
- Function encoding - Encode function parameters
- Event encoding - Encode event topics
- Selectors - Selector generation

