Hyperledger Fabric(構建你的第一個網絡)

構建你的第一個網絡

這些說明已通過驗證,能夠與最新的穩定Docker鏡像和提供的tar文件中預編譯的安裝實用程序一塊兒工做,若是使用當前主分支中的鏡像或工具運行這些命令,則可能會看到配置和緊急錯誤。

構建你的第一個網絡(BYFN)方案提供了一個包含兩個組織的示例Hyperledger Fabric網絡,每一個組織維護兩個對等節點,以及一個「獨立」排序服務。node

安裝前提條件

在咱們開始以前,若是你尚未這樣作,你可能但願檢查你是否已在將要開發區塊鏈應用程序和/或運行Hyperledger Fabric的平臺上安裝了全部前提條件golang

你還須要安裝樣例,二進制文件和Docker鏡像,你會注意到fabric-samples存儲庫中包含許多樣例,咱們將使用first-network樣例,咱們如今打開那個子目錄。docker

cd fabric-samples/first-network
本文檔中提供的命令必須從 fabric-samples存儲庫克隆的 first-network子目錄運行,若是你選擇從其餘位置運行命令,則各類提供的腳本將沒法找到二進制文件。

想如今運行嗎?

咱們提供了一個徹底註解的腳本 - byfn.sh - 它利用這些Docker鏡像快速引導Hyperledger Fabric網絡,該網絡由表明兩個不一樣組織的4個對等點和一個排序節點組成。它還將啓動一個容器來運行腳本執行,該執行將對等點鏈接到一個通道,部署和實例化鏈碼並驅動針對部署的鏈碼執行交易。segmentfault

這是byfn.sh腳本的幫助文本:網絡

Usage:
  byfn.sh <mode> [-c <channel name>] [-t <timeout>] [-d <delay>] [-f <docker-compose-file>] [-s <dbtype>] [-l <language>] [-i <imagetag>] [-v]
    <mode> - one of 'up', 'down', 'restart', 'generate' or 'upgrade'
      - 'up' - bring up the network with docker-compose up
      - 'down' - clear the network with docker-compose down
      - 'restart' - restart the network
      - 'generate' - generate required certificates and genesis block
      - 'upgrade'  - upgrade the network from v1.0.x to v1.1
    -c <channel name> - channel name to use (defaults to "mychannel")
    -t <timeout> - CLI timeout duration in seconds (defaults to 10)
    -d <delay> - delay duration in seconds (defaults to 3)
    -f <docker-compose-file> - specify which docker-compose file use (defaults to docker-compose-cli.yaml)
    -s <dbtype> - the database backend to use: goleveldb (default) or couchdb
    -l <language> - the chaincode language: golang (default) or node
    -i <imagetag> - the tag to be used to launch the network (defaults to "latest")
    -v - verbose mode
  byfn.sh -h (print this message)

Typically, one would first generate the required certificates and
genesis block, then bring up the network. e.g.:

        byfn.sh generate -c mychannel
        byfn.sh up -c mychannel -s couchdb
        byfn.sh up -c mychannel -s couchdb -i 1.1.0-alpha
        byfn.sh up -l node
        byfn.sh down -c mychannel
        byfn.sh upgrade -c mychannel

Taking all defaults:
        byfn.sh generate
        byfn.sh up
        byfn.sh down

若是你選擇不提供通道名稱,則腳本將使用默認名稱mychannel,CLI超時參數(使用-t標誌指定)是可選值;若是你選擇不設置它,那麼CLI將放棄在默認設置10秒後進行的查詢請求。工具

相關文章
相關標籤/搜索