LoginSignup
0
0

More than 5 years have passed since last update.

【読書&写経】『ブロックチェーン・プログラミング』 Charpter1. ツールの導入

Posted at

ツールの導入方法のところ

Ubuntuのパッケージインストールは特に問題なく出来た

bitcoindの起動と停止の話

なんかまだるっこしく、フォルダ構成とかconfファイルの話とかしてたけど、
要は、一回起動させる→bitcoinディレクトリ出来る→confファイル作る→再度起動 って流れをやる。

  1. 起動
    Ubuntuだとこのコマンド
    bitcoind -deamon &
    &つけないと、バックグラウンド起動にならないから、いろいろめんどい

  2. 停止
    Ctl+Cで抜ける

  3. bitcoinフォルダの直下にbitcoin.confを作成する。
    Ubuntuだと ~/.bitcoin/ に出来る。ファイルの内容は本の通りに。

  4. もう一回起動
    bitcoind -deamon &

ブロックチェーンの情報確認

bitcoin-cli getinfoで確認出来るって書いてたけど、もう無くなったAPIになっちゃてたみたい。

$ bitcoin-cli getinfo
error code: -32601
error message:
getinfo

This call was removed in version 0.16.0. Use the appropriate fields from:
- getblockchaininfo: blocks, difficulty, chain
- getnetworkinfo: version, protocolversion, timeoffset, connections, proxy, relayfee, warnings
- getwalletinfo: balance, keypoololdest, keypoolsize, paytxfee, unlocked_until, walletversion

bitcoin-cli has the option -getinfo to collect and format these in the old format.

書いてある通りに以下のコマンドを叩いてみれば、それらしいJSONが返ってくる。

$ bitcoin-cli getblockchaininfo
$ bitcoin-cli getnetworkinfo
$ bitcoin-cli getwalletinfo

Rubyのインストール

Ubuntuのaptはリポジトリは古いから、apt-getで落ちてきたのは2.3でした。
今は最新は2.5。
本は2.4だったので、2.4を入れることに。
@sasurai_usagi3 さんのUbuntuで最新バージョンの諸々をインストールする パターン2 リポジトリの追加 を参考にさせていただきました。
ちなみに、リポジトリを追加したら、apt-get updateしないといけないみたいね。。
https://www.brightbox.com/blog/2017/01/13/ruby-2-4-ubuntu-packages/

openassets-rubyのインストール

ruby2.4-dev入れてもなんかわからないエラーが出るなぁと思ったら開発ツールが入ってなかったってオチでした。
@moris さんの Ubuntu 14.04 に gcc、gdb などの開発ツールをインストールする
を参考に以下のコマンド叩いて、

sudo apt-get install build-essential

sqlite3を入れたら、openassets-rubyもOKでした。

0
0
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
0
0