[Ethereum] Geth will not start mining in private network!

go-ethereumminingprivate-blockchaintestnets

Will somebody please help me out? I am stuck at this since hours; did the process +3 times, each time deleting the datadir content. Geth still will not start mining!!

Specs:
Geth 1.8.11, on macOS X

This is what I did:

1. Used this genesis.json file

{
  "difficulty" : "0x20000",
  "extraData"  : "",
  "gasLimit"   : "0x8000000",
  "alloc": {},
  "config": {
        "chainId": 15,
        "homesteadBlock": 0,
        "eip155Block": 0,
        "eip158Block": 0
    }
}

2. Ran geth with these two commands

Initialized the private chain geth --datadir=/Users/shaikhaalothman/chaindata init /Users/shaikhaalothman/genesis/genesis.json then started geth geth --datadir=/Users/shaikhaalothman/chaindata


Last login: Mon Jun 25 22:15:52 on ttys000
Shaikhas-MacBook-Pro:~ shaikhaalothman$ geth --datadir=/Users/shaikhaalothman/chaindata init /Users/shaikhaalothman/genesis/genesis.json
INFO [06-25|22:20:29] Maximum peer count                       ETH=25 LES=0 total=25
INFO [06-25|22:20:29] Allocated cache and file handles         database=/Users/shaikhaalothman/chaindata/geth/chaindata cache=16 handles=16
INFO [06-25|22:20:29] Writing custom genesis block 
INFO [06-25|22:20:29] Persisted trie from memory database      nodes=0 size=0.00B time=11.447µs gcnodes=0 gcsize=0.00B gctime=0s livenodes=1 livesize=0.00B
INFO [06-25|22:20:29] Successfully wrote genesis state         database=chaindata                                       hash=0613eb…9a64e7
INFO [06-25|22:20:29] Allocated cache and file handles         database=/Users/shaikhaalothman/chaindata/geth/lightchaindata cache=16 handles=16
INFO [06-25|22:20:29] Writing custom genesis block 
INFO [06-25|22:20:29] Persisted trie from memory database      nodes=0 size=0.00B time=4.588µs  gcnodes=0 gcsize=0.00B gctime=0s livenodes=1 livesize=0.00B
INFO [06-25|22:20:29] Successfully wrote genesis state         database=lightchaindata                                       hash=0613eb…9a64e7
Shaikhas-MacBook-Pro:~ shaikhaalothman$ geth --datadir=/Users/shaikhaalothman/chaindata 
INFO [06-25|22:20:39] Maximum peer count                       ETH=25 LES=0 total=25
INFO [06-25|22:20:39] Starting peer-to-peer node               instance=Geth/v1.8.11-stable-dea1ce05/darwin-amd64/go1.10.3
INFO [06-25|22:20:39] Allocated cache and file handles         database=/Users/shaikhaalothman/chaindata/geth/chaindata cache=768 handles=128
INFO [06-25|22:20:39] Initialised chain configuration          config="{ChainID: 15 Homestead: 0 DAO: <nil> DAOSupport: false EIP150: <nil> EIP155: 0 EIP158: 0 Byzantium: <nil> Constantinople: <nil> Engine: unknown}"
INFO [06-25|22:20:39] Disk storage enabled for ethash caches   dir=/Users/shaikhaalothman/chaindata/geth/ethash count=3
INFO [06-25|22:20:39] Disk storage enabled for ethash DAGs     dir=/Users/shaikhaalothman/.ethash               count=2
INFO [06-25|22:20:39] Initialising Ethereum protocol           versions="[63 62]" network=1
INFO [06-25|22:20:39] Loaded most recent local header          number=0 hash=0613eb…9a64e7 td=131072
INFO [06-25|22:20:39] Loaded most recent local full block      number=0 hash=0613eb…9a64e7 td=131072
INFO [06-25|22:20:39] Loaded most recent local fast block      number=0 hash=0613eb…9a64e7 td=131072
INFO [06-25|22:20:39] Regenerated local transaction journal    transactions=0 accounts=0
INFO [06-25|22:20:39] Starting P2P networking 
INFO [06-25|22:20:41] UDP listener up                          self=enode://de764357ef765c4cb6fb7aed6e97b895d1f67837ce3764a5dcf138e7f48a5044a81d68d54c18d653a825784bb52e90220ab05f42c176d44cf44b242985bc2118@[::]:30303
INFO [06-25|22:20:41] RLPx listener up                         self=enode://de764357ef765c4cb6fb7aed6e97b895d1f67837ce3764a5dcf138e7f48a5044a81d68d54c18d653a825784bb52e90220ab05f42c176d44cf44b242985bc2118@[::]:30303
INFO [06-25|22:20:41] IPC endpoint opened                      url=/Users/shaikhaalothman/chaindata/geth.ipc
INFO [06-25|22:22:27] Updated mining threads                   threads=1
INFO [06-25|22:22:27] Transaction pool price threshold updated price=18000000000
INFO [06-25|22:22:27] Starting mining operation 
INFO [06-25|22:22:27] Commit new mining work                   number=1 txs=0 uncles=0 elapsed=72.379ms
INFO [06-25|22:23:14] Updated mining threads                   threads=1
INFO [06-25|22:29:59] Updated mining threads                   threads=1

