1

I want to develop a dapp and deploy on geth. I have installed geth and mist wallet. Now, when I am starting miner.start(1) to make some ethers for account. It is showing me null and no ether is getting generated. I have geth running on 1 terminal window, Mist wallet opened and geth console running on 2nd terminal window. I am following a tutorial on youtube and in that miner.start(2) returns true and mining starts within no time. Please help how I can generate ether for my private network.

My genesis.json is

{
  "alloc": {
  "0x0000000000000000000000000000000000000001": {"balance": "111111111"},
  "0x0000000000000000000000000000000000000002": {"balance": "222222222"}
  },
  "config": {
        "chainId": 15,
        "homesteadBlock": 0,
        "eip155Block": 0,
        "eip158Block": 0
    },
  "coinbase"   : "0x0000000000000000000000000000000000000000",
  "difficulty" : "0x20000",
  "extraData"  : "",
  "gasLimit"   : "0x2fefd8",
  "nonce"      : "0x0000000000000042",
  "mixhash"    : "0x0000000000000000000000000000000000000000000000000000000000000000",
  "parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000",
  "timestamp"  : "0x00"
}

Please help in how to solve miner.start() issue.

  • @PrashantPrabhakarSingh that question didn't help me. I have added my one of my account in alloc. still it is not showing anything in the ethereum wallet. – UbuntuCoder Aug 9 '17 at 8:59
  • Lower the difficulty level to "0x400", try with miner.start(1) it may take some time to generate the DAG. Also every time you modify the genesis requires a restart geth <other params> removedb & geth <other params> init genesis.json – Ismael Aug 9 '17 at 17:16
  • @Ismael I have lowered the difficulty level to "0x200" and set alloc to my accounts as well as coinbase to one of my account. But the main thing is miner.start(1) is returning me null and is doing nothing. – UbuntuCoder Aug 10 '17 at 4:20
  • Which version of geth are you using? I have 1.6.7 in both windows and linux working as expected. You can try adding --datadir <directory> to point an empty directory to discard any problems with your old data directory. – Ismael Aug 10 '17 at 15:30
1

I finally got the answer of my question. After following the steps till genesis.json and making the directory, all we need to do is to make some accounts first. It is required as the 0th which is the 1st account is set as the coinbase automatically. We can set any other account as coinbase also. But it is important because when we mine, there has to be some account which takes the ether. So, after making the account, check eth.coinbase ,it should be same as 0th account.

Then just do miner.start() It will return null where the confusion was. It will return you null but the mining will actually start. It will give you a msg like this

INFO [08-16|10:26:51] Commit new mining work                   number=1 txs=0 uncles=0 elapsed=204.377µs

And after waiting for some time (around 2-3 hours) your coinbase or 0th account will get ether and blocks will get generated.

INFO [08-16|11:32:58] Successfully sealed new block            number=1 hash=6a867b…8d7b13
INFO [08-16|11:32:58] 🔨 mined potential block                  number=1 hash=6a867b…8d7b13
INFO [08-16|11:32:59] Commit new mining work                   number=2 txs=0 uncles=0 elapsed=36.597ms

As you can see, it took more than an hour to have some activity. So, have patience and go with it.

I'm sharing this link which I believe is very much helpful. https://alanbuxton.wordpress.com/2017/07/19/first-steps-with-ethereum-private-networks-and-smart-contracts-on-ubuntu-16-04/

After following this link, you can do transactions between 2 accounts. You can deploy smart contracts on geth.

If you have any problem in any of the steps. Feel free to comment or message.

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.