# Statesync

<figure><img src="https://pbs.twimg.com/profile_images/1693591385469837313/6dYwFnXW_400x400.jpg" alt="" width="188"><figcaption></figcaption></figure>

***

| Latest Version | Chain-id | Wasm     |
| -------------- | -------- | -------- |
| v1.1.0         | sgenet-1 | DISABLED |

### Statesync

```shell
sudo systemctl stop sged
cp $HOME/.sge/data/priv_validator_state.json $HOME/.sge/priv_validator_state.json.backup
sged tendermint unsafe-reset-all --keep-addr-book --home $HOME/.sge


STATE_SYNC_RPC=https://rpc.sge.indonode.net:443
STATE_SYNC_PEER=e411f9a5c2e00f791a1463dc3f557e3ffb267052@rpc.sge.indonode.net:13656
LATEST_HEIGHT=$(curl -s $STATE_SYNC_RPC/block | jq -r .result.block.header.height)
SYNC_BLOCK_HEIGHT=$(($LATEST_HEIGHT - 1000))
SYNC_BLOCK_HASH=$(curl -s "$STATE_SYNC_RPC/block?height=$SYNC_BLOCK_HEIGHT" | jq -r .result.block_id.hash)

sed -i \
  -e "s|^enable *=.*|enable = true|" \
  -e "s|^rpc_servers *=.*|rpc_servers = \"$STATE_SYNC_RPC,$STATE_SYNC_RPC\"|" \
  -e "s|^trust_height *=.*|trust_height = $SYNC_BLOCK_HEIGHT|" \
  -e "s|^trust_hash *=.*|trust_hash = \"$SYNC_BLOCK_HASH\"|" \
  -e "s|^persistent_peers *=.*|persistent_peers = \"$STATE_SYNC_PEER\"|" \
  $HOME/.sge/config/config.toml

mv $HOME/.sge/priv_validator_state.json.backup $HOME/.sge/data/priv_validator_state.json
```

```shell
# Restart Service
sudo systemctl start sged && sudo journalctl -u sged -f
```
