Delete and reinstall hyperledger fabric - hyperledger-fabric

I have already installed and worked in hyperledger fabric in ubuntu 16.04 and somehow i deleted the packages. I want to reinstall it again and working but it always showing up the error in first-network itself.
So can anyone suggest me how to start over it from the first?

Make sure you add the go.mod and go.sum for the vendored packages, chaincode in 2.0.0 does not include the packages, follow the chaincode structure of go.mod and go.sum like here
https://github.com/hyperledger/fabric-samples/tree/master/chaincode/marbles02/go
, then execute the following command to vendor the packages,
go mod download

try pruning the docker volumes and system. Use docker volume prune -f and docker system prune -f

Related

Install old packages in docker file

We are using docker containers as our build workspace . for compilation of our legacy code we need to use very old version of some of the Linux rpms. I tried giving the full name of the old rpm with their version , but it end up with the error package not available.
Request to please help how can i develop my docker file to install these old packages.
I have tried using alpine as well as centos image .
Please help me what is the correct way to do this as a good docker file practice.
One possible way is to download the package (with all the prerequisites), then in Dockerfile initiate the copy of package and additional file (if applicable) to the docker, then install them with rpm command.

Hyperledger Caliper tutorial for Composer network

I want to execute a performance evaluation test on a deployed Hyperledger Composer business network using Hyperledger Caliper.
Into the official documentation there is a section for the Composer configuration but I think that it's not very user friendly for those approaching this framework for the first time and I cannot find a better basic step-by-step tutorial for configuring and running an evaluation test.
Check that all the prerequisites are installed:
NodeJS 8 (LTS), 9, or 10 (LTS) higher versions are not supported as
the dependancy chain does not permit this
node-gyp
Docker
Docker-compose
Build Caliper:
Run npm install in Caliper root folder to install base dependencies locally
Run npm run repoclean in Caliper root folder to ensure that all the packages are clean
Run npm run bootstrap to bootstrap the packages in the Caliper repository. This will install all package dependancies and link any cross dependancies. It will take some time to finish installation. If it is interrupted by ctrl+c, please recover the file package.json first and then run npm run bootstrap again.
Do not run any of the above commands with sudo, as it will cause the bootstrap process to fail
Install the Caliper CLI
Execute the following command from the packages/caliper-tests-integration directory:
npm run e2e_install
Run a Sample Benchmark
from caliper/packages/caliper-samples/ run
caliper benchmark run -c benchmark/composer/config.yaml -n network/fabric-v1.3/2org1peercouchdb/composer.json -w ../caliper-samples/
where the parameters means:
-w : path to a workspace directory (required)
-c : relative path from the workspace to the benchmark configuration file (required).
-n : relative path from the workspace to the config file of the blockchain network under test (required).
To create tests for your Business Network you need to modify the config.yaml and composer.json files. You also have to create a .js file where you need to implement the test to be runned, and specify the path to this file in the callback section of config.yaml file.
For more informations check https://hyperledger.github.io/caliper/docs/1_Getting_Started.html

Where is nodejs chaincode stored in a container? and is it compiled?

I am learning hyperledger fabric and am curious where is the nodejs chaincode stored in a container after it has been installed and instantiated?
Also the docs say the chaincode is compiled - is that applicable to nodejs also? How is nodejs compiled? What compiler is used? Is the compilation output some VM bytecode or is it machine code?
The NodeJS chaincode can be found under /usr/local/src of the docker container in which its instantiated. It is not compiled into anything.
$ docker exec -it dev-peer1-jnj-mycc-1.0 /bin/bash
root#0dbcfb72e6d8:/# ls /usr/local/src
chaincode.js node_modules package-lock.json package.json

startFabric.sh fails with docker compose command not find

I am following the tutorial on writing your first application to make a sample hyperledger fabric application. I am using Ubuntu 16.04 and I have installed prerequisites as well as binaries and docker images. When I move into fabric-samples/fabcar, after npm install. I run:
./startFabric.sh
I get the following error:
docker-compose -f docker-compose.yml down.
./start.sh: line 13: docker-compose: command not found.
I looked into ./startFabric.sh by nano. Line 13 is as follows:
starttime=$(date +%s)
LANGUAGE=${1:-"golang"}
This is a screen shot of the error I get:
It may be irrelevant, but I have also issues running .byfn -m up as I have posted on issue with byfn. I am not sure if these two are related. But obviously neither can I start fabric, nor can I build a network.
I appreciate any help to solve the issue.
Thank you for your attention.
You should install docker. If you already installed docker, you should check if your docker bin folder is referenced in your PATH environment variable.
https://docs.docker.com/install/

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