官方简单的一个 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
处解决、可最终结果还是不行
玩这个的大佬、麻烦指教下
1
learningman 2021-02-23 15:19:26 +08:00 via Android
500 怎么看怎么像他炸了
|
2
smallyu 2021-02-23 15:24:38 +08:00
为什么要 return Error 呢?
|
3
janda OP @learningman 可以安装、就是实例化的时候不行!这个一般是什么问题导致的
|
5
smallyu 2021-02-23 16:23:10 +08:00
return shim.Success(nil)
|
7
jonathanchoo 2021-02-23 18:52:10 +08:00
看 peer 日志
|