ABI Application Binary Interface

Software exposes a low-level interface called an Application Binary Interface (ABI) that specifies how programs, especially smart contracts and decentralised apps (dApps), communicate with a binary system like the Ethereum Virtual Machine (EVM) on a blockchain. It is a standardised method of machine code-level communication between these parts.
Analogy and Purpose
An Application Programming Interface (API) and an ABI are frequently contrasted. An ABI specifies the interface to compiled code, whereas an API specifies access in human-readable source code prior to compilation. Human-readable interfaces vanish when compiled smart contract code is saved as binary data within the EVM. In order to convert smart contract interactions into a binary format that the EVM can understand, the ABI intervenes.
An ABI’s main goals and significance are as follows:
- Define the Interaction Function names, parameters, and return values must all follow the precise format specified by the ABI when calling functions inside a smart contract. By specifying which certain methods can be called for execution, it serves as a function selector.
- Coding and Decoding It manages the process of decoding the results back into a format that is readable by humans and encoding data (such function parameters) into a format that the EVM can comprehend. We call this procedure ABI encoding.
- Bridging Components ABIs connect blockchain bytecode to Solidity or JavaScript.
- Compatible, interoperable ABIs help blockchain dApps and smart contracts communicate. The ABI provides a standard way for programming languages to interface with blockchain contracts because it is language-independent.
- Through intuitive user interfaces, accessibility ABIs enable human users to engage with smart contracts. Developers couldn’t create dApps that communicate with smart contracts without an ABI.
How an ABI Works
A smart contract written in a high-level language, such as Solidity, is compiled into executable bytecode by the EVM. By converting function calls that are legible by humans into bytecode that is readable by machines and vice versa, the ABI serves as a contract between this assembled smart contract and the outside world. The ABI makes sure the data is appropriately encoded for the EVM to comprehend because all contact with the smart contract is done in bytecode.
For instance, an external application or another smart contract must be familiar with the smart contract’s interface, including how to recognise a method and its parameters, in order to communicate with a smart contract on the blockchain. The ABI makes this possible.
Key Components and Contents of an ABI
ABI representations are usually JSON artefacts generated by the Solidity compiler. The user interface and public methods of a smart contract are described:
- Names of functions that are accessible from outside the smart contract.
- Function names, input and output parameters, and their corresponding types are described in function signatures.
- Names of events and the conditions that are specified in the contract.
- Details about builders.
- Booleans, strings, arrays, addresses, and signed and unsigned integers are examples of solidity data types.
- Crucially, the implementation details of the function or event are not included in the ABI. The ABI does not represent private or internal functions; it only represents public and external functions, which are utilised for front-end integration.
A generic Application Binary Interface (ABI), which goes beyond smart contracts, specifies things like:
- Details of the processor’s instruction set (memory access kinds, register file structure).
- Basic data kinds that the processor can directly access in terms of size, arrangement, and alignment.
- Calling conventions, such as call stack organisation, register usage, parameter order, and stack cleanup duty, specify how function arguments are passed and return values are received.
- Propagation of exceptions and name mangling.
- How the operating system is called by applications.
- The binary representation of program libraries and object files.
Example of ABI Encoding

To determine which function in the contract to call, the first four bytes of a transaction payload are usually supplied to the contract. This is referred to as the function selector or Method ID. This Method ID is determined by the first four bytes of the Keccak-256 hash of the function’s ASCII signature. A function signature like baz(uint32,bool) would have a Keccak-256 hash, and the Method ID would be the first four bytes. Method ID 0x70a08231 for balanceOf(address). The arguments are encoded from the fifth byte onwards. Responses lack the function signature but have a comparable format.
Usage and Generation in Development
ABI is needed to communicate with smart contracts. Hardhat/Truffle and Remix IDE automatically construct contract ABI during compilation. The Solidity Compiler NPM package lets developers manually build the ABI.
Ethereum client libraries, like web3.js, use the created ABI (as a JSON file) to communicate with the smart contract from outside applications. It enables JSON-RPC connection between the blockchain server and the web client for testing and deployment. The ABI and the smart contract’s blockchain address are set up in the JavaScript file of a web application in order to let it to utilise smart contract features. You can frequently find the ABI of a contract that has already been deployed by using the contract’s address to search on platforms such as Etherscan.
Despite the complexity of the encoding process, well-known compilers such as Remix can manage it automatically, guaranteeing that the encodings adhere to the ABI Specification.
Embedded ABI (EABI)
Embedded operating systems employ a particular kind of ABI called an embedded ABI (EABI). For embedded software systems, it outlines elements like file formats, data types, register usage, stack frame organisation, and function argument passing. Given the constrained resources of embedded devices, EABIs are frequently performance-optimized, possibly skipping dynamic linking for smaller executables and quicker loading or removing abstractions present in desktop OS systems.