I am trying to enable JWT for hyperledger composer to my blockchain project.
However whilst following the tutorial I came accross the below error. I am not sure what it means:
Error: Can't find end of central directory : is this a zip file ? If it is, see http://stuk.github.io/jszip/documentation/howto/read_zip.html
when running ./createPeerAdminCard.sh below is the exact output:
Development only script for Hyperledger Fabric control
Running 'createPeerAdminCard.sh'
FABRIC_VERSION is set to 'hlfv11'
FABRIC_START_TIMEOUT is unset, assuming 15 (seconds)
Using composer-cli at v0.19.5
Successfully created business network card file to
Output file: /tmp/PeerAdmin#hlfv1.card
Command succeeded
Successfully imported business network card
Card file: /tmp/PeerAdmin#hlfv1.card
Card name: PeerAdmin#hlfv1
Command succeeded
Error: Can't find end of central directory : is this a zip file ? If it is, see http://stuk.github.io/jszip/documentation/howto/read_zip.html
Command failed
Hyperledger Composer PeerAdmin card has been imported, host of fabric specified as 'localhost'
Are you running on a Mac ?
This problem has been seen when there is a hidden file present somewhere in the ~/.comoposer folder.
If you have cards you need to keep then try a composer card export to try and export them, then delete the folder ~/.composer and re-run the script to create the Peer Admin card.
There are a few details of the problem in this issue on github.
Related
I am working with this blockchain application for medics traceability (https://github.com/rastringer/medication-blockchain) based on hyperledger fabric blockchain.
It's exactly the same app as this project (https://github.com/hyperledger/education/tree/master/LFS171x/fabric-material/tuna-app) except that this project is for tuna traceability.
I modify the chaincode file (the file is "drug-chaincode.go"), and now apparently I need to reconfigure all my network in "basic-network" folder so that the modification is add, but I don't how I can do this.
I tried to follow this link without results (How to upgrade a chaincode after modification?)
Anyhelp is welcome, thank you in advance ;)
if u r trying to build hyperledger project similar to drug-app. Then do following things:
Delete node_modules:
drug-blockchain/drug-app/node_modules
Then change every parameter which states the drug blockchain, basically u have to change parameters to Yours on following sources:
drug-chaincode.go
startFabric.sh
server.js
routes.js
registerUser.js
registerAdmin.js
package.json
controller.js
recordDrug.js
queryDrug.js
queryAllDrug.js
changeDrugHolder.js
app.ja
index.html
In the end re-run the network:
cd drug-blockchain/drug-app
$./startFabric.sh
$npm install -g
$node registerAdmin.js
$node registerUser.js
$node server.js
if u do change parameters properly, it should work fine, otherwise recheck, there shouldn't be any data of previous drug-blockchain!
./createPeerAdminCard.sh
Development only script for Hyperledger Fabric control
Running 'createPeerAdminCard.sh'
FABRIC_VERSION is set to 'hlfv11'
FABRIC_START_TIMEOUT is unset, assuming 15 (seconds)
Using composer-cli at v0.19.5
Successfully created business network card file to
Output file: /tmp/PeerAdmin#hlfv1.card
Command succeeded
Error: No connection type provided, probably because the connection profile has no 'x-type' property defined.
Command failed
You might be using an older version of the card (Source:- https://github.com/hyperledger/composer/issues/4007)
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
I tried two different tutorials:
This one to deploy docker images locally:
https://github.com/hyperledger/fabric-samples
I tried the fabcar sample. Everything works fine. I'm able to enroll the admin, register a user and invoke transactions using this user identity. Nice.
The second one to deploy a fabric composer playground on bluemix:
https://ibm-blockchain.github.io/setup/
I was able to get into the composer playground and deploy business network examples. I'm also able to upload and deploy my own business networks I designed locally with composer-cli. I exposed the network over a Rest Server with admin rights in order to test the transactions. All works fine.
Now it comes to my problem. I want to combine both examples (just for fun, learning by doing:)). I want to deploy the fabcar samples network to the kubernetes environment on bluemix and interact with the network using the fabric node sdk like in example 1. So I made following changes in the scripts/yaml files of example 2:
adapt the chaincode installation procedure
in the create_all.sh. line 41 (for peer 1) and line 45 (for peer 2). I changed the values of the env variables CHAINCODE_NAME and CHAINCODE_VERSION
echo "=> CREATE_ALL: Running Install Chaincode on Org1 Peer1" CHAINCODE_NAME="fabcar" CHAINCODE_VERSION="1.0" MSP_CONFIGPATH="/shared/crypto-config/peerOrganizations/org1.example.com/users/Admin#org1.example.com/msp" PEER_MSPID="Org1MSP" PEER_ADDRESS="blockchain-org1peer1:30110" create/chaincode_install.sh
in the chaincode_install.yaml.base line 16, I changed the path of the chaincode. I forked the https://github.com/hyperledger/fabric and added the fabcar.go chaincode from example 1 to the new repository https://github.com/bigbelette/fabric
command: ["sh", "-c", "git clone https://github.com/bigbelette/fabric $GOPATH/src/github.com/bigbelette/fabric/ && peer chaincode install -n ${CHAINCODE_NAME} -v ${CHAINCODE_VERSION} -p github.com/bigbelette/fabric/examples/chaincode/go/fabcar/"]
adapt the chaincode instantiation procedure:
in the create_all.sh. line 49. I changed the values of the env variables CHAINCODE_NAME and CHAINCODE_VERSION:
CHANNEL_NAME="channel1" CHAINCODE_NAME="fabcar" CHAINCODE_VERSION="1.0" MSP_CONFIGPATH="/shared/crypto-config/peerOrganizations/org1.example.com/users/Admin#org1.example.com/msp" PEER_MSPID="Org1MSP" PEER_ADDRESS="blockchain-org1peer1:30110" create/chaincode_instantiate.sh
In the chaincode_instantiate.yaml.base, I made the parameter list empty:
command: ["sh", "-c", "peer chaincode instantiate -o blockchain-orderer:31010 -C ${CHANNEL_NAME} -n ${CHAINCODE_NAME} -v ${CHAINCODE_VERSION} -c '{\"Args\":[\"\"]}'"]
The deployment on the cluster works without an error. In the fabcar examples node js file enrollAdmin, regiserUser, query and invoke, I changed the channel name (from mychannel to channel1) and the IPs and ports to match to the online kubernetes services:
enrollAdmin.js and registerUser.js work fine so I can get the certificates and store it in the key store. But when I try to invoke a transaction, i get the following error:
It seems the CA which gave me the certificates is not recognized by the peers. But there is only one CA in my network!? Or is it a problem in the MSP definition (something I still dont understand well).
Thanks for your help.
I finally found the error.
My network has 1 CA (the root CA, named ca) and 2 "sub" CAs (ca1 und ca2). I was enrolling admin and user directly by the root CA because I didnt mention the name of the ca in the parameters of the Fabric_CA_Client class:
fabric_ca_client = new Fabric_CA_Client('http://184.173.5.108:30054', tlsOption, crypto_suite)
Without the name, the used CA will be the default CA (Root CA in my case). But the signature of user certificates by the root CA wont be recognized by the peers. Only the signatures from the last hierarchical CA levels will be accepted. So the solution was to refer the name of the CA:
fabric_ca_client = new Fabric_CA_Client('http://184.173.5.108:30054', tlsOptions , 'CA1', crypto_suite)
It works. Now the user can invoke transactions.
I am following this simple tutorial to set up my dev environment . Everything goes fine until I trigger ./createPeerAdminCard.sh which gives error as below
Development only script for Hyperledger Fabric control
Running 'createPeerAdminCard.sh'
FABRIC_VERSION is set to 'hlfv11'
FABRIC_START_TIMEOUT is unset, assuming 15 (seconds)
Using composer-cli at v0.17.4
Successfully created business network card file to Output file:
/tmp/PeerAdmin#hlfv1.card
Command succeeded
Error: No connection type provided, probably because the connection
profile has no 'x-type' property defined. Command failed
I am using composer version v0.17.4 and fabric at 1.1.0 - alpha on ubuntu 16.04
You get this error because your card store still has a PeerAdmin card in it that was created using Composer 0.16 or earlier. The cards are not compatible so when the cli tries to delete the card it cannot. The quickest solution is to remove the file system card store completely. Currently the file system card store will always be at ${HOME}/.composer so to delete it you would do
rm -fr ${HOME}/.composer