Hyperledger on IBM Cloud, chaincode launched and waiting for registration - hyperledger-fabric

Code
Currently I followed this article to develop my BNA to IBM blockchain cloud platform (started plan). Unluckily, I got the error when I try to run this line of code:
composer network start -c admin#mynetwork-fabric -A admin -C ./creds/admin-pub.pem -f delete.card -n my_network -V 0.0.4
Error
I am very sure that all parameters are good, the full errors are:
Error: Error trying to start business network. Error: No valid responses
from any peers.
Response from attempted peer comms was an error: Error: 2 UNKNOWN:
premature execution - chaincode (my_network:0.0.4) launched and
waiting for registration
Or sometimes the error is:
Error: Error trying to start business network. Error: No valid responses
from any peers.
Response from attempted peer comms was an error: Error:
REQUEST_TIMEOUT
I understand sometimes maybe there is a timeout, but I do not really got the launched and waiting for registration error.
P.S.
My hyperledger composer version is 0.19.
I also view this deploying tutorial, there might be some different commands, because of the different versions of Hyperledger Composer. I checked the composer hep to transfer the commands to running on composer 0.19.
Solution:
down grade composer-cli to 0.18.1
change your package.json, composer-cli to 0.18.1
npm install to create new bna
reinstall
restart

If you are using IBM Cloud Starter Plan, then you need to be using v0.18.1 of Composer not v0.19.
Also, this is the doc you should be following:
https://console.bluemix.net/docs/services/blockchain/develop_starter.html#deploying-a-business-networks-on-starter-plan

Related

"Error getting endorser client for query" when trying cli interaction with hyperledger fabric example, despite successful installation

I'm currently trying to get the example for hyperledger fabric working. I get as far as starting the chaincode successfully using the deployCC script, and get the expected printout of all the cars after running the script. However, when I get to the next step of manually querying the network, I run into issue. I've run the exports for org1 as specified, and verified that the paths match and the tls cert and mspconfig exist in those locations. However, when I try to run the query command:
peer chaincode query -C mychannel -n fabcar -c '{"Args":["queryAllCars"]}'
I get the following error printout:
Error: error getting endorser client for query: endorser client failed to connect to 0.0.0.0:7051: failed to create new connection: context deadline exceeded
I would expect to get the same printout as at the end of the deployCC script, and I can't figure out why that isn't happening. Any help in diagnosing this is appreciated!
If it matters, I'm running this in a VM with Ubuntu 20.04. All the prerequisites are fresh installations of the latest versions from the last couple of days.
Liam, if you are able to see all the cars at the end of deployCC, then it might be an environment variables issue. Remember that you have to execute the peer chaincode query -C mychannel -n fabcar -c '{"Args":["queryAllCars"]}' command in the same terminal where you ran deployCC because the environment variables are all set in that window.
We can do a couple of things to confirm:
Paste the output from DeployCC at the end, right after (and including)
Querying chaincode on peer0.org1...
Using organization
Print the following environment variables from the terminal window where you are executing deployCC and from the terminal window where you are executing the peer chaincode query -C mychannel -n fabcar -c '{"Args":["queryAllCars"]}' command
CORE_PEER_LOCALMSPID,
CORE_PEER_TLS_ROOTCERT_FILE,
CORE_PEER_MSPCONFIGPATH,
CORE_PEER_ADDRESS.
See if they match?

What is the difference between "start the chaincode" and "install the chaincode"? -- Hyperledger Fabric

I was following the documentation to run the GO chaincode in fabric network. Chaincode for Developers
For installing the chaincode and running, it instruct to open 3 terminals:
Terminal 1 - Start the network
Terminal 2 - Build & start the chaincode
Terminal 3 - Use the chaincode (install, instantiate, invoke etc in peer)
Terminal 2 :
The chaincode is started with peer and chaincode logs indicating successful registration with the peer.
What exactly terminal 2 is doing as chaincode will install and instantiated in terminal 3?
What is the meaning of start the chaincode and chaincode registration with peer?
Thanks!
In "dev mode" chaincode is built and started by us as a user, where normally it's the peer who starts and maintains the chaincode.
So in the second terminal, we are building the chaincode on our own by running :
go build
whereas, you are right if we run peer chaincode instantiate peer builds the chaincode on its own but not in this case as we build it.
Moreover, we set the properties in the second terminal for use during chaincode install and instantiate as the chaincode has not yet been associated with any channel by running,
CORE_PEER_ADDRESS=peer:7052 CORE_CHAINCODE_ID_NAME=mycc:0 ./sacc
But yeah they have mentioned
Even though you are in --peer-chaincodedev mode, you still have to install the chaincode so the life-cycle system chaincode can go through its checks normally. This requirement may be removed in future when in --peer-chaincodedev mode.
Lets hope its soon :)

