What is Ganache?
Ganache is a tool for ethereum dapp developers, supported by the Truffle team. It has 2 components:
- The Ganache CLI
- The Ganache GUI
Ganache CLI allows you to run a local ethereum blockchain on your computer. This blockchain is only local and not connected to any public testnet, nor the mainet. This is great for local development because you have absolute control over this local blockchain: you can create it, restart it, create pre-funded accounts and more. Ganache CLI is already included in Truffle, so you don’t need to install it.
Ganache GUI is a visual interface for Ganache CLI. It has many features, but can be generally described as a blockchain explorer. It is built with electron and can run as a stand-alone desktop app.
Widget not in any sidebars
How about testrpc?
In previous episodes, I used a tool called testrpc instead of Ganache CLI. The testrpc npm package still exists but the development has been moved to Ganache CLI.
Installing Ganache GUI
The first step is to install Ganache GUI on your computer. On the home page of Ganache, there is a button to download an app file. There are specific formats for Windows, Linux and Mac. I tried on Linux and Windows this method, but it failed. You might have more luck than me, but if you want to save yourself some troubles, I would recommend to run it directly from the source code.
For this, first open a terminal window, create a folder for ganache and clone the source code:
mkdir ~/ganache
git clone https://github.com/trufflesuite/ganache.git
This will download the latest version of the develop
branch. If you want to use something more stable, you might prefer to download the latest release version instead.
Once this is done, in the same folder install the required dependencies:
npm install
The install process might take a while, so feel free to let the task run on its own and come back to it later.
Once this is done, you will be able to run the Ganache GUI like this:
npm start
A window will open, and will ask you if you agree to send analytics data to Truffle, the organization which created Ganache. Agree or disagree to send them this analytics data, click on the continue button, and you should finally see the home page of Ganache!
Congrats! In the next episode, we will see how to use Ganache.
GanacheTruffle
Hi! Thanks for that!
When I start ganache through the cli I can give the command the parameter "--account" the tell the script which accounts should be created. Is it somehow possible with ganache gui?
Hi Philip,
In Ganache GUI it is indeed possible to set which account to use by setting the seed phrase. I explain this in this video:
https://www.youtube.com/watch?v=aRJA1r1Gwu0&t=2s
Cheers,
Julien