🔮
Ethereum
  • General
    • What is Ethereum
      • Ethereum & Bitcoin General Comparison
      • Singleton State
      • The Ethereum Virtual Machine (EVM)
      • Opcodes (operation codes) EVM
      • Ethereum Client
      • Forks
      • Gas (wei)
        • EIP-1559
        • Table Conversion (wei)
      • Proof of Stake (PoS)
      • Proof of Authority (PoA)
      • The Beacon Chain
      • Networks
        • Ethereum mainnet
        • Goerli
      • Account-based model & UTXO-based model
      • Externally Owned Account (EOA)
      • Node Clients
        • Geth
        • Nethermind
      • Contract Account
      • Smart Contract Upgradeability
      • Ultrasound Money
      • Merkle Trees
        • Patricia Merkle Tree
      • Tries
        • State Trie
        • Storage Trie
        • Transactions Trie
        • Receipts Trie
      • Transactions
        • Ethereum Transaction Architecture
      • World State
        • Chain of States
        • Chain of Blocks
        • Stack of Transactions / Mempool
      • Contract Creation
      • Message Call Transaction
      • P2P Network
      • Web3.js
      • Ether.js
        • Smart Contract Interaction Example
      • Web3.js vs Ether.js
      • Node Providers
      • ENS (Ethereum Name Service)
      • Web3 dapp
      • Escrow
      • Multi-signature
      • ERC-20 tokens
        • Send ERC20s to Contracts
      • NFTs
        • ERC-721 and ERC-1155
      • Solidity
        • State Variables
        • Data Location
        • Numbers
        • Modifiers
        • View & Pure Modifiers
        • Data Types
          • Modifiers
          • Modifiers (Functions)
          • Address & Address Payable
        • Hardhat
        • Payable Functions
        • Receive Function
        • Fallback Function
        • Global Variables
        • Self Destruct
        • Create2 Function
        • Revert function
        • Require function
        • Assert Function
        • Calldata
        • Interface
        • Mapping
        • Array
        • Struct
        • Inheritance
          • Virtual & Overwrite
          • Multiple inheritance
          • Hierarchical Inheritance
        • Events
          • Indexed (keyword)
          • LOG0 - LOG4
        • Multi-signature Example
        • Smart Contracts
          • Context
      • Application Binary Interface (ABI )
  • Extras
    • Terminology
      • Bytecode
      • Keccak-256
      • Turing complete
Powered by GitBook
On this page
  1. General
  2. What is Ethereum

Application Binary Interface (ABI )

PreviousContextNextTerminology

Last updated 2 years ago

ABI stands for Application Binary Interface. In the context of Solidity, ABI is used to describe the interface of a smart contract - that is, the set of functions, events, and variables that are exposed and can be accessed by other contracts or external applications.

ABI provides a standard way for contracts to communicate with each other and for external applications to interact with contracts. It defines the structure of the data that is passed to and from contracts, including the types of variables, function names, and argument lists.

ABI also plays a critical role in contract deployment and execution, as it is used to encode and decode transaction data, ensuring that the data is correctly formatted and can be processed by the Ethereum Virtual Machine (EVM).

The ABI indicates to the caller of a contract function how to encode the needed information, such as function signatures and variable declarations, in such a way that the EVM knows how to communicate that call to the deployed contract's bytecode.

In order to interact with a smart contract on the Ethereum blockchain, a web application needs the contract's address and ABI.

See the example on Etherscan

Example

[
  {
    "inputs": [
      { "internalType": "string", "name": "message", "type": "string" }
    ],
    "name": "setMessage",
    "outputs": [],
    "stateMutability": "nonpayable",
    "type": "function"
  },
  {
    "inputs": [],
    "name": "getMessage",
    "outputs": [
      {
        "internalType": "string",
        "name": "",
        "type": "string"
      }
    ],
    "stateMutability": "view",
    "type": "function"
  }
]

This ABI describes a smart contract that has two functions: setMessage and getMessage. setMessage takes in a string parameter called message and does not return anything. getMessage does not take any parameters and returns a string.

The ABI is an array of objects, where each object describes a function in the smart contract. For each function, the object includes the function name, input parameters, output parameters, and the function's state mutability.

The ABI is used by other applications to interact with the smart contract, so they can understand how to call its functions and retrieve data from it.

Contract ABI Specification — Solidity 0.8.13 documentation
Logo
https://goerli.etherscan.io/address/0x5F91eCd82b662D645b15Fd7D2e20E5e5701CCB7Agoerli.etherscan.io