Skip to main content

Contract ABIs

Application Binary Interfaces, or ABIs, describe how your app talks to a contract. Every frontend, script, indexer, and automation workflow depends on having the right ABI for the contract you call.

What to store

For each deployed contract, keep:
  • The contract name
  • The deployment address
  • The chain ID
  • The exact ABI used by the deployed bytecode
  • The commit or release that produced that deployment
Example deployments/teqoin.json:

Export ABI from Hardhat

After compilation, Hardhat writes artifacts to artifacts/contracts/.... You can copy the ABI from the artifact:
Look for the abi array and save it into your app-facing ABI file.

Export ABI from Foundry

Foundry stores compiled output in out/.
Again, copy the abi section into the file your frontend imports.

Use an ABI in ethers

ABI hygiene

Keep these rules in place:
  • Regenerate the ABI every time the contract interface changes
  • Do not hand-edit ABI files
  • Version ABIs by release when you have multiple deployments
  • Keep addresses separate from ABI definitions