Hyperledger fabric chaincode | Abstore Go application build giving permission issue - hyperledger-fabric

I am trying to run a sample chaincode application on hyperledger fabric by following the steps mentioned in their github url
I am able to start the network using docker compose, below are the running containers:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
4992a3502034 hyperledger/fabric-tools "/bin/bash -c ./scri…" 44 minutes ago Up 44 minutes cli
4646e6ebf6c0 hyperledger/fabric-ccenv "/bin/sh -c 'sleep 6…" 44 minutes ago Up 44 minutes chaincode
c43bf3621a92 hyperledger/fabric-peer "peer node start --p…" 44 minutes ago Up 44 minutes 0.0.0.0:7051->7051/tcp, 0.0.0.0:7053->7053/tcp peer
f0095379384b hyperledger/fabric-orderer "orderer" 44 minutes ago Up 44 minutes 0.0.0.0:7050->7050/tcp orderer
Now when I try to build the sample abstore Go application from within the chaincode container, I get the below error everytime.
/opt/gopath/src/chaincode/abstore/go $ go build -o abstore go build
github.com/hyperledger/fabric-samples/chaincode/abstore/go: open
abstore: permission denied.
Can someone guide me here where I am going wrong.

The issue was resolved after giving complete access to the folders using :
sudo chmod -R 777 .

Related

composer network install command gives error as Error: 14 UNAVAILABLE: EOF

I am using Hyperledger Composer version v0.19.9 and Hyperledger Fabric version v1.1.
I have setup my blockchain network using Fabric and made all docker containers up and running. Following docker containers are running:
1. cli
2. orderer.sterlite.com
3. peer0.orga.sterlite.com
4. ca.orga.sterlite.com
5. peer0.orgb.sterlite.com
I have created a Peer Admin card using Composer CLI named PeerAdminOrgA#sterlite.
Now, when I try to install a business network using below command, I am getting an error:
composer network install -c PeerAdminOrgA#sterlite -a com-fab-bn.bna
Following is the error:
safvan#safvan-VirtualBox:~/blockchain/fabric-sdk/fabric-sdk-go/src/github.com/sterliteChain/config$ composer network install -c PeerAdminOrgA#sterlite -a com-fab-bn.bna
Installing business network. This may take a minute...
Error: Error trying install business network. Error: No valid responses from any peers.
Response from attempted peer comms was an error: Error: 14 UNAVAILABLE: EOF
Command failed
Following is the outcome of docker ps command:
safvan#safvan-VirtualBox:~/blockchain/fabric-sdk/fabric-sdk-go/src/github.com/sterliteChain/config$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
3645759c804d hyperledger/fabric-tools:latest "/bin/bash" About a minute ago Up About a minute cli
7f72016afeef hyperledger/fabric-orderer:latest "orderer" 19 hours ago Up About a minute 0.0.0.0:7050->7050/tcp orderer.sterlite.com
74f6a3c3f493 hyperledger/fabric-peer:latest "peer node start" 19 hours ago Up About a minute 0.0.0.0:7051->7051/tcp, 0.0.0.0:7053->7053/tcp peer0.orga.sterlite.com
6c3ab687ec95 hyperledger/fabric-ca:latest "sh -c 'fabric-ca-seâ¦" 19 hours ago Up About a minute 0.0.0.0:7054->7054/tcp ca.orga.sterlite.com
c6187a82e300 hyperledger/fabric-peer:latest "peer node start" 19 hours ago Up About a minute 0.0.0.0:9051->7051/tcp, 0.0.0.0:9053->7053/tcp peer0.orgb.sterlite.com
Kindly help me fix this issue.

Running composer network install in Hyperledger throws out an error

I am trying to deploy BNA to Fabric but getting this error
$ composer network install -c PeerAdmin#hlfv1 -a ~/Downloads/comment-network.bna
✖ Installing business network. This may take a minute...
Error: Error trying install business network. Error: No valid responses from any peers.
Response from attempted peer comms was an error: Error: 14 UNAVAILABLE: Connect Failed
Command failed
Already got docker running.
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
4a1452a6773a hyperledger/fabric-peer:x86_64-1.1.0 "peer node start" 14 minutes ago Up 14 minutes 0.0.0.0:7051->7051/tcp, 0.0.0.0:7053->7053/tcp peer0.org1.example.com
59221c711615 hyperledger/fabric-ca:x86_64-1.1.0 "sh -c 'fabric-ca-se…" 14 minutes ago Up 14 minutes 0.0.0.0:7054->7054/tcp ca.org1.example.com
eec390a547e5 hyperledger/fabric-couchdb:x86_64-0.4.6 "tini -- /docker-ent…" 14 minutes ago Up 14 minutes 4369/tcp, 9100/tcp, 0.0.0.0:5984->5984/tcp couchdb
c7d462facea6 hyperledger/fabric-orderer:x86_64-1.1.0 "orderer" 14 minutes ago Up 14 minutes 0.0.0.0:7050->7050/tcp orderer.example.com
I installed Fabric using step 4 of this guide then ran
./startFabric.sh
./createPeerAdminCard.sh
prior to deploying BNA.
EDIT:
$ docker -v
Docker version 18.02.0-ce, build fc4de44
$ system_profiler SPSoftwareDataType
Software:
System Software Overview:
System Version: macOS 10.13.2 (17C88)
Kernel Version: Darwin 17.3.0
Boot Volume: Macintosh HD
Boot Mode: Normal
Computer Name: COMPUTER NAME
User Name: USERNAME
Secure Virtual Memory: Enabled
System Integrity Protection: Enabled
Time since boot: 13 days 18:28
I concluded that my issue was because of me using docker-machine to run Docker instead of running Docker via daemon.
I solved it by adding the ports used to VirtualBox.

