[Ethereum] Mining not working in ethereum private net

go-ethereummining

I was trying to enable mining over my private network but it won't start.

My Understanding so far about mining

Mining is used to mine new block , to confirm transaction and also to generate new coins into the network. Mining continues even if there are no transaction in order to add new layer of difficulty for future consensus(that how POW works).

But whenever i call miner.start(1) it just displays the message below .

INFO [01-22|19:05:53] Updated mining threads                   threads=10
INFO [01-22|19:05:53] Transaction pool price threshold updated price=18000000000
INFO [01-22|19:05:53] Starting mining operation 
INFO [01-22|19:05:53] Commit new mining work                   number=1 txs=0 uncles=0 elapsed=296.569µs

And thats it.It won't generate new blocks and no reward is transfered to my etherbase. sometimes it do start but after a long pause after calling miner.start(1) (approx 15-20 minutes and then it keep generating new blocks)

My Genesis.json file is

     {
       "config": {
      "chainId": 0,
      "homesteadBlock": 0,
      "eip155Block": 0,
      "eip158Block": 0
  },
"alloc"      : {},
"coinbase"   : "0x0000000000000000000000000000000000000000",
"difficulty" : "0x20000",
"extraData"  : "",
"gasLimit"   : "0x2fefd8",
"nonce"      : "0x0000000000000042",

  "mixhash":    "0x0000000000000000000000000000000000000000000000000000000000000000",
  "parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000",
 "timestamp"  : "0x00"
 }

I do not have any idea what is happening ,am i missing something that i should be aware of?

Please help.

Best Answer

The computer keeps files on any drive

/genesis.json

{
    "nonce"     : "0x0000000000000055",
    "mixHash"   : "0x0000000000000000000000000000000000000000000000000000000000000000",
    "parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000",
    "difficulty": "0x20000",
    "gasLimit"  : "0x800000",
    "timestamp" : "0x0",
    "extraData" : "",
    "coinbase"  : "0x0000000000000000000000000000000000000000",
    "alloc"     : {},
    "config"    : {
        "chainId": 100,
        "homesteadBlock": 0,
        "eip155Block": 0,
        "eip158Block": 0
    }
}

Then genesis file init and this command run example:

geth --datadir "D:\bolckchain\chaindata" init "c\genesis.json"

Then private network create example :

geth --networkid 20 --port 60303 --datadir "D:\Database\final_chain_database" console

NOTE: Ensure your blockchain is fully synchronised with the main chain before starting to mine, otherwise you will not be mining on the main chain

Then miner start

>miner.start(1)
null

Please wait some time

>miner.stop()
true

Try it

Related Topic