What is currently the best way to migrate data from one contract for example the mapping to a new one?


You basically have two options:

1) Write some sort of backend program to read data from old contract and save it into the new contract. Pros: easy to implement (if you know some programming language to talk with the blockchain). Cons: Requires other (outside blockchain) technologies and knowledge.

2) Write all the logic in a new smart contract. The contract retrieves data from the old contract and saves it in the new contract. This can either be a middle-man contract (which is used only for the transition) or the actual new contract. Pros: all logic stays in blockchain, no need to write code outside. Cons: Probably a bit costlier in terms of gas compared to option 1. Also easier to make security mistakes.

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.