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回答

自游蜗牛

2018-10-02

亲,你好。

这应该是版本不一致导致的。你从git.imooc.com下载下来的代码放到github.com/hyperledger/fabric目录下看看。

祝你学习愉快。

0
5
越狱兔__
非常感谢!
2018-10-02
共5条回复

Hyperledger Fabric实战联盟链-企业端区块链原理精讲

兼顾区块链应用层和底层 进击区块链工程师

787 学习 · 564 问题

查看课程