Hyperledger Fabric issue - "Error starting container" - hyperledger-fabric

I am running hyper-ledger fabric on an ubuntu VM on a Mac OSX running Parallels, downloaded docker, got everything setup, but when running the first network example (command ./byfn.sh -m up) I am getting this error
===================== Chaincode is installed on remote peer PEER2 =====================
Instantiating chaincode on org2/peer2...
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
CORE_PEER_TLS_KEY_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.key
CORE_PEER_LOCALMSPID=Org2MSP
CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
CORE_PEER_TLS_CERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.crt
CORE_PEER_TLS_ENABLED=true
CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/users/Admin#org2.example.com/msp
CORE_PEER_ID=cli
CORE_LOGGING_LEVEL=DEBUG
CORE_PEER_ADDRESS=peer0.org2.example.com:7051
2017-09-07 20:15:16.984 UTC [msp] GetLocalMSP -> DEBU 001 Returning existing local MSP
2017-09-07 20:15:16.984 UTC [msp] GetDefaultSigningIdentity -> DEBU 002 Obtaining default signing identity
2017-09-07 20:15:16.987 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 003 Using default escc
2017-09-07 20:15:16.987 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 004 Using default vscc
2017-09-07 20:15:16.988 UTC [msp/identity] Sign -> DEBU 005 Sign: plaintext: 0A91070A6708031A0C08D4D1C6CD0510...324D53500A04657363630A0476736363
2017-09-07 20:15:16.988 UTC [msp/identity] Sign -> DEBU 006 Sign: digest: 17D7F0C37473394040F19251CCA253B1ECA95F7AD65AF27EFA92DE1F10D94A9B
Error: Error endorsing chaincode: rpc error: code = Unknown desc = Error starting container: Get https://registry-1.docker.io/v2/hyperledger/fabric-baseos/manifests/x86_64-0.3.2: dial tcp: lookup registry-1.docker.io on 127.0.1.1:53: read udp 127.0.0.1:54547->127.0.1.1:53: i/o timeout
Usage:
peer chaincode instantiate [flags]
Flags:
-C, --channelID string The channel on which this command should be executed (default "testchainid")
-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
--logging-level string Default logging level and overrides, see core.yaml for full syntax
-o, --orderer string Ordering service endpoint
--test.coverprofile string Done (default "coverage.cov")
--tls Use TLS when communicating with the orderer endpoint
!!!!!!!!!!!!!!! Chaincode instantiation on PEER2 on channel 'mychannel' failed !!!!!!!!!!!!!!!!
========= ERROR !!! FAILED to execute End-2-End Scenario ===========

Error: Error endorsing chaincode: rpc error: code = Unknown desc = Error starting container: Get https://registry-1.docker.io/v2/hyperledger/fabric-baseos/manifests/x86_64-0.3.2: dial tcp: lookup registry-1.docker.io on 127.0.1.1:53: read udp 127.0.0.1:54547->127.0.1.1:53: i/o timeout
Like it says in the error you have a connectivity problem from your VM, seems connection to external IPs is lagging.

Related

Hyperledger - peer unable to instantiate chaincode after joining channel

