'How do you upgrade NEAR smart contracts?
If I've deployed a smart contract on NEAR, how do I upgrade it to a new version? How can I tell if an existing smart contract can still be upgraded or has been frozen?
Solution 1:[1]
Upgrading is done with access keys. If you want to be upgrading, you keep a full access key to the account, which allows you to deploy or delete/recreate/deploy.
Anyone can view the upgradeability of a contract (eg whether it can still be changed by the original owner) by viewing its keys to make sure that all full access keys have been removed using:
NEAR_ENV=mainnet near keys contract_name.near
Solution 2:[2]
In addition to the answer Erik already provided, I want to mention that even when there is no full-access keys on the account, the contract code can be re-deployed by the contract implementation itself (obviously, it should have a built-in support for that). You may also want to combine that with DAO to make the upgrade process backed by a voting process.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Erik Trautman |
Solution 2 |