Failed to deploy business network archive: not found - hyperledger-fabric

I'm following the Hyperledger Developer Tutorial and I set up my development environment using the instructions they provided.
After that, these are the steps I followed:
I created the peer admin card, using the fabric tools script.
I installed the composer runtime: composer runtime install --card PeerAdmin#hlfv1 --businessNetworkName e-wallet
I try to deploy the business network archive: composer network start --card PeerAdmin#hlfv1 --networkAdmin admin --networkAdminEnrollSecret adminpw --archiveFile ./e-wallet#0.0.1.bna --file networkadmin.card
But unfortunately this step fails. I receive this error in the client:
Error: Error trying to instantiate composer runtime. Error: Error: Invalid results returned ::NOT_FOUND
Command failed
This is the log output from the peer:
2018-02-12 13:34:24.964 UTC [eventhub_producer] validateEventMessage -> DEBU 22e ValidateEventMessage starts for signed event 0xc42037cf30
2018-02-12 13:34:24.970 UTC [eventhub_producer] registerHandler -> DEBU 22f registering event type: BLOCK
2018-02-12 13:34:25.021 UTC [eventhub_producer] validateEventMessage -> DEBU 230 ValidateEventMessage starts for signed event 0xc42037d380
2018-02-12 13:34:25.023 UTC [eventhub_producer] deRegisterHandler -> DEBU 231 deregistering event type: BLOCK
2018-02-12 13:34:25.036 UTC [eventhub_producer] Chat -> ERRO 232 error during Chat, stopping handler: rpc error: code = Canceled desc = context canceled
I got stuck debugging this at the following questions:
How do I know what "not found" relates to?
What is networkadmin.card, and should that be created already or is this command creating it? I tried to look for this detail in the tutorial but must be missing it.
Many thanks!

Related

Running Fabcar example returns error: failed to endorse chaincode install

I am on Ubuntu 19.10, installed all the pre-requisites and have downloaded the fabric-samples git repository.
I am following the tutorial on this link
I ran the first-network example and it worked fine. Now, when I am trying to run the fabcar example by running the command ./startFabric.sh javascript, I am getting the following error:
...
2020-02-02 23:51:14.534 UTC [msp.identity] Sign -> DEBU 02c Sign: digest: 8A36B905991D6B72A6F487E93C79D468A35F402D6EB4F51E3323152A03A5B64E
2020-02-02 23:53:04.531 UTC [grpc] infof -> DEBU 02d Client received GoAway with http2.ErrCodeEnhanceYourCalm.
2020-02-02 23:53:04.531 UTC [grpc] HandleSubConnStateChange -> DEBU 02e pickfirstBalancer: HandleSubConnStateChange: 0xc0003e1620, CONNECTING
2020-02-02 23:53:04.531 UTC [grpc] infof -> DEBU 02f transport: loopyWriter.run returning. connection error: desc = "transport is closing"
Error: failed to endorse chaincode install: rpc error: code = Unavailable desc = transport is closing
It looks like the error is generated when it executed:
docker exec -e CORE_PEER_LOCALMSPID=Org2MSP -e CORE_PEER_ADDRESS=peer0.org2.example.com:9051 -e CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/users/Admin#org2.example.com/msp -e CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt cli peer --tls=true --cafile=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem --orderer=orderer.example.com:7050 lifecycle chaincode install fabcar.tar.gz
I assume I aam using the latest version of hyperledger-fabric v2.0.0, since I am in the master branch of the fabric-samples repository. What am I doing wrong?
I had/have the same issue. What worked in my case was what I have described in my own question here - Hyperledger Fabric 2.0 byfn.sh error installing chaincode
Basically, even though there is an error (for some reason I do not know), the chaincode installation process is alive in the background and the chaincode does get installed.
I saw this behavior and put in a sleep statement for 10 minutes (600 s). I still do not know why this behavior is there (hence my question) but I have a workaround for now.
You need to open ports in the firewall.
in ubuntu I fix it using :
$ sudo ufw allow 4422/tcp
repeat for each docker container port,
You can view ports via :
$ docker ps
Have you stopped the first-network at first by using ./byfn.sh down before you jump into fabcar ?
Can I see some logs like docker ps -a and docker logs peer0.org1.example.com?
Also the HLF has recommended to use test-network as a replacement for first-network which is deprecated by now.
BTW, I would use the release branch other than master. Afterall the master branch is always under developing.

