What is an ABI (Application Binary Interface) in Ethereum?
Answer
An ABI (Application Binary Interface) is the interface specification that defines how to encode function calls and decode return values when interacting with an Ethereum smart contract. It is the boundary between your application (web3.js/ethers.js) and the compiled smart contract bytecode. The ABI is generated by the Solidity compiler (alongside the bytecode) and describes: (1) Functions — name, input parameter types/names, output types, whether payable/view/pure; (2) Events — name, parameter types (indexed vs. not), used for efficient log querying; (3) Errors — custom error definitions for revert messages; (4) Constructor — parameters for deployment. To call a contract function with ethers.js: const contract = new ethers.Contract(address, abi, signer); const result = await contract.transfer(to, amount). ethers.js uses the ABI to encode the function call to the correct bytecode format and decode the response. ABIs are JSON arrays and are published on Etherscan alongside verified contract source code.
Previous
What is a gas fee in Ethereum?
Next
How does Ethereum's EVM (Ethereum Virtual Machine) work?