I am currently learning how to develop client app using Hyperledger Fabric Node SDK. To do so, I'm now trying to understand the Node JS code of balance-transfer sample in fabric-samples.
In the balance-transfer/app/invoke-transaction.js file, invokeChaincode function returns Transaction ID. And that returned value is the res parameter of app.js invoke post function.
My question is, what can be done with Transaction ID alone? What if I, say, want to know the block # of my invocation? Is it just a response with no further use?
Please bear with me if this is a stupid question, I'm new to this.
Thanks!
Here's the code snippet of stated app.js
// Invoke transaction on chaincode on target peers
app.post('/channels/:channelName/chaincodes/:chaincodeName', function(req, res) {
logger.debug('==================== INVOKE ON CHAINCODE ==================');
var peers = req.body.peers;
var chaincodeName = req.params.chaincodeName;
var channelName = req.params.channelName;
var fcn = req.body.fcn;
var args = req.body.args;
logger.debug('channelName : ' + channelName);
logger.debug('chaincodeName : ' + chaincodeName);
logger.debug('fcn : ' + fcn);
logger.debug('args : ' + args);
if (!chaincodeName) {
res.json(getErrorMessage('\'chaincodeName\''));
return;
}
if (!channelName) {
res.json(getErrorMessage('\'channelName\''));
return;
}
if (!fcn) {
res.json(getErrorMessage('\'fcn\''));
return;
}
if (!args) {
res.json(getErrorMessage('\'args\''));
return;
}
invoke.invokeChaincode(peers, channelName, chaincodeName, fcn, args, req.username, req.orgname)
.then(function(message) {
res.send(message);
});
});