V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
janda
V2EX  ›  问与答

fabric 实例化链码的时候出现这样的错误!安装的时候是没有问题的、这个是怎么回事呢?找了很久都没有找到解决方案

  •  
  •   janda · Feb 23, 2021 · 1347 views
    This topic created in 1894 days ago, the information mentioned may be changed or developed.

    官方简单的一个 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处解决、可最终结果还是不行

    玩这个的大佬、麻烦指教下

    7 replies    2021-02-23 18:52:10 +08:00
    learningman
        1
    learningman  
       Feb 23, 2021 via Android
    500 怎么看怎么像他炸了
    smallyu
        2
    smallyu  
       Feb 23, 2021
    为什么要 return Error 呢?
    janda
        3
    janda  
    OP
       Feb 23, 2021
    @learningman 可以安装、就是实例化的时候不行!这个一般是什么问题导致的
    janda
        4
    janda  
    OP
       Feb 23, 2021
    @smallyu 我觉得这不是重点、只是实例化的时候打印下、能证明实例化成功了!问题是现在都实例化不成功
    smallyu
        5
    smallyu  
       Feb 23, 2021
    return shim.Success(nil)
    janda
        6
    janda  
    OP
       Feb 23, 2021
    @smallyu 试过了、没有用
    jonathanchoo
        7
    jonathanchoo  
       Feb 23, 2021
    看 peer 日志
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   796 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 32ms · UTC 22:15 · PVG 06:15 · LAX 15:15 · JFK 18:15
    ♥ Do have faith in what you're doing.