TransWikia.com

ganache-cli: how to persist new created accounts

Ethereum Asked by KQUEIROZ on August 26, 2021

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?

2 Answers

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

Answered by Vignesh K B on August 26, 2021

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.

Answered by Mikhail Vladimirov on August 26, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP