unable to generate Hyperledger network artifacts - hyperledger-fabric

I'm following this link to setup multi organizations for business network
I have cloned the git code and tried to setup my first network by following the instructions here
I have followed each and every step till I reach command to generate using ./byfn.sh -m generate it exists saying cryptogen tool not found which can be seen below.
text#blockchain-2:~/fabric-tools/fabric-samples/first-network$ ./byfn.sh -m generate
Generating certs and genesis block for with channel 'mychannel' and CLI timeout of '10000' seconds and CLI delay of '3' second
s
Continue (y/n)? y
proceeding ...
cryptogen tool not found. exiting
How to fix this issue and proceed further?

Assuming you already have Docker and Docker Compose installed, you will also need to install some platform specific binaries (including cryptogen). If you have already installed these binaries then adding the folder containing the binaries to PATH will help.
These 2 documents below in the Hyperledger Fabric will help with the pre-requisites, but don't run the byfn.sh script - run that script from the clone of the sstone repo, and run it with the parameters specified in the Multi-Org Composer Tutorial
There are the 2 fabric pre-req docs:
Cryptogen and other binaries and
Fabric Pre-reqs

Make sure your /bin and /first-network are in the same directory because cryptogen belongs to /bin
$ /learn/hyperledger/fabric-samples$ ls
balance-transfer chaincode-docker-devmode first-network README.md
basic-network config high-throughput scripts
bin fabcar LICENSE
chaincode fabric-ca MAINTAINERS.md

Related

Why do I get a "tar: Error opening archive: Unrecognized archive format" error when installing hyperledger fabric

Running Mac OS Big Sur 11.5.2 (Apple M1 chip)
When I run the command "curl -sSL https://raw.githubusercontent.com/hyperledger/fabric/main/scripts/bootstrap.sh| bash -s", I get :
tar: Error opening archive: Unrecognized archive format
==> There was an error downloading the binary file.
------> 2.3.3 platform specific fabric binary is not available to download <----
It looks like that script builds tar file names to download based on your local machine architecture:
https://github.com/hyperledger/fabric/blob/f9027a48cb6028243de75240b6a85f90834edaab/scripts/bootstrap.sh#L12
ARCH=$(echo "$(uname -s|tr '[:upper:]' '[:lower:]'|sed 's/mingw64_nt.*/windows/')-$(uname -m | sed 's/x86_64/amd64/g')")
https://github.com/hyperledger/fabric/blob/f9027a48cb6028243de75240b6a85f90834edaab/scripts/bootstrap.sh#L162-L163
BINARY_FILE=hyperledger-fabric-${ARCH}-${VERSION}.tar.gz
CA_BINARY_FILE=hyperledger-fabric-ca-${ARCH}-${CA_VERSION}.tar.gz
And then tries to download them from GitHub:
https://github.com/hyperledger/fabric/blob/f9027a48cb6028243de75240b6a85f90834edaab/scripts/bootstrap.sh#L90
download "${BINARY_FILE}" "https://github.com/hyperledger/fabric/releases/download/v${VERSION}/${BINARY_FILE}"
For me on an older Intel-based Mac, this results in a download URL something like https://github.com/hyperledger/fabric/releases/download/v2.3.3/hyperledger-fabric-darwin-amd64-2.3.3.tar.gz, which does exist. I guess whatever ARCH value your M1-based Mac generates results in a tar file URL that does not exist. Maybe you can tweak the script so it downloads the same binaries as my Intel-based Mac and get things working using Rosetta.
I had similar problem with the M1 chip. Well the one line solution to the problem is to 'make' your own binaries and copy them over.
Detail steps follow here:
Step 1 : Clone fabric and fabric-ca
git clone https://github.com/hyperledger/fabric
git clone https://github.com/hyperledger/fabric-ca
Step 2: Change directory to 'fabric'. Make Native files
make native
Step 3: Move the binaries to respective folder
mv build/bin $destination_folder/
mv sampleconfig $destination_folder/config
Step 4 : Repeat with fabric-ca
cd fabric-ca-client
make fabric-ca-client
mv bin/fabric-ca-client $destination_folder/bin
Step 5: Navigate to your $destination_folder/ and run things as usual.
Note : I learnt about the non support to M1 and also that I've to 'make' my own native files from hyperledger.org. The full credits of this answer goes to Brett Logan (https://jira.hyperledger.org/browse/FAB-18389?page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel&showAll=true).

Fatal error when initializing core config

