如何在Hyperledger Fabric中更改频道策略

问题描述 投票:1回答:1

我已经使用Hyperledger Farbic创建了网络。加密-证书是使用configtxgen工具创建的,因此,我使用以下方法创建了频道tx:

configtxgen -profile SampleChannel -outputCreateChannelTx ./config/SampleChannel.tx -channelID SampleChannel

因此,默认为管理员

"policies": {
"Admins": {
"mod_policy": "Admins",
"policy": {
  "type": 3,
  "value": {
    "rule": "MAJORITY",
    "sub_policy": "Admins"
  }
},
"version": "0"
}

如何将mod_policy更改为

"policies": {
"Admins": {
"mod_policy": "Admins",
"policy": {
  "type": 3,
  "value": {
    "rule": "ANY", // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    "sub_policy": "Admins"
  }
},
"version": "0"
}

我的下一步是

configtxgen -profile SampleChannel -outputAnchorPeersUpdate ./config/SampleChannel.tx -channelID SampleChannel -asOrg Org1MSP

但是如何使用手动更改的SampleChannel.tx将其应用于网络?

非常感谢您的帮助

hyperledger-fabric hyperledger
1个回答
0
投票

创建config.tx时,请进行以下更改

Channel: &ChannelDefaults
    Policies:
        # Who may invoke the 'Deliver' API
        Readers:
            Type: ImplicitMeta
            Rule: "ANY Readers"
        # Who may invoke the 'Broadcast' API
        Writers:
            Type: ImplicitMeta
            Rule: "ANY Writers"
        # By default, who may modify elements at this config level
        Admins:
            Type: ImplicitMeta
            Rule: "ANY Writers"

[如果您想更具体而不是NAY Writers,并且只想指定特定的组织管理员,在以下代码段中使用

Channel: &ChannelDefaults
    Policies:
        # Who may invoke the 'Deliver' API
        Readers:
            Type: ImplicitMeta
            Rule: "ANY Readers"
        # Who may invoke the 'Broadcast' API
        Writers:
            Type: ImplicitMeta
            Rule: "ANY Writers"
        # By default, who may modify elements at this config level
        Admins:
            Type: Signature
            Rule: "OR('Org1.admin')" 
© www.soinside.com 2019 - 2024. All rights reserved.