I am trying to set up a simple test network with Go Ethereum starting with just one node. I tried on two MacBooks (macOS High Sierra 10.13.6), one with 4GB RAM and one with 8GB RAM and on an AWS EC2 t2.micro instance (Ubuntu 18.x). Then I tried it on a Windows 8 machine with 4GB RAM.
The setup works fine but when I try to mine, the interesting situation is that the exact same steps work on the Windows machine but not on the Macs or on the AWS EC2 instance. I understand that the AWS free tier instance may not have sufficient power, will try on a higher instance but the MacBook Air with 8GB RAM should have been sufficient.
Can anyone help or has anyone has had a similar experience? I have tried multiple options based on the guidance provided on forums. Details below:
geth version:
Version: 1.9.14-stable
Architecture: amd64
Protocol Versions: [65 64 63]
Go Version: go1.14.2
Operating System: darwin
GOPATH=
GOROOT=/usr/local/Cellar/go/1.14.2_1/libexec
Steps I follow to start the geth node:
Create an account:
geth account new
My genesis.json:
{
"config":{
"chainId":15,
"homesteadBlock":0,
"eip150Block":0,
"eip155Block":0,
"eip158Block":0
},
"difficulty":"0x200",
"gasLimit":"21000",
"alloc":{
<account address>: { "balance": "1000000000" }
}
}
Initialize and launch geth:
geth --datadir <dir> init genesis.json
geth --mine --nodiscover --maxpeers 0 --networkid 15 --rpc --nousb --allow-insecure-unlock --unlock <address> --rpcapi "db,eth,net,web3,personal,miner,admin,txpool,debug" --datadir "<data dir>" --verbosity 5 --syncmode "full"
Run geth attach:
geth attach http://127.0.0.1:8545
instance: Geth/v1.9.14-stable/darwin-amd64/go1.14.2
coinbase: <account address>
at block: 0 (Thu Jan 01 1970 05:30:00 GMT+0530 (IST))
datadir: <data dir>
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
To start mining Note: Have tried with and without deleting the ethash folder and re-generating the DAG. On Windows, on my second attempt, it did not mine without deleting the DAG and started mining once I deleted the DAG and it was re-created.
miner.setEtherbase(<address>)
miner.start(1)
I do the following checks and here's what I get in the non-working cases (and in brackets what I get when it works on Windows)
>eth.blockNumber
0 (shows an increasing number on the Windows machine)
>eth.hashrate
0 (shows a varying number on the Windows machine)
>eth.syncing
false
>eth.minin
true
>eth.getBalance(eth.accounts[0])
0 (shows increasing Ether on the Windows machine)
Finally, here's what I believe is a major difference in the geth console output on the Mac where it it not working
Current full block not old enough
On the Windows machine where it works I get the output I see everyone gets as posted on forums so that seems fine
Also posting what I feel is the relevant part of the console output from my AWS run but it's the same on the Mac run:
INFO [05-16|06:28:49.940] Allocated cache and file handles database=/home/ubuntu/.ethereum/geth/chaindata cache=163.00MiB handles=524288
TRACE[05-16|06:28:49.958] Started watching keystore folder path=/home/ubuntu/.ethereum/keystore
DEBUG[05-16|06:28:49.974] Chain freezer table opened database=/home/ubuntu/.ethereum/geth/chaindata/ancient table=bodies items=0 size=0.00B
DEBUG[05-16|06:28:49.984] Chain freezer table opened database=/home/ubuntu/.ethereum/geth/chaindata/ancient table=receipts items=0 size=0.00B
DEBUG[05-16|06:28:49.994] Chain freezer table opened database=/home/ubuntu/.ethereum/geth/chaindata/ancient table=diffs items=0 size=0.00B
DEBUG[05-16|06:28:50.004] Chain freezer table opened database=/home/ubuntu/.ethereum/geth/chaindata/ancient table=headers items=0 size=0.00B
DEBUG[05-16|06:28:50.014] Chain freezer table opened database=/home/ubuntu/.ethereum/geth/chaindata/ancient table=hashes items=0 size=0.00B
INFO [05-16|06:28:50.014] Opened ancient database database=/home/ubuntu/.ethereum/geth/chaindata/ancient
INFO [05-16|06:28:50.015] Initialised chain configuration config="{ChainID: 15 Homestead: 0 DAO: <nil> DAOSupport: false EIP150: 0 EIP155: 0 EIP158: 0 Byzantium: <nil> Constantinople: <nil> Petersburg: <nil> Istanbul: <nil>, Muir Glacier: <nil>, Engine: unknown}"
INFO [05-16|06:28:50.015] Disk storage enabled for ethash caches dir=/home/ubuntu/.ethereum/geth/ethash count=3
INFO [05-16|06:28:50.023] Disk storage enabled for ethash DAGs dir=/home/ubuntu/.ethash count=2
INFO [05-16|06:28:50.023] Initialising Ethereum protocol versions="[65 64 63]" network=15 dbversion=<nil>
WARN [05-16|06:28:50.023] Upgrade blockchain database version from=<nil> to=7
INFO [05-16|06:28:50.023] Loaded most recent local header number=0 hash=5e3add…1b4fb7 td=512 age=51y1mo1w
INFO [05-16|06:28:50.023] Loaded most recent local full block number=0 hash=5e3add…1b4fb7 td=512 age=51y1mo1w
INFO [05-16|06:28:50.024] Loaded most recent local fast block number=0 hash=5e3add…1b4fb7 td=512 age=51y1mo1w
DEBUG[05-16|06:28:50.024] Reinjecting stale transactions count=0
INFO [05-16|06:28:50.024] Loaded local transaction journal transactions=0 dropped=0
INFO [05-16|06:28:50.024] Regenerated local transaction journal transactions=0 accounts=0
DEBUG[05-16|06:28:50.026] Current full block not old enough number=0 hash=5e3add…1b4fb7 delay=90000
DEBUG[05-16|06:28:50.026] Recalculated downloader QoS values rtt=20s confidence=1.000 ttl=1m0s
Would really appreciate any help but just a reminder again that everything works on my Windows machine so the steps are ok to some extent, and this is something specific to macOS and Ubuntu or less likely the physical hardware.
Update: I changed the consensus engine to Clique (Proof of Authority) and mining started on my Mac.