Hyperledger Fabric v1.2 中的通道创建失败

Channel creation fails in Hyperledger Fabric v1.2

我正在尝试使用我自己生成的网络(使用二进制 configtxgen)在 v1.2 中启动一个 Hyperledger Fabric 网络。网络正常启动,无组件提示错误。

但是,当我尝试创建一个新通道时,orderer级别出现错误(以下三种错误之一),没有创建通道。

Orderer Server Status Code: (400) BAD_REQUEST. Description: error authorizing update: error validating ReadSet: existing config does not contain element for [Group]  /Channel/Application/Org1MSP but was in the read set

Orderer Server Status Code: (400) BAD_REQUEST. Description: error authorizing update: error validating ReadSet: existing config does not contain element for [Group]  /Channel/Application but was in the read set

Orderer Server Status Code: (400) BAD_REQUEST. Description: error authorizing update: error validating ReadSet: existing config does not contain element for [Value]  /Channel/Consortium but was in the read set

为了创建通道,我在 master 分支上使用 Go SDK 并遵循与功能测试相同的过程。

如有任何帮助,我们将不胜感激。

详细的订购者日志

2018-07-30 07:54:34.988 UTC [cauthdsl] func2 -> DEBU 0c0 0xc42017c0b8 principal evaluation succeeds for identity 0
2018-07-30 07:54:34.988 UTC [cauthdsl] func1 -> DEBU 0c1 0xc42017c0b8 gate 1532937274988361380 evaluation succeeds
2018-07-30 07:54:34.988 UTC [policies] Evaluate -> DEBU 0c2 Signature set satisfies policy /Channel/Orderer/OrdererMSP/Writers
2018-07-30 07:54:34.988 UTC [policies] Evaluate -> DEBU 0c3 == Done Evaluating *cauthdsl.policy Policy /Channel/Orderer/OrdererMSP/Writers
2018-07-30 07:54:34.988 UTC [policies] Evaluate -> DEBU 0c4 Signature set satisfies policy /Channel/Orderer/Writers
2018-07-30 07:54:34.988 UTC [policies] Evaluate -> DEBU 0c5 == Done Evaluating *policies.implicitMetaPolicy Policy /Channel/Orderer/Writers
2018-07-30 07:54:34.988 UTC [policies] Evaluate -> DEBU 0c6 Signature set satisfies policy /Channel/Writers
2018-07-30 07:54:34.988 UTC [policies] Evaluate -> DEBU 0c7 == Done Evaluating *policies.implicitMetaPolicy Policy /Channel/Writers
2018-07-30 07:54:34.989 UTC [common/configtx] addToMap -> DEBU 0c8 Adding to config map: [Group]  /Channel
2018-07-30 07:54:34.989 UTC [common/configtx] addToMap -> DEBU 0c9 Adding to config map: [Group]  /Channel/Application
2018-07-30 07:54:34.989 UTC [common/configtx] addToMap -> DEBU 0ca Adding to config map: [Group]  /Channel/Application/Org1MSP
2018-07-30 07:54:34.989 UTC [common/configtx] addToMap -> DEBU 0cb Adding to config map: [Value]  /Channel/Consortium
2018-07-30 07:54:34.989 UTC [orderer/common/broadcast] Handle -> WARN 0cc [channel: chainhero] Rejecting broadcast of config message from 172.18.0.1:35764 because of error: error authorizing update: error validating ReadSet: existing config does not contain element for [Group]  /Channel/Application but was in the read set
2018-07-30 07:54:34.989 UTC [orderer/common/server] func1 -> DEBU 0cd Closing Broadcast stream

之前没有警告或错误。

configtx.yaml

---
Organizations:

    - &OrdererOrg
        Name: OrdererMSP
        ID: OrdererMSP
        MSPDir: crypto-config/ordererOrganizations/hf.chainhero.io/msp
        Policies: &OrdererOrgPolicies
            Readers:
                Type: Signature
                Rule: "OR('OrdererMSP.member')"
            Writers:
                Type: Signature
                Rule: "OR('OrdererMSP.member')"
            Admins:
                Type: Signature
                Rule: "OR('OrdererMSP.admin')"
    - &Org1
        Name: Org1MSP
        ID: Org1MSP
        MSPDir: crypto-config/peerOrganizations/org1.hf.chainhero.io/msp
        Policies: &Org1Policies
            Readers:
                Type: Signature
                Rule: "OR('Org1MSP.member')"
            Writers:
                Type: Signature
                Rule: "OR('Org1MSP.member')"
            Admins:
                Type: Signature
                Rule: "OR('Org1MSP.admin')"
        AnchorPeers:
            - Host: peer0.org1.hf.chainhero.io
              Port: 7051

