Ganache "Preset" Scripting?

I’m not even sure what to call this… is there a way when one initializes ganache-cli to read from a list of transactions and have it process all of them on startup? I know we can persist with the --db flag, but that’s not what I mean.

The purpose would be to recreate a default state at a moment in time for further testing from there.

Edit: OR, should I just script OZ to run a bunch of transactions at the beginning, and if so, any recommendations on that? Bash script? Mocha, but like… stateful?

1 Like

Hi @EvilJordan,

I had a look through the ganache-cli README: https://github.com/trufflesuite/ganache-cli and didn’t see anything helpful.

Conceptually you want to do a ganache-cli --fork.

You could run with --db flag and then run your transactions and save that database to use as a starting point.

Ganache GUI has a concept of workspaces so you might be able to do something with that.

My suggestion would be to create a script which ran all the transactions that you needed: (See Interacting Programmatically)

Maybe ganache-cli --deterministic is what you’re looking for ?

1 Like

Hi @EvilJordan,

Did you resolve this using a script?

It’s on the back-burner for now… I’ve been able to test/setup manually and it hasn’t been a big deal.

1 Like