I currently have a running Kafka-based hyperledger running on docker.
The full container list is as such:
2x orderer
2x peer
1x certificate-authority
3x zookeeper
4x kafka nodes
1x cli tools
I have sucessfully created a channel using cli by the following command
docker exec -e "CORE_PEER_LOCALMSPID=Org1MSP" -e "CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/fabric/msp/users/Admin#company/msp" peer0.company peer channel create -o orderer0.company:7050 -c messagebus -f /etc/hyperledger/configtx/channel.tx
docker exec -e "CORE_PEER_LOCALMSPID=Org1MSP" -e "CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/fabric/msp/users/Admin#company/msp" peer0.company peer channel join -b messagebus.block
I can see the peer is joined using the following command:
docker exec cli peer channel list
2019-01-07 16:54:41.784 UTC [channelCmd] InitCmdFactory -> INFO 003 Endorser and orderer connections initialized
Channels peers has joined:
messagebus
I then want to init and instantiate my chaincode as such
#install the chaincode
docker exec -e "CORE_PEER_LOCALMSPID=Org1MSP" -e "CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/company/users/Admin#company/msp" cli peer chaincode install -n testnet -v 1.0 -p "$CC_SRC_PATH" -l "$LANGUAGE"
2019-01-07 16:46:23.154 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 003 Using default escc
2019-01-07 16:46:23.154 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 004 Using default vscc
2019-01-07 16:46:23.615 UTC [chaincodeCmd] install -> INFO 005 Installed remotely response:<status:200 payload:"OK" >
#instantiate the chaincode
docker exec -e "CORE_PEER_LOCALMSPID=Org1MSP" -e "CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/company/users/Admin#company/msp" cli peer chaincode instantiate -o orderer0.company:7050 -C messagebus -n testnet -l "$LANGUAGE" -v 1.0 -c '{"Args":[""]}' -P "OR ('Org1MSP.member','Org2MSP.member')"
2019-01-07 16:46:24.210 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 003 Using default escc
2019-01-07 16:46:24.210 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 004 Using default vscc
Error: error endorsing chaincode: rpc error: code = Unknown desc = access denied: channel [messagebus] creator org [Org1MSP]
As the final line shows, the access is denied to the channel.
I am also unable to join a Java SDK client to the channel and receive similar access denied errors.
I see the following logs in the peer0 container:
2019-01-07 16:46:23.611 UTC [endorser] callChaincode -> INFO 0f1 [][bfb2e2d4] Entry chaincode: name:"lscc"
2019-01-07 16:46:23.614 UTC [lscc] executeInstall -> INFO 0f2 Installed Chaincode [gmex] Version [1.0] to peer
2019-01-07 16:46:23.614 UTC [endorser] callChaincode -> INFO 0f3 [][bfb2e2d4] Exit chaincode: name:"lscc" (2ms)
2019-01-07 16:46:23.614 UTC [comm.grpc.server] 1 -> INFO 0f4 unary call completed {"grpc.start_time": "2019-01-07T16:46:23.61Z", "grpc.service": "protos.Endorser", "grpc.method": "ProcessProposal", "grpc.peer_address": "XXX.XXX.X.XXX:123", "grpc.code": "OK", "grpc.call_duration": "3.771114ms"}
2019-01-07 16:46:24.214 UTC [protoutils] ValidateProposalMessage -> WARN 0f5 channel [messagebus]: MSP error: the supplied identity is not valid: x509: certificate signed by unknown authority (possibly because of "x509: ECDSA verification failure" while trying to verify candidate authority certificate "ca.company")
this leads me to believe the peer is not correctly setup... however it is able to create the channel successfully.
Any pointers would be appreciated

Hyperledger Fabric: Error modifying example app from the docs

I got the "Write your First Application" stuff working great.
So I copied the files and renamed stuff to support a different chaincode app.
When I run startFabric.sh node (since my source is javascript), I eventually get:
# don't rewrite paths for Windows Git Bash users
export MSYS_NO_PATHCONV=1
docker-compose -f docker-compose.yml down
Removing network net_basic
WARNING: Network net_basic not found.
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 couchdb
Creating orderer.example.com
Creating ca.example.com
Creating peer0.org1.example.com
# 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-08-18 06:23:14.962 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
2018-08-18 06:23:14.983 UTC [cli/common] readBlock -> INFO 002 Got status: &{NOT_FOUND}
2018-08-18 06:23:14.984 UTC [channelCmd] InitCmdFactory -> INFO 003 Endorser and orderer connections initialized
2018-08-18 06:23:15.187 UTC [cli/common] readBlock -> INFO 004 Received block: 0
# 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-08-18 06:23:15.407 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
2018-08-18 06:23:15.481 UTC [channelCmd] executeJoin -> INFO 002 Successfully submitted proposal to join channel
Creating cli
2018-08-18 06:23:16.314 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc
2018-08-18 06:23:16.314 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc
2018-08-18 06:23:16.316 UTC [container] WriteFolderToTarPackage -> INFO 003 rootDirectory = /opt/gopath/src/github.com/permissioned-jpgs/node
2018-08-18 06:23:16.353 UTC [chaincodeCmd] install -> INFO 004 Installed remotely response:<status:200 payload:"OK" >
2018-08-18 06:23:16.590 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc
2018-08-18 06:23:16.590 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc
Error: endorsement failure during invoke. chaincode result: <nil>
Notice endorsement fails. Any ideas? I've checked everything I can think of and I'm completely stumped. Thanks!
My Docker ignorance is showing.
I just needed to view the logs for the peer node I was interacting with by doing: sudo docker logs -f dev-peer0.org1.example.com-fabcar-1.0
These logs showed me it was a problem with the Javascript I had written when customizing the chaincode, not a Fabric network config issue like I previously thought.

