Yenten(YTN)のマイニングプールを作ったので裏側公開!Stratumサーバー構築編(1)

Hatenablogへ移行しました

stratumuサーバー構築編

Yenten(YTN)のマイニングプールを作ったので裏側公開!の続きになります。

円天恋な〜プールはこちら

yenten price

stratumの動作について

stratumサーバーはマイニングする人たちとマイニングプールを接続代行してくれるサービスです。

主な役割は3点 - ウォレットにRPCで問い合わせし、現在の難易度(diffculty)や次点の難易度・全体のハッシュレートなどを取得 - マイナーとマイニングプールの仲介 - 採掘の総当たりを実施

早速構築

GIT: stratum-mining

pythonモジュール/memcachedを使うので事前にインストール

$  sudo apt-get install python-dev
$  sudo apt-get install python-setuptools
$  sudo apt-get install memcached
$  easy_install stratum

stratum-miningをcloneしてビルド実行※yentenのあとの5000は後ほど使うsystemdでのポート設定suffixで使用します。

$ cd /usr/local/
$ git clone https://github.com/ahmedbodi/stratum-mining.git yenten5000
$ cd yenten
$ git submodule init 
$ git submodule update 
$ cd externals/litecoin_scrypt 
$ python setup.py install 
$ cd ../stratum

twistd呼び出し時の設定で一部不備があるので、以下の点を変更

$ vim /usr/local/lib/python2.7/dist-packages/stratum-0.2.13-py2.7.egg/stratum/websocket_transport.py

1行目のautobahn.websocketautobahn.twisted.websocket に変更

yenten module 追加

$ git clone https://github.com/xshsaku/yenten_python_module
$ cd yenten_python_module
$ sudo python setup.py install

yenten パッチ

※yentenのアルゴリズムを追加するためにパッチを当てます。

$ git clone https://github.com/xshsaku/yenten_stratum_patch 
$ yenten_stratum_patch
$ cp yenten_stratum_patch/stratum.patch stratum-mining/
$ cd stratum-mining/
$ patch -p1 < stratum.patch

ここまででstratumの基本的なインストール及びパッチを当てることができました。

続いての記事では実際にconfigの設定を動かし、stratumu+tcpで接続ができるかまでを確認します。