Capabilities:
    Channel: &ChannelCapabilities
        V1_1: true
    Orderer: &OrdererCapabilities
        V1_1: true
    Application: &ApplicationCapabilities
        V1_2: true
        V1_1: false

Application: &ApplicationDefaults
    ACLs: &ACLsDefault
        lscc/ChaincodeExists: /Channel/Application/Readers
        lscc/GetDeploymentSpec: /Channel/Application/Readers
        lscc/GetChaincodeData: /Channel/Application/Readers
        lscc/GetInstantiatedChaincodes: /Channel/Application/Readers
        qscc/GetChainInfo: /Channel/Application/Readers
        qscc/GetBlockByNumber: /Channel/Application/Readers
        qscc/GetBlockByHash: /Channel/Application/Readers
        qscc/GetTransactionByID: /Channel/Application/Readers
        qscc/GetBlockByTxID: /Channel/Application/Readers
        cscc/GetConfigBlock: /Channel/Application/Readers
        cscc/GetConfigTree: /Channel/Application/Readers
        cscc/SimulateConfigTreeUpdate: /Channel/Application/Readers
        peer/Propose: /Channel/Application/Writers
        peer/ChaincodeToChaincode: /Channel/Application/Readers
        event/Block: /Channel/Application/Readers
        event/FilteredBlock: /Channel/Application/Readers

    Organizations:

    Policies:
        Readers:
            Type: ImplicitMeta
            Rule: "ANY Readers"
        Writers:
            Type: ImplicitMeta
            Rule: "ANY Writers"
        Admins:
            Type: ImplicitMeta
            Rule: "MAJORITY Admins"
        Org1MemberPolicy:
            Type: Signature
            Rule: "OR('Org1MSP.member')"

    Capabilities:
        <<: *ApplicationCapabilities

Orderer: &OrdererDefaults
    OrdererType: solo
    Addresses:
        - orderer.hf.chainhero.io:7050
    BatchTimeout: 2s
    BatchSize:
        MaxMessageCount: 10
        AbsoluteMaxBytes: 98 MB
        PreferredMaxBytes: 512 KB
    MaxChannels: 0
    Kafka:
        Brokers:

    Organizations:

    Policies:
        Readers:
            Type: ImplicitMeta
            Rule: "ANY Readers"
        Writers:
            Type: ImplicitMeta
            Rule: "ANY Writers"
        Admins:
            Type: ImplicitMeta
            Rule: "MAJORITY Admins"
        BlockValidation:
            Type: ImplicitMeta
            Rule: "ANY Writers"

    Capabilities:
        <<: *OrdererCapabilities

Channel: &ChannelDefaults
    Policies:
        Readers:
            Type: ImplicitMeta
            Rule: "ANY Readers"
        Writers:
            Type: ImplicitMeta
            Rule: "ANY Writers"
        Admins:
            Type: ImplicitMeta
            Rule: "MAJORITY Admins"

    Capabilities:
        <<: *ChannelCapabilities

Profiles:

    OrdererGenesis:
        <<: *ChannelDefaults
        Orderer:
            <<: *OrdererDefaults
            Organizations:
                - <<: *OrdererOrg
                  Policies:
                      <<: *OrdererOrgPolicies
                      Admins:
                          Type: Signature
                          Rule: "OR('OrdererMSP.member')"
        Consortiums:
            SampleConsortium:
                Organizations:
                    - <<: *Org1
                      Policies:
                          <<: *Org1Policies
                          Admins:
                              Type: Signature
                              Rule: "OR('Org1MSP.member')"

    Channel:
        Consortium: SampleConsortium
        Application:
            <<: *ApplicationDefaults
            Organizations:
                - *Org1

我终于通过更改生成频道的名称成功地通过了这个错误。但是,这并不能解释为什么有些名称不起作用。

我从 JSKIM 得到了解决方案。由于您使用的是 fabric v1.2,因此当排序节点使用创世块启动时,排序节点将创建一个默认通道。

我猜您正在使用 configtxgen 生成您自己的频道工件,但忽略了频道的命名规则。因此,当您的 exec 进入订购者的容器时:

docker exec -it <orderer's container ID> bash

cd进入chains目录,默认设置为/var/hyperledger/production/orderer/chains。您会注意到已经有一个通道出口。

解决方法如下:

configtxgen -profile testOrgsOrdererGenesis -channelID testchannel -outputBlock ./crypto-config/ordererOrganizations/orderer.block
configtxgen -profile testorgschannel -channelID mychannel-outputCreateChannelTx ./crypto-config/ordererOrganizations/mychannel.tx

当你生成创世块时,使用 channelID 来指定它。或者您可以在创建频道配置事务时重命名您的频道。