debug node js chaincode ...?

This link gives tutorial on debugging javascript chaincode in hyperledger fabric. I was able to debug my chaincode following it but recently I updated to fabric 1.2 and the peer channel list command
CORE_PEER_LOCALMSPID=Org1MSP CORE_PEER_MSPCONFIGPATH=/home/bct/fabric-samples/basic-network/crypto-config/peerOrganizations/org1.example.com/users/Admin#org1.example.com/msp peer channel list
fails with:
Fatal error when initializing core config : error when reading core
config file: Unsupported Config Type ""
I tried to go back to v1.1 but the problem persists. Can someone give me the complete list of configuration steps that may have been missed in tutorial video (which I was following) that make the debugging chaincode work.
Thanks in advance.
Finally, figured out that fabric sdk (https://github.com/hyperledger/fabric-sdk-node) has to be downloaded and configured before following the video tutorial in the question.

hyperledger fabric devmode

I am trying to deploy chaincode in devmod on my ubuntu machine. I am following this tutorial.
The issue is when I use this command : CORE_CHAINCODE_LOGLEVEL=debug CORE_PEER_ADDRESS=localhost:7052 npm start
it shows the following error:
2018-09-20T16:27:18.292Z ERROR [lib/handler.js] uncaughtException: The "peer.address" program argument must be set to a legitimate value of <host>:<port>
Full logs can be found here:
https://hastebin.com/arerozesad.sql
I am following this tutorial:
https://hyperledger-fabric.readthedocs.io/en/v1.0.6/peer-chaincode-devmode.html
First, I hope you are using Fabric v1.1 or later as Node.js chaincode is not supported in v1.0.x.
The instructions you listed are for running Go chaincode.
For Node.js chaincode, your command should look like
CORE_CHAINCODE_ID_NAME="mycc:v0" node mycc.js --peer.address grpc://localhost:7052
You should be able to replace node mycc.js with npm start as well.
See https://github.com/hyperledger/fabric-chaincode-node#test-nodejs-chaincode for more information.

Error while updating business network in CLI tutorial

I am following along the Getting Started with Fabric Command Line and have run into a error I don't understand how to resolve. Any ideas?
In the section entitled "Update the deployed business network" an exception is thrown. The terminal output is below. The command used:
composer network update --archiveFile digitalproperty-network#0.0.7.bna --enrollId WebAppAdmin --enrollSecret DJY27pEnl16d
Note that the id is different from the tutorial as the 0.0.7 id was reported during the previous step while creating. The output continued...
Deploying business network from archive digitalproperty-network#0.0.7.bna
Business network definition:
Identifier: digitalproperty-network#0.0.7
Description: Digital Property Network
events.js:160
throw er; // Unhandled 'error' event
^
Error
at ClientDuplexStream._emitStatusIfDone (/home/mnjacobs/.nvm/versions/node/v6.9.5/lib/node_modules/composer-cli/node_modules/grpc/src/node/src/client.js:189:19)
at ClientDuplexStream._readsDone (/home/mnjacobs/.nvm/versions/node/v6.9.5/lib/node_modules/composer-cli/node_modules/grpc/src/node/src/client.js:158:8)
at readCallback (/home/mnjacobs/.nvm/versions/node/v6.9.5/lib/node_modules/composer-cli/node_modules/grpc/src/node/src/client.js:217:12)
I've struggled to get the versions to match the tutorials - they seem inconsistent. Notably, the node (v6.9.5) and nodejs (v6.10.1) versions differ even though node is a symbolic link to nodejs and I notice 6.9.5 is in the stack trace. I'm not sure that difference is relevant to the problem.
Other version information:
Ubuntu 14.04.5
Docker version 17.03.1-ce, build c6d412e (manually installed as auto
install was down level)
docker-compose version 1.12.0-rc2, build 08dc2a4
I've seen exactly that error when Hyperledger Fabric isn't running. If docker ps doesn't show anything, run npm run startHLF in the sample-applications/packages/getting-started directory before trying again.

Resources