Error when deploying chaincode in test network - hyperledger-fabric

I've just started working on fabric an am having some trouble using the command:
./network.sh deployCC
after setting up my channels. This is the terminal readout:
'''
deploying chaincode on channel 'mychannel'
Vendoring Go dependencies ...
~/desktop/HF/fabric-samples/chaincode/fabcar/go ~/desktop/HF/fabric-samples/test-network
scripts/deployCC.sh: line 24: go: command not found
~/desktop/HF/fabric-samples/test-network
Finished vendoring Go dependencies
Using organization 1
++ peer lifecycle chaincode package fabcar.tar.gz --path ../chaincode/fabcar/go/ --lang golang --label fabcar_1
++ res=1
++ set +x
Error: failed to normalize chaincode path: failed to determine module root: exec: "go": executable file not found in $PATH
!!!!!!!!!!!!!!! Chaincode packaging on peer0.org1 has failed !!!!!!!!!!!!!!!!
ERROR !!! Deploying chaincode failed
'''
It seems that I must have messed something up in the prereqs. Any suggestions?

You are missing 'go' prerequisite. See in the test network documentation, the prerequisites section. You will need to install golang.

The Golang chaincodes can only be packaged through the CLI container. All the other language chain codes can be packaged through peer containers as well.

Related

Error While Installing Fabric Chaincode: _lifecycle.syscc: no such file or directory

While trying to install chaincode using Fabric v2.1, I am encountering an error. Does anyone face similar issues? My peer is running fine and able to join the channel as well. I am able to list the channel details as well.
Note: I am doing Native installation without using docker images for running orderer and peer.
Highly appreciate for your support and looking forward to hear from you.
Error:
chaincode install failed with status: 500 - error in simulation: failed to execute transaction 44688cc50afeda03e3f5e7735ae650030952477b6bdfce83064582f42bec6c84: could not launch chaincode _lifecycle.syscc: error building chaincode: error building image: failed to get chaincode package for external build: could not get legacy chaincode package '_lifecycle.syscc': open /home/vagrant/ledger/ORG2/peer1-org2/ledger/chaincodes/_lifecycle.syscc: no such file or directory
I got this error after upgrading from 1.4. In my case the problem was in the old config file for the peer.
Make sure you have next lines in your core.yaml:
chaincode:
...
# enabled system chaincodes
system:
_lifecycle: enable

Convector Framework CLI returns error when installing chaincode

I am very new to the Hyperledger Fabric and Convector Framework and I have followed this tutorial:
https://worldsibu.github.io/convector/modules/getting_started.html
When I try to use the CLI tool and run the command (test is my chaincode name):
npm run cc:start -- test 1
It gives the following errors:
Installing Chaincode test version 1.0 at org1
Error: Error endorsing chaincode: rpc error: code = Unknown desc = access
denied: channel [] creator org [org1MSP]
...
Installing Chaincode test version 1.0 at org2
Error: error getting endorser client for install: endorser client failed to
connect to localhost:7151: failed to create new connection: context deadline
exceeded
I have not changed the configs and MSPs.
What is going wrong and how should I start to resolve the problem? Any guidance is appreciated!
#shole that documentation is now deprecated, you can use http://docs.worldsibu.com/convector for the latest versions.
About your error that usually happens when the environment gets corrupted and keeps cryptographic materials from a previous installation, try re-running npm run env:restart and try again.

Composer network install: cannot get package for blockchain

