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


1 Answer 1


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...) Dec 12, 2018 at 10:42

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