Hello Everyone i am working on setup of fabric default first-network in kubernetes. But when i am instantiate the chaincode it gives me error. Please check below are my peer logs.
2019-07-22 07:25:02.134 UTC [endorser] SimulateProposal -> ERRO 066 [mychannel][c4b4e2ae] 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
Getting this error on Cli :-
2019-07-22 07:24:58.263 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc
2019-07-22 07:24:58.264 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
Once check if all your docker containers are up and running and if you are simply running the sample network without making any changes to the smart contract and the docker files then you can simply stop your network and freshly start the network(it worked in my case).
I have check with my configuration files it was due to wrong CORE_PEER_CHAINCODELISTENADDRESS env variable value for the peer.
Related
I have a hyperledger fabric network version 2.4.4 running on Kubernetes. The peers and other components are running behind istio ingress. The chaincode is running on dind (docker-in-docker) container and connects to peer through its URL. The problem is the chaincode connection is being dropped after few minutes. Below are the logs:
2022-07-14T04:31:13.057Z info [c-api:lib/handler.js] [assetschannel-ddc183b4] Calling chaincode Invoke() succeeded. Sending COMPLETED message back to peer
2022-07-14T04:33:04.197Z error [c-api:lib/handler.js] Chat stream with peer - on error: %j "Error: 14 UNAVAILABLE: Connection dropped\n at Object.callErrorFromStatus (/usr/local/src/node_modules/#grpc/grpc-js/build/src/call.js:31:26)\n at Object.onReceiveStatus (/usr/local/src/node_modules/#grpc/grpc-js/build/src/client.js:391:49)\n at Object.onReceiveStatus (/usr/local/src/node_modules/#grpc/grpc-js/build/src/client-interceptors.js:328:181)\n at /usr/local/src/node_modules/#grpc/grpc-js/build/src/call-stream.js:187:78\n at processTicksAndRejections (node:internal/process/task_queues:78:11)"
I did set the following environment variables in the peer pod to keep the connection alive:
CORE_CHAINCODE_KEEPALIVE: 60000
CORE_PEER_KEEPALIVE_CLIENT_INTERVAL: 600s
CORE_PEER_KEEPALIVE_CLIENT_TIMEOUT: 2s
CORE_PEER_KEEPALIVE_DELIVERYCLIENT_INTERVAL: 20s
CORE_PEER_KEEPALIVE_MININTERVAL: 15s
but this did not resolve the issue.
Any suggestions would be appreciated.
It appears to be an issue with aws elb. The idle timeout was set to 60s which was breaking the connection between chaincode and peer when there was no communication between them. Increasing this time fixed the issue.
I have been trying to deploy a hyperledger fabric model with 3 CAs 1 orderer and 2 peer nodes. I am able to create the channel with OSADMIN command of fabric but when I try to join the channel with peer node, I get Error: error getting endorser client for channel: endorser client failed to connect to peer-govt:7051: failed to create new connection: context...... .
Here are the logs from terminal (local host machine):
2021-06-01 06:38:54.509 UTC [common.tools.configtxgen] main -> INFO 001 Loading configuration
2021-06-01 06:38:54.522 UTC [common.tools.configtxgen.localconfig] completeInitialization -> INFO 002 orderer type: etcdraft
2021-06-01 06:38:54.522 UTC [common.tools.configtxgen.localconfig] completeInitialization -> INFO 003 Orderer.EtcdRaft.Options unset, setting to tick_interval:"500ms" election_tick:10 heartbeat_tick:1 max_inflight_blocks:5 snapshot_interval_size:16777216
2021-06-01 06:38:54.522 UTC [common.tools.configtxgen.localconfig] Load -> INFO 004 Loaded configuration: /etc/hyperledger/clipod/configtx/configtx.yaml
2021-06-01 06:38:54.712 UTC [common.tools.configtxgen] doOutputBlock -> INFO 005 Generating genesis block
2021-06-01 06:38:54.712 UTC [common.tools.configtxgen] doOutputBlock -> INFO 006 Creating application channel genesis block
2021-06-01 06:38:54.712 UTC [common.tools.configtxgen] doOutputBlock -> INFO 007 Writing genesis block
cli-dd4cc5fbf-pdcgb
Status: 201
{
"name": "commonchannel",
"url": "/participation/v1/channels/commonchannel",
"consensusRelation": "consenter",
"status": "active",
"height": 1
}
cli-dd4cc5fbf-pdcgb
Error: error getting endorser client for channel: endorser client failed to connect to peer-govt:7051: failed to create new connection: context deadline exceeded
command terminated with exit code 1
Error: error getting endorser client for channel: endorser client failed to connect to peer-general:9051: failed to create new connection: context deadline exceeded
command terminated with exit code 1
One thing to note down here is I am using Kubernetes and service CLUSTER_IP for all the PODS.
here are logs from one of the PEER POD (same for other)
2021-06-01 06:38:42.180 UTC [nodeCmd] registerDiscoveryService -> INFO 01b Discovery service activated
2021-06-01 06:38:42.180 UTC [nodeCmd] serve -> INFO 01c Starting peer with ID=[peer-govt], network ID=[dev], address=[peer-govt:7051]
2021-06-01 06:38:42.180 UTC [nodeCmd] func6 -> INFO 01d Starting profiling server with listenAddress = 0.0.0.0:6060
2021-06-01 06:38:42.180 UTC [nodeCmd] serve -> INFO 01e Started peer with ID=[peer-govt], network ID=[dev], address=[peer-govt:7051]
2021-06-01 06:38:42.181 UTC [kvledger] LoadPreResetHeight -> INFO 01f Loading prereset height from path [/var/hyperledger/production/ledgersData/chains]
2021-06-01 06:38:42.181 UTC [blkstorage] preResetHtFiles -> INFO 020 No active channels passed
2021-06-01 06:38:56.006 UTC [core.comm] ServerHandshake -> ERRO 021 Server TLS handshake failed in 24.669µs with error tls: first record does not look like a TLS handshake server=PeerServer remoteaddress=172.17.0.1:13258
2021-06-01 06:38:57.007 UTC [core.comm] ServerHandshake -> ERRO 022 Server TLS handshake failed in 17.772µs with error tls: first record does not look like a TLS handshake server=PeerServer remoteaddress=172.17.0.1:29568
2021-06-01 06:38:58.903 UTC [core.comm] ServerHandshake -> ERRO 023 Server TLS handshake failed in 13.581µs with error tls: first record does not look like a TLS handshake server=PeerServer remoteaddress=172.17.0.1:32615
To overcome this issue, I tried disabling the TLS by setting CORE_PEER_TLS_ENABLED to FALSE
then the proposal gets submitted but the orderer POD throws the same error of TLS handshake failed.........
Here are the commands I am using to join the channel from cli pod:
kubectl -n hyperledger -it exec $CLI_POD -- sh -c "export FABRIC_CFG_PATH=/etc/hyperledger/clipod/config && export CORE_PEER_LOCALMSPID=GeneralMSP && export CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/clipod/organizations/peerOrganizations/general.example.com/peers/peer0.general.example.com/tls/ca.crt && export CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/clipod/organizations/peerOrganizations/general.example.com/users/Admin#general.example.com/msp && export CORE_PEER_ADDRESS=peer-general:9051 && peer channel join -b /etc/hyperledger/clipod/channel-artifacts/$CHANNEL_NAME.block -o orderer:7050 --tls --cafile /etc/hyperledger/clipod/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem"
I am stuck on this problem, any help will be appreciated.
Thank you
I have fixed it. The issue I was facing was because of not setting the CORE_PEER_TLS_ENABLED = true for CLI pod.
One thing I have got learn from this whole model, whenever you see TLS issue, first to check for would be checking CORE_PEER_TLS_ENABLED variable. Make sure you have set it for all the pods or containers you are trying to interact with. The case can be false(for no TLS) or true(for using TLS) depending on your deployment.
Other things to keep in mind is using the correct variables of fabric including FABRIC_CFG_PATH, CORE_PEER_LOCALMSPID, CORE_PEER_TLS_ROOTCERT_FILE, CORE_PEER_MSPCONFIGPATH and some others depending on your command.
After starting the image, orderer cannot start normally
2021-02-02 11:17:13.897 UTC [orderer.common.server] Main -> PANI 005 Failed validating bootstrap block: initializing channelconfig failed: could not create channel Consortiums sub-group config: Attempted to define two different versions of MSP: OrgcppMSP
panic: Failed validating bootstrap block: initializing channelconfig failed: could not create channel Consortiums sub-group config: Attempted to define two different versions of MSP: OrgcppMSP```
I am presently working on hyperledger. I have created a 4 organization network and I am trying create a channel from cli container. Below is the command
peer channel create -o orderer.example.com:7050 -c mychannel -f channel.tx
But i am getting an error as mentioned below:
2019-10-18 10:56:58.922 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
Error: rpc error: code = Unavailable desc = transport is closing
please help me solve this problem, Thanks in advance
I'm following the tutorial as-is given here - http://hyperledger-fabric.readthedocs.io/en/latest/write_first_app.html
I'm working on Mac OS : High Sierra.
I'm getting error as below:
Error: Error endorsing chaincode: rpc error: code = Unknown desc =
timeout expired while starting chaincode
fabcar:1.0(networkid:dev,peerid:peer0.org1.example.com,tx:c51ca82792bd8823a60edf9c31a550836fc8932a90a2a4cec8b9c37ba24c46ea)
Thanks for the help.
command: ./startFabric.sh node
complete logs:
# don't rewrite paths for Windows Git Bash users
export MSYS_NO_PATHCONV=1
docker-compose -f docker-compose.yml down
Stopping peer0.org1.example.com ... done
Stopping orderer.example.com ... done
Stopping ca.example.com ... done
Stopping couchdb ... done
Removing peer0.org1.example.com ... done
Removing orderer.example.com ... done
Removing ca.example.com ... done
Removing couchdb ... done
Removing network net_basic
docker-compose -f docker-compose.yml up -d ca.example.com orderer.example.com
peer0.org1.example.com couchdb
Creating network "net_basic" with the default driver
Creating orderer.example.com ... done
Creating ca.example.com ... done
Creating couchdb ... done
Creating peer0.org1.example.com ... done
# wait for Hyperledger Fabric to start
# incase of errors when running later commands, issue export
FABRIC_START_TIMEOUT=<larger number>
export FABRIC_START_TIMEOUT=10
#echo ${FABRIC_START_TIMEOUT}
sleep ${FABRIC_START_TIMEOUT}
# Create the channel
docker exec -e "CORE_PEER_LOCALMSPID=Org1MSP" -e
"CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/msp/users/Admin#org1.example.com/msp"
peer0.org1.example.com peer channel create -o orderer.example.com:7050 -c
mychannel -f /etc/hyperledger/configtx/channel.tx
2018-05-03 17:56:04.275 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser
and orderer connections initialized
2018-05-03 17:56:04.392 UTC [channelCmd] InitCmdFactory -> INFO 002 Endorser
and orderer connections initialized
2018-05-03 17:56:04.621 UTC [main] main -> INFO 003 Exiting.....
# Join peer0.org1.example.com to the channel.
docker exec -e "CORE_PEER_LOCALMSPID=Org1MSP" -e
"CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/msp/users/Admin#org1.example.com/msp"
peer0.org1.example.com peer channel join -b mychannel.block
2018-05-03 17:56:04.861 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser
and orderer connections initialized
2018-05-03 17:56:05.018 UTC [channelCmd] executeJoin -> INFO 002 Successfully
submitted proposal to join channel
2018-05-03 17:56:05.018 UTC [main] main -> INFO 003 Exiting.....
Creating cli ... done
2018-05-03 17:56:06.745 UTC [msp] GetLocalMSP -> DEBU 001 Returning existing
local MSP
2018-05-03 17:56:06.745 UTC [msp] GetDefaultSigningIdentity -> DEBU 002
Obtaining default signing identity
2018-05-03 17:56:06.746 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 003
Using default escc
2018-05-03 17:56:06.746 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 004
Using default vscc
2018-05-03 17:56:06.746 UTC [chaincodeCmd] getChaincodeSpec -> DEBU 005 java
chaincode disabled
2018-05-03 17:56:06.749 UTC [node-platform] GetDeploymentPayload -> DEBU 006
Packaging node.js project from path /opt/gopath/src/github.com/fabcar/node
2018-05-03 17:56:06.749 UTC [container] WriteFolderToTarPackage -> INFO 007
rootDirectory = /opt/gopath/src/github.com/fabcar/node
2018-05-03 17:56:06.752 UTC [container] WriteFileToPackage -> DEBU 008 Writing
file to tarball: src/fabcar.js
2018-05-03 17:56:06.762 UTC [container] WriteFileToPackage -> DEBU 009 Writing
file to tarball: src/package.json
2018-05-03 17:56:06.765 UTC [msp/identity] Sign -> DEBU 00a Sign: plaintext:
0A9C070A5C08031A0C08B69AADD70510...C1F84F000000FFFF22CB6E3A001E0000
2018-05-03 17:56:06.765 UTC [msp/identity] Sign -> DEBU 00b Sign: digest:
CAD5821E4354EA410ED3567BE82D12813B469783B96FB8EEE2A1B4416A323B76
2018-05-03 17:56:06.816 UTC [chaincodeCmd] install -> DEBU 00c Installed
remotely response:<status:200 payload:"OK" >
2018-05-03 17:56:06.816 UTC [main] main -> INFO 00d Exiting.....
2018-05-03 17:56:07.116 UTC [msp] GetLocalMSP -> DEBU 001 Returning existing
local MSP
2018-05-03 17:56:07.116 UTC [msp] GetDefaultSigningIdentity -> DEBU 002
Obtaining default signing identity
2018-05-03 17:56:07.121 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 003
Using default escc
2018-05-03 17:56:07.121 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 004
Using default vscc
2018-05-03 17:56:07.123 UTC [chaincodeCmd] getChaincodeSpec -> DEBU 005 java
chaincode disabled
2018-05-03 17:56:07.125 UTC [msp/identity] Sign -> DEBU 006 Sign: plaintext:
0AA6070A6608031A0B08B79AADD70510...324D53500A04657363630A0476736363
2018-05-03 17:56:07.126 UTC [msp/identity] Sign -> DEBU 007 Sign: digest:
7574A79A053907A7CD90E656B612CE20AA80E95067403F097B3F6185EC25D329
Error: Error endorsing chaincode: rpc error: code = Unknown desc = timeout
expired while starting chaincode fabcar:1.0(networkid:dev,peerid:peer0.org1.example.com,tx:c51ca82792bd8823a60edf9c31a550836fc8932a90a2a4cec8b9c37ba24c46ea)
Usage:
peer chaincode instantiate [flags]
Flags:
-C, --channelID string The channel on which this command should be executed
--collections-config string The file containing the configuration for the chaincode's collection
-c, --ctor string Constructor message for the chaincode in JSON format (default "{}")
-E, --escc string The name of the endorsement system chaincode to be used for this chaincode
-l, --lang string Language the chaincode is written in (default "golang")
-n, --name string Name of the chaincode
-P, --policy string The endorsement policy associated to this chaincode
-v, --version string Version of the chaincode specified in install/instantiate/upgrade commands
-V, --vscc string The name of the verification system chaincode to be used for this chaincode
Global Flags:
--cafile string Path to file containing PEM-encoded
trusted certificate(s) for the ordering endpoint
--certfile string Path to file containing PEM-encoded
X509 public key to use for mutual TLS communication with the orderer endpoint
--clientauth Use mutual TLS when communicating with
the orderer endpoint
--keyfile string Path to file containing PEM-encoded
private key to use for mutual TLS communication with the orderer endpoint
--logging-level string Default logging level and overrides,
see core.yaml for full syntax
-o, --orderer string Ordering service endpoint
--ordererTLSHostnameOverride string The hostname override to use when
validating the TLS connection to the orderer.
--tls Use TLS when communicating with the
orderer endpoint
--transient string Transient map of arguments in JSON
encoding
Timeout issue is a common issue that occurs during instantiation of a chaincode. What can help you is that after issuing the
peer chaincode instantiate
command or when the logs reach to this state
[chaincodeCmd] install -> DEBU 00c Installed remotely response:<status:200 payload:"OK" >
, in a separate terminal, list the docker containers using
docker ps
You'll notice a container with a random name that you've never heard before and its image (fabric-ccenv) shows that its a secure docker container that is started for establishing chaincode environment. Note the name of the container and tail its logs using
docker logs -f <container-name-here>
now you'll see in the logs that its actually resolving the npm dependencies listed in the chaincode's package.json. The dependency resolution sometimes takes a bit larger than the expected time and hence the fabric runtime exits with the timeout issue. If the fabric script exits with the timeout issue, then you have to exec into the peer docker container and execute the
peer chaincode instantiate [flags]
command manually providing necessary flags and params. In case the dependencies are perfectly resolved, the chaincode will start within seconds this time.
I faced a similar problem. I resolved it by ensuring that docker containers start in the correct order. For example, the orderer container should start before the peers start. If the containers don't start in the right order, I faced problems while creating the channel (SERVICE_UNAVAILABLE) or while instantiating the chaincode(time out error).
I faced the same error. In my case the problem was that the name of project folder was not the same as the network name, these names are somehow related and must be the same. I renamed the folder and the problem was gone.