Node.js blockchain bitcoin api

+1 vote

So I want to use this: (taken from their API site -> node.js documentation)https://github.com/blockchain/api-v1-client-node

Recieving payments: 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';

Ok, so the recieving part:

var receive = new blockchain.Receive( [confirmations: 1], ? ); // What do I need to put here?

Documentation says: callbackURL: the url to which the callback should be sent (string)

I don't understand what URL it should go to?!

Sep 10, 2018 in Blockchain by digger
• 27,630 points
89 views

1 answer to this question.

0 votes

The callback URL should be the one that redirects back to your site. So setup a callback url with blockchain like...

https://www.yoursite.com/callback/blockchain

Assuming you are using something like express in your app make a route like so.

app.get('/callback/blockchain', function (req, res) {

// Stuff here  

});

you will prob need to include

var https = require('https'); 

That way then you can set up your logic inside for example...

// 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();
answered Sep 10, 2018 by slayer
• 29,050 points

Related Questions In Blockchain

0 votes
1 answer

Can't import "blockchain.info" to Node.js.. Need help.

Aurelia is a client-side framework and blockchain ...READ MORE

answered Jun 27, 2018 in Blockchain by Omkar
• 67,290 points
56 views
0 votes
1 answer

Bitcoin: parsing Blockchain API using JSON

Because you only add one address to ...READ MORE

answered Aug 22, 2018 in Blockchain by digger
• 27,630 points
210 views
+1 vote
1 answer

Node.js API wrapper for altcoin exchange

In order to pass these variables to ...READ MORE

answered Sep 10, 2018 in Blockchain by digger
• 27,630 points
23 views
+1 vote
1 answer

How blockchain node behaves upon receiving a new block when previous block wasn't acquired?

A node will ask for block number ...READ MORE

answered Mar 26, 2018 in Blockchain by Perry
• 17,010 points
41 views
+1 vote
3 answers

Removing double quotes from a string from JSON response in PHP

Just remove the json_encode call, and it should work: $resp ...READ MORE

answered Sep 12, 2018 in Blockchain by digger
• 27,630 points
2,530 views
0 votes
1 answer
0 votes
1 answer

Truffle tests not running after truffle init

This was a bug. They've fixed it. ...READ MORE

answered Sep 11, 2018 in Blockchain by Christine
• 15,790 points
126 views
0 votes
1 answer

Not able to send payments using Blockchain API.

Try the following code. It should help ...READ MORE

answered Jul 31, 2018 in Blockchain by slayer
• 29,050 points
37 views
0 votes
1 answer

Android Socket connection to bitcoin node

The checkSum field is mandatory and fellow ...READ MORE

answered Aug 29, 2018 in Blockchain by slayer
• 29,050 points
44 views