10

I'm actually using truffle with Ganache to do some development.

I would like to know where does Ganache store it's blockchain to see how much data is used by my test. Is it stored somewhere accessible on the pc ?

I'm using

  • Ubuntu 17.10 64-bit
  • ganache-1.0.1-x86_64
Zackorrigan
  • 178
  • 1
  • 10

3 Answers3

8

TestRPC used to just be in memory. They only recently released support for writing the blockchain out to the file system. As far as I can tell, the in memory implementation is still the default behavior. If you want to find the blockchain files, you'd specify the location yourself with the --db option.

From their release page (under v4.0.0):

Because we backed the TestRPC via the filesystem, this means you can now save your blockchain's data for later use. That's right, if you close the TestRPC and reopen it later, say, you can start up right where you left off. You'll need to use the new --db option (see the README) to tell the TestRPC where you'd like the data saved. You'll also likely want to use the --mnemonic option to use the same accounts each time.

Adam Kipnis
  • 10,175
  • 10
  • 35
  • 48
  • Thank you, I tried with ganache-cli and it worked. I tried with ganache as well but it seems that this is not implemented yet. – Zackorrigan Jan 05 '18 at 12:40
3

With Ganache v2, there is a new feature allowing you to maintain different workspaces. Each workspace can represent a different ongoing chain, and can be resumed by reading from disk at (just about) any time.

For example (on Windows) a workspace named "sample-spot" would be stored at %AppData%\Ganache\workspaces\sample-spot\chaindata (where %AppData% may be something like C:\Users\yourname\AppData\Roaming\).

Some additional details can be found in code here and documentation here.

WBT
  • 2,249
  • 3
  • 28
  • 40
  • 1
    If on Mac sometimes Ganache breaks and a clean up by removing local files in `~/Library/Application Support/Ganache` helps (which is an equivalent of AppData). – Yauhen Yakimovich May 14 '19 at 22:09
2

If you want to use --db, you need to use parameters --mnemonic and --networkId

Example: ganache-cli -p 7545 --mnemonic --networkId 100 --db .

Ref: https://github.com/trufflesuite/ganache-cli/issues/407#issuecomment-347663452

Cuong Tran
  • 1,909
  • 1
  • 20
  • 21
  • In my case I had to add a value for the --mnemonic section e.g. `ganache-cli -p 7545 --mnemonic "polar velvet stereo oval echo senior cause cruel tube hobby exact angry" --networkId 100 --db .` If you run the command multiple times confirm that the available accounts are the same each run – 8bitme Feb 04 '19 at 12:33