GithubHelp home page GithubHelp logo

josephbedminster / lotus-miner Goto Github PK

View Code? Open in Web Editor NEW

This project forked from shannon-6block/lotus-miner

0.0 1.0 0.0 25 KB

An improved lotus toolchain for Filecoin cluster mining

Home Page: https://6block.com/

Shell 100.00%

lotus-miner's Introduction

lotus-miner

English

石榴矿池lotus-miner社区版,持续免费向公众提供。

推荐配置

  • CPU:AMD 3960X 或 Ryzen Threadripper 其他型号
  • 内存:256 GB
  • SSD:2 TB * 2
  • GPU:NVIDIA 2080 Ti
  • 操作系统:Ubuntu 18.04

最低配置

未测试。如果有问题可以提issue。

  • CPU:带有 SHA 扩展的 AMD
  • 内存:128 GB
  • SSD:1 TB
  • 操作系统:Linux

特点

  • 首次启动之后,以后所有操作自动化,无需人工干预。
  • 封装操作完全在worker完成,除了最终sealed sector(约33 GB)回传miner之外没有网络传输。
  • 自动发现空闲worker,启动封装操作。
  • 程序退出后,再次启动都能恢复运行。如果出现不能恢复的情况,可以提issue。
  • 基于推荐配置,可以进行单机3-4个sector的并行运行,每日产出存力200 GB以上。
  • 自动设置FIL_PROOFS_MAXIMIZE_CACHING环境变量。
  • 默认不使用LOTUS_STORAGE_PATH来存储文件,分离目录。

注意

  • 开始之前请确保有足够的空闲内存。
  • 请确保所有设备能够正常连接互联网。

安装配置

将会安装挖矿程序、必要的库、时间校准、显卡驱动、ulimit、swap内存(64 GB)。

# 下载
git clone https://github.com/shannon-6block/lotus-miner.git
cd lotus-miner

# 切换至root账户
sudo su
# 执行安装
./script/install.sh
# 安装完后可以exit回到之前的账户
# 如果是首次安装显卡驱动,需要重启以生效

首次启动

几个可以配置的环境变量,根据自己需求设置。

# lotus、miner、worker、零知识证明参数的目录。建议设置为SSD上的目录
export LOTUS_PATH="$HOME/lotus"
export LOTUS_STORAGE_PATH="$HOME/lotusstorage"
export WORKER_PATH="$HOME/lotusworker"
export FIL_PROOFS_PARAMETER_CACHE="$HOME/filecoin-proof-parameters"

# 设置国内的零知识证明参数下载源
export IPFS_GATEWAY="https://proof-parameters.s3.cn-south-1.jdcloud-oss.com/ipfs/"
# 手动下载零知识证明参数到FIL_PROOFS_PARAMETER_CACHE目录中,有200GB
lotus fetch-params 32GiB

启动lotus。

# 确定版本
lotus -v
lotus version 0.4.1+git.ee7bdf38

# 启动lotus
nohup lotus daemon > ~/lotus.log 2>&1 &

# 查看日志
tail -f ~/lotus.log

# 生成account。需要去 https://faucet.testnet.filecoin.io/ 领取测试币和创建矿工账户
lotus wallet new bls

# 等待节点同步完成
lotus sync wait

启动miner。需要先完成领取测试币、注册矿工、节点同步完成。

# 使用矿工注册结果来初始化miner
lotus-storage-miner init --actor=xxx --owner=xxxxx

# 如果miner和worker不在一台机器,需要配置miner的IP
# 取消ListenAddress和RemoteListenAddress前面的注释,并将它们的IP改成局域网IP
vi ~/.lotusstorage/config.toml

# 启动miner。
# --max-parallel表示每个worker允许并行的sector数量。
# 当有 256 GB 内存、64 GB swap 和 1.4 TB 硬盘空闲空间的情况下,可以并行2个sector。
# 当有 128 GB 内存、64 GB swap 和 0.7 TB 硬盘空闲空间的情况下,可以并行1个sector。
nohup lotus-storage-miner run --max-parallel 2 > ~/miner.log 2>&1 &

# 查看日志
tail -f ~/miner.log

# storage attach,即告诉miner真正存储数据的地方。请选择机械硬盘或网盘下的目录
lotus-storage-miner storage attach --init=true --store=true /path/to/storage

# 查看miner信息
lotus-storage-miner info

启动worker。

# 如果miner和worker不在一台机器,需要将miner机器LOTUS_STORAGE_PATH下的api和token两个文件拷贝到worker机器的LOTUS_STORAGE_PATH下

# 可选的环境变量
# 以下设置会让worker使用GPU计算PreCommit2。
export FIL_PROOFS_USE_GPU_COLUMN_BUILDER=1
export FIL_PROOFS_USE_GPU_TREE_BUILDER=1
# 以下设置会让worker不使用GPU计算Commit2,而改用CPU。
export BELLMAN_NO_GPU=true
# 以下设置将会让worker显示更详细的日志
export RUST_BACKTRACE=full
export RUST_LOG=debug

# 启动worker,需要加入局域网IP
lotus-seal-worker run --address xxx.xxx.xxx.xxx:3456 > ~/worker.log 2>&1 &
# 查看日志
tail -f ~/miner.log

进阶:worker使用多个SSD路径用于封装,注意并行数也会随之增加。

lotus-seal-worker run --address xxx.xxx.xxx.xxx:3456 --attach /path/to/another/ssd/directory > ~/worker.log 2>&1 &

观察运行情况。在miner机器执行。常用命令列举如下。

lotus-storage-miner info
lotus-storage-miner storage list
lotus-storage-miner workers list
lotus-storage-miner sectors list

或者使用区块浏览器,例如 https://filfox.io/ ,查看。

如果sector出错,可以查看sector日志,找到出错原因。或者直接删除sector。以0号sector为例。

lotus-storage-miner sectors status --log 0
lotus-storage-miner sectors update-state --really-do-it 0 Removing

TODO

  • 有时会因为worker运行任务过多,资源不够,导致部分sector出现短时间的SealPreCommit1Failed状态,可忽略。
  • 程序在推荐配置下顺利运行,没有做过其他环境的测试,如果遇到问题可以提issue。
  • 会及时合入官方的代码改动。
  • 运行前请保证可用内存和SSD空间充裕。

lotus-miner's People

Contributors

josephbedminster avatar shannon-6block avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.