An Application Binary Interface (ABI) serves as an interface between two binary program modules in computer software. One module is usually a library or an operating system function, while the other is a user-executed program. The ABI instructs how data structures or computational routines are accessed in machine code, which is a low-level format that depends on the hardware being used. In contrast, an API explains access in source code, which is more readable and independent from hardware.
ABIs are contracts between binary code modules that specify how functions are called and parameters are passed between the caller and the called. They are crucial in developing applications that make use of smart contracts on blockchain protocols like Ethereum.
Smart contracts are codes stored on the blockchain executed on the Ethereum Virtual Machine (EVM). The EVM features opcodes, which are low-level codes used to execute specific operations. These opcodes are accessed through the Ethereum Yellow Book and are compiled and stored as bytes or binary representation on the blockchain. A contract on Ethereum and EVM is regarded as a single program executed on the byte sequence.
To interact with the blockchain, an external application or another smart contract needs to know the interface of a smart contract, which includes identifying a method and its parameters. This is where the Ethereum Application Binary Interface (ABI) comes in handy. Only higher-level languages like Solidity, Viper, or Bamboo explain how to transition the entry point of the program to the entry point of a specific function.
What is the difference between ABI and API?
The main difference between ABI and API is the way they instruct about data structures or computational routines in binary code. An ABI provides instructions in low-level machine code that is hardware-dependent to access these structures while an API provides instructions in source code format, which is more readable and hardware-independent.
What is a calling convention?
A calling convention defines how data is given as input or read as output from computing routines.
An Application Binary Interface is an essential contract between two binary program modules in computer software that specifies how functions are called and how parameters are passed between two modules. ABIs are critical in developing applications that leverage smart contracts on blockchain protocols like Ethereum. They enable external applications and other smart contracts to interact seamlessly on the blockchain.