Hyperledger fabric 如何在Hyperledger结构中更改频道策略
我用Hyperledger Farbic创建了网络。 加密-证书是使用configtxgen工具创建的, 因此,我创建了通道tx,其中包括: configtxgen-profile SampleChannel-OutputCreateChangeTx./config/SampleChannel.tx-channelID SampleChannel 因此,默认情况下,管理员Hyperledger fabric 如何在Hyperledger结构中更改频道策略,hyperledger-fabric,hyperledger,Hyperledger Fabric,Hyperledger,我用Hyperledger Farbic创建了网络。 加密-证书是使用configtxgen工具创建的, 因此,我创建了通道tx,其中包括: configtxgen-profile SampleChannel-OutputCreateChangeTx./config/SampleChannel.tx-channelID SampleChannel 因此,默认情况下,管理员 "policies": { "Admins": { "mod_policy": "Admins", "policy": {
"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-OutputAchorPeersUpdate./config/SampleChannel.tx-channelID SampleChannel-asOrg Org1MSP
但如何使用手动更改的SampleChannel.tx将其应用于网络
非常感谢您的帮助策略有两种类型
- 签名策略
- 隐式元策略
签名策略
这些策略标识必须签名才能满足策略要求的特定用户
For Example:
Policies:
MyPolicy:
Type: Signature
Rule: “Org1.Peer OR Org2.Peer”
隐式元策略
隐式元策略将策略的结果聚合到配置层次结构中,配置层次结构最终由签名策略定义。它们支持默认规则,如“大多数组织管理员”。与签名策略相比,这些策略使用了不同但仍然非常简单的语法:
下面是您的答案:在创建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: Signature
Rule: "OR('Org1.admin')"
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"
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')"