This question already has an answer here:

I have created an ethereum application with Ganache and truffle js. i have installed ganache in a server, and th application work. but when i stop the server i lose the the smart contract that i have deployed. How can i set up a backup in case de cut of the server. i have tested

ganche-cli --db /path/

i can recoup my balnces one time and i can't done a transactions any more . how can i set up a backup

marked as duplicate by Richard Horrocks, Achala Dissanayake, Briomkez, Ismael, shane Dec 12 '18 at 17:05

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.


When starting ganache-cli, you can specify the flag --db /path/to/db which creates the DB directory if it doesn't exist and save the blockchain state. So when you restart ganache with the same flag, it initializes the blockchain from this state.

ganache-cli --db /path/to/db/

Extract from documentation:

--db: Specify a path to a directory to save the chain database. If a database already exists, ganache-cli will initialize that chain instead of creating a new one.

  • Sorry didn't get that. --db stores the entire blockchain states (transactions, accounts balances, smart contract states, etc...) – Greg Jeanmart Dec 12 '18 at 10:42

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