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
• 27,620 points
47 views

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
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
• 65,850 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
• 16,450 points
600 views
+2 votes
3 answers
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
• 65,850 points
210 views

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.