2

This question already has an answer here:

a request for these users (Richard Horrocks, Achala Dissanayake, shane, flygoing ), please read the questions completely and understand them... then answer them if you actually know something about the topic....before flagging them as duplicate, if you do not know the topic...please move to something you know something about on rather than giving wrong information just to score points


I am trying to use the persistence of blockchain data across invocations of ganache-cli. In summary,

  1. Invoke ganache with --db and -m flags like so: ganache-cli --db /xyz/ganachedata -m <same mnemonic across invocations> -e 1000
  2. Then, using web3.js, I create a new contract contract#1.
  3. Kill and restart ganache with the same command invocation parameters as in #1
  4. Now when I try to refer to contract#1 in my application, it tells me contract#1 does not exist.
  5. However, If I try to create a new contract, the new contract gets assigned the same address that was assigned to contract#1 in the first invocation.
  6. I also see that new contract was again created in block#1, so it looks like ganache-cli did not initialise blockchain from the data that was left by previous invocation of ganache-cli.

What I am doing wrong??

marked as duplicate by Ismael, Richard Horrocks, Achala Dissanayake, shane, flygoing Dec 18 '18 at 14:12

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.

  • Did you kill it gracefully? – goodvibration Dec 8 '18 at 21:29
  • used ctrl-c, how do you kill it gracefully, do I need to csend it a signal??? – satyendra Dec 8 '18 at 22:01
  • 2
    You are missing the parameter -i NETWORK_ID, if it changes between invocations your blockchain data will be invalid. – Ismael Dec 12 '18 at 19:50

Browse other questions tagged or ask your own question.