# Zenrock

## Public Endpoints

```
RPC: https://zenrock-archive-rpc.validatorvn.com/
API: https://zenrock-archive-api.validatorvn.com/
```

## Snapshots (Daily at 2AM UTC)

```
sudo systemctl stop zenrockd #or equivalent to your service names

mv $HOME/.zrchain/data/priv_validator_state.json $HOME/.zrchain/priv_validator_state.json.backup

rm -rf $HOME/.zrchain/data

curl -L https://snapshot.validatorvn.com/zenrock/data.tar.lz4 | lz4 -dc - | tar -xf - -C $HOME/.zrchain

mv $HOME/.zrchain/priv_validator_state.json.backup $HOME/.zrchain/data/priv_validator_state.json

sudo systemctl start zenrockd #or equivalent to your service names
```

## Genesis & Addrbook files

```
curl -L https://snapshot.validatorvn.com/zenrock/addrbook.json > $HOME/.zrchain/config/addrbook.json
curl -L https://snapshot.validatorvn.com/zenrock/genesis.json > $HOME/.zrchain/config/genesis.json
```

## Live Peers

```
URL="https://zenrock-archive-rpc.validatorvn.com/net_info"

response=$(curl -s $URL)

PEERS=$(echo $response | jq -r '.result.peers[] | "\(.node_info.id)@\(.remote_ip):" + (.node_info.listen_addr | capture("(?<ip>.+):(?<port>[0-9]+)$").port)' | paste -sd "," -)

echo "PEERS=\"$PEERS\""

sed -i 's|^persistent_peers *=.*|persistent_peers = "'$PEERS'"|' $HOME/.zrchain/config/config.toml
```

### Seeds

```bash
sed -i -e 's|^seeds *=.*|seeds = "59a524fb021acab2819bcb51d9f6f4795eb04db7@zenrock-archive-rpc.validatorvn.com:13656"|' $HOME/.zrchain/config/config.toml
```

### State Sync <a href="#state-sync" id="state-sync"></a>

```
sudo systemctl stop zenrockd

SNAP_RPC="https://zenrock-archive-rpc.validatorvn.com:443"
cp $HOME/.zrchain/data/priv_validator_state.json $HOME/.zrchain/priv_validator_state.json.backup
zenrockd tendermint unsafe-reset-all --home ~/.zrchain/ --keep-addr-book

LATEST_HEIGHT=$(curl -s $SNAP_RPC/block | jq -r .result.block.header.height); \
BLOCK_HEIGHT=$((LATEST_HEIGHT - 2000)); \
TRUST_HASH=$(curl -s "$SNAP_RPC/block?height=$BLOCK_HEIGHT" | jq -r .result.block_id.hash)
echo $LATEST_HEIGHT $BLOCK_HEIGHT $TRUST_HASH

sed -i.bak -E "s|^(enable[[:space:]]+=[[:space:]]+).*$|\1true| ; \
s|^(rpc_servers[[:space:]]+=[[:space:]]+).*$|\1\"$SNAP_RPC,$SNAP_RPC\"| ; \
s|^(trust_height[[:space:]]+=[[:space:]]+).*$|\1$BLOCK_HEIGHT| ; \
s|^(trust_hash[[:space:]]+=[[:space:]]+).*$|\1\"$TRUST_HASH\"|" ~/.zrchain/config/config.toml
more ~/.zrchain/config/config.toml | grep 'rpc_servers'
more ~/.zrchain/config/config.toml | grep 'trust_height'
more ~/.zrchain/config/config.toml | grep 'trust_hash'

sudo mv $HOME/.zrchain/priv_validator_state.json.backup $HOME/.zrchain/data/priv_validator_state.json

sudo systemctl restart zenrockd && journalctl -u zenrockd -f -o cat
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://services.validatorvn.com/zenrock.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
