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

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 solidity compiler is installed local machine and solc command is working, then type below command to get Abi file. To install solc compiler,

  • First, you need to have nodejs installed,
  • Next install solc package which is an javascript binding for solidity.
  • Once npm library is done, solc command works
solc contract.sol --abi

you can --abi option to command line to get generated ABI code. This generates ABI json file Also, --bin option provided to deploy the contract

How to get ABI file in Remix IDE

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

  • Go to https://remix.ethereum.org/ 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
  • you can 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 EtherScan
  • Enter contract address to open 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.

Join 6,000 subscribers and get a daily digest of full stack tutorials delivered to your inbox directly.No spam ever. Unsubscribe any time.

Similar Posts
You'll get a notification every time a post gets published here.