Cannot instantiate chaincode on hyperledger fabric network

I tried instantiating well tested chaincode onto my fabric network but got issue summarized as "cannot register chaincode".
There is no trace of chaincode container. I have tested my chaincodes and they pass all the base tests so there is no issue with the code. No matter on whichever orgs peer I run this, instantiation keeps failing.
Can someone help?
Hyperledger fabric version controlling platform mentions a same bug filed but I don't see what solution they came up with (https://jira.hyperledger.org/browse/FAB-14638). They seem to say something about the node version mismatch.
cli logs :
peer chaincode instantiate -o orderer.flightcommand.com:7050 -C flightcommandchannel -l node -n TripCC -v v0 -c '{"Args":["init"]}' -P 'AND ("CapitalcityMSP.member")' 2019-05-08 05:40:55.146 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc 2019-05-08 05:40:55.150 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc Error: could not assemble transaction, err proposal response was not successful, error code 500, msg chaincode registration failed: container exited with 0**
peer logs :
[flightcommandchannel][97cbe635] Exit chaincode: name:"lscc" (98834ms)
2019-05-08 05:42:33.897 UTC [endorser] SimulateProposal -> ERRO 18f [flightcommandchannel][97cbe635] failed to invoke chaincode name:"lscc" , error: container exited with 0
github.com/hyperledger/fabric/core/chaincode.(*RuntimeLauncher).Launch.func1 /opt/gopath/src/github.com/hyperledger/fabric/core/chaincode/runtime_launcher.go:63 runtime.goexit /opt/go/src/runtime/asm_amd64.s:1333 chaincode registration failed
2019-05-08 05:42:33.898 UTC [comm.grpc.server] 1 -> INFO 190 unary call completed grpc.service=protos.Endorser grpc.method=ProcessProposal grpc.peer_address=192.168.96.12:38100 grpc.code=OK grpc.call_duration=1m38.836283s
I have finally found the issue. I missed out a ENV Variable to specify in the peer docker-compose.yaml.
"- CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=network_1.0"
Where network_1.0 is the name of the docker network. Although the error messages was not so descriptive, I took some pain and rebuilt my prevoius project where chaincode deployment did work and compared it with my current project. Found only this piece missing and after adding it, to my surprise, everything worked.
Port 7052 is unlikely to be the problem here. This is the explanation (from core.yaml) about port 7052.
# The endpoint this peer uses to listen for inbound chaincode connections.
# If this is commented-out, the listen address is selected to be
# the peer's address (see below) with port 7052
# chaincodeListenAddress: 0.0.0.0:7052
In your debug output I see "chaincodeBuildlevel":"1.4.1-rc1"
I think you are using Fabric Images for 1.4.1-rc1.
I would suggest removing the Docker Images on your system and replacing with 1.4.1 and then using fabric-shim 1.4.1 too for consistency. This might clear the problem, but will certainly be a better place to continue investigations.
Updated following comments
With Docker Compose, if your group of containers are started on the same Network Bridge (on the same host machine/VM) they can resolve each others' addresses and connect on any port.
The mapping of Ports in the docker-compose.yaml file maps ports from the host computer into the container (not between containers).
Port 7053 used to be used for Events in older versions of Fabric, but it is not used in 1.4.1
The error you have now shown in the comment is a Name Resolution error so not to do with the ports. Perhaps your containers are not on the same Docker Bridge?
I modified the logging level of the peer and got to see something bizzare. Following are the chaincode logs in debug mode.
2019-05-08 11:21:52.980 UTC [endorser] callChaincode -> INFO 04f [flightcommandchannel][d01daf8c] Entry chaincode: name:"lscc"
2019-05-08 11:21:54.424 UTC [peer.chaincode.dev-peer0.onesky.flightcommand.com-AccountChaincode-v0] func2 -> INFO 050
2019-05-08 11:21:54.426 UTC [peer.chaincode.dev-peer0.onesky.flightcommand.com-AccountChaincode-v0] func2 -> INFO 051 > trip#1.0.0 start /usr/local/src
2019-05-08 11:21:54.427 UTC [peer.chaincode.dev-peer0.onesky.flightcommand.com-AccountChaincode-v0] func2 -> INFO 052 > **NODE_ENV=development node account.js "--peer.address" "peer0.onesky.flightcommand.com:7052"**
2019-05-08 11:21:54.428 UTC [peer.chaincode.dev-peer0.onesky.flightcommand.com-AccountChaincode-v0] func2 -> INFO 053
2019-05-08 11:21:55.124 UTC [peer.chaincode.dev-peer0.onesky.flightcommand.com-AccountChaincode-v0] func2 -> INFO 054 2019-05-08T11:21:55.118Z debug [lib/chaincode.js] debug: Starting chaincode using options {"_":[],"peer.address":"peer0.onesky.flightcommand.com:7052","chaincodeBuildlevel":"1.4.1-rc1","chaincodeLoggingLevel":"debug","chaincodeLoggingFormat":"%{color}%{time:2006-01-02 15:04:05.000 MST} [%{module}] %{shortfunc} -> %{level:.4s} %{id:03x}%{color:reset} %{message}","chaincodeIdName":"AccountChaincode:v0","chaincodeLoggingShim":"debug","peerTlsEnabled":"false","grpc.max_send_message_length":-1,"grpc.max_receive_message_length":-1,"grpc.keepalive_time_ms":110000,"grpc.http2.min_time_between_pings_ms":110000,"grpc.keepalive_timeout_ms":20000,"grpc.http2.max_pings_without_data":0,"grpc.keepalive_permit_without_calls":1,"module-path":"/usr/local/src","modulePath":"/usr/local/src","chaincode-id-name":"AccountChaincode:v0","timestamp":"2019-05-08T11:21:55.118Z"}
2019-05-08 11:21:55.128 UTC [peer.chaincode.dev-peer0.onesky.flightcommand.com-AccountChaincode-v0] func2 -> INFO 055 2019-05-08T11:21:55.127Z debug [lib/chaincode.js] debug: Peer URL {"0":"g","1":"r","2":"p","3":"c","4":":","5":"/","6":"/","7":"p","8":"e","9":"e","10":"r","11":"0","12":".","13":"o","14":"n","15":"e","16":"s","17":"k","18":"y","19":".","20":"f","21":"l","22":"i","23":"g","24":"h","25":"t","26":"c","27":"o","28":"m","29":"m","30":"a","31":"n","32":"d","33":".","34":"c","35":"o","36":"m","37":":","38":"7","39":"0","40":"5","41":"2","timestamp":"2019-05-08T11:21:55.127Z"}
2019-05-08 11:21:55.135 UTC [peer.chaincode.dev-peer0.onesky.flightcommand.com-AccountChaincode-v0] func2 -> INFO 056 2019-05-08T11:21:55.135Z info [lib/chaincode.js] info: Registering with peer peer0.onesky.flightcommand.com:7052 as chaincode "AccountChaincode:v0" {"timestamp":"2019-05-08T11:21:55.135Z"}
2019-05-08 11:21:55.147 UTC [peer.chaincode.dev-peer0.onesky.flightcommand.com-AccountChaincode-v0] func2 -> INFO 057 2019-05-08T11:21:55.146Z debug [lib/handler.js] debug: Sending chat message: {"type":1,"payload":{"type":"Buffer","data":[18,19,65,99,99,111,117,110,116,67,104,97,105,110,99,111,100,101,58,118,48]}} {"timestamp":"2019-05-08T11:21:55.146Z"}
2019-05-08 11:21:55.440 UTC [peer.chaincode.dev-peer0.onesky.flightcommand.com-AccountChaincode-v0] func2 -> INFO 058 2019-05-08T11:21:55.437Z error [lib/handler.js] error: Chat stream with peer - on error: "Error: 14 UNAVAILABLE: Name resolution failure\n at Object.exports.createStatusError (/usr/local/src/node_modules/grpc/src/common.js:91:15)\n at ClientDuplexStream._emitStatusIfDone (/usr/local/src/node_modules/grpc/src/client.js:233:26)\n at ClientDuplexStream._receiveStatus (/usr/local/src/node_modules/grpc/src/client.js:211:8)\n at Object.onReceiveStatus (/usr/local/src/node_modules/grpc/src/client_interceptors.js:1306:15)\n at InterceptingListener._callNext (/usr/local/src/node_modules/grpc/src/client_interceptors.js:568:42)\n at InterceptingListener.onReceiveStatus (/usr/local/src/node_modules/grpc/src/client_interceptors.js:618:8)\n at /usr/local/src/node_modules/grpc/src/client_interceptors.js:1123:18" {"timestamp":"2019-05-08T11:21:55.437Z"}
2019-05-08 11:21:55.617 UTC [dockercontroller] func2 -> INFO 059 Container dev-peer0.onesky.flightcommand.com-AccountChaincode-v0 has closed its IO channel
2019-05-08 11:21:56.091 UTC [endorser] callChaincode -> INFO 05a [flightcommandchannel][d01daf8c] Exit chaincode: name:"lscc" (3111ms)
2019-05-08 11:21:56.091 UTC [endorser] SimulateProposal -> ERRO 05b [flightcommandchannel][d01daf8c] failed to invoke chaincode name:"lscc" , error: container exited with 0
github.com/hyperledger/fabric/core/chaincode.(*RuntimeLauncher).Launch.func1
/opt/gopath/src/github.com/hyperledger/fabric/core/chaincode/runtime_launcher.go:63
runtime.goexit
/opt/go/src/runtime/asm_amd64.s:1333
chaincode registration failed
2019-05-08 11:21:56.091 UTC [comm.grpc.server] 1 -> INFO 05c unary call completed grpc.service=protos.Endorser grpc.method=ProcessProposal grpc.peer_address=172.25.0.4:59932 grpc.code=OK grpc.call_duration=3.1157286s
So here lies the problem. My peer listens on port 7051, not 7052. Ideally the command should look like "NODE_ENV=development node account.js "--peer.address" "peer0.onesky.flightcommand.com:7051"". I have no idea from where it is getting 7052.
P.S.
I added following to get a better overview of the issue in the chaincode instantiation.
FABRIC_LOGGING_SPEC=info
CORE_CHAINCODE_LOGGING_SHIM=debug
CORE_CHAINCODE_LOGGING_LEVEL=debug
core.yaml says
# The endpoint this peer uses to listen for inbound chaincode connections.
# If this is commented-out, the listen address is selected to be
# the peer's address (see below) with port 7052
# chaincodeListenAddress: 0.0.0.0:7052
# The endpoint the chaincode for this peer uses to connect to the peer.
# If this is not specified, the chaincodeListenAddress address is selected.
# And if chaincodeListenAddress is not specified, address is selected from
# peer listenAddress.
# chaincodeAddress: 0.0.0.0:7052
So I concluded since both are commented, 7051 is used as the address to listen to chaincode.
I faced exactly the same problem whenever I tried to instantiate the chaincode, I got this error
peer logs:
2019-05-09 04:05:38.285 EDT [endorser] SimulateProposal -> ERRO 15c [mychannel][03349c15] failed to invoke chaincode name:"lscc" , error: container exited with 1
github.com/hyperledger/fabric/core/chaincode.(*RuntimeLauncher).Launch.func1
/home/alex/go/src/github.com/hyperledger/fabric/core/chaincode/runtime_launcher.go:63
runtime.goexit
/usr/local/go/src/runtime/asm_amd64.s:1337
chaincode registration failed
I was able to fix it by changing build.gradle file, make sure in your build.gradle you have set Main-Class in manifest attributes to your main java file.
shadowJar {
baseName = 'chaincode'
version = null
classifier = null
manifest {
attributes 'Main-Class': 'org.hyperledger.fabric.chaincode.XXX'
}
}
Where XXX is the XXX.java file where your main() function is defined
Not sure how can this be done in node. But I hope this will give you the idea.
i faced the same issue not find any solution yet.
2021-03-25 04:53:55.840 UTC [endorser] SimulateProposal -> ERRO 046 failed to invoke chaincode bankcc, error: container exited with 0
github.com/hyperledger/fabric/core/chaincode.(*RuntimeLauncher).Launch.func1
/go/src/github.com/hyperledger/fabric/core/chaincode/runtime_launcher.go:118
and this my chaincode container logs
Error starting Marbles02 chaincode: ccid must be specified
but i specified the ccid here
server := &shim.ChaincodeServer{
//CCID: ccid,
CCID: os.Getenv("CHAINCODE_CCID"),
Address: os.Getenv("CHAINCODE_ADDRESS"),
CC: chaincode,
TLSProps: shim.TLSProperties{
Disabled: true,
},
I had the same problem,and I have sloved it by change peer env,and I think this problem was caused by CORE_PEER_ADDRESSAUTODETECT,actual,I dont know why .
I set CORE_PEER_ADDRESSAUTODETECT=true ,commented CORE_PEER_CHAINCODEADDRESS and CORE_PEER_CHAINCODELISTENADDRESS,It is work.
my peer env like this :
CORE_PEER_ADDRESSAUTODETECT=true
#CORE_PEER_CHAINCODEADDRESS=peer0.org1.example.com:30012
#CORE_PEER_CHAINCODELISTENADDRESS=0.0.0.0:30012

Error: Error getting chaincode code chaincode: <go, [env]>: failed with error: "exec: not started"

I have created hyperledger in azure blockchain and created fabric-ca, orderer and 2 peer nodes. I am able to create channel and 2 peers joined in the channel. I am not able to install chaincode. The commands are executed form Git bash. Getting below error while running the command from peer node. Please help...
root#d62e3aedc701:/# peer chaincode install -n balcc -v 1.0 -p Chaincode/fabric-samples/balance-transfer/artifacts/src/github.com/example_cc/go/
2018-05-25 05:32:42.702 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc
2018-05-25 05:32:42.702 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc
Error: Error getting chaincode code chaincode: : failed with error: "exec: not started"
In my case, I just reinstall go and this problem fix.

REQUEST_TIMEOUT when trying to start business network

When I try to start my business network app on composer v1.1 I get a timeout after 5 minutes with the following message:
2018-03-31 12:54:39.183 UTC [chaincode] Launch -> ERRO 4c3
launchAndWaitForRegister failed: timeout expired while starting
chaincode
sre-frontend-app:0.0.1(networkid:dev,peerid:peer0.org1.example.com,tx:ab15fb53ed8e1de99ad7253ffa2ab4b68bd787b8a9561c9b422bc203e14fc048)
There is also another error in the logs:
2018-03-31 12:54:39.183 UTC [endorser] simulateProposal -> ERRO 4c5
[composerchannel][ab15fb53] failed to invoke chaincode name:"lscc" ,
error: timeout expired while starting chaincode
sre-frontend-app:0.0.1(networkid:dev,peerid:peer0.org1.example.com,tx:ab15fb53ed8e1de99ad7253ffa2ab4b68bd787b8a9561c9b422bc203e14fc048)
Any idea what might be happening? I have tried changing localhost to 0.0.0.0 when building the PeerAdmin card and even tried changing the listening address of fabric-ca to localhost based on reading other's solutions but these changes did not work for me.
Any other suggestions?? Do I need to extend the timeouts - and how I would do that?
Thanks in advance :)