I am a rookie in hyperledger in China.
I followed the order of the official documents
My fabric version is up to date (2020.10.10)and I attend a error when i carry out this moment:
./network.sh deployCC,
I found an answer in the official documentation, and have an error in test-network.
I carried out fabric-samples/facar/startFabric.sh and carried out peer chaincode query -C mychannel -n fabcar -c '{"Args":["queryAllCars"]}' in test-network directory.
However, there is a new problem:
fatal error when initializing core config : Could not find config file. Please make sure that FABRIC_CFG_PATH is set to a path which contains core.yaml,
I set up this path already, why?
My English is not very good, I'm sorry :(
The error is came from this file:
https://github.com/hyperledger/fabric-samples/blob/v2.1.1/test-network/scripts/deployCC.sh
Check line 16 which is "FABRIC_CFG_PATH=$PWD/../config/" and make sure you have the config folder on that directory.
Inside that config folder, you may find core.yaml, configtx.yaml, orderer.yaml.
After install samples, binaries and docker images, you can find this config folder in "fabric-samples" directory.
To install samples, binaries and docker images, go to this link:
https://hyperledger-fabric.readthedocs.io/en/release-2.2/install.html#install-samples-binaries-and-docker-images
You might have forgotten to set the environment variable. In the command line, set
export FABRIC_CFG_PATH=$PWD/config/
or wherever your config directory is relative to your current working directory and then try again.

Can not running command to run Code Composer

Ubuntu Version: 19.10
Code Composer Version: CCS10.1.0.00010_linux-x64
I'm trying to install the Code Composer at Linux. But at README into Code Composer file, say this.
Code Composer Studio for Linux README
-----------------------------------------
Please note that use of anti-virus software or a firewall may cause issues
during installation. McAfee software in particular has been especially
troublesome. If possible, disable anti-virus and firewall software during
installation. If not, use of the Offline Installer is strongly recommended.
If you are using an Offline CCS Installer, the tar.gz file in which it is
distributed must first be extracted:
1. tar xfz CCSxx.x.x.xxxxx_linux-x64.tar.gz
2. cd CCSxx.x.x.xxxxx_linux
If you are using the Online/Web installer you need to extract the respective tar file
1. tar xfz CCSxx.x.x.xxxxx_web_linux-x64.tar.gz
Once extraction has successfully completed, proceed with the installation
steps below.
To install Code Composer Studio:
1. Execute ccs_setup_xx.x.x.xxxxx.run
2. Choose where you want to install.
3. Select the components you wish to install.
I extracted the file using the command
tar xfz CCS10.1.0.00010_linux-x64.tar.gz -C ../Documents/CodeComposer
I navigated to CodeComposer directory and used ls to see the files and I saw the file that the readme say to run.
So I wrote the command
ccs_setup_10.1.0.00010.run
And appeared this
zsh: command not found: ccs_setup_10.1.0.00010.run
Can you do ./ccs_setup_10.1.0.00010.run instead?
ccs_setup... is not on your path, so you need to give it a specific relative path so it knows where to look.

Hyperledger Fabric change go path

My go path currently points to /usr/local/go but this IS NOT where I prefer to install projects.
What is the preferred method to point to the go path to execute go but build projects from a completely different directory? Thanks
In fabric, you will install the chaincode from inside the cli container, that way don't matter specifically where your gopath is mapped on your machine.
Map your chaincode path to the container go_path:
volumes:
- ./chaincode/:/opt/gopath/src/github.com/
And then install and instantiate it.

Difference between fabric-orderer/fabric-peer and fabric-ca-orderer/fabric-ca-peer images

Please tell me what is the difference between the fabric-orderer/fabric-peer and fabric-ca-orderer/fabric-ca-peer images. One difference I found was that fabric-ca-* images contains fabric-ca-client.
Also, which of these two sets would be carried forward in future releases?
You can build your development or service environment with "fabric-ca-*" if you decide to use "FABRIC CA" for issuing certificates. If not, using OpenSSL or other CA tools for, you can use fabric-orderer, fabric-peer and ...
A typical thing fabric-ca do is automatically generate and store their own root ca or intermediate ca certificate by its configuration (e.g., fabric-ca-server-config.yaml) at the time of fabric-ca-server starting (initializing).
I came upon this question out of the desire to create fabric-ca-* containers for fabric 1.3, they are very nice for abandoning cryptogen. My search led me to FABC-722 and a commentor had a nice link to the gerrit. I landed up being able to create 1.3 versions simply by cloning fabric-ca and running make docker-all. After inspecting it with my poor knowledge of make i found it linked to various Dockerfile.in's in the images folder. The fabric-ca-orderer for example runs this.
#
# Copyright IBM Corp. All Rights Reserved.
#
# SPDX-License-Identifier: Apache-2.0
#
FROM _NS_/fabric-orderer:_FABRIC_TAG_
COPY payload/fabric-ca-client /usr/local/bin
ARG FABRIC_CA_DYNAMIC_LINK=false
RUN chmod +x /usr/local/bin/fabric-ca-client
RUN apt-get update && apt-get install -y netcat && rm -rf /var/cache/apt
# libraries needed when image is built dynamically
RUN if [ "$FABRIC_CA_DYNAMIC_LINK" = "true" ]; then apt-get install -y libltdl-dev; fi
I hope this at least leads you to the answer your seeking

Resources