Skip to content

Commit

Permalink
Add doc about app state reset and export
Browse files Browse the repository at this point in the history
  • Loading branch information
chengwenxi committed Jun 4, 2019
1 parent bd16089 commit 909da75
Show file tree
Hide file tree
Showing 5 changed files with 78 additions and 44 deletions.
30 changes: 30 additions & 0 deletions docs/software/app-state-export.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Export Blockchain State

## Description

IRISnet can export blockchain state and output json format string. Save the out json string to a json file and the json file can be used as genesis file of a new blockchain. This can be accomplished by command `iris export`.
If you want to export the state of the historical block height, you need to [reset](app-state-reset.md) the app state to the specified height.

## Usage
```
iris export <flags>
```
### Flags

| Nameshorthand | type | Required | Default | Description |
| ------------------- | ----- | -------- | -------- | -------------- |
| --for-zero-height | bool | false | false | Do some clean up work before exporting state. If you want use the exported state to start a new blockchain, please add this flag. Otherwise, just leave out it |
| --home | string | false | $HOME/.iris | Specify the directory which stores node config and blockchain data |
| --output-file | string | false | genesis.json | Target file to save exported state |


1. Export the current blockchain state

```
iris export --home=<path_to_your_home>
```

2. If you want to export the the current blockchain state and use the exported state as genesis state of another blockchain
```
iris export --for-zero-height --home=<path_to_your_home>
```
21 changes: 21 additions & 0 deletions docs/software/app-state-reset.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Reset Blockchain State

## Description

IRISnet can reset blockchain state at any height. This can be accomplished by command `iris reset`.

## Usage
```
iris reset <flags>
```
### Flags

| Nameshorthand | type | Required | Default | Description |
| ------------------- | ----- | -------- | -------- | -------------- |
| --height | int | false | 0 | Specify the height, default value is 0 which means to export the latest state |
| --home | string | false | $HOME/.iris | Specify the directory which stores node config and blockchain data |

1. Reset the blockchain state to block 100:
```
iris reset --height 100 --home=<path_to_your_home>
```
34 changes: 0 additions & 34 deletions docs/software/export.md

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

## 介绍

这里介绍一种能导出区块链状态并以json格式返回给用户如果把返回的json字符串保存到一个json文件里那么这个json文件可以作为一个新区块链网络的创世块导出区块链状态所用的命令为`iris export`
IRISnet支持导出区块链状态并以json格式返回给用户如果把返回的json字符串保存到一个json文件里这个json文件可以作为一个新区块链网络的创世块导出区块链状态所用的命令为`iris export`
如果想导出历史高度的状态,需要先[重置](app-state-reset.md)app状态到指定的高度

## 用法

Expand All @@ -15,21 +16,16 @@ iris export <flags>
| 名称速记 | 类型 | 是否必填 | 默认值 | 介绍 |
| ------------------- | ----- | -------- | -------- | -------------- |
| --for-zero-height | bool | false | false | 导出数据之前做一些清理性的工作如果不想以导出的数据启动一条新链可以不加这个标志 |
| --height | int | false | 0 | 指定的高度默认值为0表示导出当前高度状态 |
| --home | string | false | $HOME/.iris | 指定存储配置和区块链数据的目录 |
| --output-file | string | false | genesis.json | 存储导出状态的文件 |

## 示例

1. 导出最新的区块链状态:
1. 导出当前区块链状态
```
iris export
iris export --home=<path_to_your_home>
```
2. 导出高度10000的区块链状态
2. 如果想导出当前高度的区块链状态并且以这个状态启动一条新链可以尝试这个命令
```
iris export --height=10000
```
3. 如果想导出105000高度的区块链状态并且以这个状态启动一条新链可以尝试这个命令
```
iris export --height=105000 --for-zero-height --home=<path_to_your_home>
iris export --for-zero-height --home=<path_to_your_home>
```
21 changes: 21 additions & 0 deletions docs/zh/software/app-state-reset.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Reset Blockchain State

## Description

IRISnet支持重置区块链状态到任意高度这里介绍重置区块链状态所用的命令为`iris reset`

## Usage
```
iris reset <flags>
```
### Flags

| Nameshorthand | type | Required | Default | Description |
| ------------------- | ----- | -------- | -------- | -------------- |
| --height | int | false | 0 | Specify the height, default value is 0 which means to export the latest state |
| --home | string | false | $HOME/.iris | Specify the directory which stores node config and blockchain data |

1. 重置区块链状态到区块100:
```
iris reset --height 100 --home=<path_to_your_home>
```

0 comments on commit 909da75

Please sign in to comment.