I set up a private in my linux system and create a new account using personal.createAccount
. After I start mining using miner.start()
. But i found block number is not increasing. Then I found my miner address is 0x000000000000000000000
using the command eth.getBlock(eth.blockNumber).miner
. I changed miner coinbase and everything but it still shows miner is 0. How can i mine some ethers in private network or is there any way to change miner address.
-
You cannot change the miner in blocks already mined, if you restart the miner it will use the created account when mining new blocks.– Ismael ♦Commented Apr 19, 2018 at 15:50
-
the zero miner can be only seen in genesis block, block number 0. So, you are probably looking at your genesis block, and there is no blocks in your blockchain except the genesis block, that means, you didn't mine any coins.– NulikCommented Apr 19, 2018 at 17:57
1 Answer
You don't have to mine ethers in private network. Instead, you can just edit your genesis.json file and add ethers to your coinbase account.
Once you create your network, you'll get 'geth' folder created. Start your network for the first time and create an account. This will generate another folder (don't remember the name now) that will have your private key. Keep this safe. Now, stop the network. Delete the 'geth' folder (which basically means that you're deleting your network/ node). Edit your genesis.json and set some ethers for your account. Now, create your network again and start it. Vola! you will have ethers.
-
Something like this should be added to your genesis.json file. "alloc": { "7b684d27167d208c66584ece7f09d8bc8f86ffff": { "balance": "100000000000000000000000" }, "ae13d41d66af28380c7af6d825ab557eb271ffff": { "balance": "120000000000000000000000" } } refer here Commented Apr 19, 2018 at 15:54