简体   繁体   English

Hyperledger Fabric 1.2功能错误

[英]Hyperledger fabric 1.2 capabilities error

I am trying to use hyperledger fabric sample network with my own chaincode. 我正在尝试将超级账本结构样本网络与自己的链码一起使用。 I am using balance-transfer but my chaincode requires collections config file because It is using private data. 我正在使用余额转移,但是我的链码需要使用配置文件,因为它使用的是私人数据。 I added to sendInstantiateProposal request but, I keep getting the error while instantiating the chaincode; 我添加了sendInstantiateProposal请求,但是在实例化链码时仍然收到错误;

{"success":false,"message":"Failed to instantiate the chaincode. cause:instantiate proposal resulted in an error :: Error: as V1_2 or later capability is not enabled, private channel collections and data are not available"}

I added capabilities section to artifacts/channel/configtx.yaml file but error still continue. 我在artifacts / channel / configtx.yaml文件中添加了功能部分,但错误仍然继续。 You can see that file from this link. 您可以从此链接中看到该文件

So, how can I solve this error and make this network work with private channels ? 那么,如何解决此错误并使该网络与专用渠道一起使用?

This error occurs when Application and channels are not enabled with the V1.2 or above capabilities. 如果未使用V1.2或更高版本的功能启用应用程序和通道,则会发生此错误。

Solution: 解:

Add Capabilities in configtx.yaml file 在configtx.yaml文件中添加功能

Capabilities:
    # Channel capabilities apply to both the orderers and the peers and must be
    # supported by both.
    # Set the value of the capability to true to require it.
    Channel: &ChannelCapabilities
        # V1.3 for Channel is a catchall flag for behavior which has been
        # determined to be desired for all orderers and peers running at the v1.3.x
        # level, but which would be incompatible with orderers and peers from
        # prior releases.
        # Prior to enabling V1.3 channel capabilities, ensure that all
        # orderers and peers on a channel are at v1.3.0 or later.
        V1_3: true

    # Orderer capabilities apply only to the orderers, and may be safely
    # used with prior release peers.
    # Set the value of the capability to true to require it.
    Orderer: &OrdererCapabilities
        # V1.1 for Orderer is a catchall flag for behavior which has been
        # determined to be desired for all orderers running at the v1.1.x
        # level, but which would be incompatible with orderers from prior releases.
        # Prior to enabling V1.1 orderer capabilities, ensure that all
        # orderers on a channel are at v1.1.0 or later.
        V1_1: true

    # Application capabilities apply only to the peer network, and may be safely
    # used with prior release orderers.
    # Set the value of the capability to true to require it.
    Application: &ApplicationCapabilities
        # V1.3 for Application enables the new non-backwards compatible
        # features and fixes of fabric v1.3.
        V1_3: true
        V1_2: false
        V1_1: false

And then apply them in Profile section 然后在“个人资料”部分应用它们

ThreeOrgsOrdererGenesis:
        <<: *ChannelDefaults
        Capabilities:
            <<: *ChannelCapabilities
        Orderer:
            <<: *OrdererDefaults
            Organizations:
                    - *OrdererOrg
            Capabilities:
                <<: *OrdererCapabilities
        Consortiums:
            SampleConsortium:
                Organizations:
                    - *Org1
                    - *Org2
                    - *Org3

    ThreeOrgsChannel:
        Consortium: SampleConsortium
        Application:
            <<: *ApplicationDefaults
            Organizations:
                - *Org1
                - *Org2
                - *Org3
            Capabilities:
                <<: *ApplicationCapabilities

Refer fabric-samples/first-network configtx.yaml file for more details. 有关更多详细信息,请参考fabric-samples / first-network configtx.yaml文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM