build链码报错
来源:7-8 合约部署A

越狱兔__
2018-10-01
#老师您好,我build编写的链码时报这个错,直接贴工程里带的链码build也是报这个错,以下是错误信息:
jinyu@ubuntu:~/Desktop/go_workspace/src/github.com/hyperledger/fabric/imocc/chaincode/assetsExchange$ go build --tags=nopkcs11
#github.com/hyperledger/fabric/core/chaincode/shim
…/…/…/core/chaincode/shim/handler.go:242:25: cannot use stub (type *ChaincodeStub) as type ChaincodeStubInterface in argument to handler.cc.Init:
*ChaincodeStub does not implement ChaincodeStubInterface (missing getState method)
have GetState(string) ([]byte, error)
want getState(string) (interface {}, interface {})
…/…/…/core/chaincode/shim/handler.go:317:27: cannot use stub (type *ChaincodeStub) as type ChaincodeStubInterface in argument to handler.cc.Invoke:
*ChaincodeStub does not implement ChaincodeStubInterface (missing getState method)
have GetState(string) ([]byte, error)
want getState(string) (interface {}, interface {})
…/…/…/core/chaincode/shim/mockstub.go:123:21: cannot use stub (type *MockStub) as type ChaincodeStubInterface in argument to stub.cc.Init:
*MockStub does not implement ChaincodeStubInterface (missing getState method)
have GetState(string) ([]byte, error)
want getState(string) (interface {}, interface {})
…/…/…/core/chaincode/shim/mockstub.go:132:23: cannot use stub (type *MockStub) as type ChaincodeStubInterface in argument to stub.cc.Invoke:
*MockStub does not implement ChaincodeStubInterface (missing getState method)
have GetState(string) ([]byte, error)
want getState(string) (interface {}, interface {})
…/…/…/core/chaincode/shim/mockstub.go:142:23: cannot use stub (type *MockStub) as type ChaincodeStubInterface in argument to stub.cc.Invoke:
*MockStub does not implement ChaincodeStubInterface (missing getState method)
have GetState(string) ([]byte, error)
want getState(string) (interface {}, interface {})
1回答
-
亲,你好。
这应该是版本不一致导致的。你从git.imooc.com下载下来的代码放到github.com/hyperledger/fabric目录下看看。
祝你学习愉快。
052018-10-02
相似问题