i have started a fabric 1.1 blockchain network with two orgs org1 and org2 and having two peers each with single orderer and certificate Authority. created a Channel and added peers to that and installed same chaincode on to 4 peers using Hyperledger composer with ConnectionProfiles.json, Now am confused of using NODE JS SDK :( wheteher to use (NODE JS SDK) to communicate to peers in the above (FABRIC 1.1 ) network created or it(node js SDK) is used to create channel & add peers Does node JS replaces the composer ?????
1 Answers
0
votes
It is not compulsory that you need node sdk to connect with hyperledger. You can easily connect with hyperledger composer through node.Than you can easily write a node code to connect two Peers Easily
var request = require('request');
var headers = {
'Content-Type': 'application/json',
'Accept': 'application/json'
};
var dataString = '{ \
"$class": "test.User", \
"uid": "01", \
"firstName": "Prateek", \
"lastName": "Tiwari", \
"emailAddress": "prat%40", \
"contactNo": "789", \
"password": "7596.." \
}';
var options = {
url: 'http://localhost:3000/api/test.User',
method: 'POST',
headers: headers,
body: dataString
};
function callback(error, response, body) {
if (!error && response.statusCode == 200) {
console.log(body);
}
}
request(options, callback);
composer network install(to install the NodeJS chaincode on the Fabric peers) . So now you know what they do - you probably you want to decide HOW you develop your chaincodes (ie business networks in Composer). Hyperledger Composer is a set of collaboration tools that's model driven, for building blockchain business networks (smart contracts) thats designed to make it easier and fast for business orgs and developers to create smart contracts (chaincodes) and blockchain applications to solve business problems. - Paul O'Mahony