3. Launched Mist with the private network ipc file

Launched Mist with command /applications/mist.app/contents/macos/mist --rpc /Users/shaikhaalothman/chaindata/geth.ipc


Last login: Mon Jun 25 22:20:14 on ttys000
Shaikhas-MacBook-Pro:~ shaikhaalothman$ /applications/mist.app/contents/macos/mist --rpc /Users/shaikhaalothman/chaindata/geth.ipc
[2018-06-25T22:21:00.528] [INFO] Settings - Running in production mode: true
[2018-06-25T22:21:00.616] [INFO] EthereumNode - undefined 'light' 'light'
[2018-06-25T22:21:00.618] [INFO] EthereumNode - Defaults loaded: geth main light
[2018-06-25T22:21:00.784] [INFO] main - Starting in Mist mode
[2018-06-25T22:21:03.580] [INFO] Db - Loading db: /Users/shaikhaalothman/Library/Application Support/Mist/mist.lokidb
[2018-06-25T22:21:03.691] [INFO] Windows - Creating commonly-used windows
[2018-06-25T22:21:03.693] [INFO] Windows - Create secondary window: loading, owner: notset
[2018-06-25T22:21:07.847] [INFO] updateChecker - Check for update...
[2018-06-25T22:21:12.839] [INFO] Windows - Create primary window: main, owner: notset
[2018-06-25T22:21:12.859] [INFO] Windows - Create primary window: splash, owner: notset
[2018-06-25T22:21:19.141] [INFO] (ui: popupWindow) - Web3 not yet initialized, doing so now with HttpProvider.
[2018-06-25T22:21:19.161] [INFO] updateChecker - App is up-to-date.
[2018-06-25T22:21:19.162] [INFO] (ui: splashscreen) - Web3 already initialized, re-using provider.
[2018-06-25T22:21:19.163] [INFO] (ui: popupWindow) - Web3 already initialized, re-using provider.
[2018-06-25T22:21:19.307] [INFO] (ui: splashscreen) - Meteor starting up...
[2018-06-25T22:21:19.308] [INFO] (ui: popupWindow) - Meteor starting up...
[2018-06-25T22:21:19.309] [INFO] (ui: popupWindow) - Meteor starting up...
[2018-06-25T22:21:20.585] [INFO] ClientBinaryManager - Initializing...
[2018-06-25T22:21:20.586] [INFO] ClientBinaryManager - Checking for new client binaries config from: https://raw.githubusercontent.com/ethereum/mist/master/clientBinaries.json
[2018-06-25T22:21:21.038] [INFO] ClientBinaryManager - No "skippedNodeVersion.json" found.
[2018-06-25T22:21:21.040] [INFO] ClientBinaryManager - Initializing...
[2018-06-25T22:21:21.041] [INFO] ClientBinaryManager - Resolving platform...
[2018-06-25T22:21:21.042] [INFO] ClientBinaryManager - Calculating possible clients...
[2018-06-25T22:21:21.044] [INFO] ClientBinaryManager - 1 possible clients.
[2018-06-25T22:21:21.044] [INFO] ClientBinaryManager - Verifying status of all 1 possible clients...
[2018-06-25T22:21:21.045] [INFO] ClientBinaryManager - Verify Geth status ...
[2018-06-25T22:21:21.891] [INFO] ClientBinaryManager - Checking for Geth sanity check ...
[2018-06-25T22:21:21.892] [INFO] ClientBinaryManager - Checking for Geth sanity check ...
[2018-06-25T22:21:21.892] [INFO] ClientBinaryManager - Checking sanity for Geth ...
[2018-06-25T22:21:21.895] [INFO] ClientBinaryManager - Checking sanity for Geth ...
[2018-06-25T22:21:23.210] [INFO] Sockets/node-ipc - Connect to {"path":"/Users/shaikhaalothman/chaindata/geth.ipc"}
[2018-06-25T22:21:23.213] [INFO] Sockets/node-ipc - Connected!
[2018-06-25T22:21:23.214] [INFO] NodeSync - Ethereum node connected, re-start sync
[2018-06-25T22:21:23.215] [INFO] NodeSync - Starting sync loop
[2018-06-25T22:21:23.216] [INFO] Sockets/2 - Connect to {"path":"/Users/shaikhaalothman/chaindata/geth.ipc"}
[2018-06-25T22:21:23.217] [INFO] Sockets/4 - Connect to {"path":"/Users/shaikhaalothman/chaindata/geth.ipc"}
[2018-06-25T22:21:23.218] [INFO] main - Connected via IPC to node.
[2018-06-25T22:21:23.233] [INFO] Sockets/2 - Connected!
[2018-06-25T22:21:23.234] [INFO] Sockets/4 - Connected!
[2018-06-25T22:21:23.444] [INFO] (ui: splashscreen) - Network is privatenet
[2018-06-25T22:21:23.445] [INFO] (ui: splashscreen) - Network is privatenet
[2018-06-25T22:21:27.479] [INFO] NodeSync - Sync has been skipped
[2018-06-25T22:21:27.480] [INFO] NodeSync - Sync loop ended
[2018-06-25T22:21:27.481] [INFO] main - Loading Interface at file:///Applications/Mist.app/Contents/Resources/app.asar/interface/index.html
[2018-06-25T22:21:28.710] [INFO] Sockets/3 - Connect to {"path":"/Users/shaikhaalothman/chaindata/geth.ipc"}
[2018-06-25T22:21:28.711] [INFO] Sockets/3 - Connected!
[2018-06-25T22:21:29.392] [INFO] (ui: mist) - Web3 already initialized, re-using provider.
[2018-06-25T22:21:29.644] [INFO] (ui: mist) - Meteor starting up...
[2018-06-25T22:21:29.658] [INFO] (ui: mist) - Initialise Mist Interface
[2018-06-25T22:21:31.209] [INFO] (ui: mist) - Network is privatenet
[2018-06-25T22:21:33.649] [INFO] (ui: mist) - did-navigate wallet https://wallet.ethereum.org/
[2018-06-25T22:21:33.706] [INFO] Sockets/3 - Disconnecting...
[2018-06-25T22:21:33.969] [INFO] Sockets/3 - Connect to {"path":"/Users/shaikhaalothman/chaindata/geth.ipc"}
[2018-06-25T22:21:33.970] [INFO] Sockets/3 - Connected!
[2018-06-25T22:21:34.247] [INFO] (ui: mist) - did-navigate browser https://github.com/ethereum/mist/releases
[2018-06-25T22:21:34.249] [INFO] Sockets/3 - Disconnecting...
[2018-06-25T22:21:34.253] [INFO] Sockets/6 - Connect to {"path":"/Users/shaikhaalothman/chaindata/geth.ipc"}
[2018-06-25T22:21:34.255] [INFO] Sockets/6 - Connected!
[2018-06-25T22:21:34.314] [INFO] Sockets/3 - Connect to {"path":"/Users/shaikhaalothman/chaindata/geth.ipc"}
[2018-06-25T22:21:34.315] [INFO] Sockets/3 - Connected!
[2018-06-25T22:21:34.505] [INFO] Sockets/5 - Connect to {"path":"/Users/shaikhaalothman/chaindata/geth.ipc"}
[2018-06-25T22:21:34.506] [INFO] Sockets/5 - Connected!
[2018-06-25T22:21:36.584] [INFO] (ui: mist) - did-navigate-in-page wallet https://wallet.ethereum.org/
[2018-06-25T22:21:36.701] [INFO] (ui: mist) - dom-ready wallet https://wallet.ethereum.org/
[2018-06-25T22:21:40.442] [INFO] (ui: mist) - did-stop-loading wallet https://wallet.ethereum.org/
[2018-06-25T22:21:41.252] [INFO] (ui: mist) - dom-ready browser https://github.com/ethereum/mist/releases
[2018-06-25T22:21:42.799] [INFO] (ui: mist) - did-stop-loading browser https://github.com/ethereum/mist/releases

