0

I have been searching around a lot but couldn't find the answer to this.

My understanding is that one a Ethereum blockchain, there should be one/multiple types contracts. Once live, those contract being immutable, no one can add another type of contract. If needing to create another type of contract, a fork should happen in the chain.

Is this true?

In such case, what would be the general recommendation on handling a business which has contracts that often change or that often has new products? Should we spin a new blockchain each time?

1

Your understanding does not seem right, though it is hard to completely understand what you said.

In Ethereum, new contract deployment is a transaction, similar to transfer of cryptocurrency, so new contract can be deployed at any time, no need to fork blockchain or start a new one.

Once deployed, contract's byte code (computer program that control contract behavior) becomes immutable, while contract state may change. Contract state includes such things as amount of ether held by the contract, data stored in contract"s storage, etc.

As long as byte code may analyze contract state and alter its behavior based on this analysis, the contract behavior, in general, may change, even though byte code may not. For example, one may deploy a contract whose byte code implements (Forth)1 interpreter, write actual contract logic in Forth and put it into contract's storage.

This way one would get smart contract with fully mutable code.

Returning to your question, there are several ways how you could evolve your contracts along with your business evolution:

  1. You may deploy new contract each time you requirements change. Some tricks will be needed to preserve data. See this question for details.
  2. You may use upgradable contract. Usually this means, that front-end contract delegates actual work to back-end contract, whose address is stored in front-end contract's storage. By pointing front-end to different back-end one may change contract behavior.
  3. Use interpretation technique, as in my example with Forth above.

Let me know if you need more details about some of the options.

  • Sorry for the late answer. Thank you really much, it's way clearer now! I guess the misunderstanding comes from the fact that I haven't yet understood the basics. Would you have any recommendation on high level documentation I could read (schema based maybe) on how a blockchain/ethereum is setup? – Goul Dec 22 '19 at 11:15
  • Not every blockchain has smart contracts ability. For those, that do not have it, enhancing functionality is much more tricker and often require forking. You may start learning about Ethereum here: ethereum.org/learn/#ethereum-basics – Mikhail Vladimirov Dec 22 '19 at 11:33
  • I see. Makes sense. I mean it’s what I understood from bitcoin. Thanks for the link, it is really good! – Goul Dec 24 '19 at 1:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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