当我启动orderer,peer node,然后我启动example01.go来实例化链代码, 并指定:
peer.address 192.168.120.189:7051
chaincode.id.name simple-token:1.0.0
example01.go的主要代码是:
func main() {
viper.Set("chaincode.id.name","simple-token:1.0.0")
err := shim.Start(new(SimpleChaincode))
if err != nil {
fmt.Printf("Error starting Simple chaincode: %s", err)
}
}
方法shim.Start()中的错误发生在以下句子中:
err = chatWithPeer(chaincodename, stream, cc)//causes the error
但显示错误:未实现的desc =未知服务protos.ChaincodeSupport 处理已完成,退出代码为0
GOROOT=/usr/local/Cellar/go/1.9/libexec #gosetup
GOPATH=/Users/friends/Documents/VirtualMachine/share/gopath #gosetup
/usr/local/Cellar/go/1.9/libexec/bin/go build -i "-ldflags=-linkmode internal" -o /private/var/folders/cg/mwzlhrjs5y55ny553g6xz9tr0000gn/T/___chaincode_example01_cc /Users/friends/Documents/VirtualMachine/share/gopath/src/github.com/hyperledger/fabric/examples/chaincode/go/chaincode_example01/chaincode_example01.go #gosetup
/private/var/folders/cg/mwzlhrjs5y55ny553g6xz9tr0000gn/T/___chaincode_example01_cc -peer.address 192.168.120.189:7051 #gosetup
2017-12-28 20:14:30.124 CST [shim] SetupChaincodeLogging -> INFO 001 Chaincode log level not provided; defaulting to: INFO
2017-12-28 20:14:30.124 CST [shim] SetupChaincodeLogging -> INFO 002 Chaincode (build level: ) starting up ...
2017-12-28 20:14:30.126 CST [shim] func1 -> ERRO 003 Received error from server, ending chaincode stream: rpc error: code = Unimplemented desc = unknown service protos.ChaincodeSupport
Error starting Simple chaincode: rpc error: code = Unimplemented desc = unknown service protos.ChaincodeSupport
Process finished with exit code 0
答案 0 :(得分:15)
您使用了错误的端口。在v1.1中,端口是7052而不是像在v1.0中那样7051