Skip to content

Commit

Permalink
add State Sync docs (#2700)
Browse files Browse the repository at this point in the history
Co-authored-by: Yelong Zhang <yelong@bianjie.ai>
  • Loading branch information
hulatown and zhangyelong committed Dec 6, 2021
1 parent 97c66a3 commit fd45db4
Show file tree
Hide file tree
Showing 4 changed files with 84 additions and 0 deletions.
2 changes: 2 additions & 0 deletions docs/get-started/mainnet.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ Next, your node will process all chain upgrades. Between each upgrade, you must
You may see some connection errors, it does not matter, the P2P network is trying to find available connections

Try to add some of the [Community Peers](https://github.com/irisnet/mainnet/blob/master/config/community-peers.md) to `persistent_peers` in the config.toml

If you want to quickly start the node and join IRIS Hub without historical data, you can consider using the [state_sync](./state-sync.md) function.
:::

## Upgrade to Validator Node
Expand Down
40 changes: 40 additions & 0 deletions docs/get-started/state-sync.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---
order: 7
---

# State Sync

If you want to quickly start the node and join IRIS Hub without historical data, you can consider using the `state_sync` feature. **Note that the data directory must be empty when starting the node.**

## Procedure

1. Initialize the mainnet node by referring to [Join The Mainnet](./mainnet.md).
2. Check the block height of the current snapshot, and select the latest height.

```bash
curl http://34.82.96.8:26658/
```

3. Modify the `config.toml`.

```toml
[statesync]
enable = true # whether enable stat_sync; set true
rpc_servers = "34.82.96.8:26657,34.77.68.145:26657" # RPC server address which the node connects to
trust_height = # Set to the block height of the latest snapshot
trust_hash = "" #Set to the hash corresponding to the latest snapshot block height (trust height), which can be checked via https://irishub.iobscan.io/#/block/<trust_height>.
trust_period = "168h0m0s"
discovery_time = "15s"
temp_dir = ""
```

4. Start the node.

```bash
iris start
```

## Others

1. If any problem occurs during chain starting, you can execute `iris unsafe-reset-all` to reset the node and repeat the steps above.
2. If you can't find solutions to the current issue, please contact us via [IRISnet Discord channel](https://discord.com/invite/bmhu9F9xbX) for help.
2 changes: 2 additions & 0 deletions docs/zh/get-started/mainnet.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ iris start
您可能会看到一些连接错误,这没关系,P2P网络正在尝试查找可用的连接

可以添加几个[社区公开节点](https://github.com/irisnet/mainnet/blob/master/config/community-peers.md)`config.toml`中的`persistent_peers`

如果您在不需要历史数据的情况下要快速启动节点并加入 IRIS Hub,可以考虑使用 [state_sync](./state-sync.md) 功能快速启动节点。
:::

## 升级为验证人节点
Expand Down
40 changes: 40 additions & 0 deletions docs/zh/get-started/state-sync.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---
order: 7
---

# State Sync
## 背景

如果您在不需要历史数据的情况下要快速启动节点并加入 IRIS Hub,可以考虑使用 `state_sync` 功能快速启动节点。需要注意的是在启动节点的时候要保证节点 data 目录是空的。

## 步骤

1. 参考 [加入主网](./mainnet.md) 进行主网节点初始化
2. 查看现存快照的块高,并选取最新块高

```bash
curl http://34.82.96.8:26658/
```

3. 修改配置文件 `config.toml`

```toml
[statesync]
enable = true #是否开启 stat_sync,设置为 true
rpc_servers = "34.82.96.8:26657,34.77.68.145:26657" #链接的 rpc server 地址
trust_height = # 设置为最新快照的块高
trust_hash = "" #设置为最新快照块高对应的 hash,可通过浏览器 https://irishub.iobscan.io/#/block/<trust_height> 进行查看
trust_period = "168h0m0s"
discovery_time = "15s"
temp_dir = ""
```

4. 启动节点

```bash
iris start
```

## 其他
1. 如果在启动链的过程中有问题可以执行 `iris unsafe-reset-all` 重置节点,然后重复以上步骤。
2. 如果出现不能解决的问题,请通过 [Discord](https://discord.com/invite/bmhu9F9xbX) 来联系 IRISnet,我们将帮助您解决遇到的问题。

0 comments on commit fd45db4

Please sign in to comment.