Background of the work:
I am trying to extend the Composer environment have multiple Organisation in it.
I could do that by modifying configtx.yaml, crypto-config.yaml & docker-compose.yml files.
Issue facing:
When I created a channel using startFabric.sh and try to join new Org's peers in it
docker exec -e "CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/msp/users/Admin#org2.example.com/msp" peer0.org2.example.com peer channel join -b composerchannel.block
I am getting below error.
2017-07-14 10:03:09.046 UTC [msp] GetLocalMSP -> DEBU 001 Returning existing local MSP
2017-07-14 10:03:09.046 UTC [msp] GetDefaultSigningIdentity -> DEBU 002 Obtaining default signing identity
2017-07-14 10:03:09.049 UTC [channelCmd] InitCmdFactory -> INFO 003 Endorser and orderer connections initialized
Error: genesis block file not found open composerchannel.block: no such file or directory`
My environment details.
composer-cli v0.9.2
composer-admin v0.9.2
composer-client v0.9.2
composer-common v0.9.2
composer-runtime-hlf v0.9.2
composer-runtime-hlfv1 v0.9.2
npm 3.10.10
node v6.11.0
Rather than trying to extend the composer development fabric, I think you would be better off creating a network from scratch following the hyperledger fabric documentation found at
https://hyperledger-fabric.readthedocs.io/en/latest/build_network.html
The development fabric defined by composer isn't meant to be a template for how to define a fabric, but rather as the simplest setup possible to provide a real hyperledger fabric to develop and test against.
The examples provided by hyperledger fabric are best suited for understanding and creating your own custom fabric and hyperledger composer should be able to work with that custom topology through appropriate configuration of the connection profile and importing of appropriate crypto material using the composer identity import command.
You can find composerchannel.block in the working directory (working_dir defined in your docker-compose.yaml) of your peer0.org2.example.com container.
Related
We're thinking about migration from Hyperledger Composer v0.13.0 to the latest one (v0.16.5), so I have tried to create and deploy business network according tutorial below.
https://hyperledger.github.io/composer/latest/tutorials/developer-tutorial
But at the Step 4, composer runtime install command doesn't work.
Here is the error occured.
✖ Installing runtime for business network <<MY_BUSINESS_NETWORK>>. This may take a minute...
Error: Error trying to ping. Error: Error trying to query business network. Error: could not find chaincode with name '<<MY_BUSINESS_NETWORK>>' - make sure the chaincode <<MY_BUSINESS_NETWORK>> has been successfully instantiated and try again
Command failed
But I'm not sure where instantiation should be done.
I guess that composer runtime install and composer network start are counterparts of composer network deploy in v0.13.0, but is it wrong? In v0.13.0, I didn't need to execute "instantiate" command explicitly.
I would appreciate any suggestions or information, thanks.
My procedure
1. prepare credentials,channenl-artifacts and connection profile then start dockers.
2. create channel and make peers joined.
3. create BNA & card Files.
4. import the card of PeerAdmin then confirm with composer card list command.
5. execute composer install runtime command.
Environment
Ubuntu : 16.04
hyperledger composer : 0.16.5
ibmblockchain/fabric-tools 1.0.5
ibmblockchain/fabric-ca 1.0.5
ibmblockchain/fabric-peer 1.0.5
ibmblockchain/fabric-orderer 1.0.5
ibmblockchain/fabric-couchdb 1.0.5
the runtime install and network start (as you correctly understood) are two separate tasks that are likely to be performed by a Peer administrator and a network administrator (two separate roles) and hence why they are broken out - demarcation of duty. network deploy is deprecated from old days.
On tutorial - I suggest to do a 'teardown' from the fabric-tools directory and clear out your $HOME/.composer cards directory. I assume you downloaded a new fabric tools afresh? Did you also make sure to update your pre-requisites if/as required per the documentation https://hyperledger.github.io/composer/latest/installing/installing-prereqs.html
The error you posted related to << MY_BUSINESS NETWORK >> I assume, is because you've obfuscated the real network name - understandable) otherwise is an unusual error and not the name given in the tutorial - if you follow the tutorial it should deployed as follows (ie cut and paste from tutorial):
runtime install:
composer runtime install --card PeerAdmin#hlfv1 --businessNetworkName tutorial-network
network start:
composer network start --card PeerAdmin#hlfv1 --networkAdmin admin --networkAdminEnrollSecret adminpw --archiveFile tutorial-network#0.0.1.bna --file networkadmin.card
https://hyperledger.github.io/composer/latest/tutorials/developer-tutorial.html and this has been working fine for ages.
Are you trying to build your own Fabric network, single-org or multi-org, on same virtual host or across different physical/virtual machines ? Because the Fabric Dev server setup provided by Composer does 1 and 2 for you. You can also create the PeerAdmin card for that, as instructed in our docs (run a script).
Based on your procedure I would add first:
Do a teardown and remove old cards (as mentioned above)
do your steps 1 and 2 (and then create your Fabric network if that's what you want to do)
After your [custom] Fabric is up and running:
step 3. Test your custom Fabric Network to validate the configuration using the Fabric marbles sample chaincode. If that works, proceed to build your own PeerAdmin card
step 4. deploy the Business network by installing Composer runtime on all peers first then doing a network start of the bna on the channel you configured
step 5. Create Composer BN cards, connection profiles, identities and participants etc
I'm developing a POC over IBM HyperLedger Blockchain. I have a business network developed and deployed in IBM Cloud. I can generate a working local API REST, but cannot make it work on cloud, on the deployed IP.
I'm following this guide:
https://ibm-blockchain.github.io/interacting/
You just have to execute the following command:
./create/create_composer-rest-server.sh --business-network-card MY_BIZNET_CARD_NAME
But it doesn't deploy anything, and get the following (more related to kubernetes than blockchain).
Preparing yaml file for create composer-rest-server
Creating composer-rest-server pod
Running: kubectl create -f /Users/sm/jsblock/ibm-container-service/cs-offerings/scripts/../kube-configs/composer-rest-server.yaml
The connection to the server localhost:8080 was refused - did you specify the right host or port?
the server doesn't have a resource type "svc"
Creating composer-rest-server service
Running: kubectl create -f /Users/sm/jsblock/ibm-container-service/cs-offerings/scripts/../kube-configs/composer-rest-server-services-free.yaml
The connection to the server localhost:8080 was refused - did you specify the right host or port?
Composer rest server created successfully
Any ideas? Thanks too much.
You need to ensure you have a correct kube config setup. Step 10 in https://ibm-blockchain.github.io/setup/ provides the details to set up KUBECONFIG as the error suggests that either it is not configured or not configured correctly.
The document you refer to https://ibm-blockchain.github.io/interacting/ is being updated and should be available soon.
When you run the command ./create/create_composer-rest-server.sh --business-network-card MY_BIZNET_CARD_NAME - should be the name of the Network Admin for the network you deployed, NOT the PeerAdmin card so it will be something like ./create/create_composer-rest-server.sh --business-network-card admin#perishable-network
Look like it's an issue of acceess control. You should make sure again you are running with Local Admin configuration.it will help you to run queries
I am testing a a business network I created, I ran the Composer-rest-server and all worked fine, then shut the server as suggested in the developers guide , then I proceeded use the yo hyperledger composer to create the skeleton of the angular app, however, now the angular app is showing in the local browser, however, the composer-rest- server is not.
Expected Behavior:
I should start the composer-rest- server in localhost:3000 and the angular app as well
Actual Behavior:
I get this message;
scovering types from business network definition ...
Connection fails: Error: Error trying to ping. Error: Error trying to query chaincode. Error: Connect Failed
It will be retried for the next request.
Exception: Error: Error trying to ping. Error: Error trying to query chaincode. Error: Connect Failed
Error: Error trying to ping. Error: Error trying to query chaincode. Error: Connect Failed
at _checkRuntimeVersions.then.catch (/home/node/.nvm/versions/node/v6.11.2/lib/node_modules/composer-rest-server/node_modules/composer-connector-hlfv1/lib/hlfconnection.js:696:34)
Your Environment
composer-cli#0.11.3
generator-hyperledger-composer#0.11.3
composer-rest-server#0.11.3
Docker version 17.06.0-ce, build 02c1d87
docker-compose version 1.13.0, build 1719ceb
The Problem
If you kill your fabric instance using ./stopFabric that you started using the ./startFabric command then all the containers that were apart of the business network were killed as well and therefore you need to reinstall the .bna and start the network again. (the development flow provided is purposely volatile for rapid development)
The Solution
1.) Type docker ps to see all of your running containers. You should see none if you are getting that error because your peer is not responding to pings
2.) Open a separate terminal and navigate to where you have fabric-dev-servers in the terminal and run ./fabricStart. This will start all the containers like your network Certificate Authority, the peer, the orderer, etc.
3.) Return to your project in another terminal. Do Step 1 & 2 found at the developer tutorial (you likely won't need to do step 3 since you likely already imported the network administrator identity going through the tutorial)
4.) Run composer network ping --card admin#tutorial-network. The ping should go through.
5.) Run docker ps. You should see 4 containers running
6.) Run composer-rest-server and follow the steps from the tutorial.
7.) Run cd tutorial-network-app to switch to where your angular application is (or wherever you generated it with the yo command)
8.) Navigate to http://localhost:3000 and everything should work.
Any other questions or problems just reply here and I can help.
The expected behaviour is that the REST server is already running (the the generator uses Loopback to spin up a REST server already (that's why you shut down the previous REST server)). Its described here https://hyperledger.github.io/composer/unstable/tutorials/developer-guide.html under 'Generate your Skeleton Web Application'.
After you created the application - following completion of the yo hyperledger-composer questions (and after providing the answers) you run your application using npm start from within the generated application directory. Your app is accessible at http://localhost:4200.
I am trying to install my custom chain code in my local Hyperledger Fabric v1.0 environment.
For this I have followed the documentation build your first network and I am using first network sample with in the github project. No it is up and running with ./byfn.sh -m up and executing all the scripts for channel creating, chain code installation and instantiation and all by running script.sh file.
Now I have changed the following to tryout my custom chaincode
peer chaincode install -n mycc -v 1.0 -p github.com/hyperledger/fabric/examples/chaincode/go/chaincode_example02>&log.txt
this I have changed to
peer chaincode install -n mycc -v 1.0 -p github.com/myuserId/fabrcicV1_chaincodes/mychaincode >&log.txt
Now by running ./byfn.sh -m up getting the exception
2017-08-22 11:01:17.048 UTC [msp] GetDefaultSigningIdentity -> DEBU 002 Obtaining default signing identity
2017-08-22 11:01:17.048 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 003 Using default escc
2017-08-22 11:01:17.048 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 004 Using default vscc
Error: Error getting chaincode code chaincode: path to chaincode does not exist: github.com/myuserId/fabrcicV1_chaincodes/mychaincode
Usage:
peer chaincode install [flags]
Flags:
-c, --ctor string Constructor message for the chaincode in JSON format (default "{}")
-l, --lang string Language the chaincode is written in (default "golang")
-n, --name string Name of the chaincode
-p, --path string Path to chaincode
-v, --version string Version of the chaincode specified in install/instantiate/upgrade commands
Global Flags:
--cafile string Path to file containing PEM-encoded trusted certificate(s) for the ordering endpoi
--logging-level string Default logging level and overrides, see core.yaml for full syntax
-o, --orderer string Ordering service endpoint
--test.coverprofile string Done (default "coverage.cov")
--tls Use TLS when communicating with the orderer endpoint
!!!!!!!!!!!!!!! Chaincode installation on remote peer PEER0 has Failed !!!!!!!!!!!!!!!!
========= ERROR !!! FAILED to execute End-2-End Scenario ===========
I have the repository there in github, then why it is not showing does not exit?
I have cloned the same to Windows 7 machine under the path $GOPATH/src/github.com/ and given local path, then also I am getting the same error. I am running all the commands through docker quick start terminal for windows 7.
Please suggest where I am doing wrong.
Also in some of the network log I have found a location /opt/gopath/src/github.com/.... and where it is pointing to. In my windows path gopath is /c/users/public/fabricv1.
Since I am not much familiar with the tool, please comment on this also.
After doing some analysis from my side, it seems like the chain code
is reading from some pre-mounted directories sacc/, fabcar/, /marble02
, chaincode_example_02, hyperledger/ under the path
root#7785f8b27559:/opt/gopath/src/chaincodedev/chaincode# and
chaincode also pre-loaded at the time of making the network up
using docker image. There it seems no effect by adding chaincode in
windows folder and it is from the above said virtual machine path.
So what can I do now to continue my work? is there any way to install
my custom chaincode to the local network. I tried with my githhub path
and local path but no use. please somebody help :(
It seems that you do not have your chaincode in the $GOPATH, you need to run:
go get github.com/myuserId/fabrcicV1_chaincodes/mychaincode
Before trying to install the chaincode on peer, in your case where you are using build your first network, you need to make sure your new chaincode inside fabric-samples/chaincode folder. And also note that you need to mount folder with your chaincode into docker cli container, see example of current docker-compose-cli.yaml file:
volumes:
- /var/run/:/host/var/run/
- ./../chaincode/:/opt/gopath/src/github.com/hyperledger/fabric/examples/chaincode/go
- ./crypto-config:/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/
- ./scripts:/opt/gopath/src/github.com/hyperledger/fabric/peer/scripts/
- ./channel-artifacts:/opt/gopath/src/github.com/hyperledger/fabric/peer/channel-artifacts
In particular, you probably need to replace here with your chaincode or make sure to mount an additional folder within $GOPATH of cli container:
- ./../chaincode/:/opt/gopath/src/github.com/hyperledger/fabric/examples/chaincode/go
I have a business network which has deployed no problem in the past, now when I try to deploy using the command
composer network deploy -a test.bna -i PeerAdmin -s adminpw -p hlfv1
I get
Deploying business network from archive: test.bna
Business network definition:
Identifier: test#0.0.1
Description: Test Network
✖ Deploying business network definition. This may take a minute...
Error: error trying deploy. Error: Failed to deserialize creator
identity, err MSP Org1MSP is unknown
Command failed
what is the problem ?
This error could be the result of a problem to create the channel and join the peer to the channel.
If you followed the hyperledger composer guides and downloaded the hyperledger fabric development server then you must ensure you have a version of docker equal or greater to version 17.03. The channel will fail to be created on older versions of docker.
It seems also a problem related to the connection profile and the new changes on identities. Check https://hyperledger.github.io/composer/business-network/bnd-deploy.html and Trying to deploy a business network onto hyperledger fabric 1.0 beta fails to install chaincode