はじめに
- ここではMac OS X へビットコインクライアント(ビットコインコア)をソースコードからインストールします
- UI版(bitcoin-qt)は以下のサイトからダウンロードできます。
- https://bitcoin.org/ja/download
事前準備
- 事前にXcodeやautoconf,automake等をインストールする
$ brew install autoconf
$ brew install automake
ダウンロード
GitHubにあるビットコインのページからソースをダウンロードする。
https://github.com/bitcoin/bitcoin
$ git clone https://github.com/bitcoin/bitcoin.git
Cloning into 'bitcoin'...
remote: Counting objects: 76435, done.
Receiving objects: 100% (76435/76435), 68.48 MiB | 102.00 KiB/s, done.
remote: Total 76435 (delta 0), reused 0 (delta 0), pack-reused 76435
Resolving deltas: 100% (56632/56632), done.
Checking connectivity... done.
バージョン確認・選択
ダウンロードされた場所に移動する。
$cd bitcoin
バージョン一覧を表示する。
$ git tag
:
v0.9.5
v0.9.5rc1
v0.9.5rc2
ソースコードのバージョンを選ぶ。
$git checkout v0.9.5
Note: checking out 'v0.9.5'.
You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.
If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:
git checkout -b <new-branch-name>
HEAD is now at b880967... Merge pull request #6169
環境設定、コンパイル、インストール
環境の自動設定やコンパイル、インストールを行う。
$ ./autogen.sh
configure.ac:118: installing 'src/build-aux/compile'
:
:
parallel-tests: installing 'src/build-aux/test-driver'
configure.ac:707: warning: 'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS')
$./configure
checking build system type... x86_64-apple-darwin14.5.0
checking host system type... x86_64-apple-darwin14.5.0
:
:
config.status: creating src/bitcoin-config.h
config.status: executing depfiles commands
$ make
Making all in src
/Applications/Xcode.app/Contents/Developer/usr/bin/make all-recursive
Making all in .
CXX addrman.o
$ sudo make install
Making install in src
Making install in .
:
:
../../src/build-aux/install-sh -c -d '/usr/local/bin'
/usr/bin/install -c test_bitcoin '/usr/local/bin'
make[4]: Nothing to be done for `install-data-am'.
make[2]: Nothing to be done for `install-exec-am'.
make[2]: Nothing to be done for `install-data-am'.
インストール後の確認
bitcoindやbitcoin-cliのバージョンを確認する。
- bitcoind:ビットコインクライアントプロセス
- bitcoin-cli:ビットコインコマンド(クライアントへのAPI通知コマンド)
- bitcoin-qt:ビットコインクライアントのUI版(こちらはソースコードからはインストールされない)
$ bitcoind --help
Bitcoin Core Daemon version v0.9.5-beta
Usage:
:
:
$ bitcoin-cli --help
Bitcoin Core RPC client version v0.9.5-beta
Usage:
設定ファイル
bitcoinの設定ファイル(bitcoin.conf)を作成します。
今回はテストということで、テストネット側の接続として作成します。
作成する場所(/Users/[ユーザ]/Library/Application Support/Bitcoin)に注意してください。
bitcoin.conf
rpcuser=[*ユーザ名*]
rpcpassword=[*パスワード*]
server=1
txindex=1
rpcport=18332
testnet=3
動作確認
bitcoindをバックグランドで起動する。
$bitcoind -deamon
Bitcoin server starting
bitcoin-cliコマンドで情報を参照する。
$ bitcoin-cli getinfo
{
"version" : 90500,
"protocolversion" : 70002,
"walletversion" : 60000,
"balance" : 0.00000000,
"blocks" : 20495,
"timeoffset" : 0,
"connections" : 6,
"proxy" : "",
"difficulty" : 1.00000000,
"testnet" : true,
"keypoololdest" : 1474090632,
"keypoolsize" : 101,
"paytxfee" : 0.00000000,
"relayfee" : 0.00001000,
"errors" : ""
}
bitcoindを停止する。
$ bitcoin-cli stop
Bitcoin server stopping