Creating a blockchain network for development
You don't always have to create a fully functioning node to support your development. There are development networks that can simulate an Ethereum network. In this recipe, you will learn about ganache-cli
(previously TestRPC), which is part of the Truffle suit of Ethereum development tools and is a command-line tool that you can use to create your personal blockchain network for Ethereum development.
Getting ready
Since the tool is written in JavaScript and distributed via npm
, you will need Node.js
(>= v6.11.5) installed on your machine to try this recipe.
How to do it...
Follow these steps to install and create a test Ethereum network using npm
:
- Install
ganache-cli
usingnpm
:
npm install -g ganache-cli
- Starting a basic blockchain network is as simple as running this command:
ganache-cli
You will know that your blockchain is ready when you see this screen:

Ganache creates a virtual Ethereum blockchain, and it generates some sample accounts for you to use during development. Each account is filled in 100 Ether so that you only have to focus on development. You can access the network from http://localhost:8545
.
- You can use a few parameters to customize the blockchain. Here's one such example:
ganache-cli -a 5 -e 2000 -p 8080 -l 999999
-a
: Number of accounts to generate while starting the network. The default is 10.-e
: Amount of Ether to allocate for each account. The default is 100 Ether.-p
: Port number for listening to RPC requests. The default is 8,545.-l
: Gas limit for each block. The default is 90,000.
You can find the complete list of parameters to configure here:
https://github.com/trufflesuite/ganache-cli.
Note
By default, accounts are unlocked and you can do the transaction from any account without a password. You can change this by using the --secure
or -n
flag. This will lock all accounts by default and you need to unlock each one to send a transaction.
There's more...
There is a GUI for ganache that offers an easy-to-use interface for creating Ethereum networks. It even offers an intuitive User Interface (UI) for browsing blocks and transactions.
You can download and install the ganache GUI from http://truffleframework.com/ganache/.