Fabric调用链码报错

Fabric调用链码报错

Error: endorsement failure during invoke. response: status:500 message:"error in simulation: failed to execute transaction aaeb7054ce35680547c88d4f166767ef5cd367e09358135bb821e permission_1.0.1:a678e6451f0636edc070cc702ccdec1da6370774f3d40bb6f67498f1cb2b6726: error starting container: error starting container: API error (400): failed to create shim teate failed: unable to start container process: exec: \"chaincode\": executable file not found in $PATH: unknown"
error starting container: API error (400): failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: exec: "chaincode": executable file not found in $PATH: unknown

检查方法

1. 查看链码容器状态【status】

docker ps -a

这里可以看到,链码容器的状态是Create,说明链码容器并未成功启动。
在这里插入图片描述

2. 查看链码是否安装成功

#前提:设置环境变量
export CORE_PEER_TLS_ENABLED=true
export CORE_PEER_LOCALMSPID=Org1MSP
export CORE_PEER_MSPCONFIGPATH=${PWD}/organizations/peerOrganizations/org1.example.com/users/creator1@org1.example.com/msp
export CORE_PEER_TLS_ROOTCERT_FILE=${PWD}/organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt
export CORE_PEER_ADDRESS=localhost:7051
export TARGET_TLS_OPTIONS=(-o localhost:7050 --ordererTLSHostnameOverride orderer.example.com --tls --cafile "${PWD}/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem" --peerAddresses localhost:7051 --tlsRootCertFiles "${PWD}/organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt" --peerAddresses localhost:9051 --tlsRootCertFiles "${PWD}/organizations/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt")

#查看节点已安装列表
peer chaincode list --installed --channelID mychannel

这里可以看到,输出的列表为空,说明没有链码被安装,所以调用链码时会报错
在这里插入图片描述

解决方法

1.重新安装链码,安装链码时注意检查是否有报错,是否成功安装

2.显示安装成功,但是仍然出现上方问题?

检查智能合约文件的package是否为main包,是否写了主程序入口函数
在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值