Hyperledger composer commands not working - hyperledger-fabric

I'm going through the Composer tutorials available here - https://hyperledger.github.io/composer/tutorials/developer-tutorial. I believe this is the official documentation.
The steps and commands listed in the developer tutorial - Deploying the business network is not working. All the steps and commands listed in this section are deprecated I think. Where can I find the latest documentation?

To give little more background, the commands failing in the developer tutorial are
composer runtime install --card PeerAdmin#hlfv1 --businessNetworkName tutorial-network
composer network start --card PeerAdmin#hlfv1 --networkAdmin admin --networkAdminEnrollSecret adminpw --archiveFile tutorial-network#0.0.1.bna --file networkadmin.card
--card is not a parameter anymore I think, not sure though.
Composer version - v0.16.3
Operating System/version - MacOS High Sierra
Solution - skipped to tutorial deploy business network to single org https://hyperledger.github.io/composer/tutorials/deploy-to-fabric-single-org
The steps listed in this tutorial helped me create the necessary network cards with the certificate and connection profile. These were required to successfully deploy the business network in my local fabric.
Hope this helps.

Related

Installing and Starting old network (.BNA) files in hlf1.4

I created a network (.BNA) and this installs and starts successfully under hlfv12 using composer v20.9 network install and composer network start commands).
All other components (e.g. composer-rest-server and composer-playground) work fine.
I have successfully installed hlf 1.4 and can get the sample, first-network, generated, up and down.
How can I install and start my old network (.BNA) under hlf 1.4? I understand Composer v20.9 does still work under hlf1.4.
Thanks.

How can I see old data after a Hyperledger Composer Network Upgrade?

I am trying to add 1 column to my mode.cto file. Once I added and apply the following commands, I was not able to see previous data:
composer archive create -t dir -n .
composer network install -a hash-health\#0.0.3.bna -c peerAdmin#hlfv1
composer network upgrade -c peerAdmin#hlfv1 -n hash-health -V 0.0.3
But, I noticed every time there is a new docker instance running.
I want to see my old data.
This link should provide you with help around your issue https://hyperledger.github.io/composer/latest/reference/model-compatibility
Please be aware that Hyperledger Composer is now deprecated and you should focus on using the hyperledger fabric programming models. Of course you can continue to use hyperledger composer for education purposes if you wish

hyperledger composer network update

Is anyone have an idea why composer network update is not listed to available commands for composer network? is it already deprecated? If yes, what is the substitute command for it? Thanks in advance.
composer network
Composer network command
Commands:
composer network download [options] Downloads a business network from the Hyperledger Fabric, does not undeploy
composer network install [options] Installs a business network archive to Hyperledger Fabric
composer network list [options] List the contents of a business network
composer network loglevel [options] Change the logging level of a business network
composer network ping [options] Test a connection to a business network
composer network reset [options] Resets a business network
composer network start [options] Starts a specific version of a business network that is already installed to Hyperledger Fabric
composer network upgrade [options] Upgrades to a specific version of a business network that is already installed to Hyperledger Fabric
Options:
--help Show help [boolean]
-v, --version Show version number [boolean]
In composer version .19 they changed the command for update.
After changing you files change the version in package.json. Then use the below command to upgrade :
composer network upgrade -c CARD-NAME -n NETWORK-NAME -V NETWORK-VERSION
Update was removed starting with composer 0.19.0 when we defined business networks as actual fabric chaincode affording it the security and management that fabric provides around chaincode.
Information about how to upgrade deployed business networks can be found here
https://hyperledger.github.io/composer/latest/business-network/upgrading-bna

Error trying to enroll user and return certificates

