0

I've read countless posts referencing some form of "Synchronisation failed, dropping peer err='retrieved hash chain is invalid'" and of the few that had solutions, none of them worked for me.

I started using this tutorial, from which I used Geth to create a private PoW network with two local miner nodes on my PC (Windows 10). Initially things went swimmingly; I got the two miner nodes synced and mining properly, and was able to add a RPi into the mix and eventually deploy a smart contract using truffle that the RPi would then monitor through Python. Recently I got 2 more RPi's, but upon following the same steps as for the first RPi I was not able to sync them with my blockchain.

My chain is fewer than 50 blocks, yet I have been unable to get this up and running as I originally did no matter what I try. I've tried fast and full sync, I've added peers using a static-nodes.json file and the admin.addPeer() method, I've updated geth on each node/machine to 1.8.27-stable. All nodes are connected to a network switch and I can ping/ssh into any of them with no problems. I've deleted the geth folder/reset my database countless times and used several simple genesis.json files to no avail. I've gone back to trying to successfully sync a single RPi node, but even that seems to be hit or miss. Any ideas? Otherwise I might just try Parity instead.

I'll leave some of the commands/files I'm using for reference.

{
"config": {
"chainId": 2424,
"homesteadBlock": 0,
"eip155Block": 0,
"eip158Block": 0
},
"nonce": "0x0000000000000042",
"mixhash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"difficulty": "0x200",
"alloc": {},
"coinbase": "0x0000000000000000000000000000000000000000",
"timestamp": "0x00",
parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"gasLimit": "0xffffffff",
"alloc": {
}
}

geth --identity "miner1" --syncmode "fast" --networkid 2424 --datadir "~/Documents/Spencer/PrivateChain/miner1" --nodiscover --mine --rpc --rpcport "8042" --rpcapi "admin,db,eth,net,web3,miner,personal" --port "30303" --unlock 0 --password ~/Documents/Spencer/PrivateChain/miner1/password.sec --ipcpath "~/AppData/Roaming/Ethereum"

--

geth --identity "miner2" --syncmode "fast" --networkid 2424 --datadir "~/Documents/Spencer/PrivateChain/miner2" --nodiscover --mine --rpc --rpcport "8043" --rpcapi "admin,db,eth,net,web3,miner" --port "30304" --unlock 0 --password ~/Documents/Spencer/PrivateChain/miner2/password.sec

error img

Maybe it would be worth trying to run the miner nodes in a Linux environment using Docker? I know Windows can be wonky sometimes...

0

Well, I feel dumb but I found the problem -- my Raspberry Pis' clocks weren't synced with the computer they were getting the chain from. I've gotten used to my devices staying synced to the correct time even when turned off and didn't realize that my RPis clocks were thrown out of sync every time I turned them off. I had set the timezone for each one in raspi-config without knowing that they aren't set to sync with an NTP server by default.

Either connecting to the internet, setting the timezone, and running

timedatectl set-ntp true

or manually syncing to the computer's time using

sudo date -s 'YYYY-MM-DD HH:MM:SS'

should solve the problem as long as there aren't any other errors. Worked for me and now all 3 nodes are properly synced and can interact with my deployed contracts.

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.