0

我在调用过程中遇到了问题。

1.)我运行以下命令:

peer lifecycle chaincode querycommitted \
    --channelID mychannel \
    --name basic \
    --cafile ${PWD}/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem

--> 到这里一切正常。

比我想调用链​​码:

peer chaincode invoke \
    -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 \
    -C mychannel \
    -n basic \
    --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 \
    -c '{"function":"InitLedger","Args":[]}'

之后我得到了错误

Error: endorsement failure during invoke. response: status:500 message:"error in simulation: failed to execute transaction 93.....: could not launch chaincode basic_1.0:465......: chaincode registration failed: container exited with 1"

我尝试了整个过程几次,以确保我之前没有任何错误。我还检查了码头工人docker ps,一切正常。

所以我没有胶水,错误的根源可能是什么。我会对每一次帮助感到高兴!谢谢!!!

4

1 回答 1

0

最初在提交链代码后,必须首先执行 init。要执行 init,您只需要--isInit在调用参数选项中指定。请参阅下面的文档。 结构/对等/链码

peer chaincode invoke \
    -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 \
    -C mychannel \
    -n basic \
    --isInit \
    --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 \
    -c '{"function":"InitLedger","Args":[]}'
于 2020-12-31T01:19:38.200 回答