Composer version v.0.19.5 on Ubuntu
composer network install is producing error. I have chacked all the similar posts regarding these keywords: trying to start business network .... no valid responses from any peers ... cannot get package for blockchain
but it didn't help.
Network version is checked and it is correctly entered in the commmand. START and INSTALL commands are as follows:
composer network install --archiveFile carauction-network1.bna --card PeerAdmin#hlfv1
which resulted in: Successfully installed business network caracution-network1, version 0.2.4.-deploy.0
Command succeeded
composer network start --networkName carauction-network1 --networkVersion 0.2.4 --card PeerAdmin#hlfv1 --networkAdmin admin --networkAdminEnrollSecret adminpw][2]
resulted in: Starting business network definition. this may take a minute...
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: chaincode error (status: 500, message: cannot get package for chaincode (carauction-network1:0.2.4)
I suspect it cannot find npm package. It says: "cannot get package for blockchain". Maybe it is not looking to the right directory. Anyway, where should be respective npm packages? Maybe the key is in the environment variables. My variables regarding Hyperledger are:
GOPATH=/home/hyperl/go
NVM_CD_FLAGS=
NVM_DIR=/home/hyperl/.nvm
NVM_BIN=/home/hyperl/.nvm/versions/node/v8.9.4/bin
PWD=/home/hyperl/.composer/cards/PeerAdmin#carauction-network5 ---> on samo of the trials the value was PWD=/home/hyperl
PATH=/home/hyperl/bin:/home/hyperl/.local/bin:/home/hyperl/.nvm/versions/node/v8.9.4/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/lib/go-1.9/bin`

Hyperledger first network sample error

I am following this link first-network to run hyperledger samples name first-network.
I am using Ubuntu 18.04LTS
./byfn.sh -m generate got successfully executed.
When I am trying to execute ./byfn.sh -m up I am getting error
`2018-05-08 08:45:22.485 UTC [main] main -> ERRO 001 Cannot run peer because cannot init crypto, missing /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin#org1.example.com/msp folder
!!!!!!!!!!!!!!! Channel creation failed !!!!!!!!!!!!!!!!
========= ERROR !!! FAILED to execute End-2-End Scenario ===========
Edits 1: Adding docker compose files
docker-compose-cli.yaml
docker-compose-couch.yaml
docker-compose-e2e.yaml
docker-compose-couch-org3.yaml
docker-compose-e2e-template.yaml
docker-compose-org3.yaml
Your crypto materials are not getting generated properly as required . Check that you have all the Prerequisites installed on the platform(s) I hope you have downloaded all the platform specific binaries https://github.com/hyperledger/fabric/blob/master/scripts/bootstrap.sh
This will make sure you have the correct Cryptogen and Configtxgen tools for creating crypto material,ca clients and channel configurations .

Chaincode instantiation failing with other go packages

need help on chaincode instantiation which is dependent on other go packages like golang/protobuf and pkg/errors. Below is the error i am getting in the peer logs,
2018-01-10 19:59:42.040 UTC [endorser] simulateProposal -> ERRO 405 failed to invoke chaincode name:"lscc" on transaction 380f014688cb8638b66cc9e9c8c85f1bf06ba062fbb979442483f7e9ae2139be, error: Error starting container: Failed to generate platform-specific docker build: Error returned from build: 1 "chaincode/input/src/Loyalty/loyalty.go:15:2: cannot find package "github.com/golang/protobuf/proto" in any of:
/opt/go/src/github.com/golang/protobuf/proto (from $GOROOT)
/chaincode/input/src/github.com/golang/protobuf/proto (from $GOPATH)
/opt/gopath/src/github.com/golang/protobuf/proto
chaincode/input/src/Loyalty/loyalty.go:18:2: cannot find package "github.com/pkg/errors" in any of:
/opt/go/src/github.com/pkg/errors (from $GOROOT)
/chaincode/input/src/github.com/pkg/errors (from $GOPATH)
/opt/gopath/src/github.com/pkg/errors
I've already mounted these to the peer docker and are present at these /opt/gopath/src/github.com/golang/protobuf/proto locations
In order to compile chaincode the peer starts new container using fabric-ccenv base image. As a result mounted to the peer folder /opt/gopath/src/github.com/golang/protobuf/proto is not available at runtime.
It's better to vendor the proto package with the chaincode, try to run following command in the root folder of your project:
govendor add github.com/golang/protobuf/proto
This command should create subfolder vendor/github.com/golang/protobuf/proto and populate it with all necessary files.
Just try to install your chaincode again, required dependencies will be shipped with your source code and are availalbe in runtime.

Resources