Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

--db Option Requires Same Mnemonic and Network ID #1030

Open
groovypete opened this issue Oct 26, 2017 · 7 comments
Open

--db Option Requires Same Mnemonic and Network ID #1030

groovypete opened this issue Oct 26, 2017 · 7 comments

Comments

@groovypete
Copy link

Dear all,

I am just in the process of testing the latest version of testrpc (4.1.3) and the --db option still appears to not be working correctly as reported in earlier versions by users.

In summary, the chain data appears to be saved but when closing and starting testrpc again, my test contract is no longer deployed.

Has anyone been able to get this feature to work in v4.1.3?

Many Thanks,

Pete

@dkent600
Copy link

dkent600 commented Oct 29, 2017

+1
Same results here

@QuynhNguyen
Copy link

Same here

@benjamincburns
Copy link
Contributor

Right now for the --db option to work correctly you need to run ganache-cli the second time using the same mnemonic and network id.

In a future release we'll store this information in the database and retrieve it on start, and give a warning when the user specifies a mnemonic or network id which is different from the one which was stored.

@mikeseese mikeseese changed the title --db option not working --db Option Requires Same Mnemonic and Network ID Jul 3, 2018
@Swader
Copy link

Swader commented Jul 25, 2019

This does not work for me. Connected to #1007

If I start the chain via my Thundercloud script: https://github.com/status-im/thundercloud
and then try re-running from saved DB inside deploy/db (db exists, files are created), I get a bunch of new accounts, even if I use the same mnemonic and network ID: ganache-cli --db deploy\db --mnemonic "main blouse fashion brand own rocket fluid notable vacuum gain guitar leaf" -i 666 (the network ID is in my dev branch locally, hence will not appear in the repo link. Assume it's there)

@davidmurdoch
Copy link
Member

davidmurdoch commented Jul 26, 2019

ganache-cli --db deploy/db --mnemonic "main blouse fashion brand own rocket fluid notable vacuum gain guitar leaf" -i 666 outputs the same accounts every time for me (notice I changed \ to / in the --db path).

this small program (install ganache-core locally first) outputs the identical accounts as well:

var provider = require("ganache-core").provider({
    mnemonic: "main blouse fashion brand own rocket fluid notable vacuum gain guitar leaf",
    network_id: 666,
    db_path: "./deploy/db"
});
provider.send({
    jsonrpc: "2.0",
    id: 1,
    method: "eth_accounts",
    params: []
}, console.log);

@Swader, what version of ganache-cli are you using?

@Swader
Copy link

Swader commented Jul 26, 2019

Sorry should have been more specific. Accounts are same, yes, but the state is not. So what I do first is I generate accounts with a script, seed them with some eth, deploy a contract, do some transactions. Then, I fire up ganache from this DB, but my accounts are always fresh - they have 100 eth. Something just occured to me though - if I don't specify an account limiting flag like -a 1 to limit to 1 account, and I have inserted and seeded 10 accounts in another script, will the default of a=10 then reseed those accounts with 100 eth even if they were in the db? It shouldn't right?

@davidmurdoch
Copy link
Member

Another data point for when this get's worked on: db_path is incompatible with forking from "latest" (the default) as on each new start up "latest" will change.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
Status: Backlog
Development

No branches or pull requests

7 participants