Libbitcoin Node

提供: tezos-wiki
移動先: 案内検索

libbitcoin-nodeライブラリは、Bitcoinピアツーピアネットワーク上にフルノードを実装するために必要な低レベルのネットワークコールを抽象化しています。もともとは libbitcoinに含まれていました。

例(Version3)[編集]

 #include <future>  #include <iostream>  #include <bitcoin / node.hpp>    int main()  {      std :: cout << "起動中..." << std :: endl;        bc ::スレッドプール(1);      bc :: node ::構成設定(bc :: config :: settings :: mainnet);      bc :: node :: full_nodeノード(設定);      std :: promise <bc :: code>が起動しました。        const auto handle_started = [&started](const bc :: code&ec)      {          started.set_value(ec);      };        //また、p2p nework next node.run(...)でノードを "実行"する。      node.start(handle_started);        const auto ec = started.get_future()。get();        if(ec)      {          std :: cout << "ノードの開始に失敗しました:" << ec.message()<< std :: endl;          1を返します。      }        const auto display_history = [](const bc :: code&code、          const bc :: chain :: history_compact :: list&history)      {          if(コード)          {              std :: cout << "エラー:" << code.message();              戻る;          }            for(const auto&entry:history)のために          {              自動出力=(entry.kind == bc :: chain :: point_kind :: output);              auto kind =(出力? "出力": "消費");              自動高さ= entry.height;              自動ハッシュ= bc :: encode_hash(entry.point.hash());              自動インデックス= entry.point.index();                //費用の値は、そのエントリのentry.point.checksum()です。              //出力します。これにより、支出を出力に関連付けることができます。              std :: cout << "履歴..." << std :: endl;              std :: cout << "種類:" << kind << std :: endl;              std :: cout << "高さ:" << height << std :: endl;              std :: cout << "Point:" << hash << ":" << index << std :: endl;              std :: cout << "Value:" << entry.value << std :: endl;              std :: cout << std :: endl;          }      };        while(真)      {          std :: cout << "ビットコインアドレスを入力するか、終了するには" stop "を入力してください。 << std :: endl;            std :: stringコマンド。          std :: getline(std :: cin、command);            if(command == "stop")              ブレーク;            bc :: wallet :: payment_addressアドレス(コマンド);            if(!アドレス)          {              std :: cout << "無効なアドレス:" <<コマンド<< std :: endl;              持続する;          }            // 1000行まで受け入れ、ブロック0から検索します。          node.chain()。fetch_history(アドレス、1000、0、display_history);      }        std :: cout << "シャットダウン..." << std :: endl;        0を返します。  }

コンソールアプリケーション[編集]

ライブラリにはコンソールアプリケーション Bitcoin Node(bn)が付いています。

デザイン[編集]

  • [1](Bitcoinサーバー)を参照してください。

依存関係(Version2)[編集]

依存関係(Version3)=[編集]

関連項目[編集]

参考文献[編集]

カテゴリ:ノード カテゴリ:オープンソース カテゴリ:ソフトウェア