Try to update hyperledger-composer version,but still not compatible with the client version - hyperledger-composer

I just a new beginner of Hyperledger Composer.So I try to deploy REST server using Docker by following this guide
Deploying the REST server for a business network
Then when i run docker, it show this error on docker logs
docker logs rest
0|composer | WARNING: NODE_APP_INSTANCE value of '0' did not match any instance config file names.
0|composer | WARNING: See https://github.com/lorenwest/node-config/wiki/Strict-Mode
0|composer | Discovering types from business network definition ...
0|composer | D0831 07:04:36.180952003 24 env_linux.c:66] Warning: insecure environment read function 'getenv' used
0|composer | D0831 07:04:37.574385287 24 env_linux.c:66] Warning: insecure environment read function 'getenv' used
0|composer | Connection fails: Error: Error trying to ping. Error: Composer runtime (0.11.3) is not compatible with client (0.11.2)
0|composer | It will be retried for the next request.
0|composer | Exception: Error: Error trying to ping. Error: Composer runtime (0.11.3) is not compatible with client (0.11.2)
0|composer | Error: Error trying to ping. Error: Composer runtime (0.11.3) is not compatible with client (0.11.2)
0|composer | at _checkRuntimeVersions.then.catch (/usr/local/lib/node_modules/composer-rest-server/node_modules/composer-connector-hlfv1/lib/hlfconnection.js:696:34)
PM2 | App [composer-rest-server] with id [0] and pid [24], exited with code [1] via signal [SIGINT]
PM2 | Starting execution sequence in -fork mode- for app name:composer-rest-server id:0
PM2 | App name:composer-rest-server id:0 online
So i try to update the version by following on this guide on the same doc
Updating Hyperledger Composer
But after I stop/reboot fabric, redeploy the chaincode again and run the docker, the error still exist.
Can anyone please tell me what i've missing?
Note: I try this solution too but still have the same problem.

Ok i've solve the problem. I remove all docker image and start new fabric to download image again,and it works!!
docker rmi $(docker images -q)

Related

Error installling chaincode on the network

I get the following error when I try to install chaincode
VirtualBox:~/fabric-samples/test-network$ peer lifecycle chaincode install GameEX.tar.gz --peerAddresses peer0.org1.example.com:7051
2021-08-12 16:01:53.066 IST [main] InitCmd -> ERRO 001 Cannot run peer because error when setting up MSP of type bccsp from directory /home/raju/fabric-samples/test-network/organizations/peerOrganizations/org1.example.com/users/Admin#org1.example.com/msp: KeyMaterial not found in SigningIdentityInfo
The code was written in java and compiled fine. Using test-network to deploy chaincode the network was running
What am I missing?

Warning: require(/var/www/vendor/autoload.php):

