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?
This can be done with the
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 dave the network data to
./data/save directory. If the data is already present in that directory, it will return to the same state (provided
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