Fabric手动创建通道之坑

作为一个有强迫症的代码狗来说,有时候强迫症真的是很浪费时间的一件事,这也算是一种无奈了。Fabric网络的手动配置过程主要分为三步:

  1. 利用cryptogen和configtxgen工具生成配置文件
  2. 利用Docker-Compose启动容器,利用Docker创建通道、把节点加入通道
  3. 链码操作,链码的状态有这几种:Install → Instantiate → invocable → Upgrade → Deinstantiate → Uninstall

这次在利用configtxgen工具生成配置文件的过程倒算顺畅,没有出现任何错误,却单单报出了个警告。如下:未给指定的通道 ID,系统提示会默认设置为testchainid。

2019-08-04 02:33:48.979 CST [common.tools.configtxgen] main -> WARN 001 Omitting the channel ID for configtxgen for output operations is deprecated.  Explicitly passing the channel ID will be required in the future, defaulting to 'testchainid'.

偏偏强迫症作祟,非要给它加个通道 ID。而 configtxgen 工具会生成 genesis block for orderer 和 channel configuration transaction。在不名缘由的情况下,我把两个通道ID给出了一样的参数 mychannel。如下:

# generate genesis block for orderer
configtxgen -profile ComposerOrdererGenesis -channelID mychannel -outputBlock ./config/genesis.block
if [ "$?" -ne 0 ]; then
  echo "Failed to generate orderer genesis block..."
  exit 1
fi

# generate channel configuration transaction
configtxgen -profile ComposerChannel -outputCreateChannelTx ./config/channel.tx -channelID mychannel
if [ "$?" -ne 0 ]; then
  echo "Failed to generate channel configuration transaction..."
  exit 1
fi

然后问题来了:

2019-08-03 18:40:15.625 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
Error: got unexpected status: FORBIDDEN -- implicit policy evaluation failed - 0 sub-policies were satisfied, but this policy requires 1 of the 'Writers' sub-policies to be satisfied: permission denied

给出解决方案, generate genesis block for orderer 和 generate channel configuration transaction 两个中的通道ID 不能一致,都可以随便命名,generate genesis block for orderer 中的通道ID参数也可不写。

两天半的时间,心塞。。。

  • 8
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 7
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 7
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值