LoginSignup
15
17

More than 3 years have passed since last update.

bitcoindをcentos7にインストール

Last updated at Posted at 2016-09-07

ノードの構築にどうぞ。

  • ソースからインストールする手順です。バイナリパッケージでいい人はこんなことしなくていいです。
  • GUIを使わずに、CLIオンリーな人向けです。
  • sudoerユーザーで行っています。難しい場合にはrootユーザーで行えばいいです。

環境

こんなんです。seLinuxは無効にしています。

bash
[murata@bitcoin-core-test ~]$ getenforce 
Disabled
[murata@bitcoin-core-test ~]$ cat /etc/redhat-release
CentOS Linux release 7.2.1511 (Core) 
[murata@bitcoin-core-test ~]$ uname -a
Linux bitcoin-core-test 3.10.0-327.28.3.el7.x86_64 #1 SMP Thu Aug 18 19:05:49 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

bitcoind インストールprefix

yumでインストールできるものはyumで。コアとなるものは、ソースからインストールします。
今回は、/opt/bitcoind/ にインストールしようと思います。

事前にepelとgccなどインストール

bitcoindさんDBにBerkeley DBの4.8が必要なので、epel を入れておく。

[murata@bitcoin-core-test ~]$ sudo rpm -ivh http://ftp.riken.jp/Linux/fedora/epel/7/x86_64/e/epel-release-7-7.noarch.rpm

yes/noなどを聞かれたらyで。

不必要なものもありそうだか、ほかのものでもだいたい下記を使うので入れておく。

[murata@bitcoin-core-test ~]$ sudo yum install gcc gcc-c++ cpp libtool patch patchutils bzip2 zip unzip rsync wget ntp pciutils make autoconf automake libxslt openssl-devel zlib-devel curl-devel bind-utils ncurses ncurses-devel ncurses-static ncurses-term libevent libevent-devel libevent-doc

手順

ディレクトリを掘る

すでにディレクトリがないかを確認してから行いましょう。

bash
[murata@bitcoin-core-test /]$ sudo mkdir -p /opt/bitcoind/src/

bitcoinのソースをDLする。

/opt/bitcoind/src/https://github.com/bitcoin/bitcoin/releasesから最新のものをDLする。

[murata@bitcoin-core-test src]$ pwd
/opt/bitcoind/src
[murata@bitcoin-core-test src]$ sudo wget https://github.com/bitcoin/bitcoin/archive/v0.13.0.tar.gz
--2016-09-07 14:34:47--  https://github.com/bitcoin/bitcoin/archive/v0.13.0.tar.gz
github.com (github.com) をDNSに問いあわせています... 192.30.253.112
github.com (github.com)|192.30.253.112|:443 に接続しています... 接続しました。
HTTP による接続要求を送信しました、応答を待っています... 302 Found
場所: https://codeload.github.com/bitcoin/bitcoin/tar.gz/v0.13.0 [続く]
--2016-09-07 14:34:48--  https://codeload.github.com/bitcoin/bitcoin/tar.gz/v0.13.0
codeload.github.com (codeload.github.com) をDNSに問いあわせています... 192.30.253.120
codeload.github.com (codeload.github.com)|192.30.253.120|:443 に接続しています... 接続しました。
HTTP による接続要求を送信しました、応答を待っています... 200 OK
長さ: 特定できません [application/x-gzip]
`v0.13.0.tar.gz' に保存中

    [                          <=>                                                                                                                                               ] 5,833,967    818KB/s 時間 7.9s   

2016-09-07 14:34:56 (721 KB/s) - `v0.13.0.tar.gz' へ保存終了 [5833967]

DLしたソースを解凍する。

[murata@bitcoin-core-test src]$ sudo tar zxfv v0.13.0.tar.gz                                                                                                                                                         
bitcoin-0.13.0/
bitcoin-0.13.0/.gitattributes
bitcoin-0.13.0/.gitignore
bitcoin-0.13.0/.travis.yml
bitcoin-0.13.0/.tx/
bitcoin-0.13.0/.tx/config
bitcoin-0.13.0/CONTRIBUTING.md
bitcoin-0.13.0/COPYING
bitcoin-0.13.0/INSTALL
bitcoin-0.13.0/Makefile.am
bitcoin-0.13.0/README.md
bitcoin-0.13.0/autogen.sh
bitcoin-0.13.0/build-aux/

