11

I have been writing my first few contracts. So, as I understand it, once you write, compile, and deploy your contract, the only way to then interact with that contract is via something like web3.js and the ABI Definitions within the contract itself.

My question is: How does one update the contract itself after it has been deployed? What if something went wrong, or you want to make improvements within the contract code itself?

Is this possible, or something you need to setup via the ABI definitions in the first place. Just seems hard that I would know what to expect in the future, but then again maybe I am thinking of this completely wrong. Any help would be greatly appreciated.

0

1 Answer 1

16

The short answer is that contract code is immutable so you can't update without destroying the contract and deploying a new one in which case any state will be lost and users, other contracts or user interfaces will need to interact with another contract.

However there are various patterns which allow you to point to a new version and optionally keep state for example:

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