No valid responses from any peers while deploying the BNA file with "composer network start"

I am following the link: https://hyperledger.github.io/composer/tutorials/deploy-to-fabric-multi-org to deploy bna file in 2 different peers.
Up to step-16 everything is working fine, but when I am trying to deploy the .bna file getting following error.
After importing the identity cards to composer when I have run "install runtime" command for Org1, it is successfully processed but when I am running for Org2 it is showing "No valid responses from any peers" error.
Following are the output.
amandai#ubuntultop:~/block chain/fabric-samples V1/ess-multipeer-sample/network$ composer network start -c PeerAdmin#amsnetwork-essbbsr -a amsnetwork.bna -o endorsementPolicyFile=endorsement-policy.json -A chinmayak -C chinmayak/admin-pub.pem -A kkumarbabu -C kkumarbabu/admin-pub.pem
Starting business network from archive: amsnetwork.bna
Business network definition:
Identifier: amsnetwork#0.2.0-20180102082548
Description: The Hello World of Hyperledger Composer samples
Processing these Network Admins:
userName: chinmayak
userName: kkumarbabu
✖ Starting business network definition. This may take a minute...
Error: Error trying to instantiate composer runtime. Error: No valid responses from any peers.
Response from attempted peer comms was an error: Error: REQUEST_TIMEOUT
Response from attempted peer comms was an error: Error: REQUEST_TIMEOUT
Command failed
Even all the peers are up.
amandai#ubuntultop:~/block chain/fabric-samples V1/ess-multipeer-sample/network$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
c83e1a245386 hyperledger/fabric-tools "/bin/bash -c './s..." 6 minutes ago Up 6 minutes cli
46bf68ca719e hyperledger/fabric-peer "peer node start" 6 minutes ago Up 6 minutes 0.0.0.0:8051->7051/tcp, 0.0.0.0:8053->7053/tcp peer0.ezone.esspl.com
2e740ce743fe hyperledger/fabric-ca "sh -c 'fabric-ca-..." 6 minutes ago Up 6 minutes 0.0.0.0:7054->7054/tcp ca_peerEssbbsr
cc48b8ee44db hyperledger/fabric-orderer "orderer" 6 minutes ago Up 6 minutes 0.0.0.0:7050->7050/tcp orderer.esspl.com
46077fc3888a hyperledger/fabric-peer "peer node start" 6 minutes ago Up 6 minutes 0.0.0.0:7051->7051/tcp, 0.0.0.0:7053->7053/tcp peer0.essbbsr.esspl.com
3f65239e7315 hyperledger/fabric-ca "sh -c 'fabric-ca-..." 6 minutes ago Up 6 minutes 0.0.0.0:8054->7054/tcp ca_peerEzone
Please help how to resolve this. Thanks
I did the following modification in "peer-base.yaml" file and issue has been resolved.
- CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=${COMPOSE_PROJECT_NAME}_byfn
To
- CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=network_amsnetwork
Here "network_amsnetwork" is the network name. You can find your network name by using "docker network ls" command

v0.18.1 error , can't start network