~snip;

解凍出来ているか確認する。
↓みたいになっていればOK

[murata@bitcoin-core-test src]$ cd bitcoin-0.13.0/
[murata@bitcoin-core-test bitcoin-0.13.0]$ ll
合計 104
-rw-rw-r--  1 root root  9123  8月 17 20:06 CONTRIBUTING.md
-rw-rw-r--  1 root root  1099  8月 17 20:06 COPYING
-rw-rw-r--  1 root root   163  8月 17 20:06 INSTALL
-rw-rw-r--  1 root root  8699  8月 17 20:06 Makefile.am
-rw-rw-r--  1 root root  3501  8月 17 20:06 README.md
-rwxrwxr-x  1 root root   335  8月 17 20:06 autogen.sh
drwxrwxr-x  3 root root    15  8月 17 20:06 build-aux
-rw-rw-r--  1 root root 39694  8月 17 20:06 configure.ac
drwxrwxr-x 17 root root  4096  8月 17 20:06 contrib
drwxrwxr-x  6 root root  4096  8月 17 20:06 depends
drwxrwxr-x  4 root root  4096  8月 17 20:06 doc
-rw-rw-r--  1 root root   295  8月 17 20:06 libbitcoinconsensus.pc.in
drwxrwxr-x  4 root root    56  8月 17 20:06 qa
drwxrwxr-x  6 root root    92  8月 17 20:06 share
drwxrwxr-x 21 root root  4096  8月 17 20:06 src

autogen.sh で configure ファイルを作成する。

[murata@bitcoin-core-test bitcoin-0.13.0]$ sudo ./autogen.sh 
libtoolize: putting auxiliary files in AC_CONFIG_AUX_DIR, `build-aux'.
libtoolize: copying file `build-aux/ltmain.sh'
libtoolize: putting macros in AC_CONFIG_MACRO_DIR, `build-aux/m4'.
libtoolize: copying file `build-aux/m4/libtool.m4'
libtoolize: copying file `build-aux/m4/ltoptions.m4'
libtoolize: copying file `build-aux/m4/ltsugar.m4'
libtoolize: copying file `build-aux/m4/ltversion.m4'
libtoolize: copying file `build-aux/m4/lt~obsolete.m4'
configure.ac:45: installing 'build-aux/config.guess'
configure.ac:45: installing 'build-aux/config.sub'
configure.ac:28: installing 'build-aux/install-sh'
configure.ac:28: installing 'build-aux/missing'
Makefile.am: installing 'build-aux/depcomp'
parallel-tests: installing 'build-aux/test-driver'
libtoolize: putting auxiliary files in AC_CONFIG_AUX_DIR, `build-aux'.
libtoolize: copying file `build-aux/ltmain.sh'
libtoolize: putting macros in AC_CONFIG_MACRO_DIR, `build-aux/m4'.
libtoolize: copying file `build-aux/m4/libtool.m4'
libtoolize: copying file `build-aux/m4/ltoptions.m4'
libtoolize: copying file `build-aux/m4/ltsugar.m4'
libtoolize: copying file `build-aux/m4/ltversion.m4'
libtoolize: copying file `build-aux/m4/lt~obsolete.m4'
configure.ac:26: installing 'build-aux/compile'
configure.ac:5: installing 'build-aux/config.guess'
configure.ac:5: installing 'build-aux/config.sub'
configure.ac:9: installing 'build-aux/install-sh'
configure.ac:9: installing 'build-aux/missing'
Makefile.am: installing 'build-aux/depcomp'
parallel-tests: installing 'build-aux/test-driver'
libtoolize: putting auxiliary files in AC_CONFIG_AUX_DIR, `build-aux'.
libtoolize: copying file `build-aux/ltmain.sh'
libtoolize: putting macros in AC_CONFIG_MACRO_DIR, `build-aux/m4'.
libtoolize: copying file `build-aux/m4/libtool.m4'
libtoolize: copying file `build-aux/m4/ltoptions.m4'
libtoolize: copying file `build-aux/m4/ltsugar.m4'
libtoolize: copying file `build-aux/m4/ltversion.m4'
libtoolize: copying file `build-aux/m4/lt~obsolete.m4'
configure.ac:22: installing 'build-aux/config.guess'
configure.ac:22: installing 'build-aux/config.sub'
configure.ac:32: installing 'build-aux/install-sh'
configure.ac:32: installing 'build-aux/missing'
Makefile.am:5: warning: user variable 'GZIP_ENV' defined here ...
/usr/share/automake-1.13/am/distdir.am: ... overrides Automake variable 'GZIP_ENV' defined here
src/Makefile.am: installing 'build-aux/depcomp'
src/Makefile.am:454: warning: user target '.mm.o' defined here ...
/usr/share/automake-1.13/am/depend2.am: ... overrides Automake target '.mm.o' defined here
parallel-tests: installing 'build-aux/test-driver'

