Hyperledger Fabric: cannot run chaincode from github on Ubuntu terminal

0 votes

I can run the chaincode from the following official path. but cannot run chainncode from my own github path

the error info is:

Error: Error building chaincode: rpc error: code = 2 desc = Error getting

chaincode package bytes: Error getting code 'go get' failed with error: "exit status 2"
# <path>
/go/_usercode_/519629987/src/<path>/chaincode_example01.go:31: cannot use new(SimpleChaincode) (type *SimpleChaincode) as type shim.Chaincode in argument to shim.Start:
    *SimpleChaincode does not implement shim.Chaincode (wrong type for Init method)
        have Init(*shim.ChaincodeStub, string, []string) ([]byte, error)
        want Init(shim.ChaincodeStubInterface, string, []string) ([]byte, error)

How to solve this?

Oct 31, 2018 in Blockchain by digger
• 26,550 points
75 views

1 answer to this question.

0 votes

Like the error says:

*SimpleChaincode does not implement shim.Chaincode (wrong type for Init method)
        have Init(*shim.ChaincodeStub, string, []string) ([]byte, error)
        want Init(shim.ChaincodeStubInterface, string, []string) ([]byte, error)

You need to replace stub *shim.ChaincodeStub with stub shim.ChaincodeStubInterface​

answered Oct 31, 2018 by Omkar
• 67,660 points

Related Questions In Blockchain

+1 vote
2 answers

How to return value from a chaincode in Hyperledger Fabric?

Hyperledger Fabric supports only 2 types of ...READ MORE

answered Jun 13, 2018 in Blockchain by Perry
• 17,020 points
922 views
+1 vote
3 answers
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

Hyperledger Fabric: Cannot update chaincode

First, stop and delete all the containers: docker ...READ MORE

answered Oct 31, 2018 in Blockchain by Omkar
• 67,660 points
436 views