欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

在用configtxgen tool创建创世区块时,报错:While parsing config: yaml: unknown anchor 'OrdererDefaults' referenced

程序员文章站 2022-07-14 16:02:03
...

在执行以下命令生成创世区块时,出现报错!

生成创世区块命令:

         ./bin/configtxgen -profile TwoOrgsOrdererGenesis -outputBlock ./genesis.block 

报错信息

2019-05-31 16:24:31.914 CST [common.tools.configtxgen] main -> INFO 002 Loading configuration
2019-05-31 16:24:31.914 CST [common.tools.configtxgen.localconfig] Load -> PANI 003 Error reading configuration:  While parsing config: yaml: unknown anchor 'OrdererDefaults' referenced
2019-05-31 16:24:31.914 CST [common.tools.configtxgen] func1 -> PANI 004 Error reading configuration:  While parsing config: yaml: unknown anchor 'OrdererDefaults' referenced
panic: Error reading configuration:  While parsing config: yaml: unknown anchor 'OrdererDefaults' referenced [recovered]
panic: Error reading configuration:  While parsing config: yaml: unknown anchor 'OrdererDefaults' referenced

 在Stack Overflow找到解决方案:

In YAML all anchors ( those tokens starting with &) need to precede any references to them (using aliases, the tokens starting with *) in the file.

So in the root-level mapping you should put your key Profiles and its value after the key Organizations, Orderer and Application (and their values):

应该将configtx.yaml文件中Profiles的部分放置到最后,原因如上:

Organizations:
  - &Smartforce
    Name: smartforce
    ID: SmartforceMSP
    MSPDir: /home/falcon/iq-smartforce/crypto-config/ordererOrganizations/smartforce.io/msp

  - &BusinessPartner1
    Name: BusinessPartner1
    ID: FalconMSP
    MSPDir: /home/falcon/iq-smartforce/crypto-config/peerOrganizations/falcon.io/msp

  - &BusinessPartner2
    Name: BusinessPartner2
    ID: FrostMSP
    MSPDir: /home/frost/iq-smartforce/crypto-config/peerOrganizations/frost.io/msp

Orderer: &OrdererDefaults
  OrdererType: solo

  Addresses:
    - orderer.smartforce.io:7050

  BatchTimeout: 2s

  BatchSize:
    MaxMessageCount: 10
    AbsoluteMaxBytes: 99 MB
    PreferredMaxBytes: 512 KB

  Organizations:

Application: &ApplicationDefaults
  Organizations:

Profiles:
  TwoOrgOrdererGenesis:
    Orderer:
      <<: *OrdererDefaults
      Organizations:
        - *Smartforce

    Consortiums:
      SampleConsortium:
        Organizations:
          - *BusinessPartner1
          - *BusinessPartner2

  TwoOrgChannel:
    Consortium: SampleConsortium
    Application:
      <<: *ApplicationDefaults
      Organizations:
        - *BusinessPartner1
        - *BusinessPartner2

 


 

 

相关标签: Fabric