1

I am developing an app that is using the etherscan-api package.

I use it to get the contract ABI.

The problem is that I retrieve it via the API every time the function is called.

My question is: Can a Contracts ABI change at any point and can I just store the ABI json in a database field to reduce processing time?

2 Answers 2

4

While there is a concept of 'contract upgradeability' that developers can build into their smart contract logic, smart contracts cannot update their contract ABI as a part of that process.

The exposed functions of a smart contract are immutable once the contract is created, and thus the contract ABI is also immutable.

1
  • It's worth mentioning that "The exposed functions of a smart contract" can include the "catch-all" or "anonymous" function. If defined, it means that you can call any function on that contract. "mutability" is immaterial if a contract can receive a call to ANY function. Commented Oct 31, 2020 at 19:48
0

Contract ABI should never change. You can safely use the ABI extracted from the deployment of your contract.

Also, to expand on what @shawn-tabrizi is talking about "contract upgradeability", if you plan to use. With "contract upgradeability", you separate logic and data into separate smart contracts. It essentially means, we use one contract to implement the logic and another contract to store the data.

1
  • Which contract defines the ABI in that case? The data contract or logic contract? Commented Oct 31, 2020 at 19:48

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.