9

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.

marked as duplicate by tayvano, eth Jun 1 '16 at 17:57

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

13

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.