SHARE
TWEET

Untitled

a guest Oct 18th, 2019 110 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.   var Request = require("request");
  2.   var express = require('express');
  3.   var bodyParser = require('body-parser');
  4.   var app = express();
  5.  
  6.   var urlencodedParser = bodyParser.urlencoded({ extended: true });
  7.  
  8.      var server = app.listen(8084, function () {
  9.      var port = server.address().port;
  10.     require('dns').lookup(require('os').hostname(), function (err, add, fam) {
  11.     console.log('HTTP running on http://%s:8082', add);
  12.     })
  13.      });
  14.  
  15.      app.get('/', function (req, res) {
  16.        var html='';
  17.        html +="<!DOCTYPE html>";
  18.        html +="  <html>";
  19.        html +="    <head>";
  20.        html +="      <link rel='stylesheet' type='text/css' href='./public/style.css'>";
  21.        html +="    </head>";
  22.        html +="        <body>";
  23.        html += "<form action='/report'  method='post' name='form1'>";
  24.        html += "<center>Address:<br>";
  25.        html += "<input type= 'text' name='aid' style='background-color: #3CBC8D; color: white; size: 150px;'> <br>";
  26.        html += "<input type='submit' value='submit' style='background-color: #3CBC8D; color: white;'></center>";
  27.        html += "</form>";
  28.        html += "</body>";
  29.        res.send(html);
  30.      });
  31.  
  32.  
  33.   app.post('/report', urlencodedParser, function (req, res) {
  34.   Request.get(`https://chainz.cryptoid.info/pnd/api.dws?q=multiaddr&key=1a9c92c7492b&active=${req.body.aid}`, (error, response, body) => {
  35.       if(error) {
  36.           return console.dir(error);
  37.       }
  38.           obj = JSON.parse(body);
  39.  
  40.    var html='';
  41.     html +="<!DOCTYPE html>";
  42.     html +="  <html>";
  43.     html +="    <head>";
  44.     html +="    </head>";
  45.     html +="        <body>";
  46.     html += "Looking up Address: " + JSON.stringify(obj.addresses[0].address);
  47.     html += "<br><br><br>";
  48.     for (var i = 0; i < obj.txs.length; i++) {
  49.     html += 'TX HASH: <a href="https://chainz.cryptoid.info/pnd/tx.dws?'+ obj.txs[i].hash +'"> '+ JSON.stringify(obj.txs[i].hash);
  50.         Request.get(`https://chainz.cryptoid.info/pnd/api.dws?q=txinfo&t=${obj.txs[i].hash}`, (error, response, body) => {
  51.           if(error) {
  52.             return console.log(error);
  53.           }
  54.             obj = JSON.parse(body);
  55.             var html='';
  56.             html += JSON.stringify(obj);
  57.             console.log(obj)
  58.         })
  59.     html += "</a><br>";
  60.     html += "Confirmations: " + JSON.stringify(obj.txs[i].confirmations);
  61.     html += "<br>";
  62.     html += "Change: " + JSON.stringify(obj.txs[i].change);
  63.     html += "<br>";
  64.     html += "Time: " + JSON.stringify(obj.txs[i].time_utc);
  65.     html += "<br>";
  66.     html += "N: " + JSON.stringify(obj.txs[i].n);
  67.     html += "<br><br>";
  68.     }
  69.     html += "</body>";
  70.     html += "</html>";
  71.     res.send(html);
  72.  
  73.       console.dir(JSON.parse(body));
  74.   }) });
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top