First network in hyperledger - hyperledger

I am trying to work on my first network in Hyperledger Fabric. Using the following documentation
http://hyperledger-fabric.readthedocs.io/en/latest/build_network.html
I have completed the setup till
http://hyperledger-fabric.readthedocs.io/en/latest/build_network.html#create-join-channel
but when I run the
peer channel create -o orderer.example.com:7050 -c $CHANNEL_NAME -f ./channel-artifacts/channel.tx --tls $CORE_PEER_TLS_ENABLED --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem
I got error as
Error: Got unexpected status: BAD_REQUEST
Searching for the issue i came across
http://hyperledgerdocs.readthedocs.io/en/latest/asset_trouble.html
Hence I've tried to use a new channel name as given(old channel name=mychannel),
I've tried below cmds
CORE_PEER_COMMITTER_LEDGER_ORDERER=orderer:7050 peer channel create -c myc1
CORE_PEER_COMMITTER_LEDGER_ORDERER=orderer.example.com:7050 peer channel create -c myc1
CORE_PEER_COMMITTER_LEDGER_ORDERER=172.18.0.2:7050 peer channel create -c myc1
For all the three I am getting error
Error: Ordering service endpoint is not valid or missing
Usage:
peer channel create [flags]
Also I've tried to skip it assuming the channel is already created.
hence ran
peer channel join -b ./mychannel.block
But got
Error: proposal failed (err: rpc error: code = Unknown desc = chaincode error (status: 500, message: Cannot create ledger from genesis block, due to LedgerID already exists))
My OS is Ubuntu 16.04
docker ps
Kindly help

Let's try to make sure you run thru all the steps as outlined in docs.
First of all you need to edit your docker-compose-cli.yaml file the cli section to comment out line responsible to run automatic flow of channel creation and join:
command: /bin/bash -c './scripts/script.sh ${CHANNEL_NAME}; sleep $TIMEOUT'
E.g.
# command: /bin/bash -c './scripts/script.sh ${CHANNEL_NAME}; sleep $TIMEOUT'
Next export channel name you are working with:
export CHANNEL_NAME=mychannel
Start the network (use default timeout of 60s):
CHANNEL_NAME=$CHANNEL_NAME docker-compose -f docker-compose-cli.yaml up -d
Enter the cli container:
docker exec -it cli bash
Export environmental variables:
export CHANNEL_NAME=mychannel
Create the channel:
peer channel create -o orderer.example.com:7050 -c $CHANNEL_NAME -f ./channel-artifacts/channel.tx --tls $CORE_PEER_TLS_ENABLED --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem
Join the channel:
peer channel join -b mychannel.block

Related

Hyperledger Fabric: Setup two peers of same Org on different physical Machines

