Hyperledger Fabric(构建你的第一个网络)

构建你的第一个网络

这些说明已经过验证,可以与最新的稳定Docker镜像和提供的tar文件中预编译的安装实用程序一起工作,如果使用当前主分支中的镜像或工具运行这些命令,则可能会看到配置和紧急错误。

构建你的第一个网络(BYFN)方案提供了一个包含两个组织的示例Hyperledger Fabric网络,每个组织维护两个对等节点,以及一个“独立”排序服务。

安装前提条件

在我们开始之前,如果你还没有这样做,你可能希望检查你是否已在将要开发区块链应用程序和/或运行Hyperledger Fabric的平台上安装了所有前提条件

你还需要安装样例,二进制文件和Docker镜像,你会注意到fabric-samples存储库中包含许多样例,我们将使用first-network样例,我们现在打开那个子目录。

cd fabric-samples/first-network

本文档中提供的命令必须从
fabric-samples存储库克隆的
first-network子目录运行,如果你选择从其他位置运行命令,则各种提供的脚本将无法找到二进制文件。

想现在运行吗?

我们提供了一个完全注解的脚本 – byfn.sh – 它利用这些Docker镜像快速引导Hyperledger Fabric网络,该网络由代表两个不同组织的4个对等点和一个排序节点组成。它还将启动一个容器来运行脚本执行,该执行将对等点连接到一个通道,部署和实例化链码并驱动针对部署的链码执行交易。

这是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秒后进行的查询请求。

    原文作者:博弈
    原文地址: https://segmentfault.com/a/1190000016147764
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