the channel is supposed to be created with the peer channel create inside the container after generating the channel tx files with configtxgen.
I wanted to know if it is possible to create the channel tx files and create the channel with the help of the node js server like previously in the fabric 1.4 we used to do with the help of the fabric-client.
At the moment there isn't an API in the Node SDK (v2) to manage the chaincode lifecycle.
You should be able to use the SDK to invoke lifecycle functions using the system '_lifecycle' chaincode.
There are also third-party libraries built on the SDK which provides some lifecycle support, e.g https://github.com/davidkhala/fabric-common/tree/master/nodejs/admin
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.
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.
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.