2

I am running two nodes over a private blockchain with a custom genesis file that uses the new "config" recommended here. However, aside from the random handshakes with external nodes I am trying to deploy some contracts via RPC but my nodes don't seem to be mining (with eth.mining -> true ) nor syncing (eth.syncing -> false).

Should I modify my genesis file? isn't it supposed to be unique with the networkId?

{ 
    "nonce":      "0x0000000000000042", 
    "timestamp":  "0x00", 
    "extraData":  "0x0000...",
    "gasLimit":   "0xffffffff", 
    "difficulty": "0x400", 
    "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000", 
    "mixhash":    "0x0000000000000000000000000000000000000000000000000000000000000000", 
    "coinbase":   "0x0000000000000000000000000000000000000000", 
    "alloc": { 
           "0xX..." : { 
                  "balance" : "2000000000000000000000" 
            } 
    }, 
    "config": { 
            "chainId":        000000000, // 9-digit NetworkId 
            "homesteadBlock": 0, 
            "eip155Block":    0, 
            "eip158Block":    0 
    } 
}

My node is running with this configuration:

--cache=512 --verbosity=6 --v5disc --datadir <X> --nat extip:<IP> --networkid=<9-digit-val> --port 30303 --rpc --rpcaddr=0.0.0.0 --rpcapi=eth,net,web3,personal --rpccorsdomain '*' --ipcapi "admin,eth,debug,miner,net,shh,txpool,personal,web3" --identity <identity>

I don't know what happened, I remember being able to mine and seeing the mining icon in the logs but now I cannot find it anymore. I think it has to do with the genesis file and the handshakes.But this new configuration was required to build the custom genesis file: without the "config" it just uses the default genesis file.

Should I choose a different nonce? should I choose a different mixhash? what do I do to make my nodes "sync". Why are they not really mining?

The contracts that I deploy are not returning the contract address because they need to be mined but they aren't. This is blocking me.

Some of the logs that might be useful are:

Pooled new transaction                   hash=X from=Z to=nil
Submitted contract creation              fullhash=X contract=Y
Receipt not found for transaction        hash=X
Recalculated downloader QoS values       rtt=20s confidence=1.000 ttl=1m0s

eth.getTransaction("X") --> null and eth.getTransactionReceipt("X") --> null

EDIT 1

OK, Syncronization does not need to be active all the time so that is not an issue and nodes are indeed aware of each other. My nodes are apparently mining but they are doing it VERY slowly.

