HLF 1.0.2 - 反序列化 stub.GetCreator() 提供的 SerializedIdentity

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

过程描述得很好here。 不幸的是,当我尝试在我的链代码中导入 msp 包 (github.com/hyperledger/fabric/protos/msp) 时,我在安装阶段收到错误消息:

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)

问:这是否意味着我可以在链代码中使用有限的预定义导入集?

我正在使用 dockerhub (1.0.2) 上可用的最新结构 docker 图像,通过以下命令安装 cc:

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

编辑:Artem 是正确的,错误来自安装命令 - 我已经更新了描述。

首先我认为你遇到的错误发生在安装阶段而不是实例化,因为它似乎是一个编译错误:

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)

为了解决这个问题,您需要将 vendor missing package 添加到您的链代码中,例如:

govendor init

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

很可能您还需要提供额外的依赖项。