CentOSでChia Network(XCH)をHDDマイニングする方法

chiaのインストールには、python 3.7以上、CentOS 7.7以上が必須とのことです。
Chiaではマイニングのことをファーミングともいいます。

ここでの説明は、主にCUI(コマンド)での実行をするものです。
GUI(デスクトップ環境)についてはインストールのみ記述しています。

[関連記事] 仮想通貨Chia Network(XCH)とは 多くの報酬を得る方法
[参考記事] RAIDでストレージを高速化する方法
[関連記事] Ubuntu/Debian/Raspberry PiでChia Network(XCH)をHDDマイニングする方法
[関連記事] WindowsでChia Network(XCH)をHDDマイニングする方法
[関連記事] 2台目以降のPCで同期(Sync)を早く終わらせるには

実行の前に既存パッケージをアップデートします。

# yum -y update

epelリポジトリをインストールします。

# yum -y install epel-release

インストールに必要なライブラリをインストールします。

# yum -y install gcc openssl-devel bzip2-devel zlib-devel libffi libffi-devel

sqlite関連をインストールします。

# yum -y install libsqlite3x-devel

Development Toolsをまとめてインストールします。

# yum -y groupinstall "Development Tools"

pythonをインストールします。

# yum -y install python38 python38-devel

gitをインストールします。

# yum -y install git

blockchain用のユーザーを作成する場合

blockchain用のユーザーを作成する場合は下記のコマンドです。

# useradd -g users blockchain

ユーザーIDを指定する場合

# useradd -u 510 -g users blockchain

パスワードの設定

# passwd blockchain

以降はユーザー権限で行うことができます。

GitHubから最新のchiaアプリケーションを取得します。

$ git clone https://github.com/Chia-Network/chia-blockchain.git -b latest

chia-blockchainディレクトリに移動します。

$ cd chia-blockchain

インストールを実行します。

$ sh install.sh

GUI版をインストールする場合

GUI版では、バージョン10以上のNodejsが必要です。

Nodejsをインストールします。

$ curl -sL https://rpm.nodesource.com/setup_10.x | sudo bash -
$ sudo yum install -y nodejs

GUIツールをインストールします。

$ sh install-gui.sh
$ cd chia-blockchain-gui
$ npm run build
$ npm run electron

アクティベートします。

$ . ./activate

これでchiaコマンドを使用することができます。

$ chia -h
Usage: chia [OPTIONS] COMMAND [ARGS]...

  Manage chia blockchain infrastructure (1.1.6)

Options:
  --root-path PATH  Config file root  [default:
                    /home/blockchain/.chia/mainnet]

  -h, --help        Show this message and exit.

Commands:
  configure   Modify configuration
  farm        Manage your farm
  init        Create or migrate the configuration
  keys        Manage your keys
  netspace    Estimate total farmed space on the network
  plots       Manage your plots
  run_daemon  Runs chia daemon
  show        Show node information
  start       Start service groups
  stop        Stop services
  version     Show chia version
  wallet      Manage your wallet

  Try 'chia start node', 'chia netspace -d 192', or 'chia show -s'

chiaを初期化します。

$ chia init

pipを更新します。

$ pip install --upgrade pip

キー関連のコマンドは下記のようになっています。

$ chia keys --help
Usage: chia keys [OPTIONS] COMMAND [ARGS]...

  Create, delete, view and use your key pairs

Options:
  -h, --help  Show this message and exit.

Commands:
  add                 Add a private key by mnemonic
  delete              Delete a key by its pk fingerprint in hex form
  delete_all          Delete all private keys in keychain
  generate            Generates and adds a key to keychain
  generate_and_print  Generates but does NOT add to keychain
  show                Displays all the keys in keychain
  sign                Sign a message with a private key
  verify              Verify a signature with a pk

キーがなければ、キーを作成します。

$ chia keys generate

既存でキーがある場合は、キーを読み込みます。

$ chia keys add
Enter the mnemonic you want to use: 

mnemonicは、既存で作成された24個の単語です。
スペース区切りで順番通りに24単語を入力します。

UPnP関連をインストールします。
(現在のGitのバージョンではこの2つはinstall.shに含まれています)

$ pip install -i https://hosted.chia.net/simple/ miniupnpc==2.1
$ pip install setproctitle

バージョンを指定してインストールします。

$ pip install chia-blockchain==1.1.6

これで採掘の準備は完了です。

'chia start all'で、ネットワークへの接続を開始します。

$ chia start all
Daemon not started yet
Starting daemon
chia_harvester: started
chia_timelord_launcher: started
chia_timelord: started
chia_farmer: started
chia_full_node: started
chia_wallet: started

採掘(Plot:耕作)を実行します。

nohup chia plots create -k 32 -b 4000 -r 2 -n 6 -t /chia_tmp -d /chia_data >> plots.log 2>&1 &

[参考記事] plots createコマンド
[参考記事] Plots(耕地)の作成 各パラメータの詳細説明

-k 32Plotのサイズ
-b 4000割り当てメモリ
-r 2スレッド数
-n 6生成するPlotの数
-t /chia_tmp一時ディレクトリ
-d /chia_data最終ディレクトリ

CPUのスレッド数は下記のコマンドで調べられます。

fgrep 'processor' /proc/cpuinfo | wc -l

[参考記事] Plot(耕作)中の各フェーズの動作

$ chia plots create -h
Usage: chia plots create [OPTIONS]

Options:
  -k, --size INTEGER              Plot size  [default: 32]
  --override-k                    Force size smaller than 32  [default: False]
  -n, --num INTEGER               Number of plots or challenges  [default: 1]
  -b, --buffer INTEGER            Megabytes for sort/plot buffer  [default:
                                  3389]

  -r, --num_threads INTEGER       Number of threads to use  [default: 2]
  -u, --buckets INTEGER           Number of buckets  [default: 128]
  -a, --alt_fingerprint INTEGER   Enter the alternative fingerprint of the key
                                  you want to use

  -c, --pool_contract_address TEXT
                                  Address of where the pool reward will be
                                  sent to. Only used if alt_fingerprint and
                                  pool public key are None

  -f, --farmer_public_key TEXT    Hex farmer public key
  -p, --pool_public_key TEXT      Hex public key of pool
  -t, --tmp_dir PATH              Temporary directory for plotting files
                                  [default: .]

  -2, --tmp2_dir PATH             Second temporary directory for plotting
                                  files

  -d, --final_dir PATH            Final directory for plots (relative or
                                  absolute)  [default: .]

  -i, --plotid TEXT               PlotID in hex for reproducing plots
                                  (debugging only)

  -m, --memo TEXT                 Memo in hex for reproducing plots (debugging
                                  only)

  -e, --nobitfield                Disable bitfield
  -x, --exclude_final_dir         Skips adding [final dir] to harvester for
                                  farming

  -h, --help                      Show this message and exit.

chiaの設定ファイルはyamlで、下記の場所にあります。

vi ~/.chia/mainnet/config/config.yaml

pypi chia-blockchain

関連記事

スポンサーリンク

TkSQLite

ホームページ製作・web系アプリ系の製作案件募集中です。

上に戻る