![](/img/trans.png)
[英]Is it possible to generate wallet in the waves blockchain network with api node.js?
[英]Node.js blockchain bitcoin api
所以我想用这个:(取自他们的API网站-> node.js文档) https://github.com/blockchain/api-v1-client-node
收款: https : //github.com/blockchain/api-v1-client-node/blob/master/docs/Receive.md
var blockchain = require('blockchain.info');
var identifier = 'myidentifier';
var password = 'mypassword';
var myWallet = new blockchain.MyWallet(identifier, password);
var myBTCadress = '14Q3ufL1BUHtWskBKtsshVDATRY65TaJMB';
好的,所以接收部分:
var receive = new blockchain.Receive( [confirmations: 1], ? ); // What do I need to put here?
文档说:callbackURL:回调应发送到的URL(字符串)
我不知道该输入什么网址?
回调URL应该是重定向回您网站的URL。 因此,使用类似...的区块链设置回调URL。
https://www.yoursite.com/callback/blockchain
假设您在应用中使用了express之类的方法,请按照以下步骤进行操作。
app.get('/callback/blockchain', function (req, res) {
// Stuff here
});
您可能需要包括
var https = require('https');
这样,您就可以在内部设置逻辑了……
// Stuff here
var options = {
host : 'api.blockchain.info',
path : '/some/path/',
port : 443,
method : 'GET'
}
var request = https.request(options, function(response){
var body = ""
response.on('data', function(data) {
body += data;
});
response.on('end', function() {
res.send(JSON.parse(body));
});
});
request.on('error', function(e) {
console.log('Problem with request: ' + e.message);
});
request.end();
例如,这将在您将app.get('whateverurl')设置为任何页面的json中输出您请求的内容。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.