Beginner

Understanding the ABI — How to work with ABIs

Demystify the ABI.

Developer Beginner
4/7 — Understanding the ABI — How to work with ABIs

Source of truthUse the verified ABI from an explorer or your build artifacts. Out-of-sync ABIs cause mysterious reverts.

Bitcoin seems to be a very promising idea. I like the idea of basing security on the assumption that the CPU power of honest participants outweighs that of the attacker.
— Hal Finney

DecodingUse libraries (ethers.js, viem) to encode/decode calldata and logs. Avoid hand-crafting unless debugging.

ChangesAdding/removing public functions changes the ABI. Treat it like an API: version it and communicate changes.

Minimal surfaceExpose only what you need; fewer public/external functions mean a smaller ABI and fewer attack surfaces.

← Previous section
Next section →