Created
December 2, 2017 06:51
-
-
Save daiki44/74b6a7fab13f4f2b2810d90f2a4291a7 to your computer and use it in GitHub Desktop.
【Monacoin】ubuntu14.04にインストールしてマイニングまでやってみた話 ref: https://qiita.com/daiki_44/items/2a2de88a9ae8da02eefa
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
#------------------------------------- | |
# 'monacoin-cli getnewaddress'で作成したアドレス | |
echo "マイニング報酬を受取るアドレスを入力してください" | |
read ADDR | |
#------------------------------------- | |
# confファイルの読み込み | |
. ~/.monacoin/monacoin.conf | |
if [ -z ${rpcport} ]; then | |
echo "rpcportが定義されていません" | |
exit | |
fi | |
if [ -z ${rpcuser} ]; then | |
echo "rpcuserが定義されていません" | |
exit | |
fi | |
if [ -z ${rpcpassword} ]; then | |
echo "rpcpasswordが定義されていません" | |
exit | |
fi | |
[cpuminerまでのpath]/cpuminer-multi/cpuminer -a lyra2REv2 -o localhost:${rpcport} -O ${rpcuser}:${rpcpassword} --coinbase-addr=${ADDR} --api-bind 0 --timeout=1000 --scantime=15 -D 2>&1 > /var/log/cpuminer/cpuminer.log & | |
echo "cpuminerを起動しました" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git clone https://github.com/tpruvot/cpuminer-multi.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 普段のログはこんな感じです | |
# 現在のブロック数とCPUが毎秒どれくらいの数ハッシュを算出しているのかが出力されます | |
[2017-12-02 15:32:48] Current block is 1177781 | |
# このエラーは良く吐かれますが、miningは動いているのでいつもスルーしています | |
[2017-12-02 15:32:48] JSON-RPC call failed: Method not found | |
[2017-12-02 15:33:02] CPU #0: 56.79 kH/s | |
[2017-12-02 15:33:02] CPU #1: 57.35 kH/s | |
[2017-12-02 15:33:03] Current block is 1177781 | |
[2017-12-02 15:33:26] Current block is 1177782 | |
# miningが成功するとこのログを吐きます。yes!が目印ですね | |
[2017-12-02 15:30:43] accepted: 1/1 (100%), 9067 kH/s yes! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# monacoinのdirに入る | |
cd monacoin | |
# makeファイルの生成 | |
./autogen.sh | |
./configure --with-incompatible-bdb --without-gui | |
# インストール | |
sudo make | |
sudo make install | |
# 生成されたdaemonとclientをパスの通るところへコピー | |
sudo cp src/monacoind /usr/bin/ | |
sudo cp src/monacoin-cli /usr/bin/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# monacoinディレクトリの作成 | |
mkdir ~/.monacoin | |
vim ~/.monacoin/monacoin.conf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# daemon起動 | |
monacoind & | |
# Block数や自分の残高等、様々な情報を確認する | |
monacoin-cli getinfo | |
# 残高を確認する | |
monacoin-cli getbalance | |
# ブロックチェーンアドレスを生成する | |
monacoin-cli getnewaddress [好きなアカウント名] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# cpuminer-multiのdirに入る | |
cd cpuminer-multi | |
# build用のshellを叩きます | |
# これで上手く動かなければ、monacoinと同じように、./autogen.shからやる感じです | |
sh ./build.sh | |
sudo make | |
sudo make install |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo touch /var/log/cpuminer.log | |
sudo chmod 666 /var/log/cpuminer.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo apt-get install git git-core build-essential libssl-dev libdb++-dev libminiupnpc-dev libboost-dev libboost-system-dev libboost-filesystem-dev libboost-program-options-dev libboost-thread-dev libboost-test-dev libevent-dev libboost-all-dev automake autoconf libtool |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# rpcコマンドを受け付けるかどうか | |
server=1 | |
# rpcコマンドを受け付ける際のユーザー名とパスワード、ポート番号の設定 | |
rpcuser=[user名] | |
rpcpassword=[パスワード] | |
rpcport=4444 | |
daemon=1 | |
gen=0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git clone https://github.com/monacoinproject/monacoin.git |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment