I am building a web UI for testing smart contracts and currently I have to supply the ABI for a contract I test. Is there a way to extract the ABI from a deployed contract (preferably programmatically)?


If the source code has been published to Etherscan, then they have an API to retrieve it. From https://etherscan.io/apis#contracts:

Get Contract ABI for Verified Contract Source Codes


  • Unfortunately this wont work as I need it for smart contracts running on a private network (Ganache)
    – Andrey
    Jan 30 '18 at 15:06
  • That's correct. In general, there's no way to get the ABI for a contract unless it's been explicitly stored somewhere.
    – user19510
    Jan 30 '18 at 16:57

Yes, there are tools that try to recover ABI from bytecode.

For example porosity and mythril.

It is not always possible to recover ABI because bytecode does not contain function signatures but only last 4 bytes of function signature hash.

  • If you look at potosity or mythril, you need an ABI to Disassemble or Decompilation. There's no way to get an ABI from a deployed contract.
    – hefgi
    May 16 '18 at 13:44

Go to EtherScan > enter the contract address > click on the Contract in the tab section heading > Scroll down to find the Contract ABI > click on the Copy icon to copy it


You can also copy your ABI in Remix by going to Compile-->Details(ABI) sectionABI


Deployed contracts are stored in bytecode so out of the box you can't extract the source ABI, however there are open source decompiling tools that attempt to recover the ABI.

What you can do is store the ABI JSON in IPFS and reference it by it's content hash.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.