Extracting ABI – How to Retrieve ABI from a Deployed Contract

abicontract-deploymentcontract-development

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)?

Best Answer

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

https://api.etherscan.io/api?module=contract&action=getabi&address=0xBB9bc244D798123fDe783fCc1C72d3Bb8C189413&apikey=YourApiKeyToken

Related Topic