Eric Rafaloff

My personal blog on software development and security

Home » Running Your Own Private Ethereum Network

Running Your Own Private Ethereum Network

If you’re looking to get your feet wet in Ethereum or test out a new contract that you’re developing, you may choose to run your own private network. This can be done rather than using one of Ethereum’s public testnets. By running your own private network, you can maintain total control over the network and create specific test conditions that you may find useful. You also don’t risk having others discover your new contract before you’re ready to announce it to the world.

Setting up and running your own private network is relatively easy. I present two popular options, each with their own pros and cons:

  • Geth is a popular fully fledged client and is able to do this out of the box. Setup is required, but it’s fairly straight forward.
  • TestRPC simulates an in-memory blockchain and provides a HTTP RPC server. It is extremely fast and easy to setup and tear down. However, as of today TestRPC does not implement every Ethereum API. These limitations are apparent, for example, when trying to use Mist to send personal transactions (see bug report here).

Option 1: Geth

Step 1. Genesis Block Configuration

The first thing we need to is configure our own genesis block. Create the following genesis.json file:

This configuration starts the blockchain with a couple of modern improvements (see eips), gives it its own chain ID, and sets the mining difficulty to something low so you mine new blocks without much effort.

Step 2. Blockchain Initialization

Next you’ll want to initialize your blockchain inside of a specified data directory. To do this, run the following:

Step 3. Start Node

The last step to setup your private network is to start your node. The following uses some sensible options, such as setting a custom network ID, disabling peer discovery, enabling IPC, and setting a non-conflicting port. You’ll also immediately drop into a console.

Next Steps

At this point your private network is up and running. You’ll probably want to do things like create a new wallet, start mining, and deploy your contract.

To start and stop mining, you can simply run the following in your geth console:

Most other things that you’ll want to do can be done directly from Mist. To start Mist, run the following (modifying slightly if you’re on an OS other than OS X):

Option 2: TestRPC

Step 1. Installation

TestRPC is a node application and is available from npm. If you don’t already have node installed, you should install it first.

To install TestRPC simply run:

Step 2. Start Server

The next step is to start the TestRPC HTTP server. There is no need to manually initialize the blockchain or pass any arguments to the application. When you run testrpc, you should see output similar to the following:

Next Steps

At this point your private network is up and running. As I mentioned earlier, TestRPC is somewhat limited in what remote procedure calls are supported for the time being. For example, the entire Personal API isn’t supported yet, so you won’t be able send TestRPC a remote procedure call to create a personal transaction (see bug report here). If you don’t need to use any of the non-supported APIs, you can still deploy your contracts using a framework such as Truffle. It has built-in support for TestRPC and will use supported APIs to deploy your contract.


Both options have their own pros and cons. Geth is fully featured but requires that you configure and run a full node. TestRPC is fast and easy to setup and tear down, and even offers new features such as blockchain “snapshots” (which can be extremely useful for testing). However, it doesn’t support all of Ethereum’s APIs yet. It’s a great tool for contract development and testing if you can work around this.

Name of author

Name: ericr