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,
- Invoke ganache with --db and -m flags like so:
ganache-cli --db /xyz/ganachedata -m <same mnemonic across invocations> -e 1000
- Then, using web3.js, I create a new contract contract#1.
- Kill and restart ganache with the same command invocation parameters as in #1
- Now when I try to refer to contract#1 in my application, it tells me contract#1 does not exist.
- 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.
- 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??