比特幣原始碼研讀之一

weixin_34321977發表於2017-09-19

比特幣原始碼研讀之一
——區塊鏈研習社 《比特幣原始碼研讀班》

一看資料夾結構 和 github編譯依賴,分析的依賴庫

src
    compat       //工作臺程式碼  base58等
    config
    consensus  //交易相關  merkle樹
    crypto        //加解密(aes sha)
    leveldb      //檔案資料庫  leveldb
    obj
    obj-test
    policy           //背書
    primitives  //區塊和交易的資料結構
    qt                 //ui框架 qt
    rpc               //rpc  遠端程式呼叫
    script           //交易指令碼
    secp256k1 //橢圓曲線
    support
    test              //測試程式碼
    univalue
    wallet         //錢包相關
    zmq           //訊息佇列庫  zmq
Library Purpose Description
libssl Crypto Random Number Generation, Elliptic Curve Cryptography
libboost Utility Library for threading, data structures, etc
libevent Networking OS independent asynchronous networking
miniupnpc UPnP Support Firewall-jumping support
libdb4.8 Berkeley DB Wallet storage (only needed when wallet enabled)
qt GUI GUI toolkit (only needed when GUI enabled)
protobuf Payments in GUI Data interchange format used for payment protocol (only needed when GUI enabled)
libqrencode QR codes in GUI Optional for generating QR codes (only needed when GUI enabled)
univalue Utility JSON parsing and encoding (bundled version will be used unless --with-system-univalue passed to configure)
libzmq3 ZMQ notification Optional, allows generating ZMQ notifications (requires ZMQ version >= 4.x)

二 看main.cpp檔案 (src/bitcoind.cpp)

int main(int argc, char* argv[])
{
    SetupEnvironment(); //設定執行環境變數

    // Connect bitcoind signal handlers
    noui_connect();  //連線訊號和槽

   //根據輸入的argc argv 引數初始化程式
    return (AppInit(argc, argv) ? EXIT_SUCCESS : EXIT_FAILURE);
}

三 附main函式的結構圖

31578-8183a0ffefcff8b6.png

相關文章