[Ethereum] testnet mining extremely slow

go-ethereumminingtestnets

I'm trying to run a private testnet (OSX, geth v1.3.5) but finding that mining is either not starting properly or is extremely slow.

I am using a custom genesis json as follows:

{
"nonce": "0x0000000000000042",
"timestamp": "0x0",
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"extraData": "0x0",
"gasLimit": "0x8000000",
"difficulty": "0x400",
"mixhash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"coinbase": "0x3333333333333333333333333333333333333333",
"alloc": {
}}

And I am starting geth with the following flags:

    geth --identity "testnet" --genesis <filepath to my gensis.json> --rpc --rpcport "8000" --rpccorsdomain "*" --datadir <filepath to empty folder> --port 30303 --nodiscover --ipcapi "admin,db,eth,debug,miner,net,shh,txpool,personal,web3" --rpcapi "db,eth,net,web3" --autodag --networkid 1900 --nat "any" --verbosity 3 console

Running a testnet like this right now, and have mined 1 block in about 6 minutes. Hashrate is currently 2600. The logs I see in the console though don't seem to be indicating that mining should be this slow:

I0313 17:00:16.201128     845 worker.go:348] 🔨  Mined block (#1 / 43640ff2). Wait 5 blocks for confirmation
I0313 17:00:16.216848     845 worker.go:569] commit new work on block 2 with 0 txs & 0 uncles. Took 12.437538ms
I0313 17:00:16.219133     845 worker.go:569] commit new work on block 2 with 0 txs & 0 uncles. Took 1.237624ms

A few weeks ago I was able to get a testnet running with a difficulty of 0x400 and it was giving me a block every second, haven't been able to figure out why this is stalling so much.

Best Answer

I am guessing, "difficulty": "0x400" is your bottleneck, you have 2 options to get it working as expected

1. Crete a new genesis block.

In the new genesis file put "difficulty": "0x200"

2. Let geth create own file for dev env.

You can start geth in dev mode with geth --dev which will take care of everything.

Related Topic