Back to App
HookSmith Docs

ABI Input Guide

The Application Binary Interface (ABI) is the core of HookSmith's generation process. It defines how to interact with your smart contract.

What is an ABI?

An ABI is a JSON array that describes your contract's functions, events, and errors. It allows off-chain applications (like your React app) to encode calls to the blockchain and decode the data returned.

Where to find your ABI?

Hardhat

Look in your artifacts folder:

artifacts/contracts/MyContract.sol/MyContract.json

Copy the abi array from this file.

Foundry

Look in your out folder:

out/MyContract.sol/MyContract.json

Copy the abi array.

Etherscan / Block Explorers

Go to the Contract tab, scroll down to Contract ABI, and click the Copy icon.

Valid ABI Format

HookSmith expects a standard JSON array. Example:

[
  {
    "type": "function",
    "name": "balanceOf",
    "inputs": [{"name": "account", "type": "address"}],
    "outputs": [{"name": "", "type": "uint256"}],
    "stateMutability": "view"
  },
  {
    "type": "function",
    "name": "transfer",
    "inputs": [
      {"name": "recipient", "type": "address"},
      {"name": "amount", "type": "uint256"}
    ],
    "outputs": [{"name": "", "type": "bool"}],
    "stateMutability": "nonpayable"
  }
]

Security Note

Always verify that the ABI matches your deployed contract code. Using an incorrect ABI can lead to failed transactions or incorrect data reading.