This question already has an answer here:

my ganache -cli environment

I use ganache-cli --db to create a private test chain and save it on my computer, and the result is below: enter image description here

I use web3py w3.personal.newAccount('1') to add a new address, and I use print(len(w3.personal.listAccounts)) to show the amount of accounts, and the result is belowenter image description here

but when I shut down(ctrl +c) and turn on the ganache-cli again, I find there is no account saved.

marked as duplicate by Ismael, shane, Richard Horrocks, Mahesh Rajput, Nicolas Massart Jun 11 at 16:50

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.


You must specify a location to save and load the DB from.

Both times you run the command, simply specify a location, like so:

ganche-cli --db="~/my/DB/path"

  • I try add my location but no helps. Could you please give me some more details? – Lance li Apr 13 at 15:57

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