3

我正在尝试使用以下内容设置一个简单的 Fabric 网络:

  • 订购者组织 [abccoinOrderers]
  • 样本组织 [ABC]

使用 cryptogen 工具生成所有必要的文件后,运行 configtxgen 命令会出现以下错误:

student@abc:~/Desktop/fabric/network$ configtxgen -profile DefaultBlockOrderingService -outputBlock ./config/genesis.block -configPath $PWD
    2019-12-26 12:35:42.131 MST [common.tools.configtxgen] main -> WARN 001 Omitting the channel ID for configtxgen for output operations is deprecated.  Explicitly passing the channel ID will be required in the future, defaulting to 'testchainid'.
    2019-12-26 12:35:42.136 MST [common.tools.configtxgen] main -> INFO 002 Loading configuration
    2019-12-26 12:35:42.137 MST [common.tools.configtxgen.localconfig] Load -> PANI 003 Error reading configuration:  While parsing config: yaml: map merge requires map or sequence of maps as the value
    2019-12-26 12:35:42.137 MST [common.tools.configtxgen] func1 -> PANI 004 Error reading configuration:  While parsing config: yaml: map merge requires map or sequence of maps as the value
    panic: Error reading configuration:  While parsing config: yaml: map merge requires map or sequence of maps as the value [recovered]
        panic: Error reading configuration:  While parsing config: yaml: map merge requires map or sequence of maps as the value

这是 configtx.yaml

Organizations:
    - &abccoinOrderers
        Name: abccoinOrderersMSP
        ID: abccoinOrderersMSP
        MSPDir: crypto-config/ordererOrganizations/abccoin.com/msp
    - &ABC
        Name: ABCMSP
        ID: ABCMSP
        MSPDir: crypto-config/peerOrganizations/ABC.abccoin.com/msp
        AnchorPeers:
          - Host: Andy.ABC.abccoin.com
            Port: 7051

Application: &ApplicationDefaults

Orderer:
    - &DevModeOrdering
        OrdererType: solo
        Addresses:  
            - Devorderer.abccoin.com:7050
        BatchTimeout: 2s
        BatchSize:
            MaxMessageCount: 1

Profiles:
    DefaultBlockOrderingService:
        Orderer:
            <<: *DevModeOrdering
            Organizations:
                - *abccoinOrderers
        Consortiums:
            SampleConsortium:
                Organizations:
                    - *ABC


    abcMembersOnly:
        Consortium: SampleConsortium
        Application:
            <<: *ApplicationDefaults
            Organizations:
                - *ABC

我已经尝试过重新排列本文中提到的代码。如本期YML 文档 "<<: value" cannot be parses #245中所述,我还尝试在引号中调整 "<<" 键,但它没有帮助。

4

1 回答 1

2

有2个错误configtx.yaml

  1. Orderer:是映射类型或对象类型,不是数组或切片类型。使用 定义参数时-,它在 yaml 中用作数组。
Orderer:
    // remove -
    &DevModeOrdering
      OrdererType: solo
      Addresses:  
          - Devorderer.abccoin.com:7050
      BatchTimeout: 2s
      BatchSize:
          MaxMessageCount: 1
  1. 应用:必须声明Organizations:参数。它可以是空的。如果您没有在其中声明任何内容,它将无法编译。要检查您应该尝试在任何在线转换器中将 yaml 转换为 json。
Application: &ApplicationDefaults
    Organizations:
于 2019-12-27T07:53:33.280 回答