Skip to content

Commit

Permalink
Merge pull request #284 from filecoin-project/fatman13-patch2
Browse files Browse the repository at this point in the history
add venus-cluster and clean up
  • Loading branch information
Joss-Hua authored Mar 7, 2022
2 parents 84f4f47 + d088b5a commit 4912a1c
Show file tree
Hide file tree
Showing 10 changed files with 1,456 additions and 21 deletions.
45 changes: 24 additions & 21 deletions docs/.vuepress/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,6 @@ module.exports = {
['How-To-Deploy-MingPool.md', 'Deploy a chain service'],
['Using-venus-Shared-Modules.md', 'Use a chain service'],
['Using-venus-market.md', 'Join storage market'],
['fil_withdraw_and_send.md', 'Retrieve rewards'],
['Chain.md', 'Chain management'],
['How-To-Connect-Network.md', 'Connect to different network'],
['How-To-Contribute-Docs.md', 'Contribute to doc']
]
}
Expand Down Expand Up @@ -129,11 +126,15 @@ module.exports = {
children: [
['', 'Using lotus-miner'],
['tips-running-in-China.md', 'Tips running in China'],
['venus-cli.md', 'Venus CLI commands'],
['fil_withdraw_and_send.md', 'Retrieve rewards'],
['Chain.md', 'Chain management'],
['How-To-Connect-Network.md', 'Connect to different network'],
['How-To-Setup_2knet.md', 'How to start a local dev network'],
['Multisig-wallet.md', 'Multisig wallet'],
['venus_load_balancing.md', 'Venus load balancing'],
['Payment-Channel.md', 'Payment channel'],
['How-To-Setup_2knet.md', 'How to start a local dev network'],
['venus-cli.md', 'Venus CLI commands'],

]
}
],
Expand Down Expand Up @@ -223,9 +224,7 @@ module.exports = {
['How-To-Deploy-MingPool.md', '部署链服务'],
['Using-venus-Shared-Modules.md', '使用链服务'],
['using-venus-market-v1.md', '加入存储市场'],
['fil_withdraw_and_send.md', '提取奖励'],
['chain.md', '链维护'],
['How-To-Connect-Network.md', '加入不同网络'],
['Using-venus-cluster-alt.md', '使用cluster'],
['How-To-Contribute-Docs.md', '贡献文档'],
]
}
Expand All @@ -236,15 +235,16 @@ module.exports = {
collapsable: false,
children: [
['', 'Venus daemon'],
['Venus-Auth.md', 'Venus auth'],
['Venus-Auth.md', 'venus-auth'],
['venus-miner.md', 'venus-miner'],
['How-To-Use-Messager.md', 'Venus messager'],
['Venus-Gateway.md', 'Venus gateway'],
['How-To-Use-Wallet-In-Venus.md', 'Venus 本地钱包'],
['Venus-Wallet.md', 'Venus 远程钱包'],
['Venus-Worker.md', 'Venus worker'],
['Venus-Market.md', 'Venus market'],
['Venus-Messager-Design-Spec.md', 'Venus Messager 设计说明书'],
['How-To-Use-Messager.md', 'venus-messager'],
['Venus-Gateway.md', 'venus-gateway'],
['How-To-Use-Wallet-In-Venus.md', 'venus-wallet(本地)'],
['Venus-Wallet.md', 'venus-wallet(远程)'],
['Venus-Worker.md', 'venus-worker(sealer)'],
['Venus-Market.md', 'venus-market'],
['Venus-Sector-Manager.md', 'venus-sector-manager(cluster)'],
['Venus-Worker-c.md', 'venus-worker(cluster)'],
]
}
],
Expand All @@ -253,15 +253,18 @@ module.exports = {
title: '进阶',
collapsable: false,
children: [
['', 'venus矿池进阶'],
['How-To-Setup_2knet.md', '如何搭建私网'],
['', '使用lotus-miner'],
['tips-running-in-China.md', '中国部署小贴士'],
['fil_withdraw_and_send.md', '提取奖励'],
['chain.md', '链维护'],
['How-To-Connect-Network.md', '加入不同网络'],
['How-To-Setup_2knet.md', '本地2k开发网络'],
['venus_load_balancing.md', '负载均衡'],
['Venus-Project-Dependency-Upgrade.md', 'venus组件依赖与升级'],
['venus-cli.md', 'CLI命令'],
['Multisig-Wallet.md', '多签钱包'],
['venus_load_balancing.md', '负载均衡'],
['Payment-Channel.md', '支付通道'],
['How-To-Setup_2knet.md', '本地2k开发网络'],
['venus-cli.md', 'CLI命令'],

]
}
],
Expand Down
76 changes: 76 additions & 0 deletions docs/advanced/Chain.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
---
title: 'Chain management'
description: 'The Venus blockchain carries the information necessary to compute the current state of the network, is stored on disk and grows every 30 seconds with new blocks. This guide explains how to manage several aspects of th chain.'
breadcrumb: 'Chain management'
---