ビルドに必要なものを探す。

下記URLを参考にyumで必要そうなパッケージをインストールする。

Berkeley DB 4.8インストール

[root@bitcoin-core-test ~]# yum install libdb4-cxx-devel-4.8.30-13.el7.x86_64
読み込んだプラグイン:fastestmirror
Loading mirror speeds from cached hostfile
 * base: centos.usonyx.net
 * epel: mirror01.idc.hinet.net
 * extras: mirror.vastspace.net
 * updates: mirror.vastspace.net
依存性の解決をしています
--> トランザクションの確認を実行しています。
---> パッケージ libdb4-cxx-devel.x86_64 0:4.8.30-13.el7 を インストール
--> 依存性の処理をしています: libdb4-devel(x86-64) = 4.8.30-13.el7 のパッケージ: libdb4-cxx-devel-4.8.30-13.el7.x86_64
--> 依存性の処理をしています: libdb4-cxx(x86-64) = 4.8.30-13.el7 のパッケージ: libdb4-cxx-devel-4.8.30-13.el7.x86_64
--> トランザクションの確認を実行しています。
---> パッケージ libdb4-cxx.x86_64 0:4.8.30-13.el7 を インストール
--> 依存性の処理をしています: libdb4(x86-64) = 4.8.30-13.el7 のパッケージ: libdb4-cxx-4.8.30-13.el7.x86_64
---> パッケージ libdb4-devel.x86_64 0:4.8.30-13.el7 を インストール
--> トランザクションの確認を実行しています。
---> パッケージ libdb4.x86_64 0:4.8.30-13.el7 を インストール
--> 依存性解決を終了しました。

依存性を解決しました

=====================================================================================================================================================================================================================
 Package                                                  アーキテクチャー                               バージョン                                               リポジトリー                                  容量
=====================================================================================================================================================================================================================
インストール中:
 libdb4-cxx-devel                                         x86_64                                         4.8.30-13.el7                                            epel                                          15 k
依存性関連でのインストールをします:
 libdb4                                                   x86_64                                         4.8.30-13.el7                                            epel                                         607 k
 libdb4-cxx                                               x86_64                                         4.8.30-13.el7                                            epel                                         635 k
 libdb4-devel                                             x86_64                                         4.8.30-13.el7                                            epel                                          32 k

トランザクションの要約
=====================================================================================================================================================================================================================
インストール  1 パッケージ (+3 個の依存関係のパッケージ)

総ダウンロード容量: 1.3 M
インストール容量: 3.3 M
Is this ok [y/d/N]: y
Downloading packages:
(1/4): libdb4-4.8.30-13.el7.x86_64.rpm                                                                                                                                                        | 607 kB  00:00:01     
(2/4): libdb4-cxx-4.8.30-13.el7.x86_64.rpm                                                                                                                                                    | 635 kB  00:00:00     
(3/4): libdb4-cxx-devel-4.8.30-13.el7.x86_64.rpm                                                                                                                                              |  15 kB  00:00:00     
(4/4): libdb4-devel-4.8.30-13.el7.x86_64.rpm                                                                                                                                                  |  32 kB  00:00:00     
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
合計                                                                                                                                                                                 754 kB/s | 1.3 MB  00:00:01     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  インストール中          : libdb4-4.8.30-13.el7.x86_64                                                                                                                                                          1/4 
  インストール中          : libdb4-devel-4.8.30-13.el7.x86_64                                                                                                                                                    2/4 
  インストール中          : libdb4-cxx-4.8.30-13.el7.x86_64                                                                                                                                                      3/4 
  インストール中          : libdb4-cxx-devel-4.8.30-13.el7.x86_64                                                                                                                                                4/4 
  検証中                  : libdb4-cxx-devel-4.8.30-13.el7.x86_64                                                                                                                                                1/4 
  検証中                  : libdb4-4.8.30-13.el7.x86_64                                                                                                                                                          2/4 
  検証中                  : libdb4-devel-4.8.30-13.el7.x86_64                                                                                                                                                    3/4 
  検証中                  : libdb4-cxx-4.8.30-13.el7.x86_64                                                                                                                                                      4/4 