Fail to run fabric first network

When i am running the first network in fabric-samples by running the given command
./byfn.sh -m up
The client seems that it cannot do the query and produce the following console messages.
CORE_PEER_ADDRESS=peer0.org1.example.com:7051
Attempting to Query PEER0 ...3 secs
Attempting to Query PEER0 ...6 secs
Attempting to Query PEER0 ...9 secs
Attempting to Query PEER0 ...13 secs
Attempting to Query PEER0 ...16 secs
Attempting to Query PEER0 ...19 secs
Attempting to Query PEER0 ...22 secs
Attempting to Query PEER0 ...25 secs
Attempting to Query PEER0 ...28 secs
Attempting to Query PEER0 ...31 secs
Attempting to Query PEER0 ...34 secs
Attempting to Query PEER0 ...37 secs
Attempting to Query PEER0 ...40 secs
Attempting to Query PEER0 ...43 secs
Attempting to Query PEER0 ...46 secs
Attempting to Query PEER0 ...49 secs
Attempting to Query PEER0 ...52 secs
Attempting to Query PEER0 ...55 secs
Attempting to Query PEER0 ...58 secs
Attempting to Query PEER0 ...61 secs
2017-09-14 08:28:34.964 UTC [msp] GetLocalMSP -> DEBU 001 Returning existing local MSP
2017-09-14 08:28:34.964 UTC [msp] GetDefaultSigningIdentity -> DEBU 002 Obtaining default signing identity
2017-09-14 08:28:34.964 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 003 Using default escc
2017-09-14 08:28:34.964 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 004 Using default vscc
2017-09-14 08:28:34.965 UTC [msp/identity] Sign -> DEBU 005 Sign: plaintext: 0A95070A6708031A0C08B2FBE8CD0510...6D7963631A0A0A0571756572790A0161
2017-09-14 08:28:34.965 UTC [msp/identity] Sign -> DEBU 006 Sign: digest: D5683DD12A1733A407FA3684BA9681BDA0B2FE178BCF313A2D9A96F31E6EDAD6
Error: Error endorsing query: rpc error: code = Unknown desc = could not find chaincode with name 'mycc' - make sure the chaincode mycc has been successfully instantiated and try again - <nil>
Usage:
peer chaincode query [flags]
Flags:
-C, --channelID string The channel on which this command should be executed (default "testchainid")
-c, --ctor string Constructor message for the chaincode in JSON format (default "{}")
-x, --hex If true, output the query value byte array in hexadecimal. Incompatible with --raw
-n, --name string Name of the chaincode
-r, --raw If true, output the query value as raw bytes, otherwise format as a printable string
-t, --tid string Name of a custom ID generation algorithm (hashing and decoding) e.g. sha256base64
Global Flags:
--cafile string Path to file containing PEM-encoded trusted certificate(s) for the ordering endpoint
--logging-level string Default logging level and overrides, see core.yaml for full syntax
-o, --orderer string Ordering service endpoint
--test.coverprofile string Done (default "coverage.cov")
--tls Use TLS when communicating with the orderer endpoint
-v, --version Display current version of fabric peer server
!!!!!!!!!!!!!!! Query result on PEER0 is INVALID !!!!!!!!!!!!!!!!
================== ERROR !!! FAILED to execute End-2-End Scenario ==============
I CAN successfully launch it previously. But now i can not work at all! I try to put the network down and restart again. But it still does not work!
Anyone to help me?
I'd suggest cleaning things up and getting the latest images, binaries and updating your clone of the fabric-samples repo per http://hyperledger-fabric.readthedocs.io/en/latest/samples.html.
If you've already done that, you might want to make sure you run
./byfn.sh -m generate again

error while adding new organization in hyperledger fabric -1.0