# {{ $frontmatter.title }}

{{ $frontmatter.description }}.

## Syncing

Venus will automatically sync to the latest _chain head_ by:

- Fetching the block headers from the current _head_ down to the last synced epoch.
- Retrieving and verifying all the blocks from the last synced epoch to the current head.

Once Venus is synced, it will learn about new blocks as they are mined for every epoch via Pubsub, and verify them accordingly. Note that in Venus, every epoch might see a variable number of mined blocks.

Filecoin's blockchain grows relatively fast, so a full sync will take long time. For this reason, Venus offers a faster way to sync via trusted state snapshots.

### Syncing from a trusted state snapshot (mainnet)

We recommend most users to perform the initial node sync from a minimal, lightweight snapshot. Trusted state snapshots do not contain the full chain and might not be suitable for nodes that need to perform queries against historical state information, like block explorers, but otherwise work for most users.

A recent minimal trusted state chain snapshot is available [here](https://fil-chain-snapshots-fallback.s3.amazonaws.com/mainnet/minimal_finality_stateroots_latest.car). We can instruct venus to start the daemon and directly import from the URL:

```sh
# The snapshot size is about 7GiB. This works for mainnet.
venus daemon --import-snapshot https://fil-chain-snapshots-fallback.s3.amazonaws.com/mainnet/minimal_finality_stateroots_latest.car

# An alternative is to download first and use the file
venus daemon --import-snapshot <filename.car>

# The sha256sum is stored alongside the interim snapshot and can be obtained via
curl -sI https://fil-chain-snapshots-fallback.s3.amazonaws.com/mainnet/minimal_finality_stateroots_latest.car \
| perl -ne '/^x-amz-website-redirect-location:(.+)\.car\s*$/ && print "$1.sha256sum"' \
| xargs curl -s
```

::: warning
If you do not trust the source of the snapshot or simply want Venus to validate the chain, you need to follow the steps in the next section. Complete validation of the chain is an order of magnitude slower, and is expected to take multiple days.
:::

### Checking sync status

There are two ways to track whether the Venus daemon is correctly syncing the chain and how far it has yet to go to complete the syncing:

```sh
# Inspect the current sync status, sync workers etc:
venus sync status
# View the Timestamp of the chain head compared with the current time:
venus chain head
```

## Compacting the chain data

It is possible to _prune_ the current chain data used by Venus to reduce the disk footprint of a Venus node by resyncing from a minimal snapshot.

1. Stop the Venus daemon:

```bash
venus daemon stop
```

1. Remove the contents of the `badger/` folder in the Venus path:

```bash
rm -rf ~/.venus/badger/*
```

1. Start the daemon using a minimal snapshot, as explained above:

```bash
venus daemon --import-snapshot https://fil-chain-snapshots-fallback.s3.amazonaws.com/mainnet/minimal_finality_stateroots_latest.car
```
26 changes: 26 additions & 0 deletions docs/advanced/How-To-Connect-Network.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Connect to different network

In venus, it is easy to decide whether to connect to different networks by setting the startup parameters.


## Mainnet

```sh
./venus daemon #connect to mainnet by default
```

## Calibration Network

parameters must be configured to connect to the calibration network.

```sh
./venus daemon --network cali
```

## 2k Local Network

in addition to the corresponding network parameters, a network boot file (.car) is required to connect the 2k network.

```sh
./venus daemon --network 2k --genesisfile *.car
```
38 changes: 38 additions & 0 deletions docs/advanced/fil_withdraw_and_send.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
## Retrieve rewards

When storage provider get block rewards from the network, 25% percent of the reward will be immediately released to your miner actor's available balance and the rest 75% will become locked funds and be released linearly in 180 days. This tutorial will walk you through how to withdraw your rewards.

## Withdraw balance from miner

Query available balance using `venus-sealer`.

```bash
$ ./venus-sealer info
```

Check available balance from the output.

```bash
...
Vesting: 102.474 FIL
The Available: 125.421 FIL
...
```

Withdraw available balance. Then check if your owner address recieves the funds using [filscan](https://filscan.io/).

```bash
$ ./venus-sealer actor withdraw <FIL_AMOUNT>
```

List all addresses using `venus-sealer`.

```bash
$ ./venus-sealer actor control list
```

## Send funds from your addresses

`venus-wallet` doesn't support sending funds from `cli`. Sending funds can be realized by exporting private key to a [wallet](https://docs.filecoin.io/about-filecoin/managing-assets/#wallets) that supports filecoin. And then send funds through the said wallet.

Note that venus shared modules also blocks `send` messages for security reason, making your storage system more secure from potential attacks. This design makes sending funds less convienent but allows the seperation of an admin role and a node operator role for increased security.
25 changes: 25 additions & 0 deletions docs/zh/advanced/How-To-Connect-Network.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# 如何连接到不同到网络

在Venus中,通过设置启动参数来决定是否连接到不同的网络,目前支持主网,calibration,2k。网络详情https://network.filecoin.io/

## 主网

```sh
./venus daemon #connect to mainnet by default
```

## Calibration网络

必须配置为连接到Calibration网络的参数。

```sh
./venus daemon --network cali
```

## 2k 本地网络

除了相应的网络参数外,连接2k网络还需要一个网络启动导文件(.car)。

```sh
./venus daemon --network 2k --genesisfile *.car
```
78 changes: 78 additions & 0 deletions docs/zh/advanced/chain.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
---
title: 'venus: 链管理'
description: 'Venus区块链携带计算网络当前状态所需的信息,存储在磁盘上,每30秒增加一个新的块。本指南解释了如何管理th链的几个方面。'
breadcrumb: '链管理'
---

# {{ $frontmatter.title }}

{{ $frontmatter.description }}

[[TOC]]

## 同步

Venus 将通过以下方式自动同步到最新的 _chain head_ :

- 获取从当前区块头到最后一个同步高度的区块头。
- 检索并验证从上一次同步的高度到当前块头的所有区块。

一旦Venus同步后,它将通过Pubsub在每个高度出新块时进行相应的验证。请注意,在Venus上,每个高度可能会看到不同数量的区块。

Filecoin的区块链增长相对较快,因此完全同步将需要很长时间。因此,Venus提供了一种通过受信任状态快照进行同步的更快方法。

### 从受信任状态快照(主网)进行同步

我们建议大多数用户从最小的轻量级快照执行初始节点同步。受信任状态快照不包含完整的链,并且可能不适合需要对历史状态信息执行查询的节点(例如区块浏览器),但对于大多数用户而言,它们是可行的。

最近的最小受信任状态链快照在 [这里](https://fil-chain-snapshots-fallback.s3.amazonaws.com/mainnet/minimal_finality_stateroots_latest.car). 我们可以用venus启动守护程序并直接从URL导入:

```sh
# 快照大小约为7GiB。这适用于mainnet。
venus daemon --import-snapshot https://fil-chain-snapshots-fallback.s3.amazonaws.com/mainnet/minimal_finality_stateroots_latest.car

# 另一种方法是先下载并使用该文件
venus daemon --import-snapshot <filename.car>

# sha256sum 与临时快照一起存储,可以通过以下方式获取
curl -sI https://fil-chain-snapshots-fallback.s3.amazonaws.com/mainnet/minimal_finality_stateroots_latest.car \
| perl -ne '/^x-amz-website-redirect-location:(.+)\.car\s*$/ && print "$1.sha256sum"' \
| xargs curl -s
```

::: 如果您不信任快照的来源,或者只是想让Venus验证链,则需要按照下一节中的步骤进行操作。完整验证链的速度要慢一个数量级,预计需要几天的时间。:::

### 检查同步状态

有两种方法可以跟踪Venus守护程序是否正确同步了链,以及还需要多久才能完成同步:

```sh
# 检查当前同步状态,同步works程序等:
venus sync status
# 查看链头与当前时间的时间戳:
venus chain head
```

## 压缩链数据

通过从最小快照重新同步,可以精简Venus使用的当前链数据以减少Venus节点的磁盘占用量。

1. 停止 Venus daemon:

```bash
venus daemon stop
```

2. 在Venus的路径中删除 `badger/` 文件夹的内容:

```bash
rm -rf ~/.venus/badger/*
```

3. 如上所述,使用最小快照启动daemon:

```bash
venus daemon --import-snapshot https://fil-chain-snapshots-fallback.s3.amazonaws.com/mainnet/minimal_finality_stateroots_latest.car
```

在GitHub上[创建一个问题](https://github.com/filecoin-project/venus-docs/issues)。
47 changes: 47 additions & 0 deletions docs/zh/advanced/fil_withdraw_and_send.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@

## 为什么要这样做

&ensp;&ensp; venus分布式矿池中,venus-wallet属于独立组件,每个集群部署一个,这样做的目的是保证客户完全掌控集群的钱包密钥,不对外界公开,这也和venus的设计初衷一致,提高系统安全性,保障用户资金安全.

&ensp;&ensp; 在venus矿池中,我们屏蔽了Send消息的处理,避免模拟发送转账消息攻击系统的手段,但这也给客户转账带来一定的困扰,故此文档对如何提取矿工账户可用余额和转账方式进行说明。

## 怎么做

### 查看可用余额

在venus-sealer端执行命令
```sh
$ ./venus-sealer info
Chain: [sync behind! (1h26m35s behind)] [basefee 100 aFIL]
...

Sealer Balance: 253.94 FIL
PreCommit: 23.045 FIL
Pledge: 3 FIL
Vesting: 102.474 FIL
Available: 125.421 FIL
...
```
- Available 即可用余额,会随着出块或抵押释放等方式更新

### 提取可用余额

在venus-sealer端执行命令
```sh
$ ./venus-sealer actor withdraw [amount (FIL)]

```
这个命令会将指定数额的fil提取到该矿工对应的owner地址,查看owner可以通过多种方式,这里介绍在venus-sealer端查询方式:

```sh
$ ./venus-sealer actor control list
name ID key use balance
owner t01763 t3qsek22y... *** FIL
worker t01762 t3rcktwpg... other *** FIL
```

### 转账

用户将fil提取到owner地址后,利用协议实验室推荐的[钱包APP](https://fivetoken.io/download)可以转出到其他账户.

用户也可以选择其他可行方式:比如同步一个venus/lotus节点,导入钱包私钥后执行转账(Send)命令等.
Loading

0 comments on commit 4912a1c

Please sign in to comment.