dongpin1850 2016-11-09 03:50
浏览 161
已采纳

无法在Ubuntu终端上从我自己的github运行hyperledger chaincode

I can run the chaincode from the following official path: https://github.com/ibm-blockchain/learn-chaincode/finished github.com/hyperledger/fabric/examples/chaincode/go/chaincode_example02

# peer chaincode deploy -p github.com/hyperledger/fabric/examples/chaincode/go/chaincode_example02 -c '{"Function":"init", "Args": ["a","100", "b", "200"]}'

but cannot run chainncode from my own github path: https://github.com/jeffyxia/hyperledger/trade

# peer chaincode deploy -p https://github.com/jeffyxia/hyperledger/trade -c '{"Function":"init", "Args": ["a","100", "b", "200"]}'

the error info is:

Error: Error building chaincode: rpc error: code = 2 desc = Error getting

chaincode package bytes: Error getting code 'go get' failed with error: "exit status 2"
# github.com/jeffyxia/hyperledger/hello_world
/go/_usercode_/519629987/src/github.com/jeffyxia/hyperledger/hello_world/chaincode_example01.go:31: cannot use new(SimpleChaincode) (type *SimpleChaincode) as type shim.Chaincode in argument to shim.Start:
    *SimpleChaincode does not implement shim.Chaincode (wrong type for Init method)
        have Init(*shim.ChaincodeStub, string, []string) ([]byte, error)
        want Init(shim.ChaincodeStubInterface, string, []string) ([]byte, error)

supplement info: Ubuntu 16.04 without go language environment, use PBFT algrithm.

how to fix this problem, thx.

  • 写回答

1条回答 默认 最新

  • dorkahemp972157683 2016-11-09 03:57
    关注

    First of all, you may want to use the latest version of fabric from its official repository. Secondly, the error is self-explanatory,

      *SimpleChaincode does not implement shim.Chaincode (wrong type for Init method)
            have Init(*shim.ChaincodeStub, string, []string) ([]byte, error)
            want Init(shim.ChaincodeStubInterface, string, []string) ([]byte, error)
    

    You need to replace stub *shim.ChaincodeStub with stub shim.ChaincodeStubInterface everywhere in your go file. Please read this as well, https://github.com/IBM-Blockchain/ibm-blockchain-issues/issues/29

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器