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
• 26,740 points
1,083 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,370 points

Related Questions In Blockchain

0 votes
0 answers

Node.js blockchain bitcoin api

So I want to use this: (taken ...READ MORE

Apr 4, 2022 in Blockchain by Rahul
• 9,680 points
514 views
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
• 69,220 points
1,071 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
• 26,740 points
3,333 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
• 26,740 points
638 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
• 26,740 points
45,297 views
0 votes
1 answer

How do I add multiple recipients for transactions via Blockchain API?

Convert the recipes into JSON objects. x = ...READ MORE

answered Jul 6, 2018 in Blockchain by Perry
• 17,100 points
927 views
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
1,946 views
0 votes
0 answers

Blockchain.info wallet API callback

I am implementing blockchain.info wallet api to ...READ MORE

Jul 4, 2018 in Blockchain by sabby
• 4,370 points
904 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,370 points
649 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,370 points
912 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP