I have written my chaincode using hyperledger-composer and I have a function called Modify. I am trying to call this function from my java application using the hyperledger java sdk but I can't figure out how to call this function. I am getting the following error:
Sending proposal to xxx.xxx.com failed because of: gRPC
failure=Status{code=UNKNOWN, description=error executing chaincode:
transaction returned with failure: Error: Unsupported function
"com.xxx.xxx.Modify" with arguments...
My question is how can I figure out the name of the function composer is creating in the chaincode when I create this modify transaction from composer.
If you used Hyperledger Composer to create your business network (.bna), you have to use the Hyperledger Composer SDK in you client application in order to interact with the blockchain (API Reference).
Otherwise, you can use composer-rest-server (official documentation) to expose APIs of the business network.
Up to now, I don't think is available any Java SDK for Hyperledger Composer.
Related
This is a statement from Hyperledger Fabric NodeJS SDK v2.2 documentation in the section "Migrating client applications from v1.4 to v2.0":
Note that the SDK no longer aims to provide administrative and
management capability. The command-line interface should be used for
these operations.
Does this mean that the new SDK does not support actions like chaincode installation and instantiation. I understand that in v2.2 the chaincode lifecycle is different and the steps are package and install chaincode, approve and commit chaincode definition. Can any of these actions be performed using the SDK?
You can use Hyperledger Fabric SDK GO. It currently supports Fabric v2.2.
You can check our repo Akachain Admin Tool as an example. It provides RESTful API for an administrator to interact with a Hyperledger Fabric network using Fabric Go SDK
I had developed an application using composer. But it is now deprecated. So i'm trying at least to use the chaincode generated using composer.
Is it possible to interact with the chaincode generated using composer through 'peer chaincode' command?
Composer doesn't generate chaincode. A business network is tightly bound to the composer framework. A business network is an implementation written to the composer specification and contains the composer runtime to understand and interpret that implementation at runtime. Therefore a Composer Business network is not standalone chaincode.
The client side of composer for client application provides the necessary operational tools as well as the business application apis in order to correctly interact with a business network. Although technically you could work out how to invoke a business network from client code without using composer it would not be trivial.
Am working on Hyperledger composer.I have developed the Chaincode in Go language. Is it possible to deploy the Chaincode written in Go language on a Hyperledger Composer Environment? Am using the latest composer version:0.19.12. please guide..
I dont think that is possible. Hyperledger Composer interacts with the Javascript runtime and does not communicate in any way with the GO runtime.
Hyperledger Composer business networks are capable of invoking chaincode from TP functions in the business network. So you can get a business network to interact with your GO Chaincode. You would use the getNativeAPI method inside a business network to get access to the stub and then can then perform an invokeChaincode request on that stub.
Hyperledger Composer doesn't provide a Fabric network, it requires a fabric network to be deployed to (a business network is, at the end of the day, chaincode).
I am using hyperledger composer for transaction invocation and all the stuffs related to resource(participants, assets etc) manipulation. I have generated the server using composer-rest-server, and also generated the angular frontend using yeoman generator.
This makes me to ask what is the use of fabric sdk? Will I need it in the above mentioned scenario?
Please clarify, thanks.
There are two ways to write chaincode in Hyperledger Fabric,
1) Using GoLang
2) Using NodeJS
In order to connect Hyperledger Fabric and Invoke chaincode transaction. You will require SDK. Based on your application technology stack, You can either use Fabric NodeJS SDK, Fabric Java SDK and Fabric Python SDK.
On other hand; Hyperledger composer is different way of writing chaincode, which is guide of framework which can help you to accelerate your chaincode development. If you have developed business network using composer, then you can either use "composer rest server" or "composer-admin" and "composer-client" node module. You dont need to use any SDK in order to interact with Business network deployed on hyperledger fabric. Kindly refer following diagram for more clarity.
I am trying out the Hyperledger fabric Chaincode for Developers tutorial. The CLI chaincode commands to deploy and invoke the chaincode is working.
How can I enable the REST API as in the Fabric Documentation here or here. The link provided in the documentation https://github.com/hyperledger/fabric/blob/master/peer/core.yaml is not found currently.
Starting from version 1.0.0 Hyperledger Fabric no longer expose REST API to interact the peers. Instead you have set of SDK which encapsulates interaction protocol allowing you to implement client logic which. At the moment you can take a look on following SDKs:
NodeJS SDK
Golang SDK
Java SDK
Python SDK
And documentation you are referring is from v0.6 which is no longer relevant, please use updated one here. The section of chaincode for developers might be very useful for your case.