Skip to main content

Berachain Testnet V2 Statesync

1. Stop the service:​

sudo systemctl stop beacond.service

2. Reset the service:​

beacond comet unsafe-reset-all --home $HOME/.beacond --keep-addr-book

3. Fetch the data for config.toml​

For this step you will need:

  • A Berachain Testnet V2 RPC endpoint
  • A Berachain Testnet v2 Peer
RPC_ENDPOINT=https://a-berachain-rpc.org:443
PEER_ADDRESS=cf44af098820f50a1e96d51b7af6861bc961e706@46.4.87.147:5001
LATEST_HEIGHT=$(curl -s $RPC_ENDPOINT/block | jq -r .result.block.header.height)
TRUST_HEIGHT=$((LATEST_HEIGHT - 1000))
TRUST_HASH=$(curl -s "$RPC_ENDPOINT/block?height=$TRUST_HEIGHT" | jq -r .result.block_id.hash)
sed -i -e 's|^persistent_peers *=.*|persistent_peers = "'$PEER_ADDRESS'"|' $HOME/.beacond/config/config.toml
sed -i -e 's|^enable *=.*|enable = true|' $HOME/.beacond/config/config.toml
sed -i -e 's|^rpc_servers *=.*|rpc_servers = "'$RPC_ENDPOINT','$RPC_ENDPOINT'"|' $HOME/.beacond/config/config.toml
sed -i -e 's|^trust_height *=.*|trust_height = "'$TRUST_HEIGHT'"|' $HOME/.beacond/config/config.toml
sed -i -e 's|^trust_hash *=.*|trust_hash = "'$TRUST_HASH'"|' $HOME/.beacond/config/config.toml

4. Restart the service:​

sudo systemctl restart beacond.service

5. Check the logs:​

We want to see that the statesync is working correctly.

sudo journalctl -u beacond.service -f