はじめてのBitcoinノード構築Part1(2018年11月18日執筆)
- 作者: アンドレアス・M・アントノプロス
- 出版社/メーカー: NTT出版
- 発売日: 2017/06/01
- メディア: Kindle版
- この商品を含むブログを見る
1. Bitcoinとは?
Bitcoinとは、新しい決済システムと完全な電子通貨を実現するコンセンサスネットワークです。
中央機関や仲介人を伴わない、ユーザーによる初の非中央集権のpeer-to-peer決済ネットワークです。
また、暗号通貨(BTC)のことをさします。
難しいですよね?
ひとことで言うと、銀行などの管理者不在のお金の支払いの仕組みをシステムで実現したものです。
2. 環境情報
OS | バージョン | 備考 |
---|---|---|
macOS Mojava | 10.14 | ホストOS |
Oracle VM VirtualBox | 5.2.22 | |
Ubuntu | 18.04.1LTS | ゲストOS |
3. 環境構築
▼環境構築の仕方はこちらなどをご参考に。
4. Bitcoinノード構築
1. ユーザー作成
sudo adduser <user name>
UNIX パスワード以外は適当に入力してください。
[sudo] kharuka のパスワード: ユーザー `<user name>' を追加しています... 新しいグループ `<user name>' (1001) を追加しています... 新しいユーザー `<user name>' (1001) をグループ `<user name>' に追加しています... ホームディレクトリ `/home/<user name>' を作成しています... `/etc/skel' からファイルをコピーしています... 新しい UNIX パスワードを入力してください: 新しい UNIX パスワードを再入力してください: passwd: パスワードは正しく更新されました <user name> のユーザ情報を変更中 新しい値を入力してください。標準設定値を使うならリターンを押してください フルネーム []: 部屋番号 []: 職場電話番号 []: 自宅電話番号 []: その他 []: 以上で正しいですか? [Y/n] y
作成したユーザーをsudoグループに追加します。
sudo gpasswd -a <user name> sudo
ちゃんと作成したユーザーがsudoグループに追加されたか
getent group sudo
などで確認しましょう。
2. Bitcoinのバイナリーファイルをダウンロード
sudo su - <user name> mkdir work cd work wget https://bitcoincore.org/bin/bitcoin-core-0.17.0.1/bitcoin-0.17.0.1-x86_64-linux-gnu.tar.gz
3. Bitcoinのバイナリーファイルを解凍
tar -zxvf bitcoin-0.17.0.1-x86_64-linux-gnu.tar.gz
4. Bitcoinインストール確認
<user name>@kharuka-VirtualBox:~$ ./work/bitcoin-0.17.0/bin/bitcoind --version Bitcoin Core Daemon version v0.17.0.1 Copyright (C) 2009-2018 The Bitcoin Core developers Please contribute if you find Bitcoin Core useful. Visit <https://bitcoincore.org> for further information about the software. The source code is available from <https://github.com/bitcoin/bitcoin>. This is experimental software. Distributed under the MIT software license, see the accompanying file COPYING or <https://opensource.org/licenses/MIT> This product includes software developed by the OpenSSL Project for use in the OpenSSL Toolkit <https://www.openssl.org> and cryptographic software written by Eric Young and UPnP software written by Thomas Bernard.
5. bitcoin.confファイル作成
vi .bitcoin/bitcoin.conf
bitcoin.conf
# [core] daemon=1 prune=550 # [debug] debug=1 logips=1 testnet=1 # [rpc] server=1 rest=1 rpcuser=xxx rpcpassword=xxx rpcport=18332 rpcallowip=127.0.0.1
6. bitcoind起動と確認
ホームディレクトリに移動します。
cd
bitcoindの起動とプロセス起動・debug.log確認をします。
./work/bitcoin-0.17.0/bin/bitcoind ps aux | grep bitcoind less .bitcoin/testnet3/debug.log
debug.logにERRORや以下の様なログが出ていなければ同期がスタートしているはずです。
Shutdown: In progress...
気長に同期完了を待ちましょう。
環境にもよりますが、Testnetでも数時間はかかります。
7. bitcoind停止と確認
./work/bitcoin-0.17.0/bin/bitcoin-cli stop ps aux | grep bitcoind less .bitcoin/testnet3/debug.log
debug.logに以下のログがはかれているので確認してみましょう。
Shutdown: done
8. ブロック同期確認
less .bitcoin/testnet3/debug.log
debug.logにprogress=1.000000と出ていれば
2018-11-17T17:14:04Z UpdateTip: new best=00000000000723e271b9d140b87dd5868718ce2631e9101b46a12d5331370dfe height=1443849 version=0x20000000 log2_work=71.719806 tx=48054222 date='2018-11-17T17:14:05Z' progress=1.000000 cache=49.4MiB(170436txo) warning='28 of last 100 blocks have unexpected version'
同期完了です!
9. bitcoin-cliでwalletの中身を確認
./work/bitcoin-0.17.0/bin/bitcoin-cli getwalletinfo
当然ですが、まだお財布の残高(balance)は0BTCです。
{ "walletname": "", "walletversion": 169900, "balance": 0.00000000, "unconfirmed_balance": 0.00000000, "immature_balance": 0.00000000, "txcount": 0, "keypoololdest": 1541816284, "keypoolsize": 1000, "keypoolsize_hd_internal": 1000, "paytxfee": 0.00000000, "hdseedid": "xxx", "hdmasterkeyid": "xxx", "private_keys_enabled": true }
▼記事の続きは以下へ。
執筆中です。
仮想通貨取引所・販売所
- bitbank
https://bitflyer.com/ex/sp/home
【BITPoint】ビットコイン・イーサリアムなど仮想通貨の口座開設ならビットポイント
- GMOコイン
- Liquid by Quoine
- SBI Virtual Currencies
ハードウェアウォレット
- Ledger Nano S
- トレザー
ソフトウェアウォレット
- Ginco