HLF 1.0.2 - deserialize a SerializedIdentity provided by stub.GetCreator()

Viewed 304

The process is quite well described here. Unfortunately when I'm trying to import msp package (github.com/hyperledger/fabric/protos/msp) in my chaincode I'm receiving an error during install phase:

Error: Error getting chaincode code chaincode: Error getting chaincode package bytes: Error obtaining dependencies for github.com/hyperledger/fabric/protos/msp: <go, [list -f {{ join .Deps "\n"}} github.com/hyperledger/fabric/protos/msp]>: failed with error: "exit status 1" 
can't load package: package github.com/hyperledger/fabric/protos/msp: cannot find package "github.com/hyperledger/fabric/protos/msp" in any of:
/opt/go/src/github.com/hyperledger/fabric/protos/msp (from $GOROOT)
/opt/gopath/src/github.com/hyperledger/fabric/protos/msp (from $GOPATH)

Q: Does it mean that I can use the limited, predefined set of imports in the chaincode?

I'm using the newest fabric docker images available on dockerhub (1.0.2) to install cc with following command:

docker exec -e "CORE_PEER_LOCALMSPID=Org1MSP" -e "CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp" cli peer chaincode install -n testcc -v 1.0 -p github.com/testcc

EDIT: Artem is right, the error goes from Install command - I've updated the description.

1 Answers

First of all I think that the error you have experienced occurs in install stage rather than instantiate, since it seems to be a compilation error:

Error: Error getting chaincode code chaincode: Error getting chaincode package bytes: Error obtaining dependencies for github.com/hyperledger/fabric/protos/msp: : failed with error: "exit status 1"

can't load package: package github.com/hyperledger/fabric/protos/msp: cannot find package "github.com/hyperledger/fabric/protos/msp" in any of:

/opt/go/src/github.com/hyperledger/fabric/protos/msp (from $GOROOT) /opt/gopath/src/github.com/hyperledger/fabric/protos/msp (from $GOPATH)

In order to solve this problem you need to vendor missing package into your chaincode, e.g.:

govendor init

and

govendor fetch github.com/hyperledger/fabric/protos/msp

most likely you will need also to vendor additional dependencies.

Related