1

Understand that a smart contract address is deterministically computed from the address of its creator and how many transactions the creator has sent and thus every new smart contract deployment will generate a new address -- this makes a great deal of sense for public ethereum.

In Quorum, if I need to make an update to a smart contract (e.g., add/modify a new trading rule/logic) which has already been deployed, is there some way to ensure that the DApps connecting to the old smart address can swing over to the new smart contract seamlessly? i.e., no downtime needed to rewire the DApp to the new smart contract address.

Say, if downtime is not permitted (critical production system), transactions will continue to be sent to the old smart contract address, is there some way to migrate all the delta transactions sent during this period?

Nathan Aw (Singapore)

0

No. Not in a pre-implemented way.

sending transactions or reading from the EVM is an operation made to a specific address. Creating a new Smart contract would result in a new blank storage for that contract and sending all the data from a smart contract to an other is not implemented by default in the ethereum client.

So migrating from a smart contract to an other will expose two problems :

  • Changing old addresses to newer ones in hosted Dapps.
  • Migrating data from old contract storage to the newer one.

The first problem, can be done manually or preemptively by creating an off-chain DNS like naming system for addresses ( or subscribing to an existing one, it should be there already ).

The second problem, can only be solved by preemptively creating methods that will allow you to extract all data from a smart contract for cases like this, if you didn't then it will be hard.

All of this is applicable to ethereum and quorum too.

  • pretty awesome information there. Thank you! I am keen to explore both approaches, despite both pros and cons -- which would you prefer? have these approaches been done in production setting? How can one write a method in the smart contract to extract all data? – Nathan Aw Jul 13 '18 at 10:37
  • smart contract data is stored in state variables, extraction data from smart contracts is just reading the state variables. – Kaki Master Of Time Jul 13 '18 at 10:40
0

Not natively..

However there is a simple solution called proxy libraries.

  • You write a contract registry that ties a bytes32 identifier to a contract address

  • You write a library that contains your logic.

  • You write an interface to the library.

  • You create a proxy and link the interface to it.

  • You write a storage contract that contains the storage and delegates calls to the proxy.

This way when you want to update your logic you will simply have to deploy a new version of the library and set it's deployed address in the contract registry.

example: https://github.com/designisdead/blockchain-programmable-incentives/tree/master/contracts

I'm pretty sure that we have the best solution for upgradeable contracts here in our project.

  • wow nico. really really good stuff there -- thanks. – Nathan Aw Jul 14 '18 at 2:53

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.