• 微信公众号:美女很有趣。 工作之余,放松一下,关注即送10G+美女照片!

Linux高产出自动挖Chia币教程

开发技术 开发技术 1周前 (04-30) 5次浏览

 

1. 概述

  • chia挖矿分为两个环节:P图和挖矿
  • P图环节
    • 用官方命令行P图,
    • 用开源软件Plotman管理和调度任务,并且可以实现任务暂停,恢复,清理。
  • 挖矿环节
    • 用官方图形界面挖矿(本教程使用Ubuntu系统)

 

2. P图步骤

1. 安装chia-blockchain官方挖矿软件(界面客户端)

    • 用于生成chia命令行P图的配置,在P好图后用其进行挖矿。 下载地址:https://download.chia.net/latest/x86_64-Ubuntu-gui

2. 准备缓存目录和最终目录

    • 批量创建目录
for i in $(seq 1 12)   # 根据自己的磁盘数设置,这里是12个盘
do 
  mkdir /mnt/P$i/temp;   # 缓存目录
    mkdir /mnt/P$i/plots;  # 最终目录
  chmod -R 755 /mnt/P$i; # 设置写入权限
done;

 

    • 挂载硬盘
# 根据自己的实际磁盘数设置
mount -t ext4 /dev/sdb1 /mnt/P1;
mount -t ext4 /dev/sdc1 /mnt/P2;

 

 

3. 安装chia命令行和Plotman

注意:plotman直接使用界面版中自带的chia命令会异常,因此需要单独安装chia命令

sudo pip install virtualenvwrapper
echo "source /usr/local/bin/virtualenvwrapper.sh" >> ~/.bashrc
source ~/.bashrc
cd ~                           # 切换至用户目录
mkvirtualenv chia  # 创建chia环境
workon chia              # 切换至chia环境

 

pip install chia-blockchain

 

pip install plotman

 

    • 生成配置plotman
plotman config generate

 

    • 修改plotman配置
Linux高产出自动挖Chia币教程Linux高产出自动挖Chia币教程

# Default/example plotman.yaml configuration file

# Options for display and rendering
user_interface:
        # Call out to the `stty` program to determine terminal size, instead of
        # relying on what is reported by the curses library.   In some cases,
        # the curses library fails to update on SIGWINCH signals.  If the
        # `plotman interactive` curses interface does not properly adjust when
        # you resize the terminal window, you can try setting this to True. 
        use_stty_size: True

# Where to plot and log.
directories:
        # One directory in which to store all plot job logs (the STDOUT/
        # STDERR of all plot jobs).  In order to monitor progress, plotman
        # reads these logs on a regular basis, so using a fast drive is
        # recommended.
        #  配置日志存放目录,plotman依赖日志进行任务调度和进度分析
        log: /home/chia/chia/logs  

        # One or more directories to use as tmp dirs for plotting.  The
        # scheduler will use all of them and distribute jobs among them.
        # It assumes that IO is independent for each one (i.e., that each
        # one is on a different physical device).
        #
        # If multiple directories share a common prefix, reports will
        # abbreviate and show just the uniquely identifying suffix.
        # 设置缓存目录
        tmp:
                - /mnt/P1/temp
                - /mnt/P2/temp
                - /mnt/P3/temp
                - /mnt/P4/temp

        # Optional: Allows overriding some characteristics of certain tmp
        # directories. This contains a map of tmp directory names to
        # attributes. If a tmp directory and attribute is not listed here,
        # it uses the default attribute setting from the main configuration.
        #
        # Currently support override parameters:
        #     - tmpdir_max_jobs
        # 设置每个缓存目录最大并行任务数
        tmp_overrides:
                # In this example, /mnt/tmp/00 is larger than the other tmp
                # dirs and it can hold more plots than the default.
                "/mnt/P1/temp":
                        tmpdir_max_jobs: 5

        # Optional: tmp2 directory.  If specified, will be passed to
        # chia plots create as -2.  Only one tmp2 directory is supported.
        # tmp2: /mnt/tmp/a

        # One or more directories; the scheduler will use all of them.
        # These again are presumed to be on independent physical devices,
        # so writes (plot jobs) and reads (archivals) can be scheduled
        # to minimize IO contention.
        # 设置最终目录,存放P好后的图文件
        dst:
                - /mnt/P1/plots
                - /mnt/P2/plots

        # Archival configuration.  Optional; if you do not wish to run the
        # archiving operation, comment this section out.
        #
        # Currently archival depends on an rsync daemon running on the remote
        # host, and that the module is configured to match the local path.
        # See code for details.
        # 设置远程归档目录,即可以将P好的图自动同步到远程目录,这里没启用
        # archive:
        #       rsyncd_module: plots
        #       rsyncd_path: /plots
        #       rsyncd_bwlimit: 80000  # Bandwidth limit in KB/s
        #       rsyncd_host: myfarmer
        #       rsyncd_user: chia
                # Optional index.  If omitted or set to 0, plotman will archive
                # to the first archive dir with free space.  If specified,
                # plotman will skip forward up to 'index' drives (if they exist).
                # This can be useful to reduce io contention on a drive on the
                # archive host if you have multiple plotters (simultaneous io
                # can still happen at the time a drive fills up.)  E.g., if you
                # have four plotters, you could set this to 0, 1, 2, and 3, on
                # the 4 machines, or 0, 1, 0, 1.
                #   index: 0


