I am following this answer:

How do I set up a private ethereum network?

but my result of miner.start() will return null

Is it because my geth version is 1.6.6-stable?

Also welcome any beginner's guide to develop dApp.

  • After I type miner.start(), I found my Mist wallet mining in main network.
    – Shukai Ni
    Jun 28 '17 at 4:21

This is how I run my private network using geth on Ubuntu:

Create a simple genesis.json file, e.g.

  "config": {
    "chainId": 1907,
    "homesteadBlock": 0,
    "eip155Block": 0,
    "eip158Block": 0
  "difficulty": "40",
  "gasLimit": "2100000",
  "alloc": {}

Create a first node and make sure it works:

$ mkdir node1
$ geth --datadir node1 account new
$ geth --datadir node1 account new
$ geth --datadir node1 init genesis.json
$ geth --datadir node1 --networkid 98765 console
> miner.start(1)

Once you have done some mining on this node, stop the miner with miner.stop() (This isn't absolutely necessary but it is just convenient so you don't see too many info messages appearing in the console while trying to copy/paste the enode address, coming up next).

Make sure you know the enode address of the first node, you will need this to connect your second node:

> admin.nodeInfo
{  enode: "enode://08993401988acce4cd85ef46a8af10d1cacad39652c98a9df4d5785248d1910e51d7f3d330f0a96053001264700c7e94c4ac39d30ed5a5f79758774208adaa1f@[::]:30303", 

Let's do the same steps now to set up second node:

$ mkdir node2
$ geth --datadir node2 account new
$ geth --datadir node2 account new
$ geth --datadir node2 init genesis.json
$ geth --datadir node2 --networkid 98765 --port 30304 --bootnodes "enode://08993401988acce4cd85ef46a8af10d1cacad39652c98a9df4d5785248d1910e51d7f3d330f0a96053001264700c7e94c4ac39d30ed5a5f79758774208adaa1f@" console

Notice that we had to change [::] to the IP address of the host.

Once you start this node, wait for a little while and then you will eventually see the blocks that you mined on your first node being synced over.

I have written up more of my experiences getting started with geth, private network and smart contract here in case you want more details: https://alanbuxton.wordpress.com/2017/07/19/first-steps-with-ethereum-private-networks-and-smart-contracts-on-ubuntu-16-04/

  • These instructions were very helpful for a basic miner but my second node is not connecting to the first, and vice-versa. admin.peers returns an empty set. I'll have to start a new thread to see if I can figure that out. Apr 25 '20 at 15:31

I too have a private testnet working pretty OK till now. I am yet to start dApp development though - in fact, I require a good enough dApp tutorial. As far as your miner.start() returning null is concerned, that is pretty much alright. Ideally yes, it should return true, but if it doesn't, please check if the system is mining using the command eth.mining. If it is returning true, it means the blocks are getting mined.

Also keep in mind that if eth.mining is true for a very long time, say an hour or two, but eth.blockNumber still returns 0, it is because mining requires at least a minimum of 4GB RAM. So if you're on a virtual machine, make sure you give it enough RAM.

  • 1
    null is the correct return code for miner.start() Aug 29 '17 at 14:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.