インストール:
  libdb4-cxx-devel.x86_64 0:4.8.30-13.el7                                                                                                                                                                            

依存性関連をインストールしました:
  libdb4.x86_64 0:4.8.30-13.el7                                      libdb4-cxx.x86_64 0:4.8.30-13.el7                                      libdb4-devel.x86_64 0:4.8.30-13.el7                                     

完了しました!

libboostインストール

[root@bitcoin-core-test ~]# yum install boost-devel.x86_64

~snip;

configure

  • prefix(インストール先は)/opt/bitcoind/にするのでprefixを指定。
  • GUIは不要なので--with-gui=noをつけておく。
[murata@bitcoin-core-test bitcoin-0.13.0]$ sudo ./configure --prefix=/opt/bitcoind/ --with-gui=no

~snip;

checking for EC functions in libcrypto... yes
checking whether byte ordering is bigendian... no
configure: Using assembly optimizations: x86_64
configure: Using field implementation: 64bit
configure: Using bignum implementation: no
configure: Using scalar implementation: 64bit
configure: Using endomorphism optimizations: no
configure: Building ECDH module: no
configure: Building Schnorr signatures module: no
configure: Building ECDSA pubkey recovery module: yes
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: creating libsecp256k1.pc
config.status: creating src/libsecp256k1-config.h
config.status: executing depfiles commands
config.status: executing libtool commands
Fixing libtool for -rpath problems.

足りないものがあればerrorが出ているのでyumでパッケージをインストールする。

make

ビルドする。スペックによって結構時間がかかるかも。
jパラメータは同時に処理するスレッド数。他で使っていないサーバであればcore数を指定する。(別につけなくてもよい)

[murata@bitcoin-core-test bitcoin-0.13.0]$ sudo make -j4
Making all in src
make[1]: ディレクトリ `/opt/bitcoind/src/bitcoin-0.13.0/src' に入ります
make[2]: ディレクトリ `/opt/bitcoind/src/bitcoin-0.13.0/src' に入ります
  CXX      crypto/libbitcoinconsensus_la-aes.lo
  CXX      crypto/libbitcoinconsensus_la-hmac_sha256.lo
  CXX      crypto/libbitcoinconsensus_la-hmac_sha512.lo

~snip;

  CXXLD    bench/bench_bitcoin
  CXXLD    test/test_bitcoin
make[2]: ディレクトリ `/opt/bitcoind/src/bitcoin-0.13.0/src' から出ます
make[1]: ディレクトリ `/opt/bitcoind/src/bitcoin-0.13.0/src' から出ます
make[1]: ディレクトリ `/opt/bitcoind/src/bitcoin-0.13.0' に入ります
make[1]: `all-am' に対して行うべき事はありません.
make[1]: ディレクトリ `/opt/bitcoind/src/bitcoin-0.13.0' から出ます
[murata@bitcoin-core-test bitcoin-0.13.0]$ 

エラーが出ていれば対応して、$ sudo make distclean して autogen.shからやり直す。

make install

configureで指定したディレクトリにファイルがコピーされます。

[murata@bitcoin-core-test bitcoin-0.13.0]$ sudo make install
Making install in src
make[1]: ディレクトリ `/opt/bitcoind/src/bitcoin-0.13.0/src' に入ります
make[2]: ディレクトリ `/opt/bitcoind/src/bitcoin-0.13.0/src' に入ります
make[3]: ディレクトリ `/opt/bitcoind/src/bitcoin-0.13.0/src' に入ります
 /usr/bin/mkdir -p '/opt/bitcoind/lib'
 /bin/sh ../libtool   --mode=install /usr/bin/install -c   libbitcoinconsensus.la '/opt/bitcoind/lib'
