I am creating a Hyperledger fabric network and have created a channel named "mychannel" on VM1 and later I created 3 more VM and joined the channel on vm2 and vm3. Vm4 is my orderer. It is not joined to the channel.
Now I am trying to deploy chaincode to the VM1 first. I have Org1 for VM1 and Org1 has 2 peers : peer0 and peer1
presetup() {
echo Vendoring Go dependencies ...
pushd ./../../artifacts/src/github.com/fabcar/go
GO111MODULE=on go mod vendor
popd
echo Finished vendoring Go dependencies
}
# presetup
CHANNEL_NAME="mychannel"
CC_RUNTIME_LANGUAGE="golang"
VERSION="1"
CC_SRC_PATH="./../../artifacts/src/github.com/fabcar/go"
CC_NAME="fabcar"
packageChaincode() {
rm -rf ${CC_NAME}.tar.gz
setGlobalsForPeer0Org1
peer lifecycle chaincode package ${CC_NAME}.tar.gz \
--path ${CC_SRC_PATH} --lang ${CC_RUNTIME_LANGUAGE} \
--label ${CC_NAME}_${VERSION}
echo "===================== Chaincode is packaged on peer0.org1 ===================== "
}
# packageChaincode
installChaincode() {
setGlobalsForPeer0Org1
peer lifecycle chaincode install ${CC_NAME}.tar.gz
echo "===================== Chaincode is installed on peer0.org1 ===================== "
}
# installChaincode
queryInstalled() {
setGlobalsForPeer0Org1
peer lifecycle chaincode queryinstalled >&log.txt
cat log.txt
PACKAGE_ID=$(sed -n "/${CC_NAME}_${VERSION}/{s/^Package ID: //; s/, Label:.*$//; p;}" log.txt)
echo PackageID is ${PACKAGE_ID}
echo "===================== Query installed successful on peer0.org1 on channel ===================== "
}
# queryInstalled
approveForMyOrg1() {
setGlobalsForPeer0Org1
# set -x
# Replace localhost with your orderer's vm IP address
peer lifecycle chaincode approveformyorg -o localhost:7050 \
--ordererTLSHostnameOverride orderer.example.com --tls \
--cafile $ORDERER_CA --channelID $CHANNEL_NAME --name ${CC_NAME} --version ${VERSION} \
--init-required --package-id ${PACKAGE_ID} \
--sequence ${VERSION}
# set +x
echo "===================== chaincode approved from org 1 ===================== "
}
# queryInstalled
# approveForMyOrg1
checkCommitReadyness() {
setGlobalsForPeer0Org1
peer lifecycle chaincode checkcommitreadiness \
--channelID $CHANNEL_NAME --name ${CC_NAME} --version ${VERSION} \
--sequence ${VERSION} --output json --init-required
echo "===================== checking commit readyness from org 1 ===================== "
}
# checkCommitReadyness
This is code snippet from my deployChaincode.sh file
I executed each function one by one and got all desired output but when I am running the approveForMyOrg1 function there is an error
Error: timed out waiting for txid on all peers
due to this error I can not proceed ahead and because of this I checked for orderer logs
( Orderer has 3 orderers: orderer , orderer2, orderer3 )
2023-06-30 05:40:02.927 UTC [orderer.consensus.etcdraft] writeBlock -> INFO 06d Writing block [10] (Raft index: 14) to ledger channel=mychannel node=1
2023-06-30 05:40:30.904 UTC [orderer.common.broadcast] Handle -> WARN 06e Error reading from 10.29.8.25:35778: rpc error: code = Canceled desc = context canceled
2023-06-30 05:40:30.904 UTC [comm.grpc.server] 1 -> INFO 06f streaming call completed grpc.service=orderer.AtomicBroadcast grpc.method=Broadcast grpc.peer_address=10.29.8.25:35778 error="rpc error: code = Canceled desc = context canceled" grpc.code=Canceled grpc.call_duration=30.119426811s
after I saw the log I tried again and got Raft index: 15 log
023-06-30 05:59:51.491 UTC [orderer.consensus.etcdraft] writeBlock -> INFO 070 Writing block [11] (Raft index: 15) to ledger channel=mychannel node=1
2023-06-30 06:00:19.461 UTC [orderer.common.broadcast] Handle -> WARN 071 Error reading from 10.29.8.25:50966: rpc error: code = Canceled desc = context canceled
2023-06-30 06:00:19.461 UTC [comm.grpc.server] 1 -> INFO 072 streaming call completed grpc.service=orderer.AtomicBroadcast grpc.method=Broadcast grpc.peer_address=10.29.8.25:50966 error="rpc error: code = Canceled desc = context canceled" grpc.code=Canceled grpc.call_duration=30.076590275s
I can't understand why this time out error is coming and how can I fix it. I tried increasing timeout time in core.yaml file but it has no effect.
Please help me!