Crypto glossary

Bytecode and ABI

Definition

Bytecode is the compiled machine code of a smart contract that the EVM executes; the ABI is the description apps use to encode calls to it and decode results.

Developers write contracts in languages like Solidity or Vyper, but the chain only stores bytecode: a sequence of low-level EVM instructions, called opcodes, that every node executes the same way. The ABI, or application binary interface, is a JSON description generated at compile time that lists the contract's functions, their parameters and the events it emits. Wallets and apps use it to turn a call such as transfer(address, amount) into the exact bytes the contract expects.

Each function is identified by a selector, the first four bytes of the hash of its signature, followed by the encoded arguments. That is the raw data a wallet shows in its advanced view and that block explorers decode into readable inputs when they know the ABI. Security tools, decompilers and analysts read bytecode directly when no source code has been published.

Bytecode is public but hard to read, and an ABI only describes what a contract claims to expose, not what its code really does. Function selectors can collide, which some scams use to hide a malicious call behind a harmless-looking name.

Example

A wallet that lacks a token's ABI shows the user an approval as raw hex data starting with 0x095ea7b3, the selector of the approve function.

Related terms