I am good with API creation but not so good when it comes to set up the system, I was trying to learn setting laravel with docker and was referring:
https://medium.com/#shakyShane/laravel-docker-part-1-setup-for-development-e3daaefaf3c
I followed all the steps correctly but on running:
docker-compose exec app php artisan key:generate
I am getting error:
Warning: require(/var/www/vendor/autoload.php): failed to open stream: No such file or directory in /var/www/artisan on line 18
Fatal error: require(): Failed opening required '/var/www/vendor/autoload.php' (include_path='.:/usr/local/lib/php') in /var/www/artisan on line 18
Am I wrong to assume that this problem is because the composer hasn't run!!
My Project folder is in Desktop
my docker-compose.yml is written like:
# The Application
`app:`
`build:`
`context: ./`
`dockerfile: app.dockerfile`
`working_dir: /var/www`
`volumes:`
`- ./:/var/www``
` environment:`
`- "DB_PORT=3306"`
`- "DB_HOST=database"`
# The Web Server
`web:`
`build:`
`context: ./`
`dockerfile: web.dockerfile`
`working_dir: /var/www`
`volumes_from:`
`- app`
`ports:`
`- 8080:80`
I checked other solutions on the web but I couldn't quite understand how I need to do.
I think it is not a good idea to follow the steps provided in the website since the
composer image is DEPRECATED
you must use the newest one from here

Error starting hyperledger-composer network after Fabric and Composer version upgrade

I've come across an error starting the hyperledger-composer network that isn't answered in the composer-wiki.
✖ 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: transaction returned with failure: can't find PEM header: undefined
Command failed
Checking pre-requisites,
Fabric 1.2
Composer 0.20.4
Node 8.12.0
Docker 18.01.1
"composer network install" was successful, with file appearing in the docker peer at /var/hyperleder/production/chaincodes
After running the "composer network start" command, a "docker ps" shows new docker instance with name:
dev-peer0.org1.example.com-<<business-network-name>>-0.0.7
But any attempt to ping this results in a failure like this:
Error: Error trying to ping. Error: make sure the chaincode <<business-network-name>> has been successfully instantiated and try again: getccdata composerchannel/<<business-network-name>> responded with error: could not find chaincode with name '<<business-network-name>>'
Checking the log of the dev-peer0, it ends with the following:
2018-11-05T05:03:18.227Z [4264161f] ERROR :Composer :Init() can't find PEM header: undefined
2018-11-05T05:03:18.227Z [4264161f] VERBOSE :Composer :#PERF Init() Total (ms) duration for txnID [4264161fc30a61c70884d4c7efb460fea6a755d07bc4852875c393346795227a]: 929.00
2018-11-05T05:03:18.228Z ERROR [lib/handler.js] [composerchannel-4264161f]Calling chaincode Init() returned error response [can't find PEM header: undefined]. Sending ERROR message back to peer
The corresponding error in the peer0 log is a big larger:
2018-11-05 05:03:18.229 UTC [endorser] SimulateProposal -> ERRO 439d [composerchannel][4264161f] failed to invoke chaincode name:"lscc" , error: transaction returned with failure: can't find PEM header: undefined
github.com/hyperledger/fabric/core/chaincode.(*ChaincodeSupport).Execute
/opt/gopath/src/github.com/hyperledger/fabric/core/chaincode/chaincode_support.go:202
github.com/hyperledger/fabric/core/endorser.(*SupportImpl).Execute
/opt/gopath/src/github.com/hyperledger/fabric/core/endorser/support.go:131
github.com/hyperledger/fabric/core/endorser.(*Endorser).callChaincode
/opt/gopath/src/github.com/hyperledger/fabric/core/endorser/endorser.go:173
github.com/hyperledger/fabric/core/endorser.(*Endorser).SimulateProposal
/opt/gopath/src/github.com/hyperledger/fabric/core/endorser/endorser.go:287
github.com/hyperledger/fabric/core/endorser.(*Endorser).ProcessProposal
/opt/gopath/src/github.com/hyperledger/fabric/core/endorser/endorser.go:501
github.com/hyperledger/fabric/core/handlers/auth/filter.(*expirationCheckFilter).ProcessProposal
/opt/gopath/src/github.com/hyperledger/fabric/core/handlers/auth/filter/expiration.go:61
github.com/hyperledger/fabric/core/handlers/auth/filter.(*filter).ProcessProposal
/opt/gopath/src/github.com/hyperledger/fabric/core/handlers/auth/filter/filter.go:31
github.com/hyperledger/fabric/protos/peer._Endorser_ProcessProposal_Handler
/opt/gopath/src/github.com/hyperledger/fabric/protos/peer/peer.pb.go:112
github.com/hyperledger/fabric/vendor/google.golang.org/grpc.(*Server).processUnaryRPC
/opt/gopath/src/github.com/hyperledger/fabric/vendor/google.golang.org/grpc/server.go:923
github.com/hyperledger/fabric/vendor/google.golang.org/grpc.(*Server).handleStream
/opt/gopath/src/github.com/hyperledger/fabric/vendor/google.golang.org/grpc/server.go:1148
github.com/hyperledger/fabric/vendor/google.golang.org/grpc.(*Server).serveStreams.func1.1
/opt/gopath/src/github.com/hyperledger/fabric/vendor/google.golang.org/grpc/server.go:637
runtime.goexit
/opt/go/src/runtime/asm_amd64.s:2361
2018-11-05 05:03:18.229 UTC [endorser] SimulateProposal -> DEBU 439e [composerchannel][4264161f] Exit
Since this last worked I have updated composer from 0.19 to 0.20.4, and taken Fabric from 1.1 to 1.2.
Googling suggests that this kind of error "can't find PEM header: undefined" is associated with a change in key signing. After tearing down Fabric I re-ran ./createPeerAdminCard.sh - is there another card or similar that needs to be re-created to accomodate the latest versions?
Thanks to #R Thatcher for putting me onto the right direction. This was all down to mismatching cards, and was resolved by clearing out everything and starting again.
Specifically, in /fabric-dev-servers:
./stopFabric.sh
./teardownFabric.sh
composer card list
composer card delete -c admin#<business-network-name>
composer card delete -c PeerAdmin#hlfv1
./startFabric.sh
./createPeerAdminCard.sh
Then changing into the composer/business-network-name directory:
composer network install --card PeerAdmin#hlfv1 --archiveFile business-network-name\#0.0.7.bna
composer network start -c PeerAdmin#hlfv1 -n business-network-name -V 0.0.7 -A admin -S adminpw --file networkadmin.card
composer card import --file networkadmin.card --card admin#business-network-name
composer network ping -c admin#business-network-name
So yes, it was about mismatching cards and not cleaning these up as part of a new deployment.
Although not part of the original problem, it's also worth noting that the -A and -S parameters of the composer network start command HAD to be set to admin and adminpw respectively. See composer issue #3781.
Answering the the last remark from #Capn Sparrow
"the -A and -S parameters of the composer network start command HAD to be set to admin and adminpw respectively."
This is the correct and expected behaviour :-)
with the composer network start command the -A and -S are specifying an existing user in the CA that we want a new set of Credentials (certificate and keys) for which is then bound to a Composer System participant.
When you use the 'standard development fabric' this has a CA configured with a user called 'admin' with a secret of 'adminpw'. If you had build your own Fabric from scratch you could choose the name and secret of your first default user. Alternatively you could work with the fabric-ca client software to create additional users in the CA.

Hyperledger-fabric fails to instantiate chaincode

I am unable to instantiate chaincode in Hyperledge Fabric.
When executing:
peer chaincode instantiate -o orderer -n test_cc -C test-channel -v 0.1 -c '{"Args":["initLedger"]}'
I get the error:
peer0 | 2018-04-17 13:02:11.097 UTC [dockercontroller] Start -> ERRO 046 start-could not start container: API error (400): {"message":"OCI runtime create failed: container_linux.go:348: starting container process caused \"exec: \\\"chaincode\\\": executable file not found in $PATH\": unknown"}
When searching the internet, the error message is the same as on the original post at [OCI Runtimer Error when installing Hyperledger Chaincode via Java-SDK and [OCI runtime error when sending Hyperledger Fabric's chaincode instantiation request to peers, but the comments on these posts did not led me to the solution.
I am using the following software versions:
Hyperledger 1.1.0
Docker version 18.03.0-ce (on Linux), Hyperledger Docker images: x86_64-1.1.0
The following steps succeed:
Building the chaincode. The code compiles without errors. I did not include any dependencies except the two required "github.com/hyperledger/fabric/core/chaincode/shim" and
"github.com/hyperledger/fabric/protos/peer"
Packaging the chaincode.
Signing the chaincode.
Installing the chaincode (it ends up in the peer's /var/hyperledger/production/chaincodes/test_cc.0.1.
(Steps according to Hyperledger documentation: [http://hyperledger-fabric-docs.readthedocs.io/en/latest/chaincode4noah.html])
In the CLI Docker container, files are located in the directory /opt/gopath/src/chaincode/go/test_cc/, where 4 files are present: test_cc, test_cc.go, test_cc_pack.out, test_cc_signed_pack.out (the binary, source file, packaged file and signed package file).
The full output of the orderer and peer is:
orderer | 2018-04-17 13:29:43.617 UTC [orderer/common/server] Broadcast -> DEBU 167 Starting new Broadcast handler
orderer | 2018-04-17 13:29:43.617 UTC [orderer/common/broadcast] Handle -> DEBU 168 Starting new broadcast loop for 172.18.0.6:41228
couchdb | [notice] 2018-04-17T13:29:43.624931Z nonode#nohost <0.16042.3> b5d38cd27d couchdb:5984 172.18.0.5 undefined GET /test-channel_lscc/test_cc?attachments=true 404 ok 2
peer | 2018-04-17 13:29:44.416 UTC [dockercontroller] Start -> ERRO 04a start-could not start container: API error (400): {"message":"OCI runtime create failed: container_linux.go:348: starting container process caused \"exec: \\\"chaincode\\\": executable file not found in $PATH\": unknown"}
peer | 2018-04-17 13:29:44.647 UTC [chaincode] Launch -> ERRO 04b launchAndWaitForRegister failed: API error (400): {"message":"OCI runtime create failed: container_linux.go:348: starting container process caused \"exec: \\\"chaincode\\\": executable file not found in $PATH\": unknown"}
peer |
peer | error starting container
peer | 2018-04-17 13:29:44.647 UTC [endorser] simulateProposal -> ERRO 04c [test-channel][39e4414a] failed to invoke chaincode name:"lscc" , error: API error (400): {"message":"OCI runtime create failed: container_linux.go:348: starting container process caused \"exec: \\\"chaincode\\\": executable file not found in $PATH\": unknown"}
peer |
peer | error starting container
orderer | 2018-04-17 13:29:44.648 UTC [orderer/common/broadcast] Handle -> DEBU 169 Received EOF from 172.18.0.6:41228, hangup
orderer | 2018-04-17 13:29:44.648 UTC [orderer/common/server] func1 -> DEBU 16a Closing Broadcast stream
It looks like there is some path issue, but the process of the creation of the chaincode container and the variables which influence this process.
I'm messing around with this issue for few days(!) now, tried all path combinations like placing the file in /opt/gopath/bin, etcetera, but to no avail.
Someone who can shine a light on this issue? Or knows what the correct paths are and where they are, or where they should be defined?
Thanks
The issue was that in the Go source files I used 'package test_package', which, when building, does not create an executable file, but a linkable object file.
Having 'package main' in my Go files, then rebuilding and repackaging, made the 'peer chaincode install' and 'peer chaincode instantiate' commands working as expected.

Configuring the REST server with a persistent data store

I am having problems trying to deploy the rest server with persistence storage (mongo db) I ge this message when deploying the rest server:
docker logs -f rest
[2018-03-12 00:01:13] PM2 log: Launching in no daemon mode
[2018-03-12 00:01:14] PM2 log: Starting execution sequence in -fork mode- for app name:composer-rest-server id:0
[2018-03-12 00:01:14] PM2 log: App name:composer-rest-server id:0 online
WARNING: NODE_APP_INSTANCE value of '0' did not match any instance config file names.
WARNING: See https://github.com/lorenwest/node-config/wiki/Strict-Mode
Discovering types from business network definition ...
Connection fails: Error: Error trying to ping. Error: Error trying to query business network. Error: REQUEST_TIMEOUT
It will be retried for the next request.
Exception: Error: Error trying to ping. Error: Error trying to query business network. Error: REQUEST_TIMEOUT
Error: Error trying to ping. Error: Error trying to query business network. Error: REQUEST_TIMEOUT
at _checkRuntimeVersions.then.catch (/home/composer/.npm-global/lib/node_modules/composer-rest-server/node_modules/composer-connector-hlfv1/lib/hlfconnection.js:699:34)
at
at process._tickDomainCallback (internal/process/next_tick.js:228:7)
[2018-03-12 00:07:03] PM2 log: App [composer-rest-server] with id [0] and pid [14], exited with code [1] via signal [SIGINT]
I am using composer v.18
is there any work around to fix this error. when I run the composer-rest- server alone it work. but if I try to add the mongodb it does not work

Resources