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

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

报告相同问题?

悬赏问题

  • ¥100 关于使用MATLAB中copularnd函数的问题
  • ¥20 在虚拟机的pycharm上
  • ¥15 jupyterthemes 设置完毕后没有效果
  • ¥15 matlab图像高斯低通滤波
  • ¥15 针对曲面部件的制孔路径规划,大家有什么思路吗
  • ¥15 钢筋实图交点识别,机器视觉代码
  • ¥15 如何在Linux系统中,但是在window系统上idea里面可以正常运行?(相关搜索:jar包)
  • ¥50 400g qsfp 光模块iphy方案
  • ¥15 两块ADC0804用proteus仿真时,出现异常
  • ¥15 关于风控系统,如何去选择