I have set up a blockchain test network on an Ubuntu 20.04 machine. The network was built and set up according to the fabric-samples Repo https://github.com/hyperledger/fabric-samples. Fabric version is 2.3.0 and Fabric CA version is 1.4.9. My goal now is to set up a second peer for the same Org on another machine to integrate the peer into my existing network. So that I can also install my smartcontract/chaincode there and test my queries on the second peer as well.
Short summary:
Ubuntu 20.04 machine with one peer, one orderer and one ca server each for peer and orderer. Runs at an internet provider
ubuntu 20.04 machine with one peer. Is only accessible via our company VPN, because the machine is in our company network.
I have now made 3 different attempts to build or extend the network.
1. Attempt
In the first attempt I set up the network already described above on the 1st Ubuntu machine, created a channel and installed/deployed my chaincode/smartcontract. At the same time I also generated the "Crypto-Materials" for the second peer via the Fabric-CA server from the organization "Org 1".
Then I copied the previously generated "Crypto-Materials" to the 2nd Ubuntu server. After that, using my docker-compose, I started the second peer.
Then I tried to get the peer into the channel using the following commands:
#!/bin/bash
joinChannel() {
##### Umgebungvariablen setzen #####
# Frage wo die configtx.yaml liegt und setze die Umgebungvariable FABRIC_CFG_PATH
#read -p "Wo liegt die core.yaml für den peer der dem Channel hinzugefügt werden soll: " configtxpath
export CORE_PEER_LOCALMSPID="Org1MSP"
export CORE_PEER_TLS_ROOTCERT_FILE=$PWD/organizations/peerOrganizations/org1.actiware.com/peers/peer1.org1.actiware.com/tls/ca.cert
export CORE_PEER_MSPCONFIGPATH=$PWD/organizations/peerOrganizations/org1.actiware.com/users/Admin#org1.actiware.com/msp
export CORE_PEER_ADDRESS=localhost:8051
export FABRIC_CFG_PATH=$PWD/newPeer/config
BLOCKFILE=$PWD/channel-artifacts/awchannel.block
echo "use core.yaml from: $FABRIC_CFG_PATH"
echo "Use core peer localmspid: $CORE_PEER_LOCALMSPID"
echo "USe tls rootcertfiel: $CORE_PEER_TLS_ROOTCERT_FILE"
echo "Use Mspconfigpath: $CORE_PEER_MSPCONFIGPATH"
echo "Use adress: $CORE_PEER_ADDRESS"
echo "channel fetch genesis block"
peer channel fetch config -o [IP OF 1. Ubuntu Machine]:7050 --ordererTLSHostnameOverride orderer.actiware.com -c awchannel --tls --cafile $PWD/organizations/ordererOrganizations/actiware.com/orderers/orderer.actiware.com/msp/tlscacerts/tlsca.actiware.com-cert.pem
##### peer dem channel hinzufügen #####
# Frage wo die block datei ist
#read -p "Wo liegt die channel_name.block Datei?: " blockfile
DELAY=3
MAX_RETRY=5
local rc=1
local COUNTER=1
## Sometimes Join takes time, hence retry
while [ $rc -ne 0 -a $COUNTER -lt $MAX_RETRY ]; do
sleep $DELAY
peer channel join -b $BLOCKFILE
res=$?
let rc=$res
COUNTER=$(expr $COUNTER + 1)
done
}
joinChannel
And got the following error after that on orderer docker container:
Logs of Orderer Docker Container
And this failur of the peer docker container on the 2. Ubuntu Maschine:
Logs of Peer Container
I did not get this error resolved. I guess because Docker gives the containers their own IP's again, the Docker containers from the orderer on the 1st Ubuntu machine and the peer from the 2nd Ubuntu machine can't communicate directly with each other.
2. Attempt
On the second try I then tried to set it up natively on the servers.
Restarted with the 1st Ubuntu machine I then instead of setting the configuration parameters via environment variables.
I set these directly in the files provided for it (core.yaml, orderer.yaml and config.tx).
Of course, I only set the ones that were also set as environment variables in the docker-compose files.
Of course, the same goes for the fabric-ca servers and their respective configuration files.
Then I started the fabric-ca servers natively and generated the "crypto material" using the registerEnroll.sh script.
Then I started the orderer and peer using the environment variable FABRIC_CFG_PATH.
Last but not least, I then wanted to create the channel and install the chaincode as in the Docker attempt.
I was able to successfully create the channel on the orderer and the peer was able to join it.
However, when I tried to install the chaincode via the CLI commands with peer chaincode lifecycle I got an error:
CC install Error on Ubuntu Machine 1
3. Attempt
Then in the last attempt I wanted clarity if it wasn't due to some configuration error. So I decided to do everything the same
as in the fabric-sample only that I don't install it in docker containers but natively again.
For this I took all configuration files from the fabric sample and wrote or copy/pasted the following script:
completeNativeScript.sh
#!/bin/bash
#
. utils.sh
export PATH=${PWD}/../bin:$PATH
export FABRIC_CFG_PATH=${PWD}/config
export VERBOSE=false
#### Start Fabric-CA ####
echo "Start CA-Org1"
set -x
export FABRIC_CA_HOME=$PWD/organizations/fabric-ca/org1
export FABRIC_CA_SERVER_CA_NAME=ca-org1
export FABRIC_CA_SERVER_TLS_ENABLED=true
export FABRIC_CA_SERVER_PORT=7054
fabric-ca-server start -b admin:adminpw -d & >logs/CaOrg1Logs.txt
{ set +x; } 2>/dev/null
sleep 10
echo "Start CA-Orderer"
set -x
export FABRIC_CA_HOME=$PWD/organizations/fabric-ca/ordererOrg
export FABRIC_CA_SERVER_CA_NAME=ca-orderer
export FABRIC_CA_SERVER_TLS_ENABLED=true
export FABRIC_CA_SERVER_PORT=9054
fabric-ca-server start -b admin:adminpw -d & >logs/CaOrdererlogs.txt
{ set +x; } 2>/dev/null
sleep 10
echo "Creating Org1 and Orderer Identities"
. organizations/fabric-ca/registerEnroll.sh
createOrg1
createOrderer
echo "Generating CCP files for Org1"
./organizations/ccp-generate.sh
##### Start Orderer und Peer #####
echo "Start Orderer and Peer"
set -x
export FABRIC_LOGGING_SPEC=INFO
export ORDERER_GENERAL_LISTENADDRESS=0.0.0.0
export ORDERER_GENERAL_LISTENPORT=7050
export ORDERER_GENERAL_LOCALMSPID=OrdererMSP
export ORDERER_GENERAL_LOCALMSPDIR=$PWD/organizations/ordererOrganizations/actiware.com/orderers/orderer.actiware.com/msp
export ORDERER_GENERAL_TLS_ENABLED=true
export ORDERER_GENERAL_TLS_PRIVATEKEY=$PWD/organizations/ordererOrganizations/actiware.com/orderers/orderer.actiware.com/tls/server.key
export ORDERER_GENERAL_TLS_CERTIFICATE=$PWD/organizations/ordererOrganizations/actiware.com/orderers/orderer.actiware.com/tls/server.crt
export ORDERER_GENERAL_TLS_ROOTCAS=[$PWD/organizations/ordererOrganizations/actiware.com/orderers/orderer.actiware.com/tls/server.crt]
export ORDERER_KAFKA_TOPIC_REPLICATIONFACTOR=1
export ORDERER_KAFKA_VERBOSE=true
export ORDERER_GENERAL_CLUSTER_CLIENTCERTIFICATE=$PWD/organizations/ordererOrganizations/actiware.com/orderers/orderer.actiware.com/tls/server.crt
export ORDERER_GENERAL_CLUSTER_CLIENTPRIVATEKEY=$PWD/organizations/ordererOrganizations/actiware.com/orderers/orderer.actiware.com/tls/server.key
export ORDERER_GENERAL_CLUSTER_ROOTCAS=[$PWD/organizations/ordererOrganizations/actiware.com/orderers/orderer.actiware.com/tls/server.crt]
export ORDERER_GENERAL_BOOTSTRAPMETHOD=none
export ORDERER_CHANNELPARTICIPATION_ENABLED=true
export ORDERER_ADMIN_TLS_ENABLED=true
export ORDERER_ADMIN_TLS_CERTIFICATE=$PWD/organizations/ordererOrganizations/actiware.com/orderers/orderer.actiware.com/tls/server.crt
export ORDERER_ADMIN_TLS_PRIVATEKEY=$PWD/organizations/ordererOrganizations/actiware.com/orderers/orderer.actiware.com/tls/server.key
export ORDERER_ADMIN_TLS_ROOTCAS=[$PWD/organizations/ordererOrganizations/actiware.com/orderers/orderer.actiware.com/tls/server.crt]
export ORDERER_ADMIN_TLS_CLIENTROOTCAS=[$PWD/organizations/ordererOrganizations/actiware.com/orderers/orderer.actiware.com/tls/server.crt]
export ORDERER_ADMIN_LISTENADDRESS=0.0.0.0:7053
orderer & >logs/ordererlogs.txt
sleep 10
export FABRIC_LOGGING_SPEC=INFO
export CORE_PEER_TLS_ENABLED=true
export CORE_PEER_PROFILE_ENABLED=true
export CORE_PEER_TLS_CERT_FILE=$PWD/organizations/peerOrganizations/org1.actiware.com/peers/peer0.org1.actiware.com/tls/server.crt
export CORE_PEER_TLS_KEY_FILE=$PWD/organizations/peerOrganizations/org1.actiware.com/peers/peer0.org1.actiware.com/tls/server.key
export CORE_PEER_TLS_ROOTCERT_FILE=$PWD/organizations/peerOrganizations/org1.actiware.com/peers/peer0.org1.actiware.com/tls/server.crt
export CORE_PEER_ID=peer0.org1.actiware.com
export CORE_PEER_ADDRESS=localhost:7051
export CORE_PEER_LISTENADDRESS=0.0.0.0:7051
export CORE_PEER_CHAINCODEADDRESS=localhost:7052
export CORE_PEER_CHAINCODELISTENADDRESS=0.0.0.0:7052
export CORE_PEER_GOSSIP_BOOTSTRAP=localhost:7051
export CORE_PEER_GOSSIP_EXTERNALENDPOINT=localhost:7051
export CORE_PEER_LOCALMSPID=Org1MSP
peer node start & >logs/peer0logs.txt
{ set +x; } 2>/dev/null
sleep 10
CREATE_CHANNEL=$(getUserInput "Soll ein Channel erstellt werden? (y/n) ")
if [ $CREATE_CHANNEL == "y" ]; then
##### Create Gensisblock, Create and Join Channel #####
echo "Start to generate the channel"
CHANNEL_NAME="awchannel"
set -x
export FABRIC_CFG_PATH=$PWD/config
configtxgen -profile TwoOrgsApplicationGenesis -outputBlock ./channel-artifacts/${CHANNEL_NAME}.block -channelID $CHANNEL_NAME
export ORDERER_CA=${PWD}/organizations/ordererOrganizations/actiware.com/orderers/orderer.actiware.com/msp/tlscacerts/tlsca.actiware.com-cert.pem
export PEER0_ORG1_CA=${PWD}/organizations/peerOrganizations/org1.actiware.com/peers/peer0.org1.actiware.com/tls/ca.crt
export ORDERER_ADMIN_TLS_SIGN_CERT=${PWD}/organizations/ordererOrganizations/actiware.com/orderers/orderer.actiware.com/tls/server.crt
export ORDERER_ADMIN_TLS_PRIVATE_KEY=${PWD}/organizations/ordererOrganizations/actiware.com/orderers/orderer.actiware.com/tls/server.key
export CORE_PEER_LOCALMSPID="Org1MSP"
export CORE_PEER_TLS_ENABLED=true
export CORE_PEER_TLS_ROOTCERT_FILE=$PEER0_ORG1_CA
export CORE_PEER_MSPCONFIGPATH=${PWD}/organizations/peerOrganizations/org1.actiware.com/users/Admin#org1.actiware.com/msp
export CORE_PEER_ADDRESS=localhost:7051
osnadmin channel join --channelID $CHANNEL_NAME --config-block ./channel-artifacts/${CHANNEL_NAME}.block -o localhost:7053 --ca-file "$ORDERER_CA" --client-cert "$ORDERER_ADMIN_TLS_SIGN_CERT" --client-key "$ORDERER_ADMIN_TLS_PRIVATE_KEY"
peer channel join -b ./channel-artifacts/${CHANNEL_NAME}.block
{ set +x; } 2>/dev/null
CREATE_ANCHOR_PEERS=$(getUserInput "Sollen die Anchor Peers erstellt werden? (y/n)")
if [ $CREATE_ANCHOR_PEERS == "y" ]; then
#### Set Anchor Peers ####
echo "fetch channel config"
set -x
peer channel fetch config_block.pb -o localhost:7050 --ordererTLSHostnameOverride orderer.actiware.com -c $CHANNEL_NAME --tls --cafile "$ORDERER_CA"
{ set +x; } 2>/dev/null
OUTPUT=${CORE_PEER_LOCALMSPID}config.json
echo "Decoding config block to json and isolating config to $OUTPUT"
set -x
configtxlator proto_decode --input config_block.pb --type common.Block | jq .data.data[0].payload.data.config >"${OUTPUT}"
{ set +x; } 2>/dev/null
echo "Modify the configuration to append the anchor peer "
set -x
jq '.channel_group.groups.Application.groups.'${CORE_PEER_LOCALMSPID}'.values += {"AnchorPeers":{"mod_policy": "Admins","value":{"anchor_peers": [{"host": "localhost","port": "7051"}]},"version": "0"}}' ${CORE_PEER_LOCALMSPID}config.json > ${CORE_PEER_LOCALMSPID}modified_config.json
{ set +x; } 2>/dev/null
echo "Create Config Update"
ORIGINAL=${CORE_PEER_LOCALMSPID}config.json
MODIFIED=${CORE_PEER_LOCALMSPID}modified_config.json
OUTPUT=${CORE_PEER_LOCALMSPID}anchors.tx
set -x
configtxlator proto_encode --input "${ORIGINAL}" --type common.Config >original_config.pb
configtxlator proto_encode --input "${MODIFIED}" --type common.Config >modified_config.pb
configtxlator compute_update --channel_id "${CHANNEL_NAME}" --original original_config.pb --updated modified_config.pb >config_update.pb
configtxlator proto_decode --input config_update.pb --type common.ConfigUpdate >config_update.json
echo '{"payload":{"header":{"channel_header":{"channel_id":"'$CHANNEL_NAME'", "type":2}},"data":{"config_update":'$(cat config_update.json)'}}}' | jq . >config_update_in_envelope.json
configtxlator proto_encode --input config_update_in_envelope.json --type common.Envelope >"${OUTPUT}"
{ set +x; } 2>/dev/null
echo "Update Anchor Peer"
peer channel update -o localhost:7050 --ordererTLSHostnameOverride orderer.actiware.com -c $CHANNEL_NAME -f ${CORE_PEER_LOCALMSPID}anchors.tx --tls --cafile "$ORDERER_CA"
DEPLOY_CC=$(getUserInput "Soll der Chaincode deployed werden?(y/n)")
if [ $DEPLOY_CC == "y" ]; then
##### deploy Chaincode #####
echo "deploy chaincode"
CC_SRC_PATH=$PWD/StandardContract
set -x
export FABRIC_CFG_PATH=$PWD/config
pushd $CC_SRC_PATH
GO111MODULE=on go mod vendor
popd
peer lifecycle chaincode package packaged_chaincode.tar.gz --path ${CC_SRC_PATH} --lang golang --label ${CHANNEL_NAME}_1.0
peer lifecycle chaincode install packaged_chaincode.tar.gz
peer lifecycle chaincode queryinstalled
fi
fi
fi
utils.sh
#!/bin/bash
function getUserInput() {
read -p "$1" USER_INPUT
while [ -z "$USER_INPUT" ] || [ "$USER_INPUT" = "NA" ]
do
echo "Keine Eingabe erfasst. Bitte versuchen Sie es erneut." >&2
read -p "$1" USER_INPUT
done
echo $USER_INPUT
}
# println echos string
function println() {
echo -e "$1"
}
# errorln echos i red color
function errorln() {
println "${C_RED}${1}${C_RESET}"
}
# successln echos in green color
function successln() {
println "${C_GREEN}${1}${C_RESET}"
}
# infoln echos in blue color
function infoln() {
println "${C_BLUE}${1}${C_RESET}"
}
# warnln echos in yellow color
function warnln() {
println "${C_YELLOW}${1}${C_RESET}"
}
# fatalln echos in red color and exits with fail status
function fatalln() {
errorln "$1"
exit 1
}
export -f errorln
export -f successln
export -f infoln
export -f warnln
The scripts registerEnroll.sh and create-ccp.sh are the same as from the fabric-sample repo.
But I had problems to create the channel on the orderer. I get the error "Bad Certificate". Then I just tried to install the chaincode for fun and it worked...
Unfortunately I can not use this as a solution, because I need the channel. But again the question is how is it possible that this is possible?
I am still a beginner with Hyperledger Fabric.... I am already sure that I made one or more configuration errors somewhere.
Unfortunately I've reached a point where I can't get any further. Maybe someone can help me.
If you have any questions about one of the above attempts or if you need the configuration files, just let me know.
For the first attempt, How about using Docker Swarm to enable communication between containers living in separate hosts?