libtool: install: /usr/bin/install -c .libs/libbitcoinconsensus.so.0.0.0 /opt/bitcoind/lib/libbitcoinconsensus.so.0.0.0
libtool: install: (cd /opt/bitcoind/lib && { ln -s -f libbitcoinconsensus.so.0.0.0 libbitcoinconsensus.so.0 || { rm -f libbitcoinconsensus.so.0 && ln -s libbitcoinconsensus.so.0.0.0 libbitcoinconsensus.so.0; }; })
libtool: install: (cd /opt/bitcoind/lib && { ln -s -f libbitcoinconsensus.so.0.0.0 libbitcoinconsensus.so || { rm -f libbitcoinconsensus.so && ln -s libbitcoinconsensus.so.0.0.0 libbitcoinconsensus.so; }; })
libtool: install: /usr/bin/install -c .libs/libbitcoinconsensus.lai /opt/bitcoind/lib/libbitcoinconsensus.la
libtool: install: /usr/bin/install -c .libs/libbitcoinconsensus.a /opt/bitcoind/lib/libbitcoinconsensus.a
libtool: install: chmod 644 /opt/bitcoind/lib/libbitcoinconsensus.a
libtool: install: /usr/bin/ranlib /opt/bitcoind/lib/libbitcoinconsensus.a
libtool: finish: PATH="/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/home/murata/.local/bin:/home/murata/bin:/home/murata/.local/bin:/home/murata/bin:/sbin" ldconfig -n /opt/bitcoind/lib
----------------------------------------------------------------------
Libraries have been installed in:
   /opt/bitcoind/lib

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
   - add LIBDIR to the `LD_LIBRARY_PATH' environment variable
     during execution
   - add LIBDIR to the `LD_RUN_PATH' environment variable
     during linking
   - use the ` -D__LIBTOOL_IS_A_FOOL__ ' linker flag
   - have your system administrator add LIBDIR to `/etc/ld.so.conf'

See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------
 /usr/bin/mkdir -p '/opt/bitcoind/bin'
  /bin/sh ../libtool   --mode=install /usr/bin/install -c bitcoind bitcoin-cli bitcoin-tx test/test_bitcoin bench/bench_bitcoin '/opt/bitcoind/bin'
libtool: install: /usr/bin/install -c bitcoind /opt/bitcoind/bin/bitcoind
libtool: install: /usr/bin/install -c bitcoin-cli /opt/bitcoind/bin/bitcoin-cli
libtool: install: /usr/bin/install -c bitcoin-tx /opt/bitcoind/bin/bitcoin-tx
libtool: install: /usr/bin/install -c test/test_bitcoin /opt/bitcoind/bin/test_bitcoin
libtool: install: /usr/bin/install -c bench/bench_bitcoin /opt/bitcoind/bin/bench_bitcoin
 /usr/bin/mkdir -p '/opt/bitcoind/include'
 /usr/bin/install -c -m 644 script/bitcoinconsensus.h '/opt/bitcoind/include'
make[3]: ディレクトリ `/opt/bitcoind/src/bitcoin-0.13.0/src' から出ます
make[2]: ディレクトリ `/opt/bitcoind/src/bitcoin-0.13.0/src' から出ます
make[1]: ディレクトリ `/opt/bitcoind/src/bitcoin-0.13.0/src' から出ます
make[1]: ディレクトリ `/opt/bitcoind/src/bitcoin-0.13.0' に入ります
make[2]: ディレクトリ `/opt/bitcoind/src/bitcoin-0.13.0' に入ります
make[2]: `install-exec-am' に対して行うべき事はありません.
 /usr/bin/mkdir -p '/opt/bitcoind/lib/pkgconfig'
 /usr/bin/install -c -m 644 libbitcoinconsensus.pc '/opt/bitcoind/lib/pkgconfig'
