Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Channel creation fails in Hyperledger Fabric v1.2

I'm trying to start an Hyperledger Fabric network in v1.2 with a network generated by myself (with binary configtxgen). The network starts correctly and no component indicates an error.

However, when I try to create a new channel, an error occurs at the orderer level (one of the following three errors) and no channel is created.

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

or

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

or

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

To create the channel, I use the Go SDK on the master branch and follow the same procedure as for functional tests.

Any help would be greatly appreciated.

Detailed orderer logs

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

There is no previous warning or error.

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
like image 819
AnTiToinE Avatar asked Jul 30 '18 08:07

AnTiToinE


People also ask

What is Channel in Hyperledger fabric?

A channel is a private communication pathway between two or more members of a Hyperledger Fabric network on Amazon Managed Blockchain. Each transaction on a Hyperledger Fabric network occurs on a channel. A network must contain at least one channel and a network on Managed Blockchain can have up to eight channels.

What type of files are used in Hyperledger fabric to specify the configuration of channels?

yaml file contains details of the channel configuration. For more information, see Channel Configuration (configtx) in the Hyperledger Fabric documentation.


1 Answers

I got the solution from JSKIM. Since you are using the fabric v1.2, the orderer will create a default channel when the orderer node started up with the genesis block.

I guess you are using configtxgen to generate your own channel artifacts but ignore the naming rules of the channel. So when your exec into your orderer's container:

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

and cd into the chains directory, which is set to /var/hyperledger/production/orderer/chains by default. You will notice that there is already a channel exits.

Here is the solution:

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

when you generate the genesis block, using channelID to specific it. Or you can rename your channel when your create channel configuration transaction.

like image 62
Dylan Avatar answered Nov 23 '22 23:11

Dylan