官方简单的一个 demo 链码、init 的方法都是直接返回一个字符串
链码内容:
为了直观展示就 init 只返回了一个错误的字符串
func (t *SimpleChaincode) Init(stub shim.ChaincodeStubInterface) pb.Response {
return shim.Error("hello")
}
安装链码且实例化链码的过程如下:
# 安装链码
root@cli-6d4b59664-p4xfc:/opt/gopath/src/chaincode# peer chaincode install -n mycca -v 1.0 -p chaincode/
2021-02-23 06:46:23.904 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc
2021-02-23 06:46:23.904 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc
2021-02-23 06:46:24.054 UTC [chaincodeCmd] install -> INFO 003 Installed remotely response:<status:200 payload:"OK" >
#实例化链码
root@cli-6d4b59664-p4xfc:/opt/gopath/src/chaincode# peer chaincode instantiate -o orderer0.adminnodborderer:7050 --tls --cafile /etc/hyperledger/crypto-config/ordererOrganizations/adminnodborderer/orderers/orderer0.adminnodborderer/msp/tlscacerts/tlsca.adminnodborderer-cert.pem -C myc -n mycca -v 1.0 -c '{"Args":["init"]}'
2021-02-23 06:48:49.284 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc
2021-02-23 06:48:49.285 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc
Error: could not assemble transaction, err proposal response was not successful, error code 500, msg chaincode registration failed: container exited with 0
已尝试根据network
处解决、可最终结果还是不行
玩这个的大佬、麻烦指教下