0

I have a old ABI generated by executing truffle migrate. Now I update the code and generate a new ABI by truffle migrate --reset.

What exactly happens by executing truffle migrate --reset ?

What about the data storage of previous smart contract ?

1 Answer 1

3

All your migrations run from the beginning.

Using ganache blockchain (for this example), you can check this information at the bottom of your contract's .json files.

Before --reset:

  "networks": {
    "5777": {
      "events": {},
      "links": {},
      "address": "0x2429A2d4d4eE68C33a08e0490f5E3daf9d3329Ef",
      "transactionHash": "0x5b8a2e62e029665eebb57e9679dee738f88c1505280f90dc4942a302782ef4ed"
    }

After --reset:

"networks": {
    "5777": {
      "events": {},
      "links": {},
      "address": "0x31D381295EBed6D8834F5CafbfeD559Dc0AD02cC",
      "transactionHash": "0x7d5c9fa517fab0730e6ae06b576e91d2f3a44504c97e100b7f3375d05b9eaeec"
    }

As you can see there is a new address of the same contract. The data storage of the previous contract will remain but you won't communicate with it. From now on you will call the new contract address when you make a transaction.

This is easy to track in Ropsten, Rinkeby... and also possible in ganache but it depends on your configuration.

6
  • Thank you @alberto and let's say If I developed one social media platform and successfully deployed on live network. After some days I updated the code and migrate --reset and deployed again (the new JSON) to the live network. Does it means previous smart contract works perfectly fine ? new one is act as new smart contract ?
    – Suria
    Commented Jun 21, 2019 at 9:59
  • @Suria What you deploy to the blockchain is the smart contract, so the previous contract still works fine and the new deployed too.
    – alberto
    Commented Jun 21, 2019 at 10:10
  • Then how to convey the community to use new one ?
    – Suria
    Commented Jun 21, 2019 at 10:13
  • thank you so much for your response. I have cleared my questions.
    – Suria
    Commented Jun 21, 2019 at 10:13
  • @Suria Probably if the update corrects bugs, the community will accept the new contract but I consider that question more complicated...
    – alberto
    Commented Jun 21, 2019 at 10:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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