1

I start my service by:

ganache-cli -d --gasPrice 0 -q --db=./db

This persists my 10 defaults created accounts, but when I create new accounts using Web3:

web3.eth.personal.newAccount('password')

All the created accounts desapears after I restart the Ganache CLI command. So I cannot unlock this accounts. But all my erc20 token balance are there.

How can I persist the new created accounts?

0

Command-line option -d does not persist your accounts. It just generates them deterministically, i.e. the same addresses are generated every time you run it. Here is what documentation says about this:

-d or --deterministic: Generate deterministic addresses based on a pre-defined mnemonic.

I doubt ganache is able to persist accounts at all, because it was designed for clean-room testing.

  • It allows persistence of blockchain data if you use the same parameters -i, -d and -db in each invocation. But I'm not sure if the accounts details are part of the database. – Ismael Apr 20 at 7:17
0

Account won't be persistent when you rerun the ganache-cli

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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