when I run
composer network start -c PeerAdmin#hlfv1 -a test-network.bna -A admin -S adminpw
it took a long time then got a timeout error
Error: Error trying to instantiate composer runtime. Error: No valid responses from any peers.
Response from attempted peer comms was an error: Error: REQUEST_TIMEOUT
docker ps
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
84daf56fde06 hyperledger/fabric-peer:x86_64-1.1.0-rc1 "peer node start" 12 minutes ago Up 12 minutes 0.0.0.0:7051->7051/tcp, 0.0.0.0:7053->7053/tcp peer0.org1.example.com
a6835cf4ed34 hyperledger/fabric-orderer:x86_64-1.1.0-rc1 "orderer" 12 minutes ago Up 12 minutes 0.0.0.0:7050->7050/tcp orderer.example.com
3ab21e84dc6e hyperledger/fabric-couchdb:x86_64-0.4.6 "tini -- /docker-ent…" 12 minutes ago Up 12 minutes 4369/tcp, 9100/tcp, 0.0.0.0:5984->5984/tcp couchdb
64acf6dc5db7 hyperledger/fabric-ca:x86_64-1.1.0-rc1 "sh -c 'fabric-ca-se…" 12 minutes ago Up 12 minutes 0.0.0.0:7054->7054/tcp ca.org1.example.com
$ docker logs peer0.org1.example.com
2018-03-15 03:02:51.419 UTC [endorser] simulateProposal -> ERRO 4bf [composerchannel][9b4c096b] failed to invoke chaincode name:"lscc" ,
error: timeout expired while starting chaincode test-network:0.18.1(networkid:dev,peerid:peer0.org1.example.com,tx:9b4c096bcffd303acdafbc46ca17a2d69c33de917ccc0d47965b43dd67484960)
The composer network start command is creating a new docker container and using npm install within that container, so your timeout could be a result of a slow system creating the container, and/or slow performance of the npm install command.
The default timeout is 300 seconds, but you can increase that value with the environment variable CORE_CHAINCODE_EXECUTETIMEOUT=800s
If you look at the docker-compose yaml file that is used to start your Fabric (specifically the Peer) then you can add an additional line for this environment variable.
If you are using the default Dev Fabric, the file you are looking for is probably: ~/fabric-tools/fabric-scripts/hlfv11/composer/docker-compose.yml

Error when reading core config file: Unsupported Config Type

I am trying to pass in the channel configuration transaction artifact to the order-er using the command:
peer channel create -o orderer.example.com:7050 -c $CHANNEL_NAME -f ./channel-artifacts/channel.tx --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
But I get an error:
2018-03-17 20:55:21.380 GMT [main] main -> ERRO 001 Fatal error
when initializing core config : error when reading core
config file: Unsupported Config Type ""
What does this error mean? and how can I fix it?
Using docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
5c27fce33911 hyperledger/fabric-tools:latest "/bin/bash" 3 minutes ago Up 3 minutes cli
aabf72f81352 hyperledger/fabric-peer:latest "peer node start" 3 minutes ago Up 3 minutes 0.0.0.0:7051->7051/tcp, 0.0.0.0:7053->7053/tcp peer0.org1.example.com
73ddcafb5ce6 hyperledger/fabric-orderer:latest "orderer" 3 minutes ago Up 3 minutes 0.0.0.0:7050->7050/tcp orderer.example.com
205448f5479a hyperledger/fabric-peer:latest "peer node start" 3 minutes ago Up 3 minutes 0.0.0.0:8051->7051/tcp, 0.0.0.0:8053->7053/tcp peer1.org1.example.com
4e5ba2999f54 hyperledger/fabric-peer:latest "peer node start" 3 minutes ago Up 3 minutes 0.0.0.0:9051->7051/tcp, 0.0.0.0:9053->7053/tcp peer0.org2.example.com
fcc6b25b6422 hyperledger/fabric-peer:latest "peer node start" 3 minutes ago Up 3 minutes 0.0.0.0:10051->7051/tcp, 0.0.0.0:10053->7053/tcp peer1.org2.example.com
2f1536ffe265 dev-peer0.org1.example.com-fabcar-1.0-5c906e402ed29f20260ae42283216aa75549c571e2e380f3615826365d8269ba "chaincode -peer.add…" 24 hours ago Exited (255) 3 minutes ago dev-peer0.org1.example.com-fabcar-1.0
6ae48101bc34 hyperledger/fabric-ca "sh -c 'fabric-ca-se…" 24 hours ago Exited (255) 3 minutes ago 0.0.0.0:7054->7054/tcp ca.example.com
dc9e5bb3cc8e hyperledger/fabric-couchdb "tini -- /docker-ent…" 24 hours ago Exited (255) 3 minutes ago 4369/tcp, 9100/tcp, 0.0.0.0:5984->5984/tcp couchdb
this is the log of orderer.example.com
You should be inside the CLI container to execute the peer channel create command.
You will enter the CLI container using the docker exec command:
docker exec -it cli bash
If successful you should see the following:
root#0d78bb69300d:/opt/gopath/src/github.com/hyperledger/fabric/peer#
Over there, you should run the peer channel create command like this:
root#0d78bb69300d:/opt/gopath/src/github.com/hyperledger/fabric/peer# peer channel create -o orderer.example.com:7050 -c $CHANNEL_NAME -f ./channel-artifacts/channel.tx --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
Before running this command, please note that you should also run commands for creating environment variables for CHANNEL_NAME and other Environment variables for PEER0 within this CLI Container.
export FABRIC_CFG_PATH=$PWD. it will resolve this issue.
This is the error you get when the core.yaml is not found. Like the Mukesh mentioned above, running command within the CLI Container will not throw the Error.
See this link for more detail.
Can you try running this command: echo $FABRIC_CFG_PATH
Whatever value you get, can you navigate to that directory and confirm if you can see the configtx.yaml file in there.
From the docs here, it says the error is as a result of inappropriately setting the value of that variable.

Resources