[英]how to use node js SDK in hyperledger Fabric?
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. 我已经启动了一个具有两个组织org1和org2的Fabric 1.1区块链网络,并且有两个对等方,每个对等方都具有单个订购者和证书颁发机构。 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 ????? 创建了一个Channel并向其添加对等体,并使用Hyperledger composer和ConnectionProfiles.json在4个对等体上安装了相同的链码,现在对于使用NODE JS SDK感到困惑:创建的FABRIC 1.1)网络或使用它(节点js SDK)创建通道并添加对等节点节点JS取代了作曲家吗?
It is not compulsory that you need node sdk to connect with hyperledger. 您不需要节点sdk来连接Hyperledger。 You can easily connect with hyperledger composer through node.Than you can easily write a node code to connect two Peers Easily 您可以轻松地通过node与hyperledger composer连接,而不是编写节点代码轻松连接两个Peers
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);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.