# Plotting scheduling parameters
scheduling:
        # Run a job on a particular temp dir only if the number of existing jobs
        # before tmpdir_stagger_phase_major tmpdir_stagger_phase_minor
        # is less than tmpdir_stagger_phase_limit.
        # Phase major corresponds to the plot phase, phase minor corresponds to
        # the table or table pair in sequence, phase limit corresponds to
        # the number of plots allowed before [phase major, phase minor]
        # 不限制每个阶段的最大数
        tmpdir_stagger_phase_major: 99
        tmpdir_stagger_phase_minor: 99
        # Optional: default is 1
        tmpdir_stagger_phase_limit: 99

        # Don't run more than this many jobs at a time on a single temp dir.
        # 限制缓存目录的最大并行数,会同时根据tmp_overrides的配置取最小值
        tmpdir_max_jobs: 12

        # Don't run more than this many jobs at a time in total.
        # 限制所有任务的总数最大值
        global_max_jobs: 12

        # Don't run any jobs (across all temp dirs) more often than this, in minutes.
        # 设置多长时间启动一次任务(满足前面的最大限制的情况下)
        global_stagger_m: 30

        # How often the daemon wakes to consider starting a new plot job, in seconds.
        # 设置多长时间轮询一次状态
        polling_time_s: 20


# Plotting parameters.  These are pass-through parameters to chia plots create.
# See documentation at
# https://github.com/Chia-Network/chia-blockchain/wiki/CLI-Commands-Reference#create
plotting:
        k: 32
        e: False             # Use -e plotting option
        # 设置线程数
        n_threads: 2         # Threads per job
        # 设置桶数
        n_buckets: 128       # Number of buckets to split data into
        # 设置最大内存
        job_buffer: 4608     # Per job memory
        # If specified, pass through to the -f and -p options.  See CLI reference.
        #   farmer_pk: ...
        #   pool_pk: ...

View Code

 

4. 启动P图

    • 初始化配置

启动界面客户端并登录,在农田界面的右上角点击三个点按钮,添加农田文件目录,对应/mnt/P1/plots (p1到P12,根据自己前面步骤中创建的目录设置。等到P好图存入到对应的目录,会自动识别并挖矿

Linux高产出自动挖Chia币教程

 

    • 启动plotman开始自动P图
plotman interactive  # 启动可视化界面, 可视化界面第二行可以看到任务的总数和进度的整体分布情况。
# 如果无法启动,也可以用: plotman plot 

Linux高产出自动挖Chia币教程

 

3. 查看进度和收益

1. 查看P图进度

watch plotman status

Linux高产出自动挖Chia币教程

2. 查看日志分析

cd /home/chia/chia/logs  # 进入日志目录
plotman analyze *.log    # 查看总数
plotman analyze 2021-04-28*.log   # 查看28日启动的任务个阶段耗时统计,单位:秒

Linux高产出自动挖Chia币教程

3. 查看挖矿进度和收益

打开官方挖矿软件查看挖矿进度和收益,P好的图会自动导入并开始挖矿。

Linux高产出自动挖Chia币教程

 

4. 附:投入产出数据参考

  • 投入合计成本:2.3W
  • 投入配置:
  型号 数量 单个参数 合计
CPU Xeon E5-2695 v4  2 18核,36线程 36核,72线程
内存 SK HYNIX HMA42GR7MFR4N-TF  8 16G 128G
主板 X10DRL-i 1    
固态硬盘 INTEL SSDPE7KX040T7 1 4T 4T
机械硬盘 希捷ST14000NM001G 12 14T 168T
  • 按以上配置投入3日,稳定后每日P图约50个,合计空间5T,总计131个图,12.9TiB,截至全网大小1.19EiB时,预计21天爆块。(CPU和内存存在浪费,后续增加3块SSD预计可以提升至每天25T)
  • 欢迎交流QQ群:790876237  
  • 原文:https://www.yuque.com/docs/share/b6c40b2a-3448-4d15-bcef-41c04bb2dd4a?# 《Linux高产出自动挖Chia币教程》

Linux高产出自动挖Chia币教程

 

 


程序员灯塔
转载请注明原文链接:Linux高产出自动挖Chia币教程
喜欢 (0)