How to get an ABI json file from a given contract code and address in Solidity?

import Image from β€˜@components/Image.astro’

This tutorial shows ways to generate an Application Binary Interface JSON file for a given contract source code.

Application Binary Interface is an interface that contains functions and arguments of a contract in JSON format. It is used to encode and decode data to and from blockchain transactions.

Generate ABI JSON file using local solc compiler

If the solidity compiler is installed local machine and solc command is working, then type the below command to get the Abi file. To install the solc compiler,

  • First, you need to have NodeJS installed,
  • Next install solcπŸ”— package which is a JavaScript binding for solidity.
  • Once the npm library is done, the solc command works
solc contract.sol --abi

Use --abi option to the command line to get generated ABI code. This generates an ABI JSON file. Also, the --bin option is provided to deploy the contract.

How to get the ABI file in Remix IDE

The following are steps to get an ABI JSON file for a given smart contract.

  • Go to and create a contract source code

  • Go to the Solidity Compiler tab and select ABI from the top-bottom tab as the given screenshot. How to get ABI json file in REMIX solidity ide editor

  • On click on ABI and copy it to the clipboard

    "inputs": [],
    "name": "addEmployee",
    "outputs": [],
    "stateMutability": "nonpayable",
    "type": "function"

How to get an ABI json file for a given contract address?

Another way is to get abi json file for a given contract address.

  • Go to Ether ScanπŸ”—
  • Enter the contract address to open the contract
  • Go to the Contract tab and Select Code
  • Inside Code, you can find Contract ABI and copy it.


In summary, You learned multiple ways to get ABI JSON for a given contract source code or address.