3

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.

  • Did you just try with miner.start()? – Aditya Jan 22 '18 at 14:18
3

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

0

Try miner.start(100)

This will created 100 threads, normally it takes a few minutes to build the DAG.

Check that you have set the etherbase account.

You could start mist pointing to your geth.ipc file and you should see the eth racking up.

Took me a few attempts but got there in the end.

0

Currently two problems seems to be present in your genesis.json: 1. "coinbase" : "0x0000000000000000000000000000000000000000" - this is default account, so it can not be zero address 2. "chainId": 0 - is ID of your network. Set any number above 10 to be on a safe side.

Here is my working genesis.json :

    {
  "coinbase"   : "0x0000000000000000000000000000000000000001",
  "difficulty" : "0x20000",
  "extraData"  : "",
  "gasLimit"   : "0x8000000",
  "nonce"      : "0x0000000000000042",
  "mixhash"    : "0x0000000000000000000000000000000000000000000000000000000000000000",
  "parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000",
  "timestamp"  : "0x00",
  "alloc": {},
  "config": {
        "chainId": 15,
        "homesteadBlock": 0,
        "eip155Block": 0,
        "eip158Block": 0
    }
}

PS: for more information have a look here:

  1. What does each genesis.json parameter mean?

  2. https://medium.com/taipei-ethereum-meetup/beginners-guide-to-ethereum-3-explain-the-genesis-file-and-use-it-to-customize-your-blockchain-552eb6265145

  • Okay, i am testing it with your genesis file and yes chain id is the id of the network. – Thinker Jan 23 '18 at 11:28

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.