Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Blockchain by (4.1k points)

I'd like to call another chaincode from inside a chaincode's Invoke() method. What's the recommended way to do this? I guess I can use the standard REST API on /chaincode and reference to it by its ID (returned by the deploy operation), but are there "system" GO APIs to accomplish this, also, can I reference the chaincode by name instead of the ID?

1 Answer

0 votes
by (14.4k points)

There are 2 samples in the path: 

fabric/ folder examples/chaincode/go/chaincode_example04 examples/chaincode/go/chaincode_example05

These samples might help you.

Both of them invoke chaincode_example02. The only difference between them is that chaincode_example04 hardcodes chaincode_example02's ID and chaincode_exampl05 gets the ID from an argument.

At the present time, one cannot reference chaincode by name (except in "dev" mode).

Browse Categories

...