make[2]: ディレクトリ `/opt/bitcoind/src/bitcoin-0.13.0' から出ます
make[1]: ディレクトリ `/opt/bitcoind/src/bitcoin-0.13.0' から出ます

ディレクトリ確認

こんな感じにディレクトリが掘られているはず。

[murata@bitcoin-core-test bitcoin-0.13.0]$ ll /opt/bitcoind/ 
合計 4
drwxr-xr-x 2 root root   95  9月  7 15:09 bin
drwxr-xr-x 2 root root   31  9月  7 15:09 include
drwxr-xr-x 3 root root 4096  9月  7 15:09 lib
drwxr-xr-x 3 root root   48  9月  7 14:35 src
[murata@bitcoin-core-test bitcoin-0.13.0]$ 

これでインストールは完了。続いて設定ファイルなどを作成していく。

設定ファイル配置

https://en.bitcoin.it/wiki/Running_Bitcoin#Bitcoin.conf_Configuration_File
を参考に/opt/bitcoind/etc/bitcoin.conf に設定ファイルを配置する。

ディレクトリを掘る

[murata@bitcoin-core-test bitcoind]$ sudo mkdir /opt/bitcoind/etc/
[murata@bitcoin-core-test bitcoind]$ cd /opt/bitcoind/etc/
[murata@bitcoin-core-test etc]$ sudo vi bitcoin.conf

下記のようなファイルを作成する。

/opt/bitcoin/etc/bitcoin.conf
rpcbind=0.0.0.0
rpcuser=username
rpcpassword=mypassword
rpcport=8332
rpcallowip=127.0.0.1
rpcallowip=xxx.xxx.xxx.xxx/32
server=1
daemon=1
#gen=1
  • rpcbind: 使うNICのIPアドレス0.0.0.0ですべて
  • rpcuser: json-rpcに接続するユーザー名
  • rpcpassword: 同じくパスワード(必ずわかりづらいものにしてください。抜かれるとコインを持っていかれます。)
  • rpcport: RPCで使うポート番号
  • rpcallowip: 接続を許可するIPアドレス(絶対に0.0.0.0にはしないでください。CIDR形式OKの模様)
  • server: サーバとして使用するか?
  • daemon: デーモンとして起動するか。
  • gen: マイニングするか。

本番ではなくtestnetというものがあるのでtestnetを使う場合にはググッてconfファイルを設定してください。
設定ファイルをぽちぽち作成できるサービスもこちらにあります。

データディレクトリを作る。

トランザクションやウォレットのデータを保存しておくディレクトリを作成する。(他のユーザーが見れないようにパーミションもちゃんとすること。)

今回は/opt/bitcoind/var/に置く。

[murata@bitcoin-core-test bitcoind]$ sudo mkdir /opt/bitcoind/var/
[murata@bitcoin-core-test bitcoind]$ sudo chmod 600 /opt/bitcoind/var/
[murata@bitcoin-core-test bitcoind]$ ll /opt/bitcoind/
合計 4
drwxr-xr-x 2 root root   95  9月  7 15:09 bin
drwxr-xr-x 2 root root   25  9月  7 15:23 etc
drwxr-xr-x 2 root root   31  9月  7 15:09 include
drwxr-xr-x 3 root root 4096  9月  7 15:09 lib
drwxr-xr-x 3 root root   48  9月  7 14:35 src
drw------- 2 root root    6  9月  7 15:25 var

パーミションが600(drw-------)になっていることを確認すること。

起動

$ [murata@bitcoin-core-test bitcoind]$ sudo /opt/bitcoind/bin/bitcoind -daemon -datadir=/opt/bitcoind/var/ -conf=/opt/bitcoind/etc/bitcoin.conf
Bitcoin server starting

うまく起動できていればプロセスがいるはず。

[murata@bitcoin-core-test bitcoind]$ ps aux | grep bitcoind
root     10371 19.5  4.2 1345296 79800 ?       SLsl 15:25   0:06 /opt/bitcoind/bin/bitcoind -daemon -datadir=/opt/bitcoind/var/ -conf=/opt/bitcoind/etc/bitcoin.conf

データが蓄積されているのがわかる。