Error while building Docker image for Druid

I am doing this tutorial to load batch data using Apache Hadoop and I try to run this command to build a Docker image named "druid-hadoop-demo" with version tag "2.8.5" :
docker build -t druid-hadoop-demo:2.8.5 .
but it gives me this error
Step 14/53 : RUN curl -s https://archive.apache.org/dist/hadoop/core/hadoop-2.8.3/hadoop-2.8.3.tar.gz | tar -xz -C /usr/local/
---> Running in 7baa699ccc29
gzip: stdin: unexpected end of file
tar: Child returned status 1
tar: Error is not recoverable: exiting now
The command '/bin/sh -c curl -s https://archive.apache.org/dist/hadoop/core/hadoop-2.8.3/hadoop-2.8.3.tar.gz | tar -xz -C /usr/local/' returned a non-zero code: 2
Any help is appreciated.
That's a network error, indicating the file you downloaded was either corrupted in transit (it downloaded correctly for me, so unlikely to be the source), or the connection was dropped before finishing the curl command. Check for network proxies, intermittent network failures, or anything else that could interrupt the connection. You can also try to manually run curl from within a container to see if it's successful, e.g.
curl -o hadoop.tgz https://archive.apache.org/dist/hadoop/core/hadoop-2.8.3/hadoop-2.8.3.tar.gz
tar -tvzf hadoop.tgz

