zoukankan      html  css  js  c++  java
  • 创始块文件和通道文件生成

    多个组织需要加入到通道中才能互相通信。

    命令介绍:

      带-的都是参数没有子命令

      configtxgen --help
      # 输出创始块区块文件的路径和名字
      `-outputBlock string`
      # 指定创建的channel的名字, 如果没指定系统会提供一个默认的名字.
      `-channelID string`
      # 表示输通道文件路径和名字
      `-outputCreateChannelTx string`
      # 指定配置文件中的节点
      `-profile string`
      # 更新channel的配置信息
      `-outputAnchorPeersUpdate string`
      # 指定所属的组织名称
      `-asOrg string`
      # 要想执行这个命令, 需要一个配置文件  configtx.yaml
     
      要执行这个命令需要准备一个配置文件,配置文件名字是固定的configtx.yaml
      在first-network中的configtx.yaml作为模板将其copy到指定文件位置。
      configtx.yaml文件配置如下:

    Organizations:   //组织,有orderer节点组织和peer节点组织。固定不可改

      - &OrdererOrg  //&后的名字随便取,下面这个名字进行引用,排序节点组织的名字

        Name: OrdererOrg  #排序节点组织名

        ID: OrdererMSP  #排序节点组织的ID

        MSPDir: crypto-config/ordererOrganizations/example.com/msp   #组织的msp账号信息

      - &Org1  #peer节点组织第一个组织,名字自己起  
        Name: Org1MSP  #组织名字

        ID: Org1MSP    #第一个组织的ID

        MSPDir: crypto-config/peerOrganizations/org1.example.com/msp  

        AnchorPeers:      #随便找一个节点作为锚节点
          - Host: peer0.org1.example.com
          Port: 7051

      - &Org2    #也是peer组织
        Name: Org2MSP

        ID: Org2MSP

        MSPDir: crypto-config/peerOrganizations/org2.example.com/msp   #组织账号信息需要替换

        AnchorPeers:    #锚节点。访问到这个peer节点,需要指定到这个域名

                  #锚节点是用来和其他组织通信的。
          - Host: peer0.org2.example.com
          Port: 7051    #这个端口是固定的,不能i修改。镜像内部docker窃听的端口

    Capabilities:    #能力    Capabilities在fabric1.0之前是没有的。需要设置为true才能兼容
      Global: &ChannelCapabilities
        V1_1: true

      Orderer: &OrdererCapabilities
        V1_1: true

      Application: &ApplicationCapabilities
        V1_2: true

    Application: &ApplicationDefaults

      Organizations:    #这里不用动

    Orderer: &OrdererDefaults  #对应的排序节点,指定打包的规则

      OrdererType: solo  #排序算法,也就是共识机制有SOLO和kafka两种,solo比较简单但是出##于小数据,kafka比较复杂对于高并发来处理。测试的时候用solo比较方便

      Addresses:  #orderer节点的地址
        - orderer.example.com:7050  #排序节点的域名,需要根据crypto-config来修改

                      #7050表示内部绑定的端口。不能修改

      BatchTimeout: 2s  #超时时间,多长时间产生一个区块

      BatchSize:     #P的大小

        MaxMessageCount: 10  #对应的最大交易个数,达到后会产生一个区块

        AbsoluteMaxBytes: 99 MB  #数据量的大小,如果超过会也会产生一个区块,一般是32,64Mb。

        PreferredMaxBytes: 512 KB  #建议交易数值,这个没必要。可以不用改

      Kafka:  #排序算法也就是共识机制
        Brokers:  #代理人,经纪人
          - 127.0.0.1:9092  #kafka的服务器

      Organizations:    #空着就行


    Profiles:  #不能改,起到一个总结的作用

      TwoOrgsOrdererGenesis:  #区块名字,可以随便改
        Capabilities:  #能力
          <<: *ChannelCapabilities    #引用了ChannelCapabilities
      Orderer:
        <<: *OrdererDefaults
        Organizations:    #orderer节点的组织
          - *OrdererOrg
        Capabilities:     #能力
          <<: *OrdererCapabilities
        Consortiums:  #联盟
          SampleConsortium:  #联盟名字可以改
            Organizations:  #组织
              - *Org1
              - *Org2
      TwoOrgsChannel:    #通道名字,可以修改。
        Consortium: SampleConsortium  #对应前面联盟的名字需要一起修改。
        Application:
          <<: *ApplicationDefaults
          Organizations:  #组织
            - *Org1
            - *Org2
          Capabilities:
            <<: *ApplicationCapabilities

  • 相关阅读:
    JSOI 2008 火星人prefix
    OI 中的 FFT
    浅谈最大化子矩阵问题
    qq空间答案
    若瑟夫问题
    [颓废] 改某人的WebGL light mapping demo并9xSSAA
    Codeforces Round #402 (Div. 2) C. Dishonest Sellers
    Codeforces Round #402 (Div. 2) D. String Game
    Codeforces Round #401 (Div. 2) E. Hanoi Factory
    Codeforces Round #401 (Div. 2) D. Cloud of Hashtags
  • 原文地址:https://www.cnblogs.com/beautiful7/p/12846991.html
Copyright © 2011-2022 走看看