Web3.js Development – Get Contract ABI Knowing Only Contract Address

abicontract-developmentjavascriptweb3js

is there a way with web3.js to get a contract abi json, knowing only the contract address?

I cannot find anymore a link in wich they explain how to do this, in this post the guy replied telling that there is a way to do this but it's not so well documented.

How can I do this?

Best Answer

a) you know the source code of smart-contract

programmatically: see the link to gist from Ivan's answer

manually: with Remix

b) you don't know the source code but smart-contract was verified in one of the explorers

Then, use block explorer search to get ABI of smart-contract. For example, you can read the verified source code of smart-contracts in BlockScout, Etherscan, Etherchain

c) you don't know the source code && contract is not verified

You can use Panoramix smart-contracts decompiler to get a partial ABI of smart-contract

Related Topic