hyperledger-fabric - 使用 Hyperledger Fabric 添加自定义节点 OU

标签 hyperledger-fabric hyperledger-fabric-ca organizational-unit

我正在尝试在 configtx.yaml 文件内的策略定义中添加自定义节点 OU。策略定义存在于 configtx.yaml 文件的应用程序部分,如下所示:

Application: &ApplicationDefaults

# Organizations is the list of orgs which are defined as participants on
# the application side of the network
ACLs: &ACLsDefault
    peer/Propose: /Channel/Application/Checkous

Organizations:

# Policies defines the set of policies at this level of the config tree
# For Application policies, their canonical path is
#   /Channel/Application/<PolicyName>
Policies:
    Readers:
        Type: ImplicitMeta
        Rule: "ANY Readers"
    Writers:
        Type: ImplicitMeta
        Rule: "ANY Writers"
    Admins:
        Type: ImplicitMeta
        Rule: "MAJORITY Admins"
    Checkous:
        Type: Signature
        Rule: "OR('Org1MSP.admin', 'Org1MSP.client', 'Org1MSP.dept')"

Capabilities:
    <<: *ApplicationCapabilities

我已经使用 cryptogen 工具生成了加密 Material 。如您所见,我还在其中一个 ACL 中使用了自定义策略。

接下来,我创建了排序节点创世 block 。

##########################################################
#########  Generating Orderer Genesis block ##############
##########################################################
CONSENSUS_TYPE=solo
+ '[' solo == solo ']'
+ configtxgen -profile TwoOrgsOrdererGenesis -channelID byfn-sys-channel -outputBlock ./channel-artifacts/genesis.block
2020-02-17 05:17:01.991 UTC [common.tools.configtxgen] main -> INFO 001 Loading configuration
2020-02-17 05:17:02.150 UTC [common.tools.configtxgen.localconfig] completeInitialization -> INFO 002 orderer type: solo
2020-02-17 05:17:02.150 UTC [common.tools.configtxgen.localconfig] Load -> INFO 003 Loaded configuration: /home/chintanr11/fabric-samples/first-network/configtx.yaml
2020-02-17 05:17:02.309 UTC [common.tools.configtxgen.localconfig] completeInitialization -> INFO 004 orderer type: solo
2020-02-17 05:17:02.309 UTC [common.tools.configtxgen.localconfig] LoadTopLevel -> INFO 005 Loaded configuration: /home/chintanr11/fabric-samples/first-network/configtx.yaml
2020-02-17 05:17:02.311 UTC [common.tools.configtxgen] doOutputBlock -> INFO 006 Generating genesis block
2020-02-17 05:17:02.311 UTC [common.tools.configtxgen] doOutputBlock -> INFO 007 Writing genesis block
+ res=0
+ set +x

接着,当我尝试创建 channel 配置 block 时,收到以下错误:

#################################################################
### Generating channel configuration transaction 'channel.tx' ###
#################################################################
+ configtxgen -profile TwoOrgsChannel -outputCreateChannelTx ./channel-artifacts/channel.tx -channelID mychannel
2020-02-17 05:17:02.346 UTC [common.tools.configtxgen] main -> INFO 001 Loading configuration
2020-02-17 05:17:02.518 UTC [common.tools.configtxgen.localconfig] Load -> INFO 002 Loaded configuration: /home/chintanr11/fabric-samples/first-network/configtx.yaml
2020-02-17 05:17:02.680 UTC [common.tools.configtxgen.localconfig] completeInitialization -> INFO 003 orderer type: solo
2020-02-17 05:17:02.680 UTC [common.tools.configtxgen.localconfig] LoadTopLevel -> INFO 004 Loaded configuration: /home/chintanr11/fabric-samples/first-network/configtx.yaml
2020-02-17 05:17:02.680 UTC [common.tools.configtxgen] doOutputChannelCreateTx -> INFO 005 Generating new channel configtx
2020-02-17 05:17:02.680 UTC [common.tools.configtxgen] main -> FATA 006 Error on outputChannelCreateTx: could not generate default config template: error parsing configuration: could not create application group: error adding policies to application group: invalid signature policy rule 'OR('Org1MSP.admin', 'Org1MSP.client', 'Org1MSP.dept')': Unable to parse numeric value '.' to float64
+ res=1
+ set +x
Failed to generate channel configuration transaction...

注意:我已在位于以下位置的 config.yaml 文件中添加了此 OU 的定义:~/fabric-samples/first-network/crypto-config/peerOrganizations/org1.example.com/msp。该文件如下所示:

NodeOUs:
  Enable: true
  ClientOUIdentifier:
    Certificate: cacerts/ca.org1.example.com-cert.pem
    OrganizationalUnitIdentifier: client
  PeerOUIdentifier:
    Certificate: cacerts/ca.org1.example.com-cert.pem
    OrganizationalUnitIdentifier: peer
  AdminOUIdentifier:
    Certificate: cacerts/ca.org1.example.com-cert.pem
    OrganizationalUnitIdentifier: admin
  OrdererOUIdentifier:
    Certificate: cacerts/ca.org1.example.com-cert.pem
    OrganizationalUnitIdentifier: orderer
  DeptOUIdentifier:
    Certificate: cacerts/ca.org1.example.com-cert.pem
    OrganizationalUnitIdentifier: dept
  1. 上述 channel block 创建错误是什么意思以及解决它的任何解决方案?
  2. 如何使用 Fabric CA(而不是 cryptogen)在网络中使用自定义节点 OU?

最佳答案

您不能使用“自定义”NodeOU 标识符。 Fabric 策略仅支持以下角色:

  • $MSPID.admin
  • $MSPID.member
  • $MSPID.peer
  • $MSPID.client
  • $MSPID.orderer

这意味着您只能使用内置的节点 OU 标识符:

  • 客户端标识符
  • PeerOUIdentifier
  • AdminOUIdentifier
  • 订购者OUIdentifier

关于hyperledger-fabric - 使用 Hyperledger Fabric 添加自定义节点 OU,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60256416/

相关文章:

javascript - Hyperledger Composer 查询 Assets 参数

hyperledger-fabric - Composer网络安装问题

amazon-web-services - 如何访问我的开发人员创建的 EC2?

hyperledger-fabric - 清除 super 账本上的私有(private)数据时违反不变性

ssl - 在没有加密货币的情况下创建 orderer 创世 block

C# 尝试创建带空格的组织单位时出错

blockchain - "Coffee with Blockchain"如何匹配种植者和买家?

hyperledger-fabric - 将现有的 Hyperledger Fabric 排序器从单独升级到基于 Kafka

hyperledger-fabric - 使用誓言或电子邮件/密码与 hyperledger-fabric-ca 注册/登录