基于first-network自定义Fabric网络创建通道遇未知联盟DocChain错误
问题:创建Hyperledger Fabric通道时提示"Unknown consortium name: DocChain"
我正在以first-network为模板搭建自定义Hyperledger Fabric网络,前期所有步骤均执行正常,但从cli容器执行通道创建操作时,出现如下错误:
2018-05-11 11:33:13.956 UTC [msp] GetLocalMSP -> DEBU 00c Returning existing local MSP 2018-05-11 11:33:13.956 UTC [msp] GetDefaultSigningIdentity -> DEBU 00d Obtaining default signing identity 2018-05-11 11:33:13.957 UTC [msp/identity] Sign -> DEBU 00e Sign: plaintext: 0ABF060A1408021A0608F9FED5D70522...5CB2E57136F84747C182E82B76191345 2018-05-11 11:33:13.957 UTC [msp/identity] Sign -> DEBU 00f Sign: digest: 6B8E0CAC07B99E8E993D0C4C8692797D12AECD3CA09C56AF07D769B2B0783DD1 Error: got unexpected status: BAD_REQUEST -- Unknown consortium name: DocChain Usage: peer channel create [flags] Flags: -c, --channelID string In case of a newChain command, the channel ID to create. -f, --file string Configuration transaction file generated by a tool such as configtxgen for submitting to orderer -t, --timeout int
以下是我的configtx.yaml文件片段:
Profiles: DocChainOrdererGenesis: #TwoOrgsOrdererGenesis: Capabilities: <<: *ChannelCapabilities Orderer: <<: *OrdererDefaults Organizations: - *OrdererNUSTOrg Capabilities: <<: *OrdererCapabilities Consortiums: DocChain: Organizations: - *NUST - *GIKI - *LUMS DocChainOrgsChannel: Consortium: DocChain Application: <<: *ApplicationDefaults Organizations: - *NUST - *GIKI - *LUMS Capabilities: <<: *ApplicationCapabilities
解决方案
别担心,这个问题我之前也踩过坑,核心原因是生成通道交易配置文件时用错了Profile,导致orderer无法识别你指定的DocChain联盟。
咱们一步步理清楚:
- 你的
configtx.yaml里,DocChain联盟是定义在DocChainOrdererGenesis这个Profile下的,这部分没问题——你生成orderer创世块的时候肯定用了这个Profile,所以orderer的创世块里已经包含了这个联盟的定义。 - 但关键是,你生成**通道交易文件(channel.tx)**的时候,必须指定
DocChainOrgsChannel这个Profile,因为它明确关联了DocChain联盟。如果用了其他Profile(比如默认的first-network里的配置),生成的channel.tx里就不会包含正确的联盟信息,orderer自然就找不到DocChain了。
正确的通道交易文件生成命令应该是这样的:
configtxgen -profile DocChainOrgsChannel -outputCreateChannelTx ./channel-artifacts/channel.tx -channelID docchainchannel
另外再检查两个细节:
- 确认orderer节点启动时加载的创世块,确实是用
DocChainOrdererGenesis生成的,确保联盟定义已经被orderer加载。 - 检查cli容器里的环境变量,比如
CHANNEL_NAME要和生成channel.tx时指定的-channelID一致,ORDERER_CA等配置也要指向正确的orderer节点。
重新生成channel.tx后,再执行通道创建命令,这个"Unknown consortium name"的错误应该就消失了。
内容的提问来源于stack exchange,提问作者Asad Hayat
相关产品推荐
相关产品推荐

