本教程是《Fabric实战教程之一步步走向生产》系列教程的第七篇,主要总结这一路走来遇到的填坑经验,本文会持续更新记录。
教程目录结构如下:
1.切换了fabric版本后通道无法创建
错误如下:fatal: [org0.example.com]: FAILED! => {"changed": true, "msg": "non-zero return code", "rc": 1, "stderr": "Connection to 192.178.1.11 closed.\r\n", "stderr_lines": ["Connection to 192.178.1.11 closed."], "stdout": "\u001b[34m2019-12-30 06:50:06.902 UTC [channelCmd] InitCmdFactory -> INFO 001\u001b[0m Endorser and orderer connections initialized\r\nError: got unexpected status: BAD_REQUEST -- error validating channel creation transaction for new channel 'common', could not succesfully apply update to template configuration: error authorizing update: error validating DeltaSet: policy for [Group] /Channel/Application not satisfied: implicit policy evaluation failed - 0 sub-policies were satisfied, but this policy requires 1 of the 'Admins' sub-policies to be satisfied\r\n", "stdout_lines": ["\u001b[34m2019-12-30 06:50:06.902 UTC [channelCmd] InitCmdFactory -> INFO 001\u001b[0m Endorser and orderer connections initialized", "Error: got unexpected status: BAD_REQUEST -- error validating channel creation transaction for new channel 'common', could not succesfully apply update to template configuration: error authorizing update: error validating DeltaSet: policy for [Group] /Channel/Application not satisfied: implicit policy evaluation failed - 0 sub-policies were satisfied, but this policy requires 1 of the 'Admins' sub-policies to be satisfied"]}
解决方案: configtx.yaml Capabilities段落不正确,参考官方版本
################################################################################
#
# SECTION: Capabilities
#
# - This section defines the capabilities of fabric network. This is a new
# concept as of v1.1.0 and should not be utilized in mixed networks with
# v1.0.x peers and orderers. Capabilities define features which must be
# present in a fabric binary for that binary to safely participate in the
# fabric network. For instance, if a new MSP type is added, newer binaries
# might recognize and validate the signatures from this type, while older
# binaries without this support would be unable to validate those
# transactions. This could lead to different versions of the fabric binaries
# having different world states. Instead, defining a capability for a channel
# informs those binaries without this capability that they must cease
# processing transactions until they have been upgraded. For v1.0.x if any
# capabilities are defined (including a map with all capabilities turned off)
# then the v1.0.x peer will deliberately crash.
#
################################################################################
Capabilities:
# Channel capabilities apply to both the orderers and the peers and must be
# supported by both.
# Set the value of the capability to true to require it.
Channel: &ChannelCapabilities
# V1.4.3 for Channel is a catchall flag for behavior which has been
# determined to be desired for all orderers and peers running at the v1.4.3
# level, but which would be incompatible with orderers and peers from
# prior releases.
# Prior to enabling V1.4.3 channel capabilities, ensure that all
# orderers and peers on a channel are at v1.4.3 or later.
V1_4_3: true
# V1.3 for Channel enables the new non-backwards compatible
# features and fixes of fabric v1.3
V1_3: false
# V1.1 for Channel enables the new non-backwards compatible
# features and fixes of fabric v1.1
V1_1: false
# Orderer capabilities apply only to the orderers, and may be safely
# used with prior release peers.
# Set the value of the capability to true to require it.
Orderer: &OrdererCapabilities
# V1.4.2 for Orderer is a catchall flag for behavior which has been
# determined to be desired for all orderers running at the v1.4.2
# level, but which would be incompatible with orderers from prior releases.
# Prior to enabling V1.4.2 orderer capabilities, ensure that all
# orderers on a channel are at v1.4.2 or later.
V1_4_2: true
# V1.1 for Orderer enables the new non-backwards compatible
# features and fixes of fabric v1.1
V1_1: false
# Application capabilities apply only to the peer network, and may be safely
# used with prior release orderers.
# Set the value of the capability to true to require it.
Application: &ApplicationCapabilities
# V1.4.2 for Application enables the new non-backwards compatible
# features and fixes of fabric v1.4.2.
V1_4_2: true
# V1.3 for Application enables the new non-backwards compatible
# features and fixes of fabric v1.3.
V1_3: false
# V1.2 for Application enables the new non-backwards compatible
# features and fixes of fabric v1.2 (note, this need not be set if
# later version capabilities are set)
V1_2: false
# V1.1 for Application enables the new non-backwards compatible
# features and fixes of fabric v1.1 (note, this need not be set if
# later version capabilities are set).
V1_1: false
2.创建通道报错
错误如下:Error: got unexpected status: BAD_REQUEST -- config does not validly parse: cannot enable application capabilities without orderer support first
解决方案:configtx.yaml配置错误,application节点下少了capabilities配置
3.创建通道报错
错误如下:peer channel create -o orderer.example.com:7050 -c $CHANNEL_NAME -f ./channel-artifacts/channel.tx Error: got unexpected status: BAD_REQUEST -- Attempted to include a member which is not in the consortium
解决方案:$CHANNEL_NAME变量未设置
4.创建通道报错
错误如下:Error: got unexpected status: BAD_REQUEST -- error authorizing update: error validating DeltaSet: policy for [Group] /Channel/Application not satisfied: Failed to reach implicit threshold of 1 sub-policies, required 1 remaining
解决方案:cli容器中环境变量不正确,特别是证书路径和MSP名称
5.创建通道报错
错误如下: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
解决方案:orderer的每个MSP目录下都生成了config.yaml,EnableNodeOUs为true,参考官方samples也是这样的,暂时先不生成config.yaml,后面有时间再排查下
6.容器里面调用链码正常,但是查询结果没变化
错误如下:ServiceDiscoveryException fail:{}org.hyperledger.fabric.sdk.exception.ServiceDiscoveryException: Failed to find any
解决方案:链码实例化时候背书策略的MSP名称大小写错误
7.blockchain-explorer启动后页面上除了通道之后就没数据了,看容器log里面有一行报错
错误如下:Error: make sure the chaincode _lifecycle has been successfully instantiated and try again: chaincode _lifecycle not found
解决方案:应该属于blockchain-explorer自身的bug,节点安装和实例化链码后再去启动blockchain-explorer,就正常了