1

I was wondering if it is possible to interact with someone's smart contract deployed on etherscan.io by using the ABI of that smart contract. for example when developing projects on my coding editor using "truffle migrate" I get the JSON file that contains the ABI that allows me to call all the functions inside that contract. but what if I want to call the name function of someone's smart contract using the ABI found on etherscan.io? is it possible? How can I convert that ABI to a JSON file and add it to my code editor?

2 Answers 2

1

Yes, it is possible to interact with any contract deployed on the chain. The ABI can be found on the Etherscan contract code tab if the contract is verified. If the contract is not verified then you cannot really determine the ABI yourself, not easily at least, may be able to reverse engineer tx calldata and try to make sense of the input.

1

Meet explained it accurately. I'm not sure if you are asking whether you can interact with a contract that isn't verified with a different ABI you got from etherscan.io.

If so, and you know what functions it has, here's a shameless plug for a tool I wrote: https://lovethewired.github.io/blog/2022/abi-playground

It's using ethersjs, more specifically ethers.utils.interface to generate the ABI.

2
  • Hey, this doesn't support Goerli testnet. Can you add Goerli support (or open-source this so I can submit a PR?)
    – fafrd
    Commented Sep 20, 2022 at 22:30
  • Hey, it supports any chain that you can connect to via MetaMask, it just might not show up in the dropdown. But fair point, I should open-source it.
    – phaze
    Commented Sep 22, 2022 at 17:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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