[murata@bitcoin-core-test bitcoin-0.13.0]$ sudo ls -al /opt/bitcoind/var/
合計 1280
drw------- 5 root root   4096  9月  7 15:48 .
drwxr-xr-x 8 root root     70  9月  7 15:25 ..
-rw------- 1 root root      0  9月  7 15:25 .lock
-rw------- 1 root root     37  9月  7 15:25 banlist.dat
-rw------- 1 root root      6  9月  7 15:48 bitcoind.pid
drwx------ 3 root root   4096  9月  7 15:45 blocks
drwx------ 2 root root   4096  9月  7 15:48 chainstate
drwx------ 2 root root      6  9月  7 15:48 database
-rw------- 1 root root      0  9月  7 15:25 db.log
-rw------- 1 root root 202776  9月  7 15:48 debug.log
-rw------- 1 root root  28534  9月  7 15:45 fee_estimates.dat
-rw------- 1 root root 707214  9月  7 15:45 peers.dat
-rw------- 1 root root  90112  9月  7 15:45 wallet.dat

RPC確認

本家のリファレンス: https://en.bitcoin.it/wiki/Original_Bitcoin_client/API_calls_list
日本語の記事参考: http://qiita.com/osada/items/39c63a146c203f4dc751

bitcoin-cliコマンドで確認する。
helpでヘルプが見れる。

[murata@bitcoin-core-test bitcoin-0.13.0]$ /opt/bitcoind/bin/bitcoin-cli -conf=/opt/bitcoind/etc/bitcoin.conf help
== Blockchain ==
getbestblockhash
getblock "hash" ( verbose )
getblockchaininfo
getblockcount
getblockhash index
getblockheader "hash" ( verbose )
getchaintips
getdifficulty
getmempoolancestors txid (verbose)
getmempooldescendants txid (verbose)
getmempoolentry txid
getmempoolinfo

~snip;

getinfoで状態を確認する。

[murata@bitcoin-core-test bitcoin-0.13.0]$ /opt/bitcoind/bin/bitcoin-cli -conf=/opt/bitcoind/etc/bitcoin.conf getinfo
{
  "version": 130000,
  "protocolversion": 70014,
  "walletversion": 130000,
  "balance": 0.00000000,
  "blocks": 66335,
  "timeoffset": 0,
  "connections": 8,
  "proxy": "",
  "difficulty": 23.50125722290317,
  "testnet": false,
  "keypoololdest": 1473229556,
  "keypoolsize": 100,
  "paytxfee": 0.00000000,
  "relayfee": 0.00001000,
  "errors": ""

blocksが最新になるまで入出金はできないはず。まるまる1日か2日ぐらいかかる。回線の状態によってはもっと。
https://blockchain.info/
あたりで最新のブロックを確認できる。ブロック高ってのがソレ。

データサイズ的には2016/09/07現在で90Gほどある。
下記のようなコマンドで確認するとどのくらいDLできているかわかるかと。

[murata@bitcoin-core-test bitcoin-0.13.0]$ sudo du /opt/bitcoind/var/ -sh
967M    /opt/bitcoind/var/

ウォレットにbitcoinアドレスを作成

まぁ送金してみたくなると思うので、作成してみる。

[murata@bitcoin-core-test bitcoin-0.13.0]$ /opt/bitcoind/bin/bitcoin-cli -conf=/opt/bitcoind/etc/bitcoin.conf getnewaddress dododo
1Hbe5TWjMW5dNLfVTD8rHCiwUxqNkEgDx2

こんな感じ。1Hbe5TWjMW5dNLfVTD8rHCiwUxqNkEgDx2のアドレス宛にどっかからwithdrawすればよろし。

停止

電気代の無駄なのでデーモンを停止したい場合。

[murata@bitcoin-core-test bitcoin-0.13.0]$ sudo /opt/bitcoind/bin/bitcoin-cli -conf=/opt/bitcoind/etc/bitcoin.conf stop
Bitcoin server stopping

まとめ

  • 自分のサーバですので、ウォレットのバックアップや管理は自分で行ってください。backupwallet などのコマンドでバックアップできます。
  • 大量のコインをココに入れておくことはオススメしません。使わない分は必ずコールドウォレットに移しておくことをオススメします。
  • 抜かれても私は何の責任も負いません。
15
17
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
15
17