HyperLedger Fabric v1.4.4: Instantiating smart contract on mychannel with error

I am following the HyperLedger Fabric v1.4.4 "Writing Your First Application" tutorial[1], but I am having a problem running the code ./startFabric.sh javascript:
+ echo 'Instantiating smart contract on mychannel'
Instantiating smart contract on mychannel
+ docker exec -e CORE_PEER_LOCALMSPID=Org1MSP -e CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin#org1.example.com/msp cli peer chaincode instantiate -o orderer.example.com:7050 -C mychannel -n fabcar -l node -v 1.0 -c '{"Args":[]}' -P 'AND('\''Org1MSP.member'\'','\''Org2MSP.member'\'')' --tls --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem --peerAddresses peer0.org1.example.com:7051 --tlsRootCertFiles /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt
2019-11-25 16:14:38.470 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc
2019-11-25 16:14:38.470 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc
Error: could not assemble transaction, err proposal response was not successful, error code 500, msg error starting container: error starting container: Failed to generate platform-specific docker build: Error returned from build: 1 "npm ERR! code EAI_AGAIN
npm ERR! errno EAI_AGAIN
npm ERR! request to https://registry.npmjs.org/fabric-shim failed, reason: getaddrinfo EAI_AGAIN registry.npmjs.org:443
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2019-11-25T16_17_00_000Z-debug.log
"
I think that error is related to the docker image, because it occurs when the following code is executed:
echo "Instantiating smart contract on mychannel"
docker exec \
-e CORE_PEER_LOCALMSPID=Org1MSP \
-e CORE_PEER_MSPCONFIGPATH=${ORG1_MSPCONFIGPATH} \
cli \
peer chaincode instantiate \
-o orderer.example.com:7050 \
-C mychannel \
-n fabcar \
-l "$CC_RUNTIME_LANGUAGE" \
-v 1.0 \
-c '{"Args":[]}' \
-P "AND('Org1MSP.member','Org2MSP.member')" \
--tls \
--cafile ${ORDERER_TLS_ROOTCERT_FILE} \
--peerAddresses peer0.org1.example.com:7051 \
--tlsRootCertFiles ${ORG1_TLS_ROOTCERT_FILE}
I don't know much about docker, but I'm learning. Until then, does anyone help me with this problem?
[1] https://hyperledger-fabric.readthedocs.io/en/release-1.4/write_first_app.html
Update 1
The same error was observed when I run ./byfn.sh up -l node, but no error for ./byfn.sh up. I think the error is connected to fabric-shim. I am still looking for an answer to this error.
The command to Instantiate the smart contract will be trying to start a new chaincode container, and this is failing because the new container cannot successfully run npm install commands.
The problem could be a Docker DNS issue, or an npm registry connection problem due to the country or company you are connecting from.
The following 2 previous answers should help you:
Network calls fail during image build on corporate network
Error while running fabcar sample in javascript

