Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save seanbarclay/c5d0c3453c0584b1d764841a54674fa5 to your computer and use it in GitHub Desktop.
Save seanbarclay/c5d0c3453c0584b1d764841a54674fa5 to your computer and use it in GitHub Desktop.
Learn Chaincode Invoke Call
Excerpt code from https://github.com/IBM-Blockchain/learn-chaincode/blob/master/finished/chaincode_finished.go...
func (t *SimpleChaincode) Invoke(stub *shim.ChaincodeStub, function string, args []string) ([]byte, error) {
fmt.Println("invoke is running " + function)
// Handle different functions
if function == "init" {
return t.Init(stub, "init", args)
} else if function == "write" {
return t.write(stub, args)
}
fmt.Println("invoke did not find func: " + function)
return nil, errors.New("Received unknown function invocation")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment