I would like to be able to save the state of my local Ganache or Truffle Develop chains into some sort of file. At a later time, I would like to be able to restart Ganache or Truffle Develop and apply the snapshot. Is this possible? Any resources for doing so without extensive digging and tinkering?

2 Answers 2


This can be done with the ganache-cli db command. For example, to run a setup similar to the GUI client, I do

ganache-cli --db="./data/save/" -i="5777" -d --mnemonic="YOUR_12_WORDS_HERE"

Which will save the network data to the ./data/save directory. If the data is already present in that directory, it will return to the same state (provided deterministic and mnemonic are set to generate the same genesis block).

I recommend keeping one directory as a backup for your desired state, and then duplicating that file before starting up so that you can always go back to that exact state. (It may be possible to delete individual files in the save directory, but I'm not sure.)

More details at the ganache-cli repo

  • can we use the above command in the middle when the ganache is running? Commented Nov 2, 2019 at 0:36
  • If I have some data in the --db dir, and suppose I run a test, will what I do in the test be saved in the dir? I would like to have a snapshot from which I can continually start from the same place Commented Oct 4, 2021 at 1:54
  • -d and -i are very important. See ethereum.stackexchange.com/a/37729/77053 Commented Oct 14, 2022 at 18:25

This is now done by using Ganache workspaces with 0 tinkering needed :)

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.