如何在具有两个组织的网络中拥有一个具有 1 个组织的联盟?

How to have a consortium with 1 organization in a network with two organizations?

我正在搭建一个由两个组织(后面3个)组成的服务器,如下图link:https://hyperledger-fabric.readthedocs.io/en/release-1.4/network/network.html

但是,联盟不得包含两个组织(Org1 和 Org2),而只能包含组织 1 (Org1),如下图所示:https://imgur.com/a/gcBcINq

在我的 configtx.yaml 文件中,我将 SampleConsortium 值设置如下:

Profiles:

    TwoOrgsOrdererGenesis:
        <<: *ChannelDefaults
        Orderer:
            <<: *OrdererDefaults
            Organizations:
                - *OrdererOrg
            Capabilities:
                <<: *OrdererCapabilities
        Consortiums:
            SampleConsortium:
                Organizations:
                    - *Org1
                    # - *Org2
    TwoOrgsChannel:
        Consortium: SampleConsortium
        <<: *ChannelDefaults
        Application:
            <<: *ApplicationDefaults
            Organizations:
                - *Org1
                - *Org2
            Capabilities:
                <<: *ApplicationCapabilities

所以我定义了一个只有一个组织的联盟:Org2。

但是,当使用代码行

实例化我的频道时
peer channel create -o orderer.example.com:7050 -c $CHANNEL_NAME -f./channel-artifacts/channel.tx --tls --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example. com-cert.pem

屏幕显示错误告诉我:错误:得到意外状态:BAD_REQUEST -- 试图包含一个不在联盟中的成员

你有没有想通过在我的联盟中只有一个组织来生成我的频道?

非常感谢您的回答:)

PS : 这是我第一个使用 hyperledger fabric 的项目,所以我仍然 "new" 使用这项技术。但是,在我看来,没有迹象表明一个财团不应至少有2个组织。

您必须从 TwoOrgsChannel 配置文件中评论 Org2。然后您将能够在完成后创建我的频道您可以通过更新频道配置来添加 Org2 以获取更多详细信息您可以参考阅读文档 https://hyperledger-fabric.readthedocs.io/en/release-1.4/channel_update_tutorial.html

非常感谢,您的解决方案有效。但是,我只能在我的频道中添加 Org1 组织。如果我评论 Org2 行,错误

Error: got unexpected status: BAD_REQUEST -- error validating channel creation transaction for new channel 'mychannel', could not succesfully apply update to template configuration: error authorizing update: error validating DeltaSet: policy for [Group]  /Channel/Application not satisfied: implicit policy evaluation failed - 0 sub-policies were satisfied, but this policy requires 1 of the 'Admins' sub-policies to be satisfied

虽然我的 configtx.yaml 文件看起来像这样:

Profiles:

    TwoOrgsOrdererGenesis:
        <<: *ChannelDefaults
        Orderer:
            <<: *OrdererDefaults
            Organizations:
                - *OrdererOrg
            Capabilities:
                <<: *OrdererCapabilities
        Consortiums:
            SampleConsortium:
                Organizations:
                    - *Org1
                    - *Org2
    TwoOrgsChannel:
        Consortium: SampleConsortium
        <<: *ChannelDefaults
        Application:
            <<: *ApplicationDefaults
            Organizations:
               # - *Org1
                 - *Org2
            Capabilities:
                <<: *ApplicationCapabilities