INFO [04-01|19:09:16] Starting mining operation (CPU=2 TOT=3)
INFO [04-01|19:09:16] commit new work on block 1 with 0 txs & 0 uncles. Took 270.048µs
INFO [04-01|19:09:20] Generating DAG in progress               epoch=0 percentage=0 elapsed=3.152s
INFO [04-01|19:09:23] Generating DAG in progress               epoch=0 percentage=1 elapsed=6.255s
…
INFO [04-01|19:14:29] Generating DAG in progress               epoch=0 percentage=98 elapsed=5m11.742s
INFO [04-01|19:14:32] Generating DAG in progress               epoch=0 percentage=99 elapsed=5m15.184s
INFO [04-01|19:14:32] Generated ethash verification cache      epoch=0 elapsed=5m15.186s
INFO [04-01|19:14:35] Generating ethash verification cache     epoch=1 percentage=92 elapsed=3.070s
INFO [04-01|19:14:36] Generated ethash verification cache      epoch=1 elapsed=3.321s
INFO [04-01|19:14:48] Generating DAG in progress               epoch=1 percentage=0  elapsed=12.845s
INFO [04-01|19:15:01] Generating DAG in progress               epoch=1 percentage=1  elapsed=25.004s
INFO [04-01|19:15:14] Generating DAG in progress               epoch=1 percentage=2  elapsed=38.901s
…
INFO [04-01|19:35:04] Generating DAG in progress               epoch=1 percentage=98 elapsed=20m28.515s
INFO [04-01|19:35:17] Generating DAG in progress               epoch=1 percentage=99 elapsed=20m41.456s
INFO [04-01|19:35:17] Generated ethash verification cache      epoch=1 elapsed=20m41.459s
INFO [04-01|22:13:17] Imported new chain segment               blocks=1 txs=0 mgas=0.000 elapsed=234.729ms  mgasps=0.000 number=1 hash=557be4…2e9969
INFO [04-01|22:13:17] commit new work on block 2 with 0 txs & 0 uncles. Took 128.743176ms
INFO [04-01|23:12:16] Imported new chain segment               blocks=1 txs=0 mgas=0.000 elapsed=280.209ms  mgasps=0.000 number=2 hash=1029e5…3e6fe1
INFO [04-01|23:12:16] commit new work on block 3 with 0 txs & 0 uncles. Took 78.8775ms
INFO [04-02|04:44:13] Imported new chain segment               blocks=1 txs=0 mgas=0.000 elapsed=346.606ms  mgasps=0.000 number=3 hash=742a81…00abe3
INFO [04-02|04:44:14] commit new work on block 4 with 0 txs & 0 uncles. Took 16.207639ms
INFO [04-02|05:12:00] Imported new chain segment               blocks=1 txs=0 mgas=0.000 elapsed=360.243ms  mgasps=0.000 number=4 hash=e2470c…73e53d
INFO [04-02|05:12:00] commit new work on block 5 with 0 txs & 0 uncles. Took 105.105233ms
INFO [04-02|06:12:37] 🔨  mined potential block #5 [868453b1…], waiting for 5 blocks to confirm 
INFO [04-02|06:12:38] commit new work on block 6 with 0 txs & 0 uncles. Took 166.786951ms
INFO [04-02|07:22:14] Imported new chain segment               blocks=1 txs=0 mgas=0.000 elapsed=320.824ms  mgasps=0.000 number=6 hash=04b7fd…0d2c4e
INFO [04-02|07:22:15] commit new work on block 7 with 0 txs & 0 uncles. Took 95.852111ms
INFO [04-02|08:57:34] 🔨  mined potential block #7 [abc51adf…], waiting for 5 blocks to confirm 
INFO [04-02|08:57:34] commit new work on block 8 with 0 txs & 0 uncles. Took 183.782637ms
INFO [04-02|09:47:23] Imported new chain segment               blocks=1 txs=0 mgas=0.000 elapsed=297.563ms  mgasps=0.000 number=8 hash=40c13e…81f629
INFO [04-02|09:47:23] commit new work on block 9 with 0 txs & 0 uncles. Took 162.173753ms
INFO [04-02|11:31:55] Imported new chain segment               blocks=1 txs=0 mgas=0.000 elapsed=309.047ms  mgasps=0.000 number=9 hash=3a381a…585b24
INFO [04-02|11:31:55] commit new work on block 10 with 0 txs & 0 uncles. Took 145.570604ms 
INFO [04-02|15:23:24] 🔗  mined block #5 [868453b1…] reached canonical chain 
INFO [04-02|15:23:25] 🔨  mined potential block #10 [da06a4af…], waiting for 5 blocks to confirm 
INFO [04-02|15:23:25] commit new work on block 11 with 0 txs & 0 uncles. Took 79.329043ms

What can I do to make it mine faster?

3 Answers 3

2

Well, the reason why it was mining so slow was the RAM of the VM (1GB) was not enough. Not entirely sure if 2G would be enough but 5G of RAM are mining blocks quite fast.

1

It appears your nodes are not aware of each other. Try admin.peers from a console. If it is empty they are not connected.

Execute in the geth console on one of the nodes admin.nodeInfo, it will return something like this:

{
  enode: "enode://702de1918184581815e1a00e63d849524cb4126b9b5886090eabd4d4b5dc6f24c4198249775df30f835b1bfbc9a9733c014b27a99008043f3274c22e49db6fca@[::]:30303",
  // other fields...
}

Now in the second node console run admin.addPeer(<enode>), replacing after the @[::] with the correct IP.

For example if the first node is at 192.168.0.123, in the sencond node you should run admin.addPeer(enode://702de1918184581815e1a00e63d849524cb4126b9b5886090eabd4d4b5dc6f24c4198249775df30f835b1bfbc9a9733c014b27a99008043f3274c22e49db6fca@192.168.0.123:30303).

1
  • Both nodes recognize each other as peers and are displyaing the right IP address beause I am using --nat extip:IP so adding the peer is not the issue. Commented Mar 31, 2017 at 21:14
1

in my system, switching the miner from a machine with 4GB ram to a VM with 2GB ram made the mining nearly grind to a halt, and when I reverse this then mining speed goes quickly..

add the switch --nodiscover to the geth options list and create a static-nodes.json file with the enodes id of each node then put static-nodes.json in your datadir root and restart.

[
  "enode...",
  "enode..."
]

admin.nodeInfo.enode in the JSRE console

for an internal private network this works well.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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