I have downloaded and setup the hyperledger fabric network in my CentOs system. I am able to start the first network with default two organization (Org1 and Org2). Also each organization is having two peers(peer0, peer1). Now I am trying add one more Organization with one peer.
I have made changes in below files
first-network/crypto-config.yaml
first-network/configtx.yaml
first-network/docker-compose-cli.yaml
first-network/base/docker-compose-base.yaml
first-network/script/script.sh
now while trying to up the network. Below exception is coming
Having all peers join the channel...
CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt
CORE_PEER_TLS_KEY_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.key
CORE_PEER_LOCALMSPID=Org1MSP
CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
CORE_PEER_TLS_CERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.crt
CORE_PEER_TLS_ENABLED=true
CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin#org1.example.com/msp
CORE_PEER_ID=cli
CORE_LOGGING_LEVEL=DEBUG
CORE_PEER_ADDRESS=peer0.org1.example.com:7051
2017-09-06 06:40:53.134 UTC [msp] GetLocalMSP -> DEBU 001 Returning existing local MSP
2017-09-06 06:40:53.134 UTC [msp] GetDefaultSigningIdentity -> DEBU 002 Obtaining default signing identity
2017-09-06 06:40:53.136 UTC [channelCmd] InitCmdFactory -> INFO 003 Endorser and orderer connections initialized
2017-09-06 06:40:53.136 UTC [msp/identity] Sign -> DEBU 004 Sign: plaintext: 0A89070A5B08011A0B08F5B0BECD0510...742FDE921B171A080A000A000A000A00
2017-09-06 06:40:53.136 UTC [msp/identity] Sign -> DEBU 005 Sign: digest: 152A1C5D481840FB755E98925E0D346271894F15AB69E694C03BEC962E523A50
Error: proposal failed (err: rpc error: code = Unknown desc = Failed to deserialize creator identity, err Expected MSP ID org1MSP, received Org1MSP)
Usage:
peer channel join [flags]
Flags:
-b, --blockpath string Path to file containing genesis block
Global Flags:
--cafile string Path to file containing PEM-encoded trusted certificate(s) for the ordering endpoint
--logging-level string Default logging level and overrides, see core.yaml for full syntax
-o, --orderer string Ordering service endpoint
--test.coverprofile string Done (default "coverage.cov")
--tls Use TLS when communicating with the orderer endpoint
-v, --version Display current version of fabric peer server
PEER0 failed to join the channel, Retry after 2 seconds

Fail to instantiate the chaincode in first network of fabric-samples

The official hyperledger fabric v1.0.0 gives a simple demo by using docker.
What i am doing is to avoid docker and directly run them on the machine. Thanks to the answer from my previous question, I have successfully launched 1 solo orderer, two peers (each from one org), created and joined the channels from peers, installed the chaincode on two peers.
The client side's command to install chaincode is
peer chaincode install -n myC1 -v 1.0 -p github.com/hyperledger/fabric/examples/chaincode/go/chaincode_example02
Both peers return the following message and I think it should be correct.
2017-09-11 16:34:26.361 SGT [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc
2017-09-11 16:34:26.361 SGT [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc
2017-09-11 16:34:26.556 SGT [main] main -> INFO 003 Exiting.....
However, when i try to instantiate the chaincode as follows
peer chaincode instantiate -o orderer.example.com:7040 --tls $CORE_PEER_TLS_ENABLED --cafile $ORDERER_CA -C $CHANNEL_NAME -n myC1 -v 1.0 -c '{"Args":["init","a","100","b","200"]}' -P "OR ('Org1MSP.member','Org2MSP.member')
Client console returns the error message
2017-09-11 17:00:18.181 SGT [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc
2017-09-11 17:00:18.181 SGT [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc
Error: Error endorsing chaincode: rpc error: code = Unknown desc = Failed to init chaincode(handler not found for chaincode myC1:1.0)
The console of Peer0.org2 gives NO error message. But Peer0.org1's console gives the following:
2017-09-11 17:00:18.183 SGT [chaincode] Launch -> ERRO 032 sending init failed(handler not found for chaincode myC1:1.0)
2017-09-11 17:00:18.184 SGT [endorser] simulateProposal -> ERRO 033 failed to invoke chaincode name:"lscc" on transaction a665c5305c5e3f158d272e4a39b04611e5335406e2a7c7057f11d32d8e07670e, error: Failed to init chaincode(handler not found for chaincode myC1:1.0)
Can any one help me to solve this problem and give me a simple explanation??

Resources