Reputation: 71
I have my own network on and try to use the chaincode_example02 chaincode to test it out, following the first-network example. When it comes to chaincodeInvoke in my shellscipt, the console shows
Sending invoke transaction on peer0.bank peer0.caseManager...
--tlsRootCertFiles
--peerAddresses peer0.bank.snts.com:7051 --tlsRootCertFiles
--tlsRootCertFiles
--peerAddresses peer0.bank.snts.com:7051 --tlsRootCertFiles --peerAddresses peer0.caseManager.snts.com:7051 --tlsRootCertFiles
+ peer chaincode invoke -o orderer.snts.com:7050 --tls true --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/snts.com/orderers/orderer.snts.com/msp/tlscacerts/tlsca.snts.com-cert.pem -C sntschannel -n mycc --peerAddresses peer0.bank.snts.com:7051 --tlsRootCertFiles --peerAddresses peer0.caseManager.snts.com:7051 --tlsRootCertFiles -c '{"Args":["invoke","a","b","10"]}'
+ res=1
+ set +x
2019-01-01 16:38:40.670 UTC [chaincodeCmd] validatePeerConnectionParameters -> WARN 001 received more TLS root cert files (2) than peer addresses (1)
Error: error validating peer connection parameters: number of peer addresses (1) does not match the number of TLS root cert files (2)
!!!!!!!!!!!!!!! Invoke execution on peer0.bank peer0.caseManager failed !!!!!!!!!!!!!!!!
========= ERROR !!! FAILED to execute End-2-End Scenario ===========
bank has 2 peers and caseManager has 3. What can lead to this problem? In first-network example, both orgs has 2 peers, and it works perfectly. Can someone help? Thank you.
Upvotes: 0
Views: 1379
Reputation: 11
pass ca.crt file path for respective peer in --tlsRootCertFiles
Try This and it works
docker exec -it cli bash
peer chaincode invoke -o orderer.example.com:7050 --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 -C testchannel -n mycc --peerAddresses peer0.org1.example.com:7051 --tlsRootCertFiles /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt --peerAddresses peer0.org2.example.com:7051 --tlsRootCertFiles /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt -c '{"Args":["invoke","a","b","20"]}'
Upvotes: -1
Reputation: 3
You need to modify the global variables so that they are generic.
It is necessary to change, in the setOrderererGlobals() method of the file utils.sh :
setGlobals() {
PEER=$1
ORG=$2
### ADD THESES LINES !!! ###
CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org$ORG.supplychainnet.ch/peers/peer$PEER.org$ORG.supplychainnet.ch/tls/ca.crt
CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org$ORG.supplychainnet.ch/users/Admin\@org$ORG.supplychainnet.ch/msp
### ADD THESES LINES !!! ###
if [ $ORG -eq 1 ]; then
CORE_PEER_LOCALMSPID="Org1MSP"
### COMMENT THESES LINES !!! ###
#CORE_PEER_TLS_ROOTCERT_FILE=$PEER0_ORG1_CA
#CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.supplychainnet.ch/users/Admin\@org1.supplychainnet.ch/msp
### COMMENT THESES LINES !!! ###
if [ $PEER -eq 0 ]; then
CORE_PEER_ADDRESS=peer0.org1.supplychainnet.ch:7051
else
CORE_PEER_ADDRESS=peer1.org1.supplychainnet.ch:8051
fi
else
echo "================== ERROR !!! ORG Unknown =================="
fi
As a result, the environment paths for each peer will automatically be updated with the numbers $PEER and $ORG instead of retrieving the global PEERx_ORGy_CA paths defined at the top of the file.
Upvotes: 0
Reputation: 11
The problem is with the way TLSINFO is fetched. Below command is used in utils.sh file where we are mentioning the TLSCert file. You need to modify it according to your requirement.
TLSINFO=$(eval echo "--tlsRootCertFiles \$PEER$1_Org$2_CA")
Upvotes: 1
Reputation: 895
In your request, you have used --tlsRootCertFiles flag but did not specify any path for it? are you setting this externally? if not try specifying it like
--tlsRootCertFiles /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt
Upvotes: 1