How to get the endorsement from multiple peers by using command line to invoke the transaction

How to get the endorsement from multiple peers by using command line to invoke the transaction? Now the example e2e_cli only shows us get the endorsement from one peer.
The command like, CORE_PEER_ADDRESS=peer0:7051 peer chaincode invoke -C myc -n mycc -v v0 -c '{"Args":["invoke","a","b","10"]}'
Thanks.
This is not implemented.
If you want CLI-like usage with a binary you can easily transfer across machines consider using the go-SDK
In the past, peer CLI could only collect an endorsement from a single peer when submitting a transaction. A simple hack has been proposed to address this requirement in Hyperledger JIRA in the following issue report. The hack is described as the following command.
peer chaincode invoke -o orderer.example.com:7050 --tls --cafile $ORDERER_CA -C $CHANNEL_NAME -n mycc --peerAddresses peer0.org1.example.com:7051 --tlsRootCerts /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt --peerAddresses peer0.org2.example.com:7051 --tlsRootCerts /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt -c '{"Args":["invoke","a","b","10"]}' >&log.txt

Hyperledger fabric v0.6 chaincode_example05 query failed (Timeout expired while executing transaction)

I have set up hyperledger fabric v0.6 with 1 CA and 1 peer using docker-compose. I have successfully deployed chaincode_example02 which is invoked and queried "a" and "b" without problem.
Now I want to test on "chaincode calling chaincode" using chaincode_example05. I run the following command to deploy successfully:
peer chaincode deploy
-u jim
-p github.com/hyperledger/fabric/examples/chaincode/go/chaincode_example05
-c '{"Args": ["init","sum","0"]}'`
I run the following command to "invoke" it successfully:
peer chaincode invoke
-u jim
-n 7929510b01d27dadec6b42751662182c98c85decb58256defb686adb77fbe9d9bcc1acea9890d2650e186f4c2190e50dcd2020cc36455a220087baaa384390db
-c '{"Args": ["invoke","github.com/hyperledger/fabric/core/example/chaincode/chaincode_example02","sum"]}'`
Now, when I run the following query command:
peer chaincode query
-u jim
-n 7929510b01d27dadec6b42751662182c98c85decb58256defb686adb77fbe9d9bcc1acea9890d2650e186f4c2190e50dcd2020cc36455a220087baaa384390db
-c '{"Args":["query","github.com/hyperledger/fabric/core/example/chaincode/chaincode_example02","sum"]}'`
I got the following error messages:
Error: Error querying chaincode: rpc error: code = 2 desc =
Error:Failed to execute transaction or query(Timeout expired while
executing transaction)
How can I make it work?

Resources