4. I ran geth attach

I ran geth attach /Users/shaikhaalothman/chaindata/geth.ipc
, then set miner.setEtherbase("f8ddc84985c88e209a9f345bd6e87e9373cf386c"), and started mining via miner.start(1);


Last login: Mon Jun 25 22:20:53 on ttys001
Shaikhas-MacBook-Pro:~ shaikhaalothman$ geth attach /Users/shaikhaalothman/chaindata/geth.ipc
Welcome to the Geth JavaScript console!

instance: Geth/v1.8.11-stable-dea1ce05/darwin-amd64/go1.10.3
 modules: admin:1.0 debug:1.0 eth:1.0 miner:1.0 net:1.0 personal:1.0 rpc:1.0 txpool:1.0 web3:1.0

> miner.setEtherbase("f8ddc84985c88e209a9f345bd6e87e9373cf386c")
true
> miner.start(1);
null
> miner.start(1);
null
> miner.start(1);
null
> 

I am out of ideas as to what is wrong. If you have any ideas… your input will be appreciated

Best Answer

I believe you are attempting to create a private chain (with ID 15) but only initialize the files for it. Then you launch Mist which starts a production geth node instead of connecting to a node which runs on your private chain. Between the init and launching Mist, there could be another command to start a private mining node using your genesis block and inited files to which you can connect your Mist client.

Related Topic