Skip to content

Instantly share code, notes, and snippets.

@wangkui0508
Created July 6, 2023 14:58
Show Gist options
  • Save wangkui0508/99f8e746cbc17e56adb19d7b6fbbf6fb to your computer and use it in GitHub Desktop.
Save wangkui0508/99f8e746cbc17e56adb19d7b6fbbf6fb to your computer and use it in GitHub Desktop.

Emergency recover of smartBCH

We have developed an emergency patch to restart smartBCH using a single-validator mode. It's an interim solution before we finish the real patch which raises the validators' requirement by adding staking and slashing amounts.

A low requirement for validators is good for smartBCH to have more validators. SmartBCH has 28 validators before today's halt accident, who can only get a limited gas fee as a reward in such a bear market. But the quality is more important than the quantity. So we must go forward and make sure all the validators are well managed using economic methods.

If you are running a smartBCH node, no matter whether it is a validator or not, please use the following steps to recover it. We apologize for the inconvenience again and thank you for your cooperation.

# pull latest smartbchd image
docker pull smartbch/smartbchd:v0.4.7-p1

# make sure the version is v0.4.7-p1
docker run --rm smartbch/smartbchd:v0.4.7-p1 version

# stop the container/node
# replace 'sbchd' with your container name
docker stop sbchd
docker container rm sbchd

# clean up node state
# replace '~/.smartbchd' with your smartbchd home dir
cd ~/.smartbchd # 
rm -rf data/cs.wal/
rm config/addrbook.json 
# modify data/priv_validator_state.json, change it to
{
  "height": "10319606",
  "round": 0,
  "step": 0
}

# restart container/node like this
sudo docker run \
  -v ~/.smartbchd:/root/.smartbchd \
  -p 0.0.0.0:8545:8545 \
  -p 0.0.0.0:8546:8546 \
  -p 0.0.0.0:26656:26656 \
  --ulimit nofile=65535:65535 \
  --log-opt max-size=200m \
  --name sbchd \
  -d smartbch/smartbchd:v0.4.7-p1 start --mainnet-genesis-height=698502 \
  --log_level='json-rpc:debug,watcher:debug,*:info' \
  --http.api='eth,web3,net,txpool,sbch,debug'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment