How do you get a json file (ABI) from a known contract address?

  • I want to watch a Solidity contract using the Mist browser. I know how to do that and it needs the address and the json. I have the address, but I don't have the json. I do have the source code.

    Can I generate the json from the source code and/or the Ethereum address?

  • eth

    eth Correct answer

    5 years ago

    The JSON is called an ABI.

    You do need the source code, as you have, and one way to get the ABI is to paste it in Remix IDE, compile it, and then click the 'ABI' button to copy the ABI into your clipboard.

    @eth: what if it's someone else's contract that's already deployed to the blockchain? You know where the contract sits (hash of it), but you don't know the abi. How can you interact with it?

    @David If the author hasn't published the ABI, they may not want you to interact with it. In that case, you can try reverse engineering their code to interact with it.

License under CC-BY-SA with attribution


Content dated before 7/24/2021 11:53 AM