Since there was a hard fork at block #22156660 on mainnet on 5th Dec around 7AM UTC, some nodes that were running an older version of bor and using the old genesis ended up on a different fork. Here are the instructions to check if your node is on a different fork and to get it back in sync.
0x33f08e82cd658d933aec2cf90cf10d7443043c036ac4da030fc5319eba267601
curl -X POST -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"eth_getBlockByNumber","params":["0x1521600", false],"id":1}' localhost:8545 | jq ".result.hash"
0x33f08e82cd658d933aec2cf90cf10d7443043c036ac4da030fc5319eba267601
, it means you are on a different fork. Please follow the instructions below to upgrade and bring your node back in sync.First, upgrade bor on your node to the latest version by following the instructions below:
Navigate to bor directory
cd ~/bor
Fetch the latest changes and use Bor v0.2.12-beta3:
git fetch
git checkout v0.2.12-beta3
Build latest changes
make bor-all
Go back to the home directory
cd ~
Download the latest genesis file. We are upgrading the genesis contract through changed genesis.
curl <https://raw.githubusercontent.com/maticnetwork/launch/ea7ef12751291f7331b383506e5a714703f37362/mainnet-v1/sentry/sentry/bor/genesis.json> --output ~/genesis.json
Init bor with the new genesis file
bor --datadir ~/.bor/data init ~/genesis.json
If you are using a non-default datadir
, please ensure you input the correct one you have been using.
You should see the output as follows:
...
...
INFO [12-03|19:57:02.531] Successfully wrote genesis state database=chaindata hash=...
...
INFO [12-03|19:57:02.556] Successfully wrote genesis state database=lightchaindata hash=...
...
...
Start the bor service
sudo service bor start
Once your node is upgraded, rewind the chain to a block behind the hard fork. We are rewinding to block 22156600:
$ bor attach ~/.bor/data/bor.ipc
> debug.setHead("0x1521538")
Now wait for the chain to rewind and once the chain is in sync with the blockchain tip, recheck the hash at block #22156800 using the above instructions in "Check if the node is on a different fork" to ensure that your node is in sync with the chain.