Not able to use IBM Blockchain services after Bluemix 1.0 update (Hyperledger 0.6)

≡放荡痞女 提交于 2019-12-12 04:37:37

问题


My team and I are developing an app using Bluemix Blockchain services, and we were using the application just fine until the 1.0 update. We thought it could be an error related to the ibm-blockchain.js library, however we have tried deploying it via REST and we still get errors:

{
 "jsonrpc": "2.0",
 "error": {
     "code": -32001,
     "message": "Deployment failure",
     "data": "Error when deploying chaincode: Error getting chaincode package bytes: Error getting code 'go get' failed with error: 'exit status 2'\n# github.com/ibm-blockchain/learn-chaincode/finished\n/go/_usercode_/493306176/src/github.com/ibm-blockchain/learn-chaincode/finished/chaincode_finished.go:38: undefined: shim.ChaincodeStubInterface\n/go/_usercode_/493306176/src/github.com/ibm-blockchain/learn-chaincode/finished/chaincode_finished.go:52: undefined: shim.ChaincodeStubInterface\n/go/_usercode_/493306176/src/github.com/ibm-blockchain/learn-chaincode/finished/chaincode_finished.go:67: undefined: shim.ChaincodeStubInterface\n/go/_usercode_/493306176/src/github.com/ibm-blockchain/learn-chaincode/finished/chaincode_finished.go:80: undefined: shim.ChaincodeStubInterface\n/go/_usercode_/493306176/src/github.com/ibm-blockchain/learn-chaincode/finished/chaincode_finished.go:99: undefined: shim.ChaincodeStubInterface\n"
     },
 "id": 1
}

Our service is still using the 0.5 version. We have also updated the local version to 1.0 and tried the same to see if the error was the same, and it seems like it is:

12:16:55.666 [devops] getChaincodeBytes -> ERRO 034 Error getting chaincode package bytes: Error getting code 'go get' failed with error: "exit status 1"
package github.com/VitorSousaCode/chaincodes/tree/master/final: cannot find package "github.com/VitorSousaCode/chaincodes/tree/master/final" in any of:
    /opt/go/src/github.com/VitorSousaCode/chaincodes/tree/master/final (from $GOROOT)
    /opt/gopath/_usercode_/796234422/src/github.com/VitorSousaCode/chaincodes/tree/master/final (from $GOPATH)
    /opt/gopath/src/github.com/VitorSousaCode/chaincodes/tree/master/final
12:16:55.671 [devops] Deploy -> ERRO 035 Error deploying chaincode spec: type:GOLANG chaincodeID:<path:"https://github.com/VitorSousaCode/chaincodes/tree/master/final" > ctorMsg:<args:"init" > secureContext:"user_type1_xxxxxxxxx"

Has anyone experienced anything similar? Does anybody know if there's any way for us to continue using the Go chaincode we have developed before without applying major changes?


回答1:


The bluemix service was using an older version v0.5 of the Hyperledger Fabric before November 10 2016. This version used the old syntax i.e shim.ChaincodeStub

The bluemix service status page shows that on 10-11-2016 the Fabric version on bluemix has been updated to v0.6.1. This newer version should be using the new syntax i.e shim.ChaincodeStubInterface.

Your deploy transaction is failing, because your the syntax in the chaincode is not consistent with the fabric version.

Note

  • If you are using a bluemix service with v0.5 version of fabric, then make sure your chaincode builds successfully with the shim.ChaincodeStub syntax

  • If you are using a buemix service with the v0.6 version of fabric , make sure the chaincode builds with the shim.ChaincodeStubInterface .For an example chaincode using v0.6 see chaincode_example02 v0.6 chaincode



来源:https://stackoverflow.com/questions/40632277/not-able-to-use-ibm-blockchain-services-after-bluemix-1-0-update-hyperledger-0

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!