Timeout expired while starting chaincode error when instantiating chaincode

When I run the example here: fabric e2e examples it fails at instantiating chaincode. You can see a screenshot here of the error:
I can see that the chaincode instance/container was started but exited shortly after.
Any ideas on why this is happening and how to resolve?
I had the same issue while testing fabric-samples balance-transfer and fabcar samples, and fabric PTE testing.
Solved it by setting CORE_PEER_CHAINCODELISTENADDRESS to peer's containername:port in the docker compose file.
eg., CORE_PEER_CHAINCODELISTENADDRESS=peer0.org1.example.com:7052
Issue: Chaincode container (which gets created and killed after certain time) log shows below error, when inspected with docker logs CONTAINER-ID.
UTC [shim] userChaincodeStreamGetter -> ERRO 001 x509: cannot validate certificate for 172.18.0.5 because it doesn't contain any IP SANs
error trying to connect to local peer
github.com/hyperledger/fabric/core/chaincode/shim.userChaincodeStreamGetter
/opt/gopath/src/github.com/hyperledger/fabric/core/chaincode/shim/chaincode.go:109
github.com/hyperledger/fabric/core/chaincode/shim.Start
/opt/gopath/src/github.com/hyperledger/fabric/core/chaincode/shim/chaincode.go:148
main.main
/chaincode/input/src/github.com/example_cc/go/example_cc.go:199
runtime.main
/opt/go/src/runtime/proc.go:185
runtime.goexit
/opt/go/src/runtime/asm_amd64.s:2337
2017-12-26 09:59:52.823 UTC [example_cc0] Errorf -> ERRO 002 Error starting Simple chaincode: error trying to connect to local peer: x509: cannot validate certificate for 172.18.0.5 because it doesn't contain any IP SANs

Resources