If I have a frontend app in a server and the contracts are not in there, should I upload the ABI with the app so I can use it or is there a better way to fetch it from the internet?
1 Answer
Once you deploy a contract, the ABI is not natively available anywhere online. If you just have the contract address, you can only get the ABI by two means:
Reverse-engineer the contract. Not fun nor easy
Get the ABI from a third party service, where the ABI (or source code) was uploaded to. Such as Etherscan. This of course won't work if the ABI (or the source code) wasn't uploaded anywhere
So by far the easiest way is to keep the ABI with your app.
-
But if I do have the ABI, the default way to do it is to just upload it with the app, right?– OmarCommented Oct 22, 2021 at 20:48
-
Yes, upload the ABI with the app. If you don't need the full ABI, ethersjs even lets you import single functions Commented Oct 22, 2021 at 23:26