I am trying to deploy Hyperledger Composer Business Network to IBM Blockchain Platform BaaS on IBM Cloud. I used the following steps:
Create connection.json
Create composer card for admin identity
Import the card to composer
Request certificates for an identity
When I am trying step 4, I am getting an error stating:
"Error: failed to request identity. Error trying to enroll user and return certificates. Error: Calling enrollment endpoint failed with error [Error: connect ECONNREFUSED 169.60.181.250:31011]
Command failed"
I have updated the versions. And I guess the issue is due to network rules which is set in my environment. So I would request IP Range which IBM BaaS Starter and Enterprise kit consumed for Peers, Certification Authority.
Please let me know if anyone have information on IP Series.
I am guessing this is on the Starter Plan?
If so, 1) ensure that you have the latest Node version (8.10.0), and npm (5.6.0). You can check your node version with
node -v and npm with npm -v
If npm or node are earlier versions, update them.
Starter Plan is currently compatible with Composer-cli v0.18.1
2) check your composer-cli version with
composer -v
If it is not v0.18.1, then uninstall composer:
npm uninstall -g composer-cli
and install v0.18.1:
npm install -g composer-cli#0.18.1
Now, once you create your blockchain service on IBM Cloud, when you launch your service, and ensure you are in the overview tab. Click on connection profile -> download, and rename it to connection-profile.json and place it in the folder where you have your .bna file. Then, open up the connection-profile.json file you just downloaded and go all the way to the bottom where you see registrar. Under that, you will see enrollId and 'enrollSecret'. Your first command then should be using that enrollSecret from the connection-profile. Ensure you are in the same directory as your recently downloaded connection-profile.json. The first command should be:
composer card create -f ca.card -p connection-profile.json -u admin -s <enrollSecret>
after that issue this command:
composer card import -f ca.card -n ca
and lastly:
composer identity request --card ca --path ./credentials
This should solve your problem. Also, I have written a full blog of me deploying a custom .bna to Starter Plan if you have any other concerns.

Hyperledger composer install is not installing business network

I am using Ubuntu 16.04.2 LTS as VM, and composer v0.19.1. I have installed all the prerequisites as well as hyperledger composer and fabric by folowing the documents at hyperledger composer playgroung. I have followed the tutorial line by line to make a business network. When I want to install the business network by the following command:
composer network install --card PeerAdmin#hlfv1 --archiveFile tutorial-network#0.0.1.bna
It gives me the following error:
No connection type provided, probably because the connection profile has no 'x-type' property defined.
The screen shot of the error is provided as well.
I have checked and made sure that PeerAdminCard exists by
composer card list
And of course Fabric is started. I highly appreciate if someone mentions what I am doing wrong. Thank you.
The 2nd problem you are having is with the createPeerAdminCard.sh script - you are using an 'old' version of the where the default is Fabric v1.0.
The default is assuming hlfv1 because the environment variable FABRIC_VERSION is not set. So the createPeerAdminCard.sh script assumes you want a hlfv1 card and creates the files, but Composer v0.19 can't import that old card at the end of the script.
The fast solution is to export FABRIC_VERSION="hlfv11" then run the createPeerAdminCard.sh
I suspect that you may also have a problem with hlfv1 / v11 with the Fabric. You can check the Fabric version by running docker ps or docker images - if they have 1.0 at the end you need to remove them all and run downloadFabric.sh in the same window as you exported the FABRIC_VERSION variable, then run startFabric.sh
You need to remember to export that environment variable everytime you run one of those Fabric Tools scripts - so the better answer might be to delete the Fabric Tools folder and all docker Images and Containers - then download a new version of Fabric tools which includes the new default for Fabric 1.0
I was getting exactly the same error as you. Turns out if you update the Composer from version 0.16 or earlier, the card store still has the old PeerAdmin card which is now not compatible with version 0.19. Even deleting the card using composer card delete --card <CARD_NAME_HERE> doesn't work. The quick and dirty solution is to manually delete the card store. It is normally in ${HOME}/.composer, so to deleting this directory should work.
rm -fr ${HOME}/.composer
For your other problems, the easiest solution is to replace your older version of Hyperledger and do a new install from scratch. That means removing composer as well as killing and removing all previous Docker containers:
docker kill $(docker ps -q)
docker rm $(docker ps -aq)
docker rmi $(docker images dev-* -q)
Basically start from a clean slate if you can!
When you upgrade the composer modules from an earlier version to the latest version connection profile will not be compatible with the system. An ideal solution is to remove and delete the composer folder and create the .composer folder from the home directory and try creating PeerAdmin card again. Once that is done you